# Godot 3

The `zokogames` addon (`packages/sdk-engines/godot3/addons/zokogames`) targets **Godot 3** HTML5 exports (3.5 and 3.6 LTS are the targets, 3.3 and 3.4 should work, 3.0 to 3.2 are not supported). It has the same public API as the [Godot 4 addon](https://docs.zokogames.com/engines/godot): the same autoload `ZokoGames`, the same method names and the same signals, so a project can move between the two. It is written in GDScript 1 (no `await`, no lambdas) and calls the JavaScript SDK through the `JavaScript` singleton, using a small bridge (`window.ZokoBridge`) defined in the export's HTML shell. Outside a browser (in the editor, or a desktop run) a built-in simulator answers instead, so the same code runs everywhere. Terms such as "midgame" and "rewarded" are in the [glossary](https://docs.zokogames.com/getting-started/glossary).

> [!NOTE]
> Status (1.8.0): run headless in the official Godot 3.6.3 editor on macOS. The addon imports with no errors or warnings (warnings treated as errors), enabling the plugin registers the autoload, every public method and signal behaves as documented in simulator mode, and the HTML5 export contains the bridge and runs in a browser. Godot 3.3 to 3.5 are not verified, and a run against the live portal is not either. Send the Godot version and the exact error to [support](https://docs.zokogames.com/business/support) if the first import fails.

On Godot 4 this addon refuses to start (`init()` fails with `unsupportedEngine`); use the [Godot 4 page](https://docs.zokogames.com/engines/godot) there.

## Install

Download the Godot 3 plugin: [/sdk-engines/zokogames-godot3-1.8.1.zip](https://www.zokogames.com/sdk-engines/zokogames-godot3-1.8.1.zip) (the same files as the folder in the repository).

[/sdk-engines/godot3.zip](https://www.zokogames.com/sdk-engines/godot3.zip) is always the latest version. Checksums: [`/sdk-engines/SHA256SUMS`](https://www.zokogames.com/sdk-engines/SHA256SUMS). Index of every engine package with its version, size and SHA-256: [`/sdk-engines/engines.json`](https://www.zokogames.com/sdk-engines/engines.json). The source is also published at [github.com/zokogames/zokogames-godot3](https://github.com/zokogames/zokogames-godot3). It is also in the Godot Asset Library (asset 5620): search for ZokoGames in the editor's AssetLib tab (Godot 3), or install from the zip.

1. Unzip the download and copy its `addons/zokogames` folder into your project's `res://addons/` folder (create `addons` if it does not exist). It holds `plugin.cfg`, `plugin.gd`, `zokogames.gd` (the autoload), `zoko_banner.gd` and `export/zokogames_shell.html`.
2. **Project > Project Settings > Plugins**: enable **ZokoGames**. This registers the autoload `ZokoGames` (`res://addons/zokogames/zokogames.gd`) and the `zokogames/simulator/*` settings.
3. **Project > Export**: add an **HTML5** preset and set **Custom HTML Shell** (Options tab > HTML) to `res://addons/zokogames/export/zokogames_shell.html`. The shell loads `https://sdk.zokogames.com/zokogames-sdk-v1.js` before the engine, creates `window.ZokoBridge`, and reports the engine download to the portal's loading bar. With your own shell, add the script tag to `<head>` and copy the bridge block from the supplied one.
4. `yield(ZokoGames.init_async(), "completed")` once at startup, before any other call.
5. Optional: add a `ZokoBanner` node (`zoko_banner.gd`) over the space you can spare for a banner. The `examples/` folder next to the addon has `zoko_demo.gd` and `zoko_store.gd`.

> [!IMPORTANT]
> Without the custom shell `window.ZokoBridge` does not exist. The addon logs a warning and falls back to the simulator, so the game runs but uses no real ads, users or saves.

### Starter kit

A ready Godot 3 project with the addon, the shell and a small demo scene: [/starter-kits/godot3.zip](https://www.zokogames.com/starter-kits/godot3.zip). See the [starter kits](https://docs.zokogames.com/getting-started/starter-kits) page.

## What differs from Godot 4

| Godot 4 | Godot 3 |
| --- | --- |
| `await ZokoGames.get_user_async()` | `yield(ZokoGames.get_user_async(), "completed")`, which returns the same Dictionary |
| `callback: Callable` | `callback`: a `FuncRef`, `funcref(self, "_on_done")` |
| `ZokoGames.ad_started.connect(f)` | `ZokoGames.connect("ad_started", self, "_on_ad_started")` |
| The addon pauses the tree and mutes the Master bus while an ad plays and applies the portal's mute setting (`pause_game_during_ads`, `mute_audio_during_ads`, `follow_portal_mute`, all `true`) | The same properties and defaults; your own nodes that must react during an ad need `pause_mode = PAUSE_MODE_PROCESS` |
| `JavaScriptBridge` | `JavaScript` |

An `_async` call returns a request object (with `id`, `done`, `result` and the signal `completed(result)`), and `yield(..., "completed")` gives the result Dictionary. Every request completes on a later frame, so the `yield` cannot miss it.

## A working script

Put this in a script on a node in your first scene (or in your own autoload). It covers init, a midgame ad, a rewarded ad, gameplay start and stop, save and load, and a leaderboard score.

```gdscript
extends Node

func _ready() -> void:
	pause_mode = PAUSE_MODE_PROCESS                            # keep running while an ad pauses the tree
	var res = yield(ZokoGames.init_async(), "completed")
	if not res.ok:
		push_warning("ZokoGames unavailable: %s" % res.error.code)
	# The addon pauses the tree and mutes Master during an ad, and follows the portal's mute setting
	# (pause_game_during_ads, mute_audio_during_ads, follow_portal_mute): no ad or mute handlers needed.
	var level = int(ZokoGames.data_get_item("level", "1"))     # load: synchronous Strings
	start_game(level)

# Call when the player takes control, and when play stops.
func on_play_start() -> void:
	if ZokoGames.is_available():
		ZokoGames.gameplay_start()
func on_play_stop() -> void:
	if ZokoGames.is_available():
		ZokoGames.gameplay_stop()

func show_midgame() -> void:
	var res = yield(ZokoGames.request_ad_async("midgame"), "completed")   # completes after the ad is over
	if not res.ok:
		print("no ad: ", res.error.code)                       # adCooldown, unfilled, adblock ...

func on_reward_button() -> void:
	var res = yield(ZokoGames.request_ad_async("rewarded"), "completed")
	if res.ok:
		grant_reward()                                         # reward only after the ad finished

func save_progress(level: int) -> void:
	var r = ZokoGames.data_set_item("level", str(level))       # synchronous, uploaded in the background
	if not r.ok:
		push_warning(r.error.code)                             # for example dataLimitExceeded

func submit_score(score: float) -> void:
	var user = yield(ZokoGames.get_user_async(), "completed")
	if not user.ok or user.result == null:
		return                                                 # guests are not ranked
	var r = yield(ZokoGames.submit_score_async("", score), "completed")   # "" works only on a board WITHOUT an encryption key
	if not r.ok:
		print(r.error.code)

func start_game(_level: int) -> void:
	pass
func grant_reward() -> void:
	pass
```

## Leaderboard scores and encryption

A board **with** an encryption key counts only a correctly encrypted payload ([leaderboards](https://docs.zokogames.com/sdk/leaderboards#client-submission)). Since plugin 1.8.0, `encrypt_score_async(score, KEY)` seals the score with your board key and returns the payload for `submit_score_async`; `""` works only for a board without a key.

```gdscript
const BOARD_KEY = "paste-your-board-key-here"

func submit_secure_score(score: float) -> void:
	var sealed = yield(ZokoGames.encrypt_score_async(score, BOARD_KEY), "completed")
	if not sealed.ok:
		print(sealed.error.code)                               # userNotAuthenticated for guests, invalidArgument for a bad score or key
		return
	var r = yield(ZokoGames.submit_score_async(sealed.result, score), "completed")
	if not r.ok:
		print(r.error.code)
```

The optional third argument `earned_at` (Unix milliseconds, default 0 for a live run) seals the delayed copy of a score. A key inside a build stops casual edits, not a determined player: for real stakes compute the score on your server and use the server API.

## How calls work

<!-- search: headings-only -->

GDScript names are snake_case. Every method that talks to the portal comes in two forms:

| Form | Example | Use it for |
| --- | --- | --- |
| Callback | `ZokoGames.get_user(callback)` | Fire-and-forget calls. The `FuncRef` is optional and last, except in `store_get_catalog_items(callback, limit, offset)` and `store_get_player_inventory(callback, limit, offset)`, where it comes first, and in `get_user_token(signing_key_type, callback)`. |
| Request | `yield(ZokoGames.get_user_async(), "completed")` | Straight-line code. The name ends in `_async`. |

Both deliver a Dictionary, `{ "ok": true, "result": <value> }` or `{ "ok": false, "error": { "code": "...", "message": "..." } }` (`request_ad` takes a Dictionary of FuncRefs instead). All methods live directly on the autoload; there are no `ad.`, `game.` or `user.` sub-objects.

| JavaScript | GDScript |
| --- | --- |
| `SDK.init()` | `yield(ZokoGames.init_async(), "completed")` or `ZokoGames.init(callback)`; signal `initialized(ok)` |
| `SDK.environment` | `ZokoGames.environment` (`"local"`, `"zokogames"` or `"disabled"`), `ZokoGames.is_available()`, `ZokoGames.is_simulated`, `ZokoGames.is_qa_tool`, `ZokoGames.VERSION` |
| `SDK.ad.requestAd(type, cbs)` | `ZokoGames.request_ad(type, {"ad_started": f, "ad_finished": f, "ad_error": f})` (FuncRefs) or `yield(ZokoGames.request_ad_async(type), "completed")` |
| `SDK.ad.hasAdblock()` | `ZokoGames.has_adblock(callback)` or `yield(ZokoGames.has_adblock_async(), "completed")` |
| `SDK.banner.requestBanner(...)` | `yield(ZokoGames.request_banner_async(id, width, height, window_rect), "completed")` |
| `SDK.banner.requestResponsiveBanner(id)` | `yield(ZokoGames.request_responsive_banner_async(id, window_rect), "completed")` |
| `SDK.banner.clearBanner(id)` / `clearAllBanners()` | `ZokoGames.clear_banner(id)` / `ZokoGames.clear_all_banners()` |
| `SDK.banner.hideAllBanners()` / `showAllBanners()` (1.8.0) | `ZokoGames.hide_all_banners()` / `ZokoGames.show_all_banners()` (and `_async`) |
| `SDK.game.gameplayStart()` / `gameplayStop()` | `ZokoGames.gameplay_start()` / `ZokoGames.gameplay_stop()` |
| `SDK.game.loadingStart()` / `loadingStop()` / `loadingProgress(n)` | `ZokoGames.loading_start()` / `loading_stop()` / `loading_progress(n)` |
| `SDK.game.happytime()` | `ZokoGames.happytime()` |
| `SDK.game.reportGameCompletedPercentage(n)` | `ZokoGames.report_game_completed_percentage(n)` |
| `SDK.game.setGameContext(obj)` / `clearGameContext()` | `ZokoGames.set_game_context(dict)` / `ZokoGames.clear_game_context()` |
| `SDK.game.updateRoom(u)` / `leftRoom()` | `ZokoGames.update_room(dict)` / `ZokoGames.left_room()` |
| `SDK.game.inviteLink(p)` / `getInviteParam(k)` | `yield(ZokoGames.invite_link_async(dict), "completed")` / `ZokoGames.get_invite_param(key)` |
| `SDK.game.showInviteButton(p)` / `hideInviteButton()` | `yield(ZokoGames.show_invite_button_async(dict), "completed")` / `ZokoGames.hide_invite_button()` |
| `SDK.game.settings` | `ZokoGames.settings` (`disableChat`, `muteAudio`), signal `settings_changed` |
| `SDK.game.isOffline`, offline listener | `ZokoGames.is_offline`, signal `offline_changed(offline)` |
| `SDK.game.isInstantMultiplayer` / `inviteParams` | `ZokoGames.is_instant_multiplayer` (alias `is_instant_join`) / `ZokoGames.invite_params`, signal `join_room(params)` |
| `SDK.user.isUserAccountAvailable` / `systemInfo` | `ZokoGames.is_user_account_available` / `ZokoGames.system_info` |
| `SDK.user.getUser()` | `yield(ZokoGames.get_user_async(), "completed")` |
| `SDK.user.getUserToken(opts)` | `yield(ZokoGames.get_user_token_async(signing_key_type), "completed")` |
| `SDK.user.showAuthPrompt()` | `yield(ZokoGames.show_auth_prompt_async(), "completed")`, signal `auth_changed(user)` |
| `SDK.user.showAccountLinkPrompt()` | `yield(ZokoGames.show_account_link_prompt_async(), "completed")` |
| `SDK.user.listFriends(opts)` | `yield(ZokoGames.list_friends_async(page, size), "completed")` |
| `SDK.user.submitScore(opts)` | `yield(ZokoGames.submit_score_async(encrypted_score, score), "completed")` |
| `SDK.user.encryptScore(score, key)` (1.8.0) | `yield(ZokoGames.encrypt_score_async(score, key), "completed")` |
| `SDK.game.gameId` (1.8.0) | `ZokoGames.game_id` / `get_game_id()` |
| `SDK.data.mirrorIndexedDB()` (1.8.0) | HTML shell option `window.ZOKO_MIRROR_INDEXEDDB = true` (Head Include); `ZokoGames.stop_mirror_indexed_db()` |
| `SDK.data.getItem(k)` / `setItem(k, v)` | `ZokoGames.data_get_item(key, default)` / `ZokoGames.data_set_item(key, value)`; also `data_has_key`, `data_remove_item`, `data_clear` (all synchronous) |
| `SDK.store.*` | `store_get_catalog_items_async`, `store_get_player_inventory_async`, `store_buy_item_async(item_id)`, `store_consume_item_async(sku, qty)`, `store_get_purchase_token_async()`, `is_store_available`, `store_set_sandbox(bool)` (synchronous); signals `purchase_completed(item_id)`, `purchase_failed(error)` |
| `SDK.achievements.list()` / `unlock(key)` / `onUnlock` | `yield(ZokoGames.achievements_list_async(), "completed")` / `achievements_unlock_async(key)`, signal `achievement_unlocked(achievement)`; see [achievements](https://docs.zokogames.com/sdk/achievements) |
| `SDK.analytics.trackOrder(p, o)` | `yield(ZokoGames.track_order_async(provider, order), "completed")` |
| `SDK.analytics.track(name, params)` (1.7.0) | `ZokoGames.track(name, params)` / `track_async(name, params)` |


Signals on the autoload: `initialized`, `ad_started`, `ad_finished`, `ad_error(error)`, `auth_changed`, `settings_changed`, `offline_changed`, `join_room`, `purchase_completed`, `purchase_failed`. Connect them with `ZokoGames.connect("ad_finished", self, "_on_ad_finished")`. Error codes are in `ZokoGames.ERROR_CODES` (a Dictionary keyed by module, for example `ZokoGames.ERROR_CODES.ad`); `ZokoGames.has_error_code(res, "purchaseCancelled")` tests a result. `unsupportedEngine` is extra in this addon.

**Kids mode.** `ZokoGames.settings.get("kidsMode", false)` is true when the game runs in kids mode (a game with the kids flag, or a player in kids mode); hide chat, rooms, sign-in prompts and shop screens then. Keep honouring `ZokoGames.settings.disableChat` as well. To test it, switch on `zokogames/simulator/kids_mode`. See [kids mode](https://docs.zokogames.com/guides/kids-mode).

## Cloud save for user:// (IndexedDB mirror)

The web export keeps `user://` files in the browser's IndexedDB (`/userfs`). To save them to the player's cloud save, add this line in **Export > HTML > Head Include**:

```html
<script>window.ZOKO_MIRROR_INDEXEDDB = true;</script>
```

The shell restores the cloud copy before the engine starts and uploads later writes within a few seconds. The mirrored data may not exceed 1 MiB, and the data module must be enabled for the game. `ZokoGames.stop_mirror_indexed_db()` stops mirroring. `ZokoGames.mirror_local_storage({"prefix": "save_"})` is the separate mirror for JavaScript-side `localStorage`; it does not see `user://` files.

## Room data channel

The room data channel (SDK 1.3.0) lets the players of one room exchange small JSON messages and share a tiny state that only the host writes. It is for game data, not text chat. The limits and error codes are the same as in Godot 4: see the [game module](https://docs.zokogames.com/sdk/game#room-data-channel) and the [multiplayer guide](https://docs.zokogames.com/guides/multiplayer-invites#6-exchange-game-data-in-the-room). Payloads cross the bridge as JSON (numbers come back as `float`; convert with `int()`).

| JavaScript | Godot |
| --- | --- |
| `room.send(data, { to })` | `ZokoGames.room_send(data, to, cb)` / `room_send_async(data, to)` / `room_send_to(member_id, data, cb)` |
| `room.onMessage(cb)` | signal `room_message(message)` (`from`, `data`, `direct`, `seq`, `ts`) |
| `room.setState(patch)` | `room_set_state(patch, cb)` / `room_set_state_async(patch)` (a `null` value removes the key) |
| `room.getState()`, `room.onState(cb)` | `room_get_state()`, `room_get_state_value(key, default)`; signal `room_state(state, change)` |
| `room.members()`, `room.onMembers(cb)` | `room_get_members()`; signal `room_members(members)` |
| `room.isHost()`, `room.onHostChange(cb)`, `room.selfId` | `room_is_host()`; signal `room_host_changed(host_id, is_host)`; `room_self_id()` |
| `room.addLeftListener(cb)` (1.7.0) | signal `room_left(reason, room_id)` |
| `room.onError(cb)` | signal `room_error(error)` |

```gdscript
extends Node

func _ready() -> void:
	yield(ZokoGames.init_async(), "completed")
	ZokoGames.connect("room_message", self, "_on_message")
	ZokoGames.connect("room_host_changed", self, "_on_host_changed")
	yield(ZokoGames.update_room_async({"roomId": "match-1", "isJoinable": true}), "completed")

func _on_host_changed(_host_id, is_host) -> void:
	if is_host:
		ZokoGames.room_set_state({"turn": "X"})

func _on_message(message) -> void:
	print(message.from, " played cell ", int(message.data.cell))

func play_cell(cell: int) -> void:
	yield(ZokoGames.room_send_async({"cell": cell, "mark": "X"}), "completed")
```

## Banners

Banner rectangles are in window pixels. Drop a `ZokoBanner` node (a `Control`) where the banner should go; it reports its on-screen rectangle (accounting for stretch mode), requests on `_ready`, and clears itself when it leaves the tree.

| Property | Meaning |
| --- | --- |
| `container_id` | Banner id, default `zoko-banner`. |
| `size_mode` | `responsive` (largest size that fits) or one of `728x90`, `300x250`, `320x50`, `468x60`, `320x100`. |
| `request_on_ready` | Request automatically in `_ready`. |
| `show_simulator_placeholder` | Draw a placeholder rectangle while the simulator answers. |

By hand: `yield(ZokoGames.request_responsive_banner_async("menu", $BannerSlot.get_global_rect()), "completed")`. Request banners on menu screens only.

## Purchases

```gdscript
func buy_first_item() -> void:
	if not ZokoGames.is_store_available:
		return
	var catalog = yield(ZokoGames.store_get_catalog_items_async(), "completed")
	if not catalog.ok or catalog.result.empty():
		return
	var bought = yield(ZokoGames.store_buy_item_async(catalog.result[0].sku), "completed")
	if ZokoGames.has_error_code(bought, "purchaseCancelled"):
		return
	var token = yield(ZokoGames.store_get_purchase_token_async(), "completed")   # send to your server and verify there
```

Verify ownership on your server (see [in-game purchases](https://docs.zokogames.com/sdk/purchases)). `examples/zoko_store.gd` is the full flow.

## HTML5 export settings that matter

<!-- search: headings-only -->

- **Custom HTML Shell**: `res://addons/zokogames/export/zokogames_shell.html`, as above. The canvas fills the frame, so use **Canvas Resize Policy** `Adaptive` and, in Project Settings > Display > Window > Stretch, a **Mode** of `2d` or `viewport` with aspect `expand` or `keep`.
- **Threads.** Godot 3 has no threaded web export, so there is nothing to untick. Game pages are not cross-origin isolated, so leave any `SharedArrayBuffer` option off if your build shows one.
- **GDNative.** Off. Native libraries do not run in web builds unless you ship a web-compatible one. **Export With Debug**: off for the uploaded build.
- **Focus Canvas on Start**: on. **Experimental Virtual Keyboard**: on if the game has text input on phones.
- **File names.** Export to a file named `index.html`: the portal needs `index.html` at the archive root, and the export names its other files after it: `index.js`, `index.wasm`, `index.pck`. Do **not** rename them to `.br` or `.gz`: the engine requests the plain names.
- **Texture compression.** Enable VRAM compression for both desktop (S3TC) and mobile (ETC2) so every browser has a format.
- **Size.** Use a custom export template with unused modules disabled and keep the `.pck` small. Limits: 1,500 files, 250 MB unpacked, about 50 MB initial download (20 MB for mobile).
- **Memory.** Mobile browsers have a small heap; load levels with `ResourceLoader.load_interactive` in slices rather than all textures up front, and cap resolution on phones, see [mobile](https://docs.zokogames.com/guides/mobile).
- **Audio unlock.** Browsers keep audio suspended until the first click or key press. Show a "click to play" screen and start music from that input, not in `_ready`.
- **Fullscreen.** Use the fullscreen button in the portal's frame bar; `OS.window_fullscreen = true` fullscreens your canvas only, so do not add a competing button.
- **Loading.** The shell already reports the engine download and calls `loadingStop` when the engine has started. For a longer in-game loading screen call `ZokoGames.loading_start()`, `loading_progress(percent)` and `loading_stop()` yourself.

Upload: **Project > Export**, select the **HTML5** preset, click **Export Project...**, and save into an empty folder with the file name `index.html`. Zip the folder contents so `index.html` is at the archive root, upload it in the developer console, and run the [Preview tool](https://www.zokogames.com/preview) first.

## Ad rules

There are no prerolls: your game cannot request an ad before it starts. Midgame is the only interstitial type, so an interstitial or commercial break from another platform becomes a midgame ad (`request_ad("midgame")`); the only other type is `rewarded`. Call `ZokoGames.gameplay_start()` when the player takes control: the first midgame ad needs it (or 30 seconds of visible page time), and in local mode a midgame request before that fails with `adCooldown`. Rewarded ads are not held back by this. Details: [ads reference](https://docs.zokogames.com/sdk/ads#gameplay-first) and [ads guide](https://docs.zokogames.com/guides/ad-monetisation).

## Test locally

- **In the editor or a desktop run** `ZokoGames.is_simulated` is true. Tune the simulator under **Project Settings > zokogames/simulator**: `ad_behaviour` (`fill`, `no_fill`, `error`), `ad_duration_seconds`, `adblock`, `disabled`, `account_available`, `logged_in`, `username`, `user_id`, `friend_count`, `mute_audio`, `disable_chat`, `offline`, `store_available` and `verbose`. Cloud save is in `user://zoko_sim_data.json`, the simulated inventory in `user://zoko_sim_inventory.json`. The simulator does not enforce the three-minute midgame cooldown.
- **An HTML5 export on `localhost`.** Serve the export folder from a local web server (opening `index.html` from disk does not work for WebAssembly). The bridge exists, so `is_simulated` is false and the JavaScript SDK runs its own [local mode](https://docs.zokogames.com/getting-started/local-testing).
- **Then** open the [Preview tool](https://www.zokogames.com/preview) with your local address and watch the checklist tick.

## Known pitfalls

<!-- search: headings-only -->

- **`sdkNotLoaded`.** The page has no SDK script tag; use the custom shell.
- **`ZokoGames` autoload missing.** The plugin is not enabled.
- **Calls fail with `sdkNotInitialized`.** `yield(ZokoGames.init_async(), "completed")` first.
- **`unsupportedEngine`.** You are running this addon on Godot 4; use the Godot 4 addon.
- **A `yield` never returns.** A `yield` in a function that is freed first (a scene change) is dropped; keep the waiting code in a node that stays, or use the callback form.
- **Works in the editor, not in the browser.** Open the browser console and check that `window.ZokoBridge` exists (the shell defines it).
- **Game stays paused or muted after an ad.** Something else changed `get_tree().paused` or the Master bus during the ad. Set `pause_game_during_ads` or `mute_audio_during_ads` to `false` and handle `ad_started`, `ad_finished` and `ad_error` yourself. Do not use `CONNECT_ONESHOT` on `ad_started`: when an ad fails, it never fires.
- **Banners never show.** The `ZokoBanner` node needs a size and must be visible.
- **`user://` saves are not in the cloud.** Use `data_set_item`, or the IndexedDB mirror above.

## Chat reports and screenshots

`ZokoGames.report_chat({"reportedName": "Trixie", "message": "buy gold", "reason": "spam"}, callback)` (or `report_chat_async`) sends a chat report. `ZokoGames.set_screenshot_provider(funcref)` replaces the default viewport capture (registered at init after `frame_post_draw`), and `clear_screenshot_provider()` removes yours. The editor simulator accepts both.

## Custom events

```gdscript
ZokoGames.track("level_complete", {"level": 3, "value": 1250})   # value is summed per event name
```

Fire-and-forget; the call never throws. The portal adds up a numeric `value` per event name and shows the calls, players and sum under **Your game's own events** in the developer console (needs the player's analytics consent; see [analytics](https://docs.zokogames.com/sdk/analytics#custom-events-track)). Name and keys match `[a-z][a-z0-9_]{0,39}`, at most 10 params. Uncaught errors are reported by the SDK on its own, so there is nothing to call for them.

## Next

- Check your build against the [build validation rules](https://docs.zokogames.com/requirements/build-validation) and the [launch checklist](https://docs.zokogames.com/requirements/checklist).
- Upload and publish: [submission walkthrough](https://docs.zokogames.com/getting-started/submission-walkthrough).
- Godot 4 projects: [Godot](https://docs.zokogames.com/engines/godot). Other engines and shared rules: [engines overview](https://docs.zokogames.com/engines/overview).
