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
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 scratchPut 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.
hz/hzbuild run -- --lanes 2 --window-size 1920x1080Your 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.
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 projectModules 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.
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
- A failed compile leaves the previous binary on disk, so
runafter a failed build runs your old game. Read the build output. - You only need
cleanwhen generated code looks stale. Incremental builds are trusted. hz/hzbuild doctorchecks your licence, engine, project and toolchain, and prints the fix for anything broken.