Falcon Game UI

12th January 2015 Joseph Zupko

Winston Churchill’s oft-quoted line on democracy mirrors the Demiurge Studios view of Adobe Flash: the worst form of game UI, except for all the others. We’ve struggled with Flash, and we’ve triumphed with Flash.

For our current and past projects, we’ve used commercial Flash runtimes to drive our Flash based UI (Autodesk Scaleform or RAD Game Tools Iggy). For future projects, we’ve begun exploring a different approach, our own library called Falcon.

With Falcon, we’ve dropped much of the Flash runtime. Our UI code is no longer written in ActionScript. We treat many object properties as immutable (such as the edges that make up a shape). Falcon has limited vector shape support, no slice 9 support, no morph shape support and no filter support. It is built to be a fast-as-possible Flash animation and render engine, with a focus on text and bitmaps.

A big motivation for Falcon is an ongoing challenge in Marvel Puzzle Quest: framerate and battery usage. General purpose Flash runtimes are expensive. In Falcon, we are building constraints into the system up front, limiting support to the features we historically use, and we are implementing those limited features as efficiently as possible.

Rolling your own Flash environment is not for the faint of heart. If you’re headed down this path, here are some starting points:
ActionScript Virtual Machine 2 (AVM2) Overview - official documentation on the AVM2 (ActionScript 3) bytecode format.
gameswf - a mostly inactive public domain Flash SWF runtime (ActionScript 2).
Haxe - an ActionScript like language that supports native targets and has ever improving support for rendering Flash SWF content with standard libraries.
Moai - a Lua oriented game toolkit with support for exporting Adobe Flash Professional content into Lua files, which can then be played back by Moai.
Shumway - an open source Flash SWF runtime, written in JavaScript and HTML 5.
SWF File Format Specification - official documentation on the SWF file format. Useful if you decide to roll your own SWF parser or to understand what’s going on in gameswf, Haxe, or Shumway.
uniSWF - similar in concept and features to Falcon, but Unity specific.

Haxe warrants special mention. Haxe is a great option if you are heavily invested in ActionScript already, in particular if you use ActionScript for more than just game UI. Defender’s Quest II is an example of a game on this route and Papers, Please is a shipped Haxe game.

Going forward, Falcon gives us an opportunity for new features and not just efficiency. For example, we plan to use the Flash stage graph to predict image asset needs and load texture data more optimally.