Sunday 20 January 2013

Haxe & HaxePunk

I've had a lot of fun looking into cool stuff this new year and having made a move into the gaming industry; with my first job based around the development of a small, tablet based, casual game I've been looking into multi-platform, 2D, off the shelf, games engines.

I came across a project called Haxe (pronounced: Hex) that uses a language which is a derivative of ActionScript3 that compiles to native code for Android, IOS, Blackberry, Windows, Linux and Mac as well as Flash or HTML5 + Javascript... Which is pretty awesome in my opinion.
http://haxe.org/ 

HaxePunk is a Haxe port of the FlashPunk game engine which is extremely handy as it means there is a wealth of resources and tutorials on developing games with it.
Haxe Punk: http://haxepunk.com/
FlashPunk learning resources: http://flashpunk.net/learn/

I ran into a couple of problems while setting up my environment on OSX so I'll cover installing Haxe plus a couple of the problems I had here:

#1 Download Haxe here: http://haxe.org/download.

#2 Run these from the command prompt (you may need to sudo these, depending on your setup):

haxelib install jeash
haxelib install actuate
haxelib install nme
haxelib run nme setup
haxelib run nme setup android

#3 The last line will start up the android SDK installer, but the one it downloads will need upgrading. After the auto update remember to reopen the android SDK installer and select the version 8 API then download and install before continuing on with the setup script.

#4 The Haxe language bindings for MonoDevelop 3.0 didn't show up for me in:
MonoDevelop > Add-ins > Gallery
So I downloaded them manually from: http://addins.monodevelop.com/Beta/Mac/3.0/MonoDevelop.HaxeBinding-0.4.0.mpack

#5 When targeting IOS in MonoDevelop the IDE just hung. So I tried from the command prompt with:
$ sudo haxelib run nme test "project.nmml" ios  -simulator
From the directory containing my project.nmml.
This provided me with a meaningful error about the compiler not being able to find clang++ this, I think, was due to me having XCode 4.2 intalled .
Make a note of the directory it was looking for clang++ in then run:
$ which clang++ to find out where clang++ is on your system (/usr/bin/clang++ on my system) and symlink it to the directory that you made note of earlier.
Rerun: $ sudo haxelib run nme test "project.nmml" ios  -simulator
If it works then you should be ok to target iOS from MonoDevelop again, without it hanging this time.

#6 If you're having performance problems with HaxePunk on Android check out this Stackoverflow post

No comments:

Post a Comment