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.
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.
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.
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.
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?
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/
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.