For my lunar-lander-on-a-disc program I need some intersection-testing functions that were added to the Chipmunk Physics library I'm roughly based on. Since I translated the library from C99 to C++, though, I would need to translate the new code as well. This is a maintenance pain, so this weekend I spent some time trying unsuccessfully to get the stock library into a state in which I could use it.
I like Chipmunk; it's very understandably written and sensibly designed. I'm sure its author Scott Lembcke is reading this. (Hi Scott!) The key problem seems to be that the library is written in C99, a newer dialect of C which is poorly supported by Microsoft's C compiler. Since C99 moves C toward C++ I can get by with relatively small modifications if I compile the C code as if it were C++. Still, since the main library development isn't using my compiler I can expect to have to do this regularly.
As a result I've been examining Box2D some more. It builds easily out of the box, and it's written in C++ so it should mesh better with my project. It has a different approach to collision shapes; I'd need to break down the rocket hull into a set of convex shapes, but that wouldn't be hard. The terrain might be a bit more work. Box2D doesn't support line segments as a collision primitive (although there is contributed code to do so), so I'd probably take the triangulation and merge triangles into polygons up to the 8-vertex limit.
I've got various directions I can go and it's hard to decide how much work I should spend on this. I could patch up my library and continue working on gameplay; that might be the most prudent. Ultimately I want to produce a Flash version of the game, and I think Box2D might give me some help there.
No comments:
Post a Comment