Tired of jumping between different languages when working on new projects? Looking to reuse your game engine across many different platforms with no extra porting effort? Haxe is an open source write-once build-anywhere language and compiler developed with this in mind.
With the current trend of ubiquitous gaming brings the need for ubiquitous game development, and what better way to get the best bang for your buck than to write in one language that does all the native compilation legwork for you.
I’ve been looking into Haxe as a means of time-efficient distribution between multiple platforms. My main rule was that the applications had to be natively compiled (as I’ve found HTML5 performance to be heavily lacking, even when virtualised). It lead me to Haxe as a solution, and its simplicity was impressive.
This guide covers how to set up a Haxe project with NME in FlashDevelop for Windows.
1. Go to http://www.nme.io/download and download the Windows installer.
2. Run the installer and accept all defaults (screens provided below for reference).
3. Open up “Windows Command Prompt” and run “haxelib upgrade to make sure all packages are up-to-date. If asked, enter “y” to agree to upgrade selected packages.
FlashDevelop requires 32-bit Java to be installed in order to run builds in debug mode.
1. Go to http://java.com/en/download/manual.jsp and download “Windows Offline (32-bit)” Java installer.
2. Run installer, accept all defaults if there are any.
3. Locate your Java installation path (try looking somewhere like “C:\Program Files\Java\jre7”) and remember the location.
4. Open up “Environment Variables” settings, highlight “PATH” in “User Variables” and click the “Edit…” button.
1. Go to http://flashdevelop.org/ and click the green Download button to go to the download page.
3. Run the download file. It may say that you should install “Flash Player (ActiveX for IE)” – you don’t need it for this tutorial and I’ve never needed it in development.
4. When installing, untick the AIR and Flex SDKs from the Components menu – they are not used in developing for Haxe and will save you time and disk space if you skip it. The rest of the options can be kept as default.
1. Open FlashDevelop from the Start menu and select “Project” > “New Project…” from the menu bar at the top.
3. Enter your name or your company’s name if prompted (this is just meta text that gets added to new scripts you create).
4. Make sure “Debug” and “flash” are selected at the top next to the blue play button in FlashDevelop. Press “F5” or the blue play button to build and run your first project.
Note: FlashDevelop can occasionally throw errors in the output when building Flash Debug versions (as it’s using the debug functionality of the FlashDevelop build tool – FDB). Most commonly the message is to do with a “jvm.dll” not being found, even though that should be fixed when setting Java’s directory in PATH.