Getting started with Game Development in Haxe

Haxe is fantastically open source, but unfortunately spread out over the internet in patches of brilliance. In lieu of this, I've spent the past few months researching all there is to offer from the community, and i'll try to sum up noteworthies in this post. I do apologise if you’ve been missed off the list, there were many honorable mentions that I’d liked to have had the time to discuss although what follows are the projects that made waves in my paddling pool.

Skial Bainn

Skial Bainn is someone you should definitely keep a close eye on; he posts regular news roundups for the Haxe community. This is by far the strongest vessel for news regarding Haxe, and accounts for the greater part of the Haxe subreddit, running strong for 3 years.
Weekly, you can find his work here:

Skial Bainn

I heard it through the grapevine that he's moving to a new home soon; you can follow work his development on Github.


The most popular Haxe library hands down is OpenFL (Recently rebranded from NME). Natively compiling to a range of targets, it's the heart of many projects built with Haxe. Commonly misidentified, OpenFL isn't a game engine in itself, but many have been built from it including projects such as HaxeFlixel and HaxePunk. This is what powers their cross compiling ability to iOS, Android and Web platforms. Although OpenFL isn't at all stagnate amongst the game development scene, as they've just introduced a Tizen partnership while actively improving their tools for rapid development.


Many first timers with Haxe usually just flow with OpenFL. The amount of game development projects built upon this library is astonishing. The team behind OpenFL are embracing this culture and have recently been working hard on a new project by the name of Lime (Light Media Engine), which is replacing the most standard OpenFL commands.
If you're installing Haxe and OpenFL with Lime for the first time, you can run the following command straight out of the box.

lime create openfl:project MyApplication


haxelib install lime
haxelib run lime setup

Once you have this installed and your project bootstrapped and ready to go, you can start creating applications for almost every popular platform available.

Lime logo

Lime is perfect for handling all low-level events by abstracting them for cross compiling. This feature is mostly designed to suit and power higher level frameworks such as OpenFL, it is still available to make direct OpenGL calls. For the most part though, OpenFL is currently the easiest way to use Lime. Instead of making direct OpenGL calls, OpenFL uses a much simpler (but powerful) API, on top of the functionality of Lime.

OpenFL is written simply with similarities to the Flash API known to many AS3 developers.

class Main extends Sprite {

    public function new () {

            super ();

            //Get Asset to display
            var img = new Bitmap (Assets.getBitmapData ("openfl.png"));

            //Add Image to Scene
            addChild (bitmap);

            //Set bounds for image
            img.x = (stage.stageWidth - img.width) / 2;
            img.y = (stage.stageHeight - img.height) / 2;


Whereas Lime is much more focussed on the low level events, such as interfacing with OpenGL directly to render.

public function render() {

    //Set the viewport for GL
    GL.viewport( 0, 0, lib.config.width, lib.config.height );

    //Set the clear color to a weird color that bounces around
    GL.clearColor( red_value, red_value*0.5, red_value*0.3, 1);

    //Clear the buffers

} //render is called by Lime
OpenFL Bitfive

Bitfire logo

OpenFL has been a staple of cross compiling but not without it's qualms. Bitfive is an alternative to the HTML5 target written by YellowAfterLife, focussed specifically to pursue performance and compatibility in its target sphere, being Canvas-driven games. Primary differences between OpenFL and Bitfive are the compiled filesizes, garbage generation which can cause the browser to choke and the overall end result performance. Factors of backwards compatibility are also improved, where for example earlier Android browser implementations tended to miss the Context.clip() method, which the original OpenFL backend uses.


HaxeFlixel logo

From the amazing github of Adam Atomic, Flixel was born 2008. Since then, it has burst into a AS3 game framework used by thousands. Designed for rapid development, HaxeFlixel is a port of this framework into the Haxe ecosystem built atop of OpenFL. It's hard to look past this mammoth in the community, especially when it's just reached the position of most starred Haxe repository on Github. Although being a port, it sometimes is very misleading to what the discrepencies of the current API version is. For example, when searching for HaxeFlixel information, you'll usually find yourself wading through the massive Flixel community and pre 3.0 documentation which occasionally doesn't translate over to the latest builds.

public function new(X:Int, Y:Int) 
    // X,Y: Starting coordinates
    super(X, Y);

    _bullets = Bullets;

    //Set up the graphics
    loadGraphic("assets/art/lizardhead3.png", true, true, 16, 20);  
    animation.add("walking", [0, 1, 2, 3], 12, true);
    animation.add("idle", [3]);
    animation.add("jump", [2]);

    //Set physics and attributes
    drag.set(RUN_SPEED * 8, RUN_SPEED * 8);
    maxVelocity.set(RUN_SPEED, JUMP_SPEED);
    acceleration.y = GRAVITY;
    setSize(12, 16);
    offset.set(3, 4);

HaxePunk logo

An alternative to the HaxeFlixel game framework is the much more minimalistic HaxePunk. Originating from the AS3 framework FlashPunk, it makes excellent use of OpenFL. This alone leads to an overall advantage for developers using OpenFL on account of the lighter footprint and similar learning curve. The community however behind HaxeFlixel is massive in comparison to HaxePunk which unfortunately results in a lack of tutorials, articles, and information on the APIs available.

public function new(x:Float, y:Float)
    super(x, y);

    //Set up the graphics
    graphic = Image.createRect(32, 32, 0xDDEEFF);
    setHitbox(32, 32);

    //Input Events
    Input.define("up", [Key.UP, Key.W]);
    Input.define("down", [Key.DOWN, Key.S]);

    //Set properties
    velocity = 0;
    type = "player";

Awe6 logo

In contrast to the frameworks above, I've spent most of my time learning the design of Awe6 in the past few months. Awe6 is a very design pattern heavy framework, built around the concepts of Inversion of Control and Dependency Injection. The only immediate problem with Awe6 is the same of HaxePunk; a lack of tutorials and examples. However unlike HaxePunk, the learning curve is much steeper which will often deter you from reaching the final product.

class MyImage extends Entity  {
    private var _sprite:Sprite;

    public function new( p_kernel:IKernel )
        _sprite = new Sprite();
        super(p_kernel, _sprite);

    public override function _init(): Void {
        _sprite.addChild(new Bitmap (
            "assets/img/mechwarriorFrameScaled.png" )));

    override private function _updater(?p_deltaTime:Int = 0): Void
        if (_kernel.inputs.keyboard.getIsKeyDown(EKey.RIGHT))
            _sprite.x += 10;
        if (_kernel.inputs.keyboard.getIsKeyDown(EKey.LEFT))
            _sprite.x -= 10;

Game From Scratch wrote a fantastic article on getting started with Awe6 and its inverted nature. While this will definitely give you a leg up on starting with Awe6, their Google Group will fill any voids you might have for getting started.

Awe6 breakdown

You might be thinking at this point "Oh! I might be able to mix these.. and create a library that meets all my needs". Although nothing will stop you, Haxeflixel and Haxepunk already have sufficient structures in place. Mixing Awe6 may be more work than it's worth. However, there are many ways in which to blend frameworks together. Scriptorum recently created a library called Flaxen based off HaxePunk and an Entity Component System named Ash.


Awe6 breakdown

Kha is a complete alternative to OpenFL; offering its own set of benefits independent of the platform. Targeting platforms such as XNA, PlayStation Mobile or the embeddable standard Java and C#, it's definitely holding its own amongst the more established libraries. Unlike OpenFL, Kha doesn't aim to replicate Flash API's, instead lead the way of 3D and 2D APIs. Features such as automatically encoding audio for you based on a platform you are targeting and built-in bitmap font rendering are all standard amoungst their full 2D game engine. While Kha isn't aimed to replace OpenFL, it does offer a feature-set very comparable to OpenFL.

UI in Haxe

StablexUI and HaxeUI are leading the pack in terms of UI customisation bought to the Haxe community. Offering similar feature-sets, they differ in pre-existing UI resources and targets. HaxeUI often gravitates to getting things done with a minimal timeframe where StablexUI is more focussed on flexibility. The largest difference however would be that HaxeUI is still experimenting with their HTML5 builds. It's fair to say HaxeUI is more suited to a desktop admin/util style application, compiled to Neko or C++.
For more creative projects however, StablexUI seems to lead for projects such as games, with flash and html5 targets.

Away3D, H3D, Nape, and all the extras

The great thing about Haxe is the modular nature. Libraries such as Away3D can fill in the gaps left by major libraries, even to the extent of Nape which can replace their packaged physics engine altogether. H3D is a Stage3D engine adapted for Haxe but commonly used for Flash projects, but this isn't the only platform dependant library available to Haxe. Projects such as HUGS aim to target Unity3D, and Flambe to better HTML5. While this might seem overwhelming, Haxe provided a great platform to build projects for just about every niche, without adding strain on the users codebase.

Things Built with Haxe

Awe6 breakdown

With all the above technology and projects, it's fair to say that Haxe is growing strong. A testimate to this would be games like rymdkapsel; A strategic Android, iOS and Desktop game built with OpenFL. The popular LEGO® Star Wars™ Ace Assault; A full 3D Web and Mobile game was built with Awe6. Silex Labs hosts a great presentation on this, and also feature a number of videos on their site which are worth a look. Pakka Pets; Another mobile game has recently posted their development log on TIGSource, which is definitely worth reading. The highly acclaimed Papers, Please built with NME and created by Lucas Pope, has been huge amongst not only the Haxe community but the indie community at large. Creating waves in the 2014 Independent Games Festival Awards, it's a game not only worth playing from a technical standpoint, but also for its design.

Where to now

That just about wraps things up for the major players in the Haxe development community. Keep an eye on Skial Bainn, YellowAfterLife, HaxeFlixel, OpenFL and of course Haxe for some great projects coming up. As for myself, you can follow me on Nicetrysean for weekly posts.