getting started with haxepunk

HaxePunk is the 2D game library that I make most of my games in. Unfortunately, it's no longer maintained, and its website is no longer available. Despite that, I've continued to use it because I find it the simplest and most pleasant to use of the many frameworks I've tried (e.g. MonoGame, Love2D, HaxeFlixel, and others). Being able to export to both HTML5 and desktop from the same codebase is also a huge boon.

If you enjoy a "pure code" approach to game development and want a "batteries included" framework that can handle animation, sound, keyboard & gamepad input, tweening, and more - but isn't overly prescriptive or bloated - I recommend checking out HaxePunk.

I've written this guide to help anyone who's interested in HaxePunk get a small template project I've made up and running from scratch. Just follow these steps.


First, install the lastest version of Haxe from here. The default installation is fine (Haxe + Neko).

In a windows terminal, run the following commands:

haxelib install openfl
haxelib install lime

This installs HaxePunk's dependencies.

Download and unzip my updated version of HaxePunk to a folder of your choice (or clone using git).

In a windows terminal, navigate to the folder where the HaxePunk folder is located and run the following command:

haxelib dev HaxePunk .\HaxePunk\

This tells haxelib to use the HaxePunk folder as our version of HaxePunk.

Now, download and unzip my template project to a folder of your choice (it can be the same one as before, but it doesn't matter).

In a windows terminal, navigate inside the haxepunk_template folder and run the following command:

haxelib run lime test html5

This should open the template project in a browser window.

If you want to build for Windows, you need to install Visual Studio 2019. Download the Commmunity Edition here. While installing it, don't click on any of the options to install workloads. Instead, go to the individual components tab and choose the following:

This will install about 4GB of stuff that's necessary to build for Windows.

You'll also need to install hxcpp by running the following command in a windows terminal:

haxelib install hxcpp

Once you've done this, you can build and run projects using the following command:

haxelib run lime test windows

This will take a long time the first time you run it.

You can also build Mac and Linux versions using these commands:

haxelib run lime test mac
haxelib run lime test linux

It may complain about some missing dependencies for these targets (e.g., hamcrest or munit). Go ahead and install those using haxelib install if that happens, and then run the build command again.

Another useful build target is HashLink, Haxe's virtual machine. HashLink builds compile faster than native builds, and are more performant than HTML5, so it's a very useful way to test your game during development. To target HashLink, simply install it from the download page, and then use this commmand:

haxelib run lime test hl


That's it for setup. To learn more, check out the API and the archived documentation pages. You can also poke around the code for the template project, or the code for Rena Game for an example of a more complete project. Note that the level editor used in the template project is Ogmo Editor, which you can download here.