Flash 2D Physics engines fast comparison: Nape (haXe) vs Box2D (Alchemy)

Nape: 6.1 r49 Release for FP 10+ (built with haXe)
Box2D (Alchemy, WCK): last build from GitHub (pulled 09.11.11, built with Alchemy)
Flash Player: 11.0.1.152 Release 32 Bit Standalone (Projector) – Desktop
AIR: 3.0 – Mobile

I’ve tested these engines both on Desktop (Win 7, Core i7 Q740, 1.73 GHz per core, 16 GB DDR3-1333 MHz) and Mobile (Android 3.1, Samsung Galaxy Tab 10.1, overclocked to 1.4 GHz per core).
I should tell, Nape was blazingly faster both on Desktop and mobile for me.

Example measurements with 1000 boxes on Desktop (30 FPS max):
Nape: 17-19 FPS at start, ~30 FPS after boxes fall.
Box2D: 2-3 FPS at start, 4-6 FPS after fall.

Please, feel free to run those swfs yourself:
Nape | WCK

Example measurements with 100 boxes on Mobile (GPU renderMode, 30 FPS max):
Nape: 30 FPS.
Box2D: ~14 FPS.

Please, feel free to compile and test AIR apps yourself if you wish:
FlashDevelop project (Switch Document class between MainNape.as and MainWCK.as and read *readme.txt carefully).

I’ll post some measurements done on iOS (iPad) later.

UPDATE
iPad results are similar to the Android.

This entry was posted in dev and tagged , , , , , , . Bookmark the permalink.

8 Responses to Flash 2D Physics engines fast comparison: Nape (haXe) vs Box2D (Alchemy)

  1. Bart says:

    I like the way Box2D and Nape differ in what happens when the bulk of the blocks is at the lowest point: can they keep everything non-overlapping?

    Nape keeps boxes mostly non overlapping, but afterwards it expands upwards and starts a bouncy wave left and right, with some glitching blocks. Box2D compresses a lot more, but then expands to non overlap and slowly and wobbly settles, takes long time, but no self reinforcing waves.

    • focus says:

      Hi, Bart! Thanks for the comment, I believe all this stuff can be easily tweaked. There are could be applied different materials, different gravitation and a lot of other settings to the bodies and “world”, you know. Feel free to try to tweak all those things in the attached project and see how physics behavior changes.

  2. Luca says:

    Nice to see a comparison on mobile which are harder to come by… mainly because the only mobile device I have is a £7.50 phone which can believe it or not, text!

    • focus says:

      Hi, Luca! Thanks for your comment!) I’ll be glad to help you with any other Nape tests on Android\iOS if you wish, just drop me a line about that.

  3. greg says:

    HOW did you make 30 FPS on iPad? Did you use iPad 1 or iPad 2?

    My test: iPad 1, iOS 5 = 1.3 FPS (100 boxes & GPU mode).
    What version of Air did you use? I did 3.1 (Flex 4.6)

    • focus says:

      Hey, Greg! I used iPad1, GPU mode, StageQuality.LOW, AIR 3.0. Just try to download and compile a FlashDevelop project I mentioned in the post! Thanks for your comment!

  4. IceStar says:

    have you tryed the box2d-ane for this test ?
    the project : https://github.com/mnem/box2d_ane

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>