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: 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.

iPad results are similar to the Android.

Found a typo? Please, highlight it and press Shift + Enter or click here to inform me!

Share Button


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

    • Just a quick note, that box2D ANE project is extremely limited and was done simply as a really quick demo for a presentation. It seems the developer has abandoned it. On that note, I’ve begun to develop a 100% complete Box2D ANE port. It’s a huge project because of the C-style callbacks required by the AIR runtime, weighing in right now somewhere around 25K lines. It’s not complete, but I project that it should be finished within a month or so. Follow me on github and maybe you can compare the benchmarks here to it when it’s all done. 🙂 http://digitalarchitectcanada.github.com/Box2DANE/

  1. 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)

    • 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!

  2. 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!

    • 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. 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.

    • 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.

Feel free to print your thoughts on topic below

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