Friday, February 20, 2015

Haxe vs Dart

I've had my blinders on for the past couple of months, while I've been working on my first game, AlienZone.
A major part of my project was finding the right technology stack. My three main requirements are:

1) I do all my development on Linux
2) My primary target is Android
3) I want run the same code on a website.

My first try was to use Cordova, CoffeeScript, and Phaser. This soon ran into challanges. Organizing your javascript code is full of pitfalls, even when using node and browserify. But a bigger problem was that classical object hierarchies are just too brittle for games. And load time sucked.

Research pointed me in the direction of entity component systems progamming to solve the inheritance problems, Dart to addresses code organization, and CocoonJS for better performance. My stack became Cocoon, Dart, Play_Phaser and Dartemis. This works quite well,  and you can play this version at

But I still had long load times with my native Android app. I found I didn't want to play a game that takes too long to load. So I looked around and found another option, Haxe. I decided on HaxeFlixel and Ash. I found HaxeFlixel to be similar to Phaser, and Ash similar to Artemis. Enough so that it only took 2 weeks to port my code while learning Haxe. I'm satisfied with the native performance of this version. The html5 target is not quite as nice, but it's a secondary target. You can play this version of the game at

The code for Alien Zone is open source GPL3, and both versions are available at

I've decided to go forward with the Haxe version, only because my primary target is Android. If I was to target HTML, I'd definitely use Phaser, I think it just looks prettier, and has better response. The HaxeFlixel html5 target is still experimental, so that may improve, especially if they decide to use phaser for a front end.