2d physic engines comparison

Official forum for the Chipmunk2D Physics Library.
Post Reply
crazy-chris
Posts: 7
Joined: Tue Mar 04, 2008 3:40 am
Contact:

2d physic engines comparison

Post by crazy-chris »

Hey all,

I started a wiki page for comparing different 2d physics engines,
primarily box2d and chipmunk, but also phun and iphysics is in the list:

http://wiki.laptop.org/go/Physic_Engines

I hope you'll add points to the list and modify existing ones if the are inaccurate :)

Best from Vienna,
Chris
crazy-chris
Posts: 7
Joined: Tue Mar 04, 2008 3:40 am
Contact:

Re: 2d physic engines comparison

Post by crazy-chris »

Soo, I've now done a few speed tests, how chipmunk and box2d compare when used with python. Box2d seems to be an edge faster, which might be related to the SWIG implementation instead of ctypes.

http://wiki.laptop.org/go/Physic_Engines/Speed_Tests
iansmith
Posts: 1
Joined: Sun Mar 02, 2008 12:12 am
Contact:

Re: 2d physic engines comparison

Post by iansmith »

I took a look at the source code for your speed tests and one thing I noticed is that you are calling cpSpaceResizeActiveHash with default settings. This is going to hurt performance due to the size of your objects being about ten time smaller than the default hash cell size of 100. Also in the larger tests the default of 1000 for the hash array is much too small when you have 500 objects.

I'd try running the tests again with calls to cpSpaceResizeActiveHash for each demo and adjusting it for the number of objects and see what happens.
pwagner
Posts: 21
Joined: Wed Mar 23, 2011 1:59 am
Contact:

Re: 2d physic engines comparison

Post by pwagner »

Hey,

although this thread is kind of old ^^, we may could revive it. I'm am interested in a comparison of physics engines too. Maybe a good starting point would be a list of physics engines ordered by their ability of 2D or 3D. I already found this but it seems like chipmunk and Box2D are the only interesting open-source libraries out there.

If someone knows another library the link is missing or that could be interesting for some reason please write a little comment.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: 2d physic engines comparison

Post by slembcke »

Well there was this (written by me) a year and a half ago: http://forums.tigsource.com/index.php?topic=9318.0

I should update that a bit. Since then quite a bit has changed in both engines. Box2D switched from using a sweep and prune broadphase to an AABB tree much like the one in Bullet. I'm just about ready to release Chipmunk 6 which has support for 1D sort and sweep, a Bullet-like AABB tree with really good temporal coherence, and the old spatial hashing. I added sleeping to Chipmunk about a year ago now, and improved upon it again in Chipmunk 6.

I've also made Chipmunk a *lot* faster in the past year, and Chipmunk 6 should make it even faster. https://spreadsheets.google.com/ccc?key ... y=COOb4o8N
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
pwagner
Posts: 21
Joined: Wed Mar 23, 2011 1:59 am
Contact:

Re: 2d physic engines comparison

Post by pwagner »

Hey.

Yeah first I thought speed would matter but as my project goes on and on I'm thinking that I don't need real time calculations. Or at least sometimes it could be interesting to see calculations done in real time but more often it's necessary to have high accuracy.
Please don't be offended but how about the correctnes of your engine? Have you ever done some 'real' physics like a pendulum or test of friction on an inclined plane to verify your engine against pure analytical mathematics?
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: 2d physic engines comparison

Post by slembcke »

The natural frequency of pendulums and springs works as intended. Friction is also very accurate except that there is no static friction. If you want it to be really accurate, it also implies that you will be using a large number of iterations and a small timestep.

Though yes, game physics engines are tuned for speed and not 100% accuracy. The guiding principle of physics engines is that the result should look plausible, not that it could be used for scientific experiments.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
pwagner
Posts: 21
Joined: Wed Mar 23, 2011 1:59 am
Contact:

Re: 2d physic engines comparison

Post by pwagner »

Is there an alternative to physics engines to simulate 'real' physics?
Sure I could use FEM calculations but they are a bit to powerful and heavyweight as I'm just looking for simple (but accurate) mechanics.
aisman
Posts: 145
Joined: Tue Mar 04, 2008 2:21 am
Contact:

Re: 2d physic engines comparison

Post by aisman »

slembcke wrote:I've also made Chipmunk a *lot* faster in the past year, and Chipmunk 6 should make it even faster. https://spreadsheets.google.com/ccc?key ... y=COOb4o8N
Only an idea:
Maybe a hint on your web page about the comparision between Chipmunk (5.3.5, 6.0.0, Box2D) is very usefull?
Chipmunk4PB: The fastest way to write games together with PureBasic and the Chipmunk physics engine.
User avatar
slembcke
Site Admin
Posts: 4166
Joined: Tue Aug 14, 2007 7:13 pm
Contact:

Re: 2d physic engines comparison

Post by slembcke »

I'm working on multithreading and SIMD optimizations for Chipmunk Pro before releasing any number publicly like that.
Can't sleep... Chipmunks will eat me...
Check out our latest projects! -> http://howlingmoonsoftware.com/wordpress/
Post Reply

Who is online

Users browsing this forum: No registered users and 28 guests