Page 1 of 1

2d physic engines comparison

Posted: Fri Mar 14, 2008 11:38 am
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

Re: 2d physic engines comparison

Posted: Tue Mar 18, 2008 11:59 am
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

Re: 2d physic engines comparison

Posted: Fri Mar 21, 2008 9:45 am
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.

Re: 2d physic engines comparison

Posted: Tue Mar 29, 2011 4:35 am
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.

Re: 2d physic engines comparison

Posted: Tue Mar 29, 2011 9:27 am
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

Re: 2d physic engines comparison

Posted: Tue Mar 29, 2011 2:06 pm
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?

Re: 2d physic engines comparison

Posted: Tue Mar 29, 2011 3:52 pm
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.

Re: 2d physic engines comparison

Posted: Thu Mar 31, 2011 12:28 am
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.

Re: 2d physic engines comparison

Posted: Fri Jul 08, 2011 5:07 am
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?

Re: 2d physic engines comparison

Posted: Fri Jul 08, 2011 9:07 am
by slembcke
I'm working on multithreading and SIMD optimizations for Chipmunk Pro before releasing any number publicly like that.