Inexperienced Knights [Update #8]

Show off your games, demos and other (playable) creations.
Clean3d
Prole
Posts: 30
Joined: Fri Mar 29, 2013 4:16 pm

Re: Inexperienced Knights [Update #5]

Post by Clean3d »

davisdude: Thanks for continuing to check out the project! I've been using http://www.daveconservatoire.org/ to learn some music theory, and it's going pretty well.


Image

As expected, I did a lot of gameplay work this month. Things are much more playable, and I've started working on some of the other levels. There is actually less share-able news than I expected, because now everything becomes either a bit spoilery or sort of boring. (e.g. I made health pickups bounce off walls! wohoo!) At any rate, progress is always slower than I'd like, but it is steady and positive.

However, I've run into a nasty bug I thought I would share (how generous of me). I stripped a lot out for this demo, and I've tested it on Linux, Mac OS, and Windoes 8. The issue is, as nearly as I can tell, that body:getPosition() is returning NaN coordinates. Trying to index map data with NaN doesn't really work, and that's usually where it crashes. These bad coordinates seem to be returned when bodies are created at the same x/y coords, and the obvious solution would be to make sure I don't do that. I feel there's enough of a risk of that being a recurring issue, though, that I'd like to find out why it happens and fix that rather than constantly have to think about where things are spawning. I do intend to make things spawn in different locations eventually, though. ; )

DISCLAIMER! THIS .LOVE IS INTENDED TO CRASH AND DEMONSTRATE THE BUG I'M WORKING THROUGH. ON WINDOWS 8, THIS .LOVE CAUSED MY COMPUTER TO BECOME UNRESPONSIVE, AND I HAD TO KILL THE PROCESS. IF YOU RUN THIS FILE, YOU ACCEPT THE CONSEQUENCES!
Download
(Sorry, I read somewhere that disclaimers had to be capitalized and I'm paranoid about it.)

What to expect / Instructions
The game will crash as soon as the character and goblins drop in. If this doesn't happen, X activates your attack item (a broom), and arrow keys move your character. Alt+F4 will kill the process if it hasn't frozen. Y toggles an inventory view, but I'm planning to get rid of it eventually. Following the path will cause the game to crash because of the sections I stripped out. Pressing ESC will let you pause and quit the game. And crash it. Please don't judge the quality of the full game by this crashy .love - it really does work better when I haven't deleted a bunch of files!

Anyway, if any of you have insights about why body:getPosition() would return NaN I would very much appreciate hearing them. If you'd rather just wait for a working demo, I am working on it. The current holdup is the necessity of registering and setting up the development company, but that needs to happen soon if I want to launch by my current target date!
Clean3d's Twitter, Game, and Blog
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Inexperienced Knights [Update #6]

Post by Jasoco »

Well. This is very strange.

I was about to start trying to debug this so I ran it a couple times to confirm the error, which it does, and then opened the objects.lua file, went to line 671 and added some print() calls to start. Then I remembered I needed to run it from the Terminal in order to get it to show them. So I added my custom RUN.command file to the project and ran it from the Terminal. And now it works. No crash at all.

But if I run it without the Terminal it crashes.

So then I went to confirm that this is reproduceable.. Now it crashes every time. lol

But now the error is different. Instead of crashing because of nil, it crashes because of Box2D:

Code: Select all

Error: objects.lua:790: Box2D assertion failed: bd->position.IsValid()
stack traceback:
	[C]: in function 'newBody'
	objects.lua:790: in function 'update'
	game.lua:538: in function 'update'
	game.lua:135: in function 'update'
	main.lua:242: in function 'update'
	[string "boot.lua"]:434: in function <[string "boot.lua"]:399>
	[C]: in function 'xpcall'
Hope that helps now? Even though I didn't change anything.

Unfortunately it's like roulette. Sometimes it crashes with the original error on line 671. Sometimes the Box2D error on line 790. And others it runs fine.
Clean3d
Prole
Posts: 30
Joined: Fri Mar 29, 2013 4:16 pm

Re: Inexperienced Knights [Update #6]

Post by Clean3d »

Woah, thank you so much, Josoco! I'm not sure how to explain the steps I took from reading your post to finding a solution, but it seems to be fixed!

So, goblinDummy:knockback() calculates the distance from the attackers position to the goblin, and then uses that to scale the applied x/y force. The thing is, the goblins were landing on top of each other, so the distance is 0. The distance is used in division, which means I was dividing by 0 and applying NaN values to applyLinearImpulse(). LOL? :oops:

All it took was adding an if dist > 0 then around the applyLinearImpulse and things seem to work fine!

Here is the fixed version. Goblins actually damage each other when they jump to the same location, so it might be pretty easy to 'win' this fight. Hopefully it's still fun!
https://www.dropbox.com/s/wqyrb1b5698fq ... -2014.love

Thanks again!
Clean3d's Twitter, Game, and Blog
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Inexperienced Knights [Update #6]

Post by davisdude »

Once you fail the level and press space, it errors
Error Message wrote:game.lua:742: attempt to call global 'getMain' (a nil value)

Traceback

game.lua:742: in function 'keypressed'
main.lua:283: in function <main.lua 252>
[C]: in function 'xpcall'
Nice looking game so far! :)
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Clean3d
Prole
Posts: 30
Joined: Fri Mar 29, 2013 4:16 pm

Re: Inexperienced Knights [Update #6]

Post by Clean3d »

Thanks for trying it out! That happened because the main menu was removed for this upload. Sorry I forgot to mention it!
Clean3d's Twitter, Game, and Blog
Clean3d
Prole
Posts: 30
Joined: Fri Mar 29, 2013 4:16 pm

Re: Inexperienced Knights [Update #6]

Post by Clean3d »

Hey all, it's been a while so I thought I would write a quick update (which will probably do me more good than anyone else).
  • Progress has been slow for a few months, as I've struggled with implementing animated tiles. I haven't worked on anyone else's code before, so it was definitely an adventure! That is done now, though, and I'm happy to say the changes were accepted back into Kari17's excellent STI library. I suppose if it doesn't work in your project, I'm sort of the guy to yell at? ; )
  • I've been a bit procrastinating about the legal side of things, which has also been a hangup. Depending on how you register a business in the US you can be more or less liable, and the recent slew of developer harassement has made me wary. Sure, it's extremely unlikely that I would get trouble, but I'm willing to put in a little more effort for the greater peace of mind.
  • Memory management is also an issue. I know this is sort of an issue for any garbage-collected language, but it's just a pain to deal with, y'know? ; )
Well... that list comes across more negatively than I anticipated. I'm quite optimistic, though!
Clean3d's Twitter, Game, and Blog
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Inexperienced Knights [Update #6]

Post by Karai17 »

Registering your business as an LLC (limited liability corporation) is probably the best way to go. What sort of liabilities are you worried about? It's pretty difficult to get LOVE/Lua to crash a system, and it would be very difficult to blame a 2D game on causing someone's pc to catch fire.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
Clean3d
Prole
Posts: 30
Joined: Fri Mar 29, 2013 4:16 pm

Re: Inexperienced Knights [Update #6]

Post by Clean3d »

To be honest, it's not so much legal liability as developer harassement. Where I live, you need to file the contact information of a registered agent for an LLC. For indies such as myself, this could mean filing your home address and opening that can of worms. I will be contacting a lawyer to see if they can act as the registered agent. Realistically, I know this doesn't make me un-findable, and it's unlikely anyone would even pay attention to an unknown developer, let alone target them. Still, I'd like to do what I can to avoid potential headaches later on.
Clean3d's Twitter, Game, and Blog
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Inexperienced Knights [Update #6]

Post by Karai17 »

Yeah, I get that 100%. In most countries you can "rent" an address for a monthly fee that may even include mail forwarding.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
Jeeper
Party member
Posts: 611
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Re: Inexperienced Knights [Update #6]

Post by Jeeper »

Clean3d wrote:Hey all, it's been a while so I thought I would write a quick update (which will probably do me more good than anyone else).
  • Progress has been slow for a few months, as I've struggled with implementing animated tiles. I haven't worked on anyone else's code before, so it was definitely an adventure! That is done now, though, and I'm happy to say the changes were accepted back into Kari17's excellent STI library. I suppose if it doesn't work in your project, I'm sort of the guy to yell at? ; )
  • I've been a bit procrastinating about the legal side of things, which has also been a hangup. Depending on how you register a business in the US you can be more or less liable, and the recent slew of developer harassement has made me wary. Sure, it's extremely unlikely that I would get trouble, but I'm willing to put in a little more effort for the greater peace of mind.
  • Memory management is also an issue. I know this is sort of an issue for any garbage-collected language, but it's just a pain to deal with, y'know? ; )
Well... that list comes across more negatively than I anticipated. I'm quite optimistic, though!
If you are worried about legal issues, I can let you know that we have had 0 issues so far with Luminosity (5000 users on Desura). I made an EULA that covers some common issues like liability in case of property or physical damage and that people are not allowed to redistribute copies of the game etc.
Post Reply

Who is online

Users browsing this forum: No registered users and 32 guests