The build tool

Kaigen has no build system to set up. One program, hzbuild, does everything: it generates the reflection code, compiles the shaders, cooks the assets and compiles your game, all as one dependency graph, so a normal build only redoes what changed.

Inside a project it lives at hz/hzbuild (hz\hzbuild on Windows), because hz is a link to the engine your project uses. The kaigen command you installed is the same program.

Building and running

The commands you'll use every day
hz/hzbuild               # build for this machine
hz/hzbuild run           # build and run
hz/hzbuild run --release # optimized build
hz/hzbuild cook          # cook assets/ into cooked/
hz/hzbuild clean         # start from scratch

Put a platform in front to build for it: macos, windows, linux, wasm, ios or android. hz/hzbuild wasm run builds the web version and serves it to your browser.

Everything after -- goes to your game unchanged. On the web it becomes the page's query string.

Arguments for the game
hz/hzbuild run -- --lanes 2 --window-size 1920x1080

Your project

A project is a folder with an hzproject.hzt at the root. It's a plain text file that says where your code, assets and shaders are, which engine version you use, and how to sign and publish. You'll rarely touch it.

New projects and engine modules
hz/hzbuild new my_game --template starting-template
hz/hzbuild templates                   # what templates there are
hz/hzbuild module add gameplay_blocks  # copy an engine module into the project

Modules are engine code you own: they're copied into your project, and you can change them however you want. See Gameplay blocks.

Scripted runs

--commands runs a little script inside your game: press keys, click UI, move things, take screenshots. It's how we test the engine, and it's great for reproducing a bug.

Run, look, quit
hz/hzbuild --commands "1.0:key_down:W;2.0:key_up:W;2.5:screenshot;3.0:quit"

More in Debugging and profiling.

Worth knowing