Installation¶
Setting up Heaps for game development requires three components: Haxe (the language), Heaps (the engine), and a runtime (HashLink or JavaScript).
Prerequisites¶
1. Install Haxe¶
Haxe is the programming language that Heaps is built with.
Download and run the installer from haxe.org
Verify installation:
2. Install Visual Studio Code¶
While any editor works, VS Code offers the best Heaps development experience.
- Download from code.visualstudio.com
- Install the Haxe Extension Pack from the marketplace
3. Install HashLink (Recommended)¶
HashLink is a virtual machine designed for Haxe, providing native performance.
Download the installer from hashlink.haxe.org
Build from source or use the provided binaries at hashlink.haxe.org
Apple Silicon Users
HashLink doesn't fully support ARM64 yet. Use the web target for development on M1/M2/M3 Macs.
Install Heaps¶
Install Heaps and its dependencies using haxelib (Haxe's package manager):
haxelib install heaps
haxelib install hlsdl # For native builds
haxelib install hxnodejs # For Node.js builds (optional)
Create Your First Project¶
-
Create a new directory:
-
Create
build.hxml
for HashLink: -
Create
build-web.hxml
for web builds: -
Create
src/Main.hx
: -
Build and run:
IDE Setup¶
VS Code Configuration¶
-
Create
.vscode/tasks.json
: -
Create
.vscode/launch.json
for debugging:
Verify Installation¶
Create this test file as src/Main.hx
:
class Main extends hxd.App {
override function init() {
var text = new h2d.Text(hxd.res.DefaultFont.get(), s2d);
text.text = "Heaps is working!";
text.scale(3);
text.center();
}
override function update(dt:Float) {
// dt is in seconds
}
static function main() {
new Main();
}
}
If you see "Heaps is working!" on screen, you're ready to build games!
Troubleshooting¶
Common Issues¶
"Library heaps not found" : Run haxelib install heaps
again
"Type not found: hxd.App" : Make sure -lib heaps
is in your build.hxml
HashLink crashes on launch : Ensure hlsdl is installed: haxelib install hlsdl
Black screen on web build : Create an HTML file that includes your JS:
<!DOCTYPE html>
<html>
<head>
<title>Heaps Game</title>
<style>
body { margin: 0; padding: 0; }
canvas { width: 100%; height: 100vh; }
</style>
</head>
<body>
<script src="game.js"></script>
</body>
</html>
Next Steps¶
You're ready to create your first game! Continue to Hello World →