How to solve a crash problem

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
Matkins
Citizen
Posts: 53
Joined: Mon Mar 23, 2009 5:12 pm

How to solve a crash problem

Post by Matkins »

Hey everyone,

I've programmed a game that makes use of box2d physics, it seems to work nicely for a while, not getting any errors, BUT it randomly crashes--the window just closes suddenly. Objects are being created and destroyed approximately every second but theres hardly ever more than 2 objects in existance at the same time. It appears to happen on collision between an object and a sensor, or possibly on destroying the object (just to be clear i destroy both the body and the shape). The machine I'm using is powerful and should be able to handle this. One more thing, It seems totally unpredictable, i can sometimes use it for several minutes before it happens, and other time it'll crash much quicker.

What are the possible causes for crashes like this? If i know the possibilities i might be able to isolate the problem and fix it. Thanks.
User avatar
Gerrit
Prole
Posts: 46
Joined: Wed Mar 25, 2009 7:40 pm

Re: How to solve a crash problem

Post by Gerrit »

Hey, the same thing happened here. I had around 400 objects on the screen and it crashed. Not always at 400 but very often so I threw out the physics and working with my own collision detection now. Which will be released as a lib in a couple of days. So: I have no idea what causes the crash..
Matkins
Citizen
Posts: 53
Joined: Mon Mar 23, 2009 5:12 pm

Re: How to solve a crash problem

Post by Matkins »

I appear to have solved my problem now. It was to do with using sensors to destroy objects. I suspect that theres some sort of overlap between the object actually being destroyed and the collision trigger being called for a second time, somehow, so it was trying to destroy an already destroyed object maybe. Thats just my theory. So, either don't uses sensors for this purpose, or put in a condition to ensure the collision callback can only be called once for each specific object.
igor
Prole
Posts: 21
Joined: Fri Nov 20, 2009 12:39 pm
Contact:

Re: How to solve a crash problem

Post by igor »

I have the same problem. In my application i destroy objects and their shapes when they collied (call :destroy() functions) and sometimes LOVE crashed (just close window). I think this problem happened when physics engine trying to get access to dead body object. Suggest me please, how to solve this problem.

PS: Nice to have love ingine log with warnings and errors occured. Sorry for the bad english)
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 236 guests