# Publishing

> Put your game on the web with one command, or build the files to ship on stores.

## On the web, in one command

Publish to play.kaigen3d.com:

```
kaigen login
kaigen games publish --title "Lane Runner" --description "Dodge the traffic"
```

This builds your game for the web (the desktop and the phone version), uploads only what changed since last time, and makes it live on a link you can share. Players need nothing installed: they open the link and play, on a computer or a phone. Multiplayer games host right in the browser.

The `preview.png` at the root of your project is the cover on the game's page, and the `icon` under `publish` in `hzproject.hzt` is its icon.

Managing your games:

```
kaigen games                        # your published games
kaigen games status                 # this project's game
kaigen games publish --no-live      # upload a version without switching to it
kaigen games live <id> <version>    # switch which version is live, or roll back
kaigen games unpublish <id>
```

The free plan publishes up to 5 games.

## Builds for stores

A publish build is a release build with the development tools taken out (the editor, `--commands`, the debug checks):

Publish builds:

```
hz/hzbuild windows --publish
hz/hzbuild macos --publish
hz/hzbuild linux --publish
hz/hzbuild android --publish
```

They're written to `out/<platform>/publish/`, with the cooked assets next to the program, ready to upload to Steam, Epic, itch.io or a store. The product name, version, company and icon are the `publish` block of `hzproject.hzt`, where the macOS signing identity, the Android keystore and the store settings for Steam and Epic also live.

## Worth knowing

- Debug code you want gone from the shipped game goes in `#ifndef HZ_PUBLISH`, like the template's performance overlay.
- `kaigen versions snapshot . --message "jam build"` keeps a version of your project, with its build, that you can go back to and run later.
- Do one test publish early in a jam. Finding out an hour before the deadline that a sound file doesn't cook is no fun.
