A starter null0 cart, in Zig.
Press Use this template to make your own, then search the project for mygame and rename it to whatever your game is called.
Everything is built inside docker, so you never install zig, wasm32-wasi yourself. All you need is docker, plus node for the shortcuts below.
npm startThat builds webroot/mygame.null0, serves webroot/, and rebuilds whenever you edit something in cart/. To build once, without the server:
npm run buildOr call docker yourself:
rm -f webroot/mygame.null0
docker run --rm --user $(id -u):$(id -g) -v ./cart:/src -v ./webroot:/out ghcr.io/notnullgames/null0-cart-zig:latest mygameYour code is in cart/main.zig. A cart implements the callbacks it cares about and the host skips the rest:
export fn load() void {}This toolchain also needs an entry point to exist, even though null0 never uses it for gameplay. Leave it empty:
pub fn main() void {}- wasm32-wasi executables need a
main, even though null0 never uses it. Keep it empty.
You do not need to copy any null0 bindings into this project - the docker image bakes the current carts/zig/null0.zig in for you.
- Zig carts - the whole API, in Zig
- Anatomy of a cart - callbacks, input, distribution
- API reference
Two workflows come with this template:
- Publish builds the cart and deploys
webroot/to github-pages on every push tomain, so anyone can play your game in a browser without installing anything. - Release attaches
mygame.null0to any github release you create.
Players who want it natively can grab the runtime and run null0 mygame.null0.