FITC Screens 2011: Making Fast-Performing, Cross-Platform Games

I was recently given the opportunity to present at FITC Screens. For those who don’t know, I began my career as a Flash developer 12 years ago, back when Flash 4 and Actionscript were first released. I have long been inspired by industry pioneers like Joshua Davis (, and Keith Peters (, who have both spoken at FITC. It is a great honor and privilege to have been a part of this event.

A lot has changed in the last 12 years. The tools that we use, the platforms we target, the devices we use to access content and the ways we communicate and support each other (anyone remember have changed, but the goal of building rich, compelling user experiences still remains.

We started with an overview of some of the content we would cover.

Next we looked at a chart that illustrates how popular technologies are supported on different platforms.

If you are creating an application, you do not always want to use a technology that is cross-platform, because you want your application to feel as native as possible. If you are creating a game, however, this is not much of an issue, so there are many benefits to choosing a technology that will not require a rewrite to support more markets.

Particularly for mobile, the technologies which experience the best support are C/C++, Javascript and OpenGL.

Compared to Google’s V8 engine, C++ is a lot faster than Javascript, and requires a lot less memory. Especially for mobile, C++ is an obvious choice for performance.

I demonstrated Miriel’s Enchanted Mystery, a game that my wife and I both enjoy, as an example of a cross-platform C++ application.

C++ offers flexibility so that Miriel runs on Windows, Mac, iOS and webOS, including several delivery services like Big Fish Games.

If you want to make your own C++ game, SDL is an excellent tool for abstracting the low-level mechanics of each platform. If you prefer something higher level, Marmalade is a commercial framework to help abstract for mobile platforms, and optimize for the best performance on each device.

Many of the performance benefits of C++ are available if you write applications using Haxe. This is the approach that works best for me, because C++ is too low-level for my everyday needs.

Flash provides an API for sounds, display objects, events, network requests, shared objects and other important features. NME is a framework that provides C++ classes for most of the Flash API, so you can publish applications to Windows, Mac, Linux, iOS, Android, webOS and Flash.

I have been using NME to create cross-platform games for two years.

The Corona session earlier in the day demonstrated 250 objects at 28 FPS on an iPhone 4. The session following was regarding Adobe AIR, where prominent developers were quoted, “never have 500 of anything” in order to get acceptable performance. Just before I left for the event, my friend Philippe announced on Twitter that using NME, he was able to get 1000 objects, with scale, alpha, rotation and smoothing, at 60 FPS on an iPhone 4 (and has since gotten 3000 bunnies on an iPad 2).

As we had time, I stepped through Box2D physics, sprite sheet, animation and game samples. I showed how easy it is to compile for multiple platforms, and how well code completion works in FlashDevelop. Haxe is supported by many other editors, but FlashDevelop is my favorite.

I demonstrated Ponon! Deluxe and Bouncy Seed! on an iPod Touch, as well as my presentation (which was coded with NME), running on a TouchPad.

If you have any questions, please send them my way, I would love to help.

A big “thank you” goes to Mumuja, who created the squirrel you see in these slides. I had wanted to create an open-source game sample for the session, but continued to be distracted with ideas for improving NME. Thank you again, and I am glad I could still give him a prominent home in my presentation!

  • Bruno Garcia

    I’m a haXe developer building a game in Flash/AIR, operating on the assumption that Stage3D will greatly improve mobile performance once it comes out. It’s worth mentioning that prospective haXers can still continue to use AIR (which does have its benefits), but still have an escape hatch in NME in case Adobe fails to deliver.

  • You can publish an NME application for Flash, and through Flash, AIR. If this is your perspective, it may make more sense to go with NME now, knowing that you can publish with AIR if Adobe follows through. I don’t want to be a pessimist, but if Adobe fails to deliver it won’t be the first time. I would be a little nervous to put all my eggs in their basket…

    The last time I tested Bunnymark, I believe it was 5 to 7 times faster than AIR.

  • Bruno Garcia

    I know what you mean, but I’m really optimistic when it comes to Stage3D. It’s great to have open source alternatives though, thanks for all the hard work you’ve put into NME!

    About Bunnymark… drawTiles is awesome, but it’s not always possible to use it. Are there any CPU-bound benchmarks? I suspect hxcpp is faster than the AVM, but I wonder by how much.

  • Michael Ramirez

    What UI is available for cross-platform business apps using Haxe?

  • There are a few GUI libraries. Are you looking for something to provide default controls, like buttons and check boxes, or to provide widgets like lists, popups or sliding panes?

  • You will experience the biggest boosts in CPU performance when you are performing tasks that require a lot of number crunching (like physics)

    This post is a year old, but it has some CPU benchmark numbers:

    NME got 130 FPS, where Flash got 37 FPS, so in this test NME was a 3.5 times boost in performance over Flash.

  • just compiled my first hello world to iphone and whoa, its magic. It just is. Same code running in Flash and running in iOS. Awesome work. Thank you.

  • TroyWorks

    Thanks for the survey of the land Joshua, Indeed it is pretty amazing to look back over the 14 years I have been with “flash” and my oh my how much things have changed.

    >get 1000 objects, with scale, alpha, rotation and smoothing, at 60 FPS on an iPhone 4
    With Corona? didn’t quite understand.

  • You’re right! That was a little confusing (updated).

    That was using NME

  • Romy Ilano

    Wow! Thanks for taking the time to show me these slides last night. I had no idea that this stuff existed in the Flash gaming community.

  • Romy Ilano

    Heh here are some photographs from the Palm Pre dev camp in 2009… oh man! Maybe you were there. I haven’t met that many people obsessed or even paying attention to that thing. What beautiful UI… aw!