# Technical requirements

Each rule below says why it exists and how to check it before you submit. The upload validator produces a report with a code per finding; the codes are listed on [build validation](https://docs.zokogames.com/requirements/build-validation) and linked from the sections they belong to. A **build** is one set of uploaded files; the reviewer's checklist is on the [requirements checklist](https://docs.zokogames.com/requirements/checklist). Terms are in the [glossary](https://docs.zokogames.com/getting-started/glossary).

## Size and files

| Limit | Value |
| --- | --- |
| Total uncompressed build size | 250 MB |
| Number of files | 1,500 |
| Initial download | 50 MB. Above this the build is rejected. |
| Initial download, mobile target | 20 MB. Above this the validator warns and reviewers test on a phone. |

"Initial download" is what a first-time visitor must fetch before they can play. The upload validator estimates it from the uncompressed size of `index.html`, every file it references and the engine bootstrap payload (the Unity `Build/` folder, Godot `.pck` and `.wasm`, Defold archives and scripts). Files you fetch later, after the game is running, do not count, so load levels and audio lazily. Separately, the [Preview tool](https://www.zokogames.com/preview) times the first `gameplayStart` and flags anything later than 20 seconds. For techniques see [optimisation tips](https://docs.zokogames.com/guides/optimisation) and [first frame fast](https://docs.zokogames.com/guides/first-frame).

**Why:** the size and file caps keep a build quick to unpack and serve, and the initial download decides how long a visitor waits before play. **Check before submitting:** the console's **Build** step shows the size, file count and estimated initial download against these limits; the [Preview tool](https://www.zokogames.com/preview) shows the time to first gameplay. **Finding codes:** see [size and file codes](https://docs.zokogames.com/requirements/build-validation#size-and-file-codes) (`too_large`, `too_many_files`, `initial_too_large`, `mobile_initial_large`, `large_file`).

Games hosted on your own server (an `https` address that allows being framed from zokogames.com) are judged on time to gameplay and only earn if the SDK is integrated.

## Relative paths only

Every asset URL in your build must be relative (`assets/hero.png`, `./js/game.js`). Absolute paths (`/assets/hero.png`) and hard-coded domains break when we host the game under its own build folder (`g-<slug>.zokogames.com/<build-id>/`). Bundlers need a relative base: `base: "./"` in Vite, `homepage: "."` in Create React App, `publicPath: ""` in webpack.

**Why:** the build folder name is part of the address, so a root-absolute path points at the wrong place and returns 404; file names are case sensitive on the host; `http` addresses are blocked on an `https` page. **Check before submitting:** run the game from a sub-folder on `localhost` and watch the network tab for 404s, then read the report. **Finding codes:** see [path codes](https://docs.zokogames.com/requirements/build-validation#path-codes) (`absolute_path`, `case_mismatch`, `missing_reference`, `mixed_content`).

## What the validator rejects

The zip must have `index.html` at its root (or inside a single top-level folder, which is stripped). The upload is refused when it contains:

- more than 1,500 files (or more than 6,500 zip entries), or more than 250 MB unpacked;
- unsafe paths: absolute paths, drive letters, `..`, backslashes, `?` or `#` in a name, control characters, empty or dot segments, names over 1,024 characters or segments over 255;
- symbolic links, encrypted entries, unsupported compression methods or duplicate paths;
- executable or server-side files: `.php`, `.exe`, `.dll`, `.bat`, `.sh`, `.ps1`, `.jar`, `.py`, `.rb`, `.pl`, `.cgi`, `.asp`, `.jsp`, `.so`, `.apk`, `.lnk` and similar, and `.htaccess`, `web.config`, `php.ini`;
- suspicious compression ratios (a file over 1 MB that expands more than 200 to 1, or an archive that expands more than 400 to 1 overall);
- an estimated initial download over 50 MB;
- code or files that the safety scan blocks: native programs, miners, hidden `eval` of base64 data, password forms that post to another site, scripts loaded from raw IP addresses or URL shorteners, and cookies sent to another host.

Warnings do not block the upload: `__MACOSX`, `.DS_Store` and similar system files are ignored, paths that differ only by case, file types the portal does not recognise (served as generic binary), external hosts referenced from your code, root-absolute paths (`/game.js`) in `index.html`, files `index.html` references that are missing from the zip, an `index.html` that does not look like HTML, an initial download above 20 MB, and a missing SDK script. A `.gz` file that is not real gzip data is rejected. The validator also detects your engine (Unity, Godot, Construct, GameMaker, Cocos, Defold, Phaser) and whether the SDK script is referenced. Asset files must match their extension: a `.wasm` that is not WebAssembly fails validation, and mismatched images, audio or fonts are flagged for review.

**Why:** the host serves static files only, so executable and server-side files cannot run and are a security risk; unsafe paths and hostile archives could escape the build folder or exhaust memory. **Check before submitting:** the validator runs on upload and every error is shown with its path; fix it and upload again, the check costs nothing. **Finding codes:** [archive and file type codes](https://docs.zokogames.com/requirements/build-validation#archive-and-file-type-codes), [the safety scan](https://docs.zokogames.com/requirements/build-validation#the-safety-scan) and [SDK codes](https://docs.zokogames.com/requirements/build-validation#sdk-codes).

## No threaded WebAssembly

Game pages are served without cross-origin isolation headers (COOP and COEP), so `SharedArrayBuffer` is unavailable and threaded WebAssembly builds (Unity multithreading, Godot with thread support, native threads in plugins) cannot run. Export single-threaded. Check before submitting: the build must start in the [Preview tool](https://www.zokogames.com/preview) with no `SharedArrayBuffer` error in the console.

## Iframe

The game runs in a sandboxed iframe with these tokens: `allow-scripts allow-same-origin allow-forms allow-pointer-lock allow-orientation-lock allow-modals allow-downloads allow-presentation`. Popups are opt-in per game (the **Needs popups** option). Permissions delegated to the frame include autoplay, fullscreen, gamepad, clipboard write, accelerometer, gyroscope, XR tracking and keyboard map. Camera and microphone are off unless staff grant them for one game; see the embedding page. Kids games, and any game played in kids mode, run without `allow-downloads`, as they already run without popups.

Do not rely on `window.top`, cookies or third-party storage; use the [data module](https://docs.zokogames.com/sdk/data). The frame has its own `localStorage` (the sandbox allows its own origin), but it is separate from the data module and is not synced; a guest's data-module save is kept by the portal page, not by the frame. Do not add your own fullscreen button, the portal provides one.

**Why:** each game runs on its own origin in a sandbox so one game cannot read another's data or navigate the portal. **Check before submitting:** play in the [Preview tool](https://www.zokogames.com/preview), which uses the real frame, with the console open. **Finding codes:** [`service_worker`, `cookie_access`, `top_navigation`](https://docs.zokogames.com/requirements/build-validation#external-host-and-frame-behaviour-codes).

## Browsers

Why: players use all of them, and reviewers play the game on more than one. Check: open the game in the Preview tool in each browser you ticked.

- Chrome and Edge (current versions) are the baseline.
- Safari and Firefox must work as well. A game that fails on a browser can be disabled there.
- A game that does not run smoothly on a low-end 4 GB Chromebook can be switched off for Chromebooks (see the platform switches under Mobile).

## Mobile

- Support touch if you tick mobile in the submission, and keep the same features as desktop.
- Detect the device with `SDK.user.systemInfo.device.type`, not with touch events. Laptops have touch screens, and tablets have keyboards.
- Orientation is set at submission and the portal prompts players to rotate. You do not need to lock orientation in code.
- On iOS and low-memory Android, cap `devicePixelRatio` at 1 for canvases to avoid running out of memory. Tick **Tested and works well on iOS** and **Works in Safari** on the **Technical** step only when you have tested them: players on a device you did not confirm see a compatibility notice ("may not run well") before they play, with a "Play anyway" choice.
- Respect safe-area insets (`env(safe-area-inset-*)`) near screen edges, especially inside the mobile app shell where `applicationType` is not `"web"`.
- Test with the on-screen keyboard open if you have text input.

Besides the **Works on mobile** tick, you can switch **desktop**, **phone** and **tablet** availability on or off per game (`desktopEnabled`, `phoneEnabled`, `tabletEnabled` in the [developer API](https://docs.zokogames.com/guides/developer-api#game-settings); all are on by default). A player on a device class you switched off sees that the game is not available on that device instead of a broken start, and the mobile game lists leave out games with both phone and tablet off.

Three more switches work by platform instead of by screen size: **Chromebook** (ChromeOS), **Android** (phones and tablets, in any browser) and **iPhone and iPad** (iOS and iPadOS in any browser, including an iPad that asks for the desktop site). They are in the **Devices** card of the game's console settings, under **Platforms** (`chromebookEnabled`, `androidEnabled`, `iosEnabled`; all on by default). A game can run on iPhone Safari and not on Android Chrome. A platform switch applies only to players on that platform and comes on top of the device switches; on Windows, macOS or Linux none of them applies. A player on a platform you switched off sees the same "not available on this device" message instead of a broken start, on the game page and in the [embed](https://docs.zokogames.com/requirements/embedding) alike. The review and Preview views ignore the switches so you can still test. At least one device class must stay on.

**Why:** most players arrive on a phone, and the laptop-with-touch and tablet-with-keyboard cases break touch-event detection. **Check before submitting:** use the mobile (800x450) and tablet presets in the [Preview tool](https://www.zokogames.com/preview) and a real phone for the final pass; the reviewer checks touch controls only when you tick mobile.

## Audio on iOS

Mobile Safari starts the `AudioContext` suspended and only lets you resume it inside a user gesture handler:

```js
const ctx = new AudioContext();
function unlock() {
  if (ctx.state !== "running") ctx.resume();
}
window.addEventListener("touchend", unlock, { once: true });
window.addEventListener("click", unlock, { once: true });
```

Also honour `SDK.game.settings.muteAudio` and silence everything when an ad starts.

**Why:** browsers refuse sound before a user gesture, and a game that ignores the mute setting breaks the player's choice. **Check before submitting:** reload the game in the Preview tool and confirm nothing plays before your first tap, then trigger an ad break in local mode.

## Scroll and keys

The page must never scroll underneath the game. Cancel the default for wheel events and the keys the browser uses to scroll:

```js
window.addEventListener("wheel", (e) => e.preventDefault(), { passive: false });
const SCROLL_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight", "Space"];
window.addEventListener("keydown", (e) => {
  const typing = e.target instanceof HTMLInputElement || e.target instanceof HTMLTextAreaElement;
  if (!typing && SCROLL_KEYS.includes(e.code)) e.preventDefault();
});
```

Add `user-select: none` to the body so a drag does not highlight text, and `touch-action: none` on the canvas.

**Why:** the game sits inside a portal page, and scrolling that page under the game moves the player away from it. **Check before submitting:** in the Preview tool, scroll over the game and press the arrow keys and space; the page must not move.

## Sitelock

You may lock the game to run only on ZokoGames, which stops copies being re-hosted. The portal serves games from `zokogames.com` and subdomains of it:

```js
const host = location.hostname;
const allowed =
  host === "zokogames.com" || host.endsWith(".zokogames.com") ||
  host === "localhost" || host === "127.0.0.1";   // keep local development working

if (!allowed) {
  document.body.textContent = "Play this game on zokogames.com";
  throw new Error("sitelock");
}
```

**Hostnames, for a sitelock or portal detection.** A hosted game document is served from `g-<slug>.zokogames.com`, and its scripts and the SDK come from `sdk.zokogames.com` (covers from `imgs.zokogames.com`). Today the portal frames it from `zokogames.com`, `www.zokogames.com`, `developer.zokogames.com` (Preview and QA), `kids.zokogames.com` and `admin.zokogames.com` (review); the embed player is a page on `www.zokogames.com` that frames the game for partner sites. In the game's frame, `location.hostname` is the `g-<slug>` host, `document.referrer` and `location.ancestorOrigins` describe the parent, and `location.ancestorOrigins[0]` is the page that frames the game directly: `https://www.zokogames.com` on the portal and in the embed player, with the partner site as the next entry when the embed player sits on one. `ancestorOrigins` does not exist in Firefox, so never make play depend on it. These hosts can change: allow `zokogames.com` and every subdomain, never one exact name. To know whether you are on the portal, read `SDK.environment` (`"zokogames"` on the portal, `"local"` in local mode, `"disabled"` when the SDK is off) instead of reading hostnames.

The full embedding and sandbox policy is on [embedding and sitelock](https://docs.zokogames.com/requirements/embedding). Never lock to a single exact hostname; we may serve from other subdomains. **Why:** a lock that is too tight shows players a blank page and reviewers cannot tell it from a crash. **Check before submitting:** open the game in the Preview tool and on `localhost`; both must start. If you host the game on your own server, set a Content-Security-Policy such as `frame-ancestors 'self' https://zokogames.com https://*.zokogames.com` (see [hosting on your own server](https://docs.zokogames.com/requirements/embedding#hosting-on-your-own-server)).

## Privacy and your own game server

If your game collects any personal data beyond what the SDK gives you, show a notice and link a privacy policy. Do not load third-party advertising or tracking scripts.

**Your own game server is allowed.** Calling a server you run for the game itself (multiplayer, your own login and saves, a leaderboard) is permitted: use `https`, let it accept requests from the game's address, and say so on the **Technical** step (set **Progress saving** to **Own backend**, and turn on **Multiplayer game** where it applies). The validator lists such hosts as `origin_unknown` so a reviewer can see them. What the terms forbid is different: ad networks other than the SDK, third-party analytics and tracking scripts, and using the server to follow players for purposes other than running the game. Send your server only what the game needs, such as the player id from a token you verified on the server and game state.

**Origin: where your game runs.** An uploaded build runs on `https://g-<your-game-slug>.zokogames.com`. Your server sees exactly that origin in the `Origin` header in the build preview (the **Preview and QA** tab), in review, live, and inside a partner's embed, because the embed player frames the same address. The **Your own game server and notes for reviewers** card on the **Technical** step shows the origin for your game with a **Copy code** button. The slug is fixed once the first build is uploaded; until then it can still change. Three setups differ: a zip you run from your computer in the Preview tool runs on `https://preview-run.zokogames.com`, local mode runs on `http://localhost` with your port, and a game that is framed from your own address (hosting set to your own server) runs on that address. Keep the allowed origins in your server's configuration, not in code, so a change is one edit.

**Allow that origin, and only that origin.** In your server's CORS settings answer with `Access-Control-Allow-Origin` set to the origin above (add the test origins while you test) and answer the preflight `OPTIONS` request with the methods and the headers you use, at least `Authorization` and `Content-Type`. Do not allow `*.zokogames.com`: every other studio's game runs on that domain too. Do not rely on cookies: cookies of another site are not available inside the frame, so send identity in an `Authorization` header and leave `Access-Control-Allow-Credentials` off. A WebSocket upgrade is not covered by CORS, so check the `Origin` header on the upgrade yourself and refuse other origins.

**Which outbound connections work.** `https://` and `wss://` to any public host. The portal sets no list of hosts that an ordinary game may contact, so nothing has to be registered for the game to run and there is no field for it; declare your host in the notes for reviewers (below). Plain `http://` and `ws://` are blocked by the browser as mixed content, and a WebSocket to a raw IP address is flagged for review (`websocket_raw_ip`). A game made for children may call no host other than its own build. When a call is refused, the player's browser console shows one of the messages listed in the troubleshooting page under "Users, tokens and leaderboards", each with its fix.

**Who the player is.** A signed-in player's game calls `SDK.user.getUserToken()` and sends the token to your server; a guest has no token (the call rejects with `userNotAuthenticated`) and must still be able to play, with an anonymous id of your own that you never merge silently into a signed-in account. Your server verifies the token as a signed RS256 JWT against `https://www.zokogames.com/.well-known/jwks.json`, checking the issuer `zokogames`, the audience (your game id), `gameId`, `sub` and the expiry, with a few seconds of clock allowance. The complete samples, the claims and key rotation are on the user module page under "Verifying on your server"; the Node.js samples there are run against the real signing code in the portal's own tests.

**What reviewers test.** The reviewer plays the build as a guest and, when you offer sign-in, as a signed-in player, with the browser's Network tab open, and reads the notes you wrote in the card. The line "No unapproved external requests" passes when every host in the Network tab is your own files, the SDK or a host you declared in the notes and explained (the validator shows hosts it cannot classify as `origin_unknown`). The multiplayer lines need a way to start without waiting for strangers. Write in the notes: the host (for example `game.example.com`), what it is used for (rooms, login, saves, scores), what a guest can do and what needs sign-in, how to try it alone (for example "open the game in two tabs and press Create room", or a practice mode), and any limit (regions, a daily cap). Keep the server running for the whole review.

**Latency, regions and uptime.** The portal does not choose, measure or proxy your server. The game's files come from a global network; your calls go from the player's browser to your server, so put it (or an edge or serverless platform) near most of your players and avoid a slow cold start on the first call, because reviewers judge time to gameplay. No uptime figure is asked of you.

**When your server is down.** The portal does not watch your server and shows players nothing about it: no banner, no retry, no message. The game must handle it: give every call a timeout of a few seconds, show a short message with a **Retry** button instead of a spinner, and keep the game playable offline or as a guest where you can. **Check before submitting:** stop your server and start the game.

**Rate limits and data you receive.** The portal limits only what it serves, for example 60 token requests a minute per player. Calls to your server do not pass through the portal, so no portal limit applies and yours should. Many players can share one IP address (a school or an office), so limit signed-in players by their verified `userId` and not by address alone. What you may collect and what you must show players is in the privacy paragraph above and the developer terms.

**Why:** the developer terms forbid your own ad networks and tracking, and the portal's privacy policy only covers data the SDK passes on. **Check before submitting:** the report's `origin_ads` and `origin_analytics` findings list every such host the scan found. See [advertisement rules](https://docs.zokogames.com/requirements/advertisements).

## Next steps

- [Gameplay requirements](https://docs.zokogames.com/requirements/gameplay)
- [Build validation reference](https://docs.zokogames.com/requirements/build-validation)
