2d physics engine?

I will probably be working in a 2d game with some physics. Is there a physics engine you could recommend? easy to install for people, and it is enough if it does 2d, I don't need more.

(log in to comment)

Comments

pymunk
HanClinto suggested Box2D. I will be taking a look at it. any other candidates?
I'm using PyODE but it takes a bit of modification to work well with 2D.

I would go with either pyBox2d or pymunk (http://code.google.com/p/pymunk/) if I where you. ODE is harder to work with in 2d as you have to constraint the simulation to 2 dimensions and you also get a bit extra useless stuff in most calls because they assume a 3rd dimension.

As for pybox2d or pymunk, I would try them both this week and then decide (If I were you, if I were myself I would go directly with pymunk :)) You will probably find pymunk a bit easier to use from a python-perspective as its much more pythonic than pybox2d (which is very thin above box2d). You will also discover that pybox2d has a bit more features and the community of Box2d is a bit more active than the Chipmunk community. Another difference is that you only need a C-compiler and python to compile pymunk+chipmunk, while you also need swig for pybox2d+box2d.

Whopps, I actually thought pyweek was to start next week and not this week :D Well, I guess I have to revise my advice to "just pick one and go with it" :)

Thanks for the advice... We finally went with "roll our own", probably with pure python to avoid adding dependencies. Hope we don't mess up the performance.

It is not smart, but I think it is more interesting

OK, it is mostly working. It should handle rigid convex bodies, with collision, rotations and... strings, of course :)

Collisions are already implemented but bouncing of as a response to collisions is the last thing missing. Now we will have to check how it performs when increasing the object count...

We used pyODE in our entry for Pyweek 6, and I never had to do anything special to get it to work well in 2d other than always ignore the Z-component of the vector. Anything have to do with Z was always set to 0. Really, if I wasn't interested in using Box2D for another project (and so wanted to learn it), I would be using pyODE again this year -- it was a true joy to work with. Maybe it was just because we were using simple spheres and rectangular boxes, but even through long playtesting sessions, everything stayed in the same plane just fine.
dmoisset: Sweet -- I'm glad to hear your home-rolled engine is working well! I look forward to seeing how it turns out. :)