# For AI coding agents

This page is written for a coding agent that was handed a game and told to make it run on ZokoGames, and for the person who supervises it. Everything an agent needs to integrate, test and package the game is public Markdown. Only the console steps (a signed-in studio account, the upload, the submit button) need a human.

## What to fetch

All of these are plain text, English only, with no JavaScript needed. Prefer the smallest file that answers the question.

| URL | What it is | Size |
| --- | --- | --- |
| `https://docs.zokogames.com/llms.txt` | An index of every documentation page with a one-line description and a link to its Markdown. Start here. | A few thousand words |
| `https://docs.zokogames.com/<section>/<page>.md` | One page as Markdown: add `.md` to the page address, for example `https://docs.zokogames.com/sdk/ads.md`. Links inside are absolute. | One page |
| `https://docs.zokogames.com/llms-full.txt` | Every English page in one file, each after a `Source:` line. | About 1 MB. Too large for most context windows; use it for search, not for reading in full. |
| `https://sdk.zokogames.com/zokogames-sdk-v1.js` | The SDK script your game loads. Do not copy it into the build. | One script |
| [`/sdk-engines/engines.json`](https://www.zokogames.com/sdk-engines/engines.json) | The engine plugins with version, size and SHA-256. | Small |
| [Starter kits](https://docs.zokogames.com/getting-started/starter-kits) | Five runnable templates already wired to the SDK. | Zip files |

Code samples on a page may use a `:::tabs` block with `== Label` lines to group alternatives; each tab is a normal Markdown body. A `> [!NOTE]` or `> [!IMPORTANT]` quote is a callout.

Which pages to read for which task:

| Task | Fetch |
| --- | --- |
| Add the SDK to a plain JavaScript or Phaser game | `getting-started/one-file-example.md`, `sdk/introduction.md`, `sdk/game.md`, `sdk/ads.md`, `sdk/data.md` |
| Use an engine | `engines/<unity, godot, construct-3, gamemaker, cocos, defold, phaser>.md`, then `engines/overview.md` |
| Port a game that already runs on other web portals | `porting/overview.md`, then `porting/<unity, godot, construct-3, gamemaker, defold, cocos, phaser-html5>.md` for the engine, and `guides/migrating.md` for the call-by-call mapping |
| Make the upload pass | `requirements/build-validation.md`, `requirements/limits.md` |
| Fix an error message | `guides/troubleshooting.md` |
| Know what reviewers check | `requirements/checklist.md`, `requirements/quality.md` |

## The minimal integration, with a check per step

Do the steps in order. Each has a check an agent can run without a human.

1. **Load the SDK.** Put `<script src="https://sdk.zokogames.com/zokogames-sdk-v1.js"></script>` in the `<head>` of `index.html`, before your own code. Check: `grep -c "zokogames-sdk-v1.js" index.html` prints at least `1`. Keep every asset path relative (`./game.js`, not `/game.js`): `grep -nE '(src|href)="/[^/]' index.html` prints nothing.
2. **Wrap every SDK call.** The SDK can be missing, disabled or slow, and any call can reject with a plain `{ code, message }` object. The game must run in all cases. A `try`/`catch` around each `await` or a `.catch()` on each promise is enough. `SDK.data` is the exception: it is synchronous and throws.
3. **Call `init()` first.** `await window.ZokoGames.SDK.init()`. It never rejects. Afterwards read `SDK.environment`: `"zokogames"` in the portal, `"local"` on your machine, `"disabled"` anywhere else.
4. **Send the loading and gameplay signals.** `loadingStart()` when loading begins and `loadingStop()` when the first screen is playable. `gameplayStart()` when player input becomes live, `gameplayStop()` at every pause, menu, game over, and before any ad.
5. **Add one rewarded ad with a fallback.** `SDK.ad.requestAd("rewarded", { adStarted, adFinished, adError })`. Pause and mute in `adStarted`, grant the reward only in `adFinished`, and carry on in `adError`. A request can fail with `adsDisabled`, `unfilled`, `adblock`, `adCooldown`, `timeout` or `other`, and every one must leave the game playable.
6. **Save with `SDK.data`.** `getItem`, `setItem` and `removeItem` are synchronous, use strings only, and share a 1 MiB budget.
7. **Respect the portal's settings.** Read `SDK.game.settings.muteAudio` at start and listen with `addSettingsChangeListener`.
8. **Run it locally.** Serve the folder over HTTP on `localhost` (for example `python3 -m http.server 8080`) and open `http://localhost:8080/?sdk_debug=true`. Check in the page's console: `ZokoGames.SDK.environment` is `"local"`, and the log shows `[ZokoGames SDK] call game.loadingStop` and, after the first interaction, `call game.gameplayStart`. A headless browser works; use a `localhost` address, because the SDK is disabled on any other host unless the URL has `?useLocalSdk=true`.
9. **Force the failure paths.** Reload with `&ad_response=unfilled`, then `&ad_response=adsDisabled`, then `&user_response=logged_out`. The game must stay playable each time. All switches are in [testing](https://docs.zokogames.com/getting-started/local-testing).
10. **Zip.** `cd <build output folder> && zip -r ../game.zip .` so `index.html` is at the root of the archive. Zip the exported build (`dist`, `build`, the engine's web export), never the project root: source files, `node_modules` and `.git` would be packed too, and files whose names start with a dot are never served. Check: `unzip -l ../game.zip` lists `index.html` with nothing in front of it.

A complete game that does all of this is on [Copy-paste example: one index.html](https://docs.zokogames.com/getting-started/one-file-example). The same steps for an engine are on that engine's page.

## Rules the validator and reviewers enforce

A build that breaks one of these is rejected on upload or sent back in review. The numbers are all in [limits at a glance](https://docs.zokogames.com/requirements/limits).

- `index.html` at the zip root, or inside exactly one top-level folder.
- At most 1,500 files and 250 MB unpacked; an estimated first download of at most 50 MB (aim for 20 MB).
- No absolute paths, `..`, backslashes, symbolic links, encrypted or duplicate entries.
- No server-side or executable files such as `.php`, `.exe`, `.sh`, `.py` or `.jar`; the host serves static files only.
- No other portal's SDK, no ad network code, no threaded WebAssembly (`SharedArrayBuffer` is unavailable).
- Bundle fonts, libraries and assets into the zip: external hosts are warned about (`origin_*`), can be blocked, and rule out offline play; ad networks are never allowed.
- The first `gameplayStart` within 20 seconds of load.
- Sound starts only after a player gesture and obeys `muteAudio`.

Each rejection has a code listed with its fix in [build validation](https://docs.zokogames.com/requirements/build-validation) and by its exact message in [troubleshooting](https://docs.zokogames.com/guides/troubleshooting).

## What needs a human

| Step | Why |
| --- | --- |
| Create the studio and the game draft | It needs a signed-in player account and acceptance of the [developer terms](https://docs.zokogames.com/business/developer-terms). |
| Upload the zip and press **Submit for review** | These are console actions on a signed-in session. The [developer API](https://docs.zokogames.com/guides/developer-api) is read-only: it can list builds and show their state once a human has uploaded one. |
| Cover images and the description | They must be made for the game; see [covers](https://docs.zokogames.com/requirements/covers). |

An agent can do everything else, and can prepare the listing text and the covers for the human to upload. The human then follows steps 6 and 7 of [Your first game live in 30 minutes](https://docs.zokogames.com/getting-started/quick-start#6-upload-and-read-the-report-5-minutes).

## Next steps

- [Your first game live in 30 minutes](https://docs.zokogames.com/getting-started/quick-start)
- [SDK introduction](https://docs.zokogames.com/sdk/introduction)
- [Troubleshooting](https://docs.zokogames.com/guides/troubleshooting)
