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 http://darkoverlordofdata.com/alienzone-dart/


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 http://darkoverlordofdata.com/alienzone-haxe/.


The code for Alien Zone is open source GPL3, and both versions are available at
https://github.com/darkoverlordofdata/alienzone-dart
https://github.com/darkoverlordofdata/alienzone-haxe

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.

1 comment:

  1. python projects for final year students

    Both Haxe and Dart are high-level programming languages aiming to bridge the gap between web development and native app development. Here's a comparison to help you choose the right tool for your project:

    Haxe:

    Strengths:

    Cross-platform compilation: Haxe excels at compiling code to various targets like JavaScript, C++, C#, Java, Python, Lua, PHP, Flash, and native code for mobile and desktop platforms. This allows you to write a single codebase and target multiple platforms.
    Mature language: Haxe has been around since 2005 and has a stable and well-developed ecosystem with libraries and frameworks.
    Statically typed: Haxe enforces type safety during compilation, reducing runtime errors.

    ReplyDelete