NME: ready for the show!

NME is an impressive crossplatform technology particularly appropriate for 2D games development. And by crossplatform that mean:

  • Windows/Mac/Linux and iOS/Android/webOS – at full, native, C++/OpenGl speed,
  • and Flash so you can also compile it for the browser.

Activity & contributions around the NME project has increased a lot recently and it seems to have become mature enough as a few companies have started using it to develop (fairly impressive casual) commercial games. If you have an iPhone I warmly recommend trying Ponon Deluxe (free) – it’s incredibly slick and a clever variation on the Tetris theme.

If you know Flash and AS3…

…you’ll be up and running in a few hours:

  • this is most feature complete implementation of the Flash API that you will get your hands on – more complete than what Starling will ever be, and more complete than the subset of AIR you can use to keep performance decent,
  • development is in haxe, a clever language with increasing IDE support that you can however code like AS3 90% of the time.

Native performance

It’s hard emphasize enough about how incredible NME performance is. That’s really close to hand written C++ but with Flash’s easy to use APIs and a similar, strongly typed, language.

The native back-end is based on SDL, a robust and powerful opensource crossplatform C++ library used in hundreds of games & applications.

NME is composed of 2 parts:

  • a thin crossplatform API layer written in haxe,
  • precompiled C++ libraries for each native target.

Haxe code isn’t executed by a VM: it’s transformed into regular C++ code and then compiled & linked with the target library. The haxe-to-C++ transformation is extremely fast and the C++ compilation is just as efficient as with regular C++ code: initial compilation is long, iterations reasonably quick.

And if it’s not fast enough, you can rely on haxe’s lightning fast Flash compilation and, in FlashDevelop, use the regular Flash interactive debugger with your haxe code.

You can read a bit more about NME’s cross-platform high performance here.


I know you love numbers, here’s one very sweet table with numbers 😉

This is a modified BunnyMark, as popularized by Iain Lobb.

To get the best of NME when animating a lot of elements you’ll want to use Graphics.drawTiles, which is a C++ specific addition over the Flash API to allow high performance batch rendering of images using a spritesheet. This drawTiles method now lets you animate position, rotation, scale, alpha and color of the items, at a crazy speed. Also these results are with image smoothing enabled.

Is that test relevant? Obviously you’ll have to reduce greatly the number of bunnies as soon as you’ll start making the scene more complex.

Edit #1: added more numbers and a nice, tiled grass, background to the bunnies. And a pirate.

Edit #2: New iPad
The benchmark was adapted to auto-scale accordingly to iOS retina (or not): everything looks the same size as on a non-retina device. It was tested in retina and non-retina resolutions.

New iPad is definitely a much more powerful device than iPad 2 (and the most powerful device ever at this time). However the conclusion will surprise you: New iPad, with its extra resolution, should practically be considered a less powerful device than iPad 2. Slightly disappointing obviously in a way, as iPhone 4, even with retina resolution, proved to be as (if not more) powerful than the 3GS at 4x the pixels count.

Bonus conclusion: haxe NME works just fine in the crazy 2048×1536 resolution 🙂 Make sure you get the iOS5.1 SDK (yes it works in Snow Leopard) and set the deployment target to 5.1 in xcode.


Device 30fps 60fps Screen Notes
iPhone 3G 500 N/A* 480×320 Outdated, but it works 🙂
LG Optimus One 1000 N/A* 480×320
SE Xperia X8 1000 N/A* 480×320
SE Xperia Mini Pro 1750 4500 480×320
iPhone 3GS / iPod Touch 3 2750 1000 480×320
Nexus One / HTC Desire 1500 N/A* 800×480
iPod Touch 4 3250 1000 960×640 Much weaker than iPhone 4
HTC Desire S/HD 4000 1500 800×480
Nexus S 4000 2000** 800×480
LG P990 4250 2000 800×480
iPhone 4 / iPod Touch 4.5 4750 1750 960×640
Samsung Galaxy S 2 7500 3500 800×480
iPhone 4S 10000 4750 960×640 This phone is a monster
Nexus 4 8000 4000 1280×720


Device 30fps 60fps Screen Notes
Samsung Galaxy Tab 2000 1000 1024×600
Samsung Galaxy Tab 10.1 4000 1500* 1280×800 Overclocked at 1.4GHz
Advent Vega 4250 2000* 1024×600 Tegra2 dual 1Ghz
TouchPad Android 4000 1000 1024×768
Acer Iconia A501 3500 1000 1280×800
iPad 1 4250 1250 1024×768
TouchPad webOS 8000 2000** 1024×768 Overclocked at 1.5GHz (safe)
Asus Transformer 4000 2000 1280×800
New iPad (retina) 5250 2250 2048×1536
iPad 2 3000 1024×768
New iPad (low res) 11500 4250 1024×768

* Framerate can’t reliably get close to 60fps on many Android devices (45fps max on the Nexus One).
** Framerate is never at stable 60fps but a few fps unders.

More numbers!

Want to try on your Android device? I love more numbers too 😉

What about the desktop?

Flash / HTML5

NME naturally targets Flash which is great for quick iterations and a great debugging experience in FlashDevelop, however the drawTiles feature is pretty specific to native targets. A Flash implementation is coming, based on the classical Graphics.drawTriangles, but it will hardly be as powerful and complete as the native version. For heavy performance needs you’ll want to use a different rendering path (like blitting) for the Flash target – haxelibs like gm2d are meant to abstract these differences.

Currently Jeash, the HTML5 backend for NME, doesn’t support drawTriangles at all, so no drawTiles here.

Try the Flash BunnyMark.

Native Win/Mac/Linux

It turns out that the BunnyMark runs just great on the desktop using the respective native C++ targets. On my 2 years old MacBook 13″ and its lousy CPU & GPU I have 15k bunnies bouncing at 60fps, and on my PC (similar CPU, better GPU) I’m at 20k bunnies, no sweating.

Get the Windows or Mac binaries and give it a try yourself 🙂

Source code

Time to get your hands on the code and play with NME?


  1. Android Nexus-S (2.3.6) (800×480) (1GHz Cortex A8 (Hummingbird) )

    2000 Bunnies->54fps
    4000 Bunnies->30fps


    Android LG P990 (2.2.2) (800×480) (2x1GHz)

    2000 Bunnies->59fps
    4250 Bunnies->32fps

  2. On a cheap (but yet great) Optimus One 30 1000 320 x 480, just as stress test it reach 1fps at 30.000
    On a cheap (but yet great) Asus Transformer 60 2000 1280×800 / 30 4000
    It looks impressive, now I need to test some “real” stuff.
    Unfortunately downloading the NME installer Windows Security detect a malwere. Probably a false positive but Virustotal and VirSCAN have 2/42 positive results.

  3. That’s weird that you got a virus warning. I wonder why?

    I created the NME installer — it’s based on the source code for the Haxe installer, but the required packages are embedded instead of being downloaded from the internet.

    I’d love to know if there’s anything that can be done to prevent those warnings.

  4. haxe installers have always ring false positives in some AVs – I suggest you double-check using Nod32 online scanner.