I did a small comparison of the most common ways in which a Flash or an AIR developer makes use of a physics engine in a game.
The test involves creating 50 dynamic bodies with full bounce and dropping them in a walled enclosure and normal gravity. And this test was tried with the following 3 engines –
- Box2D – The most updated and authentic source of AS3 port of Box2D
- Box2D FlasCC-ed – FlasCC-ed version of native Box2D library
- Nape – 2D Physics engine for AS3/Haxe
And here are the results –
Engine | MacbookPro (with DD*) | MacbookPro (without DD) | iPhone4 (with DD) | iPhone4 (without DD) |
Box2D AS3 | 45 fps | 60 fps | 20 fps | 42 fps |
Box2D FlasCC-ed AS3 | 60 fps | 60 fps | 14 fps | 30 fps |
Nape | 60 fps | 60 fps | 42 fps | 58 fps |
* DD stands for ‘DebugDraw’, which refers to drawing the physics bodies on every enter frame.