Day 17: Insert Löve pun here

January 25, 2010 by pekuja · Leave a Comment 

So, today I decided my code was too much of a mess, so I would refactor and clean it up. I also thought at this point that it would be a good idea to start using Löve’s built-in physics engine (Box2D) instead of doing my own physics, especially since later I’ll want grenades to bounce from walls realistically for example. In order to achieve this, I needed to vectorize the bitmap based level. That in itself was not a big deal. I had done a marching cubes implementation before so I had reference material, even though my old code was in a different language. Anyways, after writing the algorithm up, I found that it still wouldn’t run. Turns out there’s some strange problem with using very small or slim polygons in Box2D. I’m not completely sure what the exact problem is or how to fix it. The comments in Box2D source code say “Shifting the edge inward by b2_toiSlop should not cause the plane to pass the centroid.” and “Your shape has a radius/extent less than b2_toiSlop.”. After those comments there is an assert that fails and stops my game from running. It’s apparently something to do with continuous collision detection.
On top of my Box2D woes, I was constantly annoyed by the lack of documentation for Löve. Some functions have no documentation whatsoever, which makes it all but impossible to use them. The physics engine is probably one of the most problematic cases, especially since I don’t have a lot of experience with physics engines in general.
Currently I’m not quite sure how to continue. I hope I can make Box2D work for me somehow, because even if I ditched Löve, I’d still need something for the physics. Chipmunk maybe? Or I could just roll my own. Not like I need anything fancy.

About pekuja

Speak Your Mind

Tell us what you're thinking...
and oh, if you want a pic to show with your comment, go get a gravatar!