@zaisma/cli 0.57.0 → 0.59.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zaisma/cli",
3
- "version": "0.57.0",
3
+ "version": "0.59.0",
4
4
  "description": "Upload and publish browser games on Zaisma from the command line.",
5
5
  "license": "MIT",
6
6
  "homepage": "https://zaisma.com",
package/skill/SKILL.md CHANGED
@@ -20,14 +20,14 @@ The MCP also serves this skill and its references as resources (`zaisma://skill`
20
20
  ## The workflow
21
21
 
22
22
  1. **Make the game.** `create_game` with a title (and a slug, or one is made from the title). It starts as a draft only its developer can see.
23
- 2. **Try it first, on this computer.** `npx @zaisma/cli play-locally` in the game's folder runs the game and its game server with no key or internet; the bench's Add a player opens a second player. Run it with `--no-open --json` in the background to test it yourself through the bench's API at `http://localhost:4800/bench/api` (`references/game-server.md`). This is where multiplayer is tested while building: it runs the same game server, SDK and game page as Zaisma, and costs no review. A preview link doesn't join rooms, so never publish just to test rooms.
23
+ 2. **Try it first, on this computer.** `npx @zaisma/cli play-locally` in the game's folder runs the game and its game server with no key or internet; the bench's Add a player opens a second player. Run it with `--no-open --json` in the background to test it yourself through the bench's API at `http://localhost:4800/bench/api` (`references/game-server.md`). This is where multiplayer is tested while building: it runs the same game server, SDK and game page as Zaisma, and costs no review. When it says a newer bench is out, stop it and start it again (or run the `npm install` it names) before testing on. A preview link doesn't join rooms, so never publish just to test rooms.
24
24
  3. **Check, then upload a version.**
25
25
  - Under 5 MB (a single-file HTML game and the like): `check_game`, then `upload_files` with the file contents.
26
26
  - Bigger: `npx @zaisma/cli upload <folder> --game <slug>`. It runs the same check first (`npx @zaisma/cli check <folder>` runs it alone, with no key), downloads files the game loads from other sites, unpacks pre-compressed builds and sends only changed files.
27
27
  - The folder needs an `index.html` at the top.
28
28
  4. **The scan.** Every version is scanned, usually in under a minute: malware, known images and Zaisma's own file checks. `get_version` shows the result, and `performance_check` on it says how the game started in Chrome, with notes on what would make it much smaller. A held version waits for a person, usually within a day.
29
29
  5. **Show the developer the preview link.** A passed version gets a private preview link that opens only for its developer. Always show it before publishing.
30
- 6. **The AI review.** A version others can reach gets an AI review against the content rules before it goes live. `is_ai_review_needed_to_publish` and `usual_ai_review_duration_min` on the version say so first: tell the developer how long it usually takes, never as a promise. `start_ai_review` starts it ahead of publishing. A developer who has earned it (`get_access`, `standing.publish_before_ai_review_enabled`) can go live at once with the review pending. A game only its developer can reach never gets one.
30
+ 6. **The AI review.** A version others can reach gets an AI review against the content rules before it goes live. `is_ai_review_needed_to_publish` and `usual_ai_review_duration_min` on the version say so first: tell the developer how long it usually takes, never as a promise. `ai_review_speed` says whether it runs at once (a small fix of 1 MB or less of new code to a game that passed) or in a batch. Start it ahead of a launch with `start_ai_review`. Reviews count on the game's hosting meter. When a live game breaks, roll back first (publish the last version that passed: free and instant, no review), then publish the fix. A developer who has earned it (`get_access`, `standing.publish_before_ai_review_enabled`) can go live at once with the review pending. A game only its developer can reach never gets one.
31
31
  7. **Publish.** `publish_version` makes a passed version live, now or at `scheduled_publish_at`, and rolls back to an older one the same way. A publish is a quiet patch unless `is_big_update` is true (with `patch_notes`): only that shows players the Updated tag. `match_update_mode: "now"` switches running matches within seconds instead of at their next match.
32
32
  8. **Choose who plays.** `update_game` with `visibility`: `listed` (everyone, in Zaisma's lists from the first day), `unlisted` (anyone with the link), `private` or `draft`. To let testers play first, keep it private and make tester links with `add_tester_link`. Before a multiplayer game goes public, test it once on Zaisma's rooms through a tester link on the live version (`version_choice: "live"`): that's where the game server's CPU limits, real networks and the chat filter show.
33
33
 
@@ -84,7 +84,8 @@ The HTTP status goes with the code, as listed. The list lives in `ERROR_CODES` (
84
84
  | `no_game` | 404 | You have no game with that slug. |
85
85
  | `bad_slug` | 400 | The link name isn't lowercase letters, numbers and single hyphens, or is reserved. |
86
86
  | `slug_taken` | 409 | Another game has that link name, or a deleted game had it. |
87
- | `too_many_games` | 403 | The account has as many games as it can have. |
87
+ | `slug_locked` | 409 | new_slug can't change the link: the game isn't a private draft, or was published, or has tester links or kept rooms. |
88
+ | `too_many_games` | 403 | The account holds as many games that no players play as it can. |
88
89
  | `account_banned` | 403 | Zaisma banned the account's developer side, or the whole account: only get_access, list_games and export_game work, and for a whole-account ban nothing does. |
89
90
  | `account_paused` | 403 | A person at Zaisma needs to look at the account: until then it can't make, upload or publish games, or post on the forum. |
90
91
  | `publishing_not_open` | 403 | Until the beta, only accounts Zaisma adds can make, upload and publish games. |
@@ -109,6 +110,10 @@ The HTTP status goes with the code, as listed. The list lives in `ERROR_CODES` (
109
110
  | `accounts_needed_for_minimum_age` | 400 | A game for 16 or 18 and up needs account_requirement whole_game, since only accounts have an age. |
110
111
  | `content_needs_minimum_age` | 409 | A version shows lifelike gore, which plays only in games for 16 and up. |
111
112
  | `gallery_picture_needed` | 409 | A listed game needs at least one gallery picture. |
113
+ | `bad_link_out_url` | 400 | link_out_url isn't an https address of a site of its own: not a link shortener, an IP address, an address with a user name or a Zaisma address. |
114
+ | `link_out_not_browser` | 400 | link_out_url is a store, payment or video page, or a download, not a game that plays in a browser. |
115
+ | `game_hosted_here` | 409 | The game has a live version on Zaisma, so it plays here and can't link out. |
116
+ | `hosted_only_setting` | 409 | The setting is for games hosted on Zaisma, and this game is a link-out listing (or the listing can't be set while the game has it). |
112
117
  | `bad_links` | 400 | links isn't a list of up to 20 { link_name, destination_url, is_on_game_page } with names of their own and https addresses that aren't link shorteners, IP addresses, addresses with a user name, or on Zaisma's own domains. |
113
118
  | `bad_own_server_urls` | 400 | own_server_urls isn't a list of up to 5 server addresses like wss://play.example.com, or one is an IP address, this computer or on Zaisma's own domains. |
114
119
  | `bad_game_server_allowed_hosts` | 400 | game_server_allowed_hosts isn't a list of up to 20 host names (like discord.com or *.example.com), or one is an IP address or on Zaisma's own domains. |
@@ -429,11 +434,13 @@ The fixed checks (malware scan, image matching and Zaisma's own file checks) run
429
434
  - **Before publishing,** `is_ai_review_needed_to_publish` says whether publishing starts a review, and `usual_ai_review_duration_min` how long a review like it usually takes, from recent real ones, not a promise: a batch can take much longer.
430
435
  - **While it runs,** `ai_review_step` says where it is (`waiting_for_daily_review`, `in_line`, `reading_files`, `judging`) and `ai_review_step_started_at` since when; waiting for a daily review, `ai_review_waiting_ahead_count` says how many of the account's reviews of the same size go first and `daily_review_free_at` when one frees up for it. The dashboard shows the same, and moves with it.
431
436
  - **A developer who has earned it** (`GET /access`, `standing.publish_before_ai_review_enabled`: established, a card that paid or a Stripe account that can take payments, with no ruling in 30 days) publishes straight away, with the review pending. With `publish_after_ai_review_enabled` it goes live only once it passes.
432
- - **Until then, what other people can reach waits for the review:** a publish stays off and goes live once it passes; a hidden game set `listed` or `unlisted` stays hidden, with `visibility_after_ai_review` saying what it becomes; a tester link says the game is being reviewed. A game's first review runs at full price in about a minute, and updates in half-price batches, usually under an hour. A tweak (nothing new in the evidence) reuses the earlier verdict.
437
+ - **Until then, what other people can reach waits for the review:** a publish stays off and goes live once it passes; a hidden game set `listed` or `unlisted` stays hidden, with `visibility_after_ai_review` saying what it becomes; a tester link says the game is being reviewed. A game's first review runs at full price in about a minute, and so does a small fix (1 MB or less of new code to read) to a game whose live version passed; other updates go in half-price batches, and `usual_ai_review_duration_min` says how long those usually take, from recent real ones. `ai_review_speed` says which speed a version gets before publishing. A tweak (nothing new in the evidence) reuses the earlier verdict.
438
+ - **When a live game breaks, roll back first, then fix:** publishing the last version that passed is free and instant and needs no review; then publish the fix, which as a small fix is usually reviewed in about a minute.
439
+ - **Reviews count on the game's hosting meter** (`ai_reviews` in `get_stats`' `shares`), against the free allowance and then credit. A re-check after a player's report is Zaisma's. A game paused for money (`free_used`, `budget_used` or `credit_used`) gets no review until its hosting starts again: its version waits (`ai_review_waiting_reason` `hosting_paused_for_money`) for credit, a budget or the next month. Rolling back to a version that passed needs no review.
433
440
  - **A game with 1,000 counted plays in the last 7 days** is reviewed at once, at full price.
434
441
  - **Ahead of a launch,** `POST /games/:slug/versions/:version_id/ai-review` (`start_ai_review`) starts a review without publishing. A scheduled release's review starts by itself up to a day before its time when other people can reach the game. If it isn't done on time, a developer who has earned it goes live anyway, and anyone else goes live when it passes.
435
442
  - **A stop** rolls the game back to the last version that passed, in running matches too, or with none leaves the game with no live version and its `review_reason`, until a fix goes live. The version's `findings` give the reason and the fix. The `ai_review_finished` webhook says when any review ends.
436
- - **Past the review's monthly budget,** versions go on with the fixed checks alone (`ai_review_status` `skipped`, with the note `ai_review_budget_used`). Nobody waits for a person.
443
+ - **Past Zaisma's monthly review budget,** a version waits for its review (`ai_review_waiting_reason` `review_budget_used`, `ai_review_step` `in_line`) and goes on by itself once reviews are available again; it never goes on unreviewed. A game paying for its own hosting with credit is reviewed at once, and a rollback to a version that passed is still instant. Only a re-check after a player's report goes on with the fixed checks alone (the note `ai_review_budget_used`).
437
444
  - **Files are read once.** A file any version that passed already had read is never read again, whoever sends it.
438
445
 
439
446
  `ai_review_status` is `not_started`, `waiting`, `reviewing`, `passed`, `stopped` or `skipped`; `ai_review_speed` is `at_once` or `batch`.
@@ -460,7 +467,7 @@ Zaisma acts on `copyright`, `defamation` and `trademark` only when someone sends
460
467
 
461
468
  When a country's law forbids what US law allows (the UK's hatred offences, say), a notice from a court, regulator or police there blocks the game for players in that country only, and everyone else still plays it: it's in the game's `country_blocks` with `country_law_notice`, whose message says which law and what it names, and the `game_blocked_in_country` alert. Players there get a page saying it isn't available in their country (HTTP 451), and Zaisma's lists, its files and Zaisma rooms leave it out there; its preview links still open, so you can check a fix from there. The game keeps its versions and can publish more: publish one without what the notice names, and a person at Zaisma checks it and lifts the block, usually within a day. If the notice is wrong, write to safety@zaisma.com with the game's slug and why. A `country_blocks_changed` webhook says when a block starts or ends.
462
469
 
463
- - **A version's `review_reason`**: a person rejected it, or a report paused the update; `null` otherwise. Its `findings` are what the scan found that holds or rejects it, each `{"code", "severity", "message", "content_rule", "path", "fix", "message_for_people"}`, where `severity` is `reject` (it can't go live) or `hold` (a person at Zaisma looks first, usually within a day). A finding with severity `info` is a note and holds nothing: `unregistered_link`, `unlisted_address` and `api_key_in_files`. A game that bumps into a protection the sandbox already enforces (a plain `window.open`, a call to an address that isn't Zaisma rooms or its own servers) passes with a note; a game that tries to get around one (a site opened with no tap, a link or address built from pieces, the page outside the frame, a peer connection from a frame of its own) is rejected as `ai_protection_dodged`. The version that only removes what held or rejected a game passes by itself, with no daily review used.
470
+ - **A version's `review_reason`**: a person rejected it, or a report paused the update; `null` otherwise. Its `findings` are what the scan found that holds or rejects it, each `{"code", "severity", "message", "content_rule", "path", "fix", "message_for_people"}`, where `severity` is `reject` (it can't go live) or `hold` (a person at Zaisma looks first, usually within a day). A finding with severity `info` is a note and holds nothing: `unregistered_link`, `unlisted_address`, `api_key_in_files` and `ai_player_name_unchecked` (a name players type for themselves that others see: show the Zaisma name, or check it with Zaisma's chat check). The AI review stops a version only for a break its quoted code proves by itself: a finding it isn't sure of comes as a note on a passed version, for you to check. A game that bumps into a protection the sandbox already enforces (a plain `window.open`, a call to an address that isn't Zaisma rooms or its own servers) passes with a note; a game that tries to get around one (a site opened with no tap, a link or address built from pieces, the page outside the frame, a peer connection from a frame of its own) is rejected as `ai_protection_dodged`. Sending the page outside the frame a message (`parent.postMessage`) isn't trying to get around anything. The version that only removes what held or rejected a game passes by itself, with no daily review used.
464
471
 
465
472
  The AI review judges each content rule by one yes/no test, shown under the rule at [zaisma.com/legal/content-rules](https://zaisma.com/legal/content-rules) (`CONTENT_RULE_DETAILS` in `packages/core/src/review.ts`). A version whose files answer a test yes is rejected within minutes, with the rule, the line it found and the fix, and no person; so is obfuscated code, which the review can't read (a minified build is fine). The AI review holds a version for a person only for lifelike gore (`ai_lifelike_gore`, which the game's age setting decides) or when it can't finish.
466
473
  - **An image's `review_reason`**: why it wasn't approved.
@@ -501,6 +508,8 @@ The list lives in `REVIEW_CODES` and the rules in `CONTENT_RULES` (`packages/cor
501
508
  | `ai_review_failed` | none | The AI review didn't finish, so a person at Zaisma looks. |
502
509
  | `daily_large_reviews_used` | none | This developer's 5 large reviews for today (a new game or a real change, judged) are used, so this version waits for the next one to free up. |
503
510
  | `daily_small_reviews_used` | none | This developer's 30 small reviews for today (versions read by the AI) are used, so this version waits unread for the next one to free up. |
511
+ | `hosting_paused_for_money` | none | This game's hosting is paused for money (its free allowance, budget or credit is used), so this version's review waits for credit, a budget or the next month. Reviews are paid like hosting: past the free allowance, by credit. |
512
+ | `review_budget_used` | none | Zaisma's AI reviews for this month are used up, so this version waits for the review instead of going on without it, until next month or until Zaisma adds more. |
504
513
  | `version_replaced` | none | A newer version of this game came in while this one waited, so this one isn't reviewed. |
505
514
  | `scan_failed` | none | The scan didn't finish after three tries, so a person at Zaisma looks. |
506
515
 
@@ -523,6 +532,7 @@ Each developer gets two kinds of review a day, across all their games. A large r
523
532
  | `ai_paid_random_rewards` | `purchases` | The AI review found paid random rewards (loot boxes): something bought with money, or with coins bought with money, that gives a random item. |
524
533
  | `ai_coin_price_without_real_price` | `purchases` | The AI review found prices in coins or gems with no real price beside them, for coins or gems bought with money. |
525
534
  | `ai_free_text_chat` | `chat` | The AI review found typed text another player reads as written that doesn't go through Zaisma's chat hosting (room.chat in Zaisma rooms, canChat and checkChat on your own server). |
535
+ | `ai_player_name_unchecked` | `chat` | The AI review found a name players type for themselves that other players see, with no check from Zaisma on it. It's a note: nothing is held. |
526
536
  | `ai_disallowed_crypto` | `crypto` | The AI review found cryptocurrency the rules don't allow: coins other than Bitcoin, tokens, NFTs or airdrops, or Bitcoin used for investment advice, paying players or asking for wallet access. |
527
537
  | `ai_other` | none | The AI review found faked plays or players, or text that addresses the reviewer. |
528
538
  | `ai_concern` | none | The AI review held or rejected the version without naming one concern; the message is its summary. |
@@ -672,11 +682,11 @@ Every call is checked before any of it runs, in this order: the key's access, wh
672
682
  | Call | What it does |
673
683
  | --- | --- |
674
684
  | `GET /games` | Your games, each with its `alerts` (see Alerts below), and `unread_topic_count`: how many of your forum topics Zaisma has replied to or changed since you last opened them. |
675
- | `POST /games` | Make a game: `{"title", "slug"?, "description"?, "glass_tint_color"?, "devices"?, "controls"?, "genres"?, "screen_orientation"?, "play_modes"?, "cloud_saves_enabled"?, "account_offer_enabled"?, "deleted_account_erase_enabled"?, "friend_joins_enabled"?, "performance_measuring_enabled"?, "multiplayer_mode"?, "room_browsing"?, "account_requirement"?, "minimum_player_age_years"?, "game_server_allowed_hosts"?, "own_server_urls"?, "links"?}`. It starts as a draft that only you can see. Up to 50 games. |
685
+ | `POST /games` | Make a game: `{"title", "slug"?, "description"?, "glass_tint_color"?, "devices"?, "controls"?, "genres"?, "screen_orientation"?, "play_modes"?, "cloud_saves_enabled"?, "account_offer_enabled"?, "deleted_account_erase_enabled"?, "friend_joins_enabled"?, "performance_measuring_enabled"?, "multiplayer_mode"?, "room_browsing"?, "account_requirement"?, "minimum_player_age_years"?, "game_server_allowed_hosts"?, "own_server_urls"?, "links"?, "link_out_url"?}`. It starts as a draft that only you can see. Publishing is never limited, but an account holds at most 50 games that no real players play; a game with players frees its slot. |
676
686
  | `GET /games/:slug` | One game with its `alerts` (see Alerts below), `playing_now_player_count` (the exact number of people playing it now: browsers that pressed Play and still have it on screen, and players in your Zaisma rooms, each counted once however many rooms they sit in, from the last 6 minutes; players see it from 3 up), `images`, `versions` (newest first, each with its `review_reason` and scan `findings`) and `testers`. |
677
- | `PATCH /games/:slug` | Change any of `title`, `description`, `visibility`, `devices`, `controls`, `genres`, `screen_orientation`, `play_modes`, `cloud_saves_enabled`, `account_offer_enabled`, `deleted_account_erase_enabled`, `friend_joins_enabled`, `performance_measuring_enabled`, `room_browsing`, `multiplayer_mode`, `account_requirement`, `minimum_player_age_years`, `game_server_allowed_hosts`, `own_server_urls`, `links`, `glass_tint_color`, `demo_game_slug`, `full_game_item_name` (the game's price to play, see "Sell your game once" under Items and purchases; it needs `purchase_access` `write`), `monthly_budget_cents` (the game's monthly budget from your hosting credit, see Hosting and credit; it needs `credit_access` `write`, and a first or higher budget answers `confirmation_needed`). Leave out what stays the same; `null` clears it. Answers with the `game`, `review_message` (set when new words wait for review), `game_server_problem` (why the game's own game server can't run yet, or `null`) and `next_steps`. |
687
+ | `PATCH /games/:slug` | Change any of `new_slug` (the game's link, only while `can_change_slug`: a draft or private game never published, with no tester links or kept rooms; else `slug_locked`), `title`, `description`, `visibility`, `devices`, `controls`, `genres`, `screen_orientation`, `play_modes`, `cloud_saves_enabled`, `account_offer_enabled`, `deleted_account_erase_enabled`, `friend_joins_enabled`, `performance_measuring_enabled`, `room_browsing`, `multiplayer_mode`, `account_requirement`, `minimum_player_age_years`, `game_server_allowed_hosts`, `own_server_urls`, `links`, `glass_tint_color`, `demo_game_slug`, `full_game_item_name` (the game's price to play, see "Sell your game once" under Items and purchases; it needs `purchase_access` `write`), `monthly_budget_cents` (the game's monthly budget from your hosting credit, see Hosting and credit; it needs `credit_access` `write`, and a first or higher budget answers `confirmation_needed`). Leave out what stays the same; `null` clears it. Answers with the `game`, `review_message` (set when new words wait for review), `game_server_problem` (why the game's own game server can't run yet, or `null`) and `next_steps`. |
678
688
 
679
- A game looks like: `slug`, `page_url`, `title`, `description`, `visibility`, `visibility_after_ai_review`, `review_status`, `review_reason`, `erases_at`, `is_erase_now_allowed`, `country_blocks`, `devices`, `controls`, `genres`, `screen_orientation`, `play_modes`, `cloud_saves_enabled`, `account_offer_enabled`, `deleted_account_erase_enabled`, `friend_joins_enabled`, `performance_measuring_enabled`, `multiplayer_mode`, `room_browsing`, `account_requirement`, `minimum_player_age_years`, `game_server_allowed_hosts`, `own_server_urls`, `links`, `details_waiting_for_review`, `title_listing_reason`, `glass_tint_color`, `monthly_budget_cents` (`null`: no paid hosting), `purchase_label` (what the game page says it sells, see In-game purchases), `refund_policy` and `refund_policy_text` (`null` until it states one), `full_game_item_name` (`null`: free to play), `demo_game_slug` (`null`: no demo), `first_published_at` (when it first went live; it never moves), `big_update_at` (the last marked big update; `null`: none yet), `recently_updated_at` (where Browse's Recently updated places it) and `updated_at`.
689
+ A game looks like: `slug`, `page_url`, `can_change_slug`, `title`, `description`, `visibility`, `visibility_after_ai_review`, `review_status`, `review_reason`, `erases_at`, `is_erase_now_allowed`, `country_blocks`, `devices`, `controls`, `genres`, `screen_orientation`, `play_modes`, `cloud_saves_enabled`, `account_offer_enabled`, `deleted_account_erase_enabled`, `friend_joins_enabled`, `performance_measuring_enabled`, `multiplayer_mode`, `room_browsing`, `account_requirement`, `minimum_player_age_years`, `game_server_allowed_hosts`, `own_server_urls`, `links`, `link_out_url`, `link_out_who_can_open`, `link_out_review_reason`, `details_waiting_for_review`, `title_listing_reason`, `glass_tint_color`, `monthly_budget_cents` (`null`: no paid hosting), `purchase_label` (what the game page says it sells, see In-game purchases), `refund_policy` and `refund_policy_text` (`null` until it states one), `full_game_item_name` (`null`: free to play), `demo_game_slug` (`null`: no demo), `first_published_at` (when it first went live; it never moves), `big_update_at` (the last marked big update; `null`: none yet), `recently_updated_at` (where Browse's Recently updated places it) and `updated_at`.
680
690
 
681
691
  - **visibility:** `draft`, `listed` (home page, search and search engines), `unlisted` (anyone with the link, never in lists or search engines) or `private`. Draft and private games open only through preview links and tester links (below), and on their own page for their developer, signed in. There a multiplayer game plays online while the page plays the live version; a newer version not yet published plays alone, and joining a room says so. A game is listed only with at least one gallery picture, sent or approved: `listed` without one answers `gallery_picture_needed`, and so does removing the last gallery picture of a listed game.
682
692
  - **review_status** is ours and separate: `pending` (no version has passed review yet), `live`, `held` or `removed`, and `review_reason` says why it's held or removed (see Holds and takedowns). Changing visibility never undoes a takedown.
@@ -704,7 +714,7 @@ A game looks like: `slug`, `page_url`, `title`, `description`, `visibility`, `vi
704
714
  | Call | What it does |
705
715
  | --- | --- |
706
716
  | `GET /games/:slug/reports?cursor=` | Player reports from the last 90 days (`period_duration_days`), counted by reason in `reasons` (`reason`, `label`, `open_count`, `closed_count`), and `bug_reports`: reports that report triage sorted as bugs, each with `player_text`, a one-line `summary`, the `version_id` they played and `reported_at`, and `player_reports`: reports about one of your game's players that Zaisma passed to you, newest first, up to 50, each with its `reason` (`harassment`, `cheating`, `other`, or one of the four Zaisma looks at itself when a person passed it on: `real_life_threat`, `personal_details`, `following_after_block`, `sexual`), `player_text`, `chat_messages` (the last chat lines, up to 20, between the reported player and the reporter, from the reporter's screen: `from_player_id`, the reported player's or `null` for anyone else's, `text` and `sent_at`; `[]` when none), `reported_player_id`, `reported_player_name`, `room_code`, `version_id` and `reported_at`. How players treat each other is your game's call, with mute and block always there; Zaisma itself acts only on threats that reach into real life, sharing someone's personal details, following someone after they blocked them, and anything sexual toward a teen. Pass the `next_cursor` from your last call as `cursor` to get only the bug and player reports that arrived after it. Child-safety reports are never counted or shown, and no report says who sent it. |
707
- | `GET /games/:slug/stats?period_duration_days=30` | How the game is played, up to 90 days (`play_stats`, see Play stats below), how many accounts have it in their favorites now (`favorite_count`, never who), how it runs on players' devices (`performance`, the same section), and multiplayer use per day in `multiplayer_days`: `date`, `room_count`, `room_play_duration_min`, `message_count` (messages and bytes players sent), the day's room traffic per player a second (`inbound_messages_per_player_sec`, `inbound_size_bytes_per_player_sec`, `outbound_messages_per_player_sec`, `outbound_size_bytes_per_player_sec`, divided by its player time, each message out counted once per player it reached) and `game_server_cpu_duration_sec`, the time the game's own game server ran in its rooms (each call's time less its waits on the database, other servers and its own timers). `hosting_use_this_month`: the game's month on its one hosting meter (see Hosting and credit): `free_used_pct`, `shares`, `is_paused`, `paused_reason`, `paused_at`, `resets_on_date`, `monthly_budget_cents`, `spent_from_credit_cents`, and the raw counts behind it, facts for tuning that are never priced on their own: `room_play_duration_hours` on Zaisma rooms, `relayed_size_bytes` (the data Zaisma's relay sent the game's players for their connections to each other, read from Cloudflare about once an hour), `game_server_cpu_duration_sec` (its rooms, and requests, schedule runs and webhooks past their first 10 ms), `request_count` (requests, webhook events and schedule runs), `written_row_count`, `read_row_count`, `database_size_bytes` and `adult_chat_check_count`. Rooms on your own server aren't counted. `room_traffic`: this month's traffic per player a second (the same four numbers), `message_types`, its 10 biggest message types by bytes (`message_type`: a message's `data.type`, or `(none)`, `(bytes)`, `(zaisma)` for Zaisma's own, `(state)` for state sync's updates (`stateSyncEnabled`) and `(other)` past a room's first 20; `direction` `inbound` or `outbound`; `message_count`, `size_bytes`, `largest_size_bytes`, `average_size_bytes`), and `traffic_hints`, each a `code` and a `message` with the game's numbers: `json_messages_large` (a JSON type averages 512 bytes or more at 5 or more a player-second: send it as bytes), `outbound_heavy` (each player gets 32 KB a second or more: send only what changed and what they can see, with `stateSyncEnabled` and `stateView`), `message_near_limit` (a message of 12 KB or more, near the 16 KB limit) and `latest_only_available` (a type goes to each player 10 or more times a second, and 10% or more of it went to players whose connection was backed up: send it with `delivery: "latest_only"`). Rooms on your own server aren't counted. `schedules`: the live version's schedules (see "Schedules" in the README), read within a minute of it going live, each with `schedule_name`, `cron` (UTC), `version_id`, `next_run_at` and `last_run_at` (`null` until it first runs); `[]` when it has none or players can't play the game. For games whose own game server runs on Zaisma (rooms on `own`, or any requests or schedules), each day's `game_server` has `call_count` (calls from its rooms), `request_count` (requests to `onRequest`, see "Requests to your game server" in the README), `scheduled_run_count` (runs of `onSchedule`), `crash_count` (a handler threw; that call, request or run is lost), `stopped_count` (ran on too long, like an endless loop; the match froze about 2 seconds, or the request or run failed) and `ended_match_count` (stopped twice, or 20 of its calls in a minute went past their 50 ms of CPU), and `game_server_errors` lists the 20 most recent distinct errors: `kind`, `message` with the file and line it came from (a game server that didn't start says why, like an option it doesn't take, with the ones it does, or a cron that doesn't read; a run's error starts with its schedule's name), `occurrence_count`, `version_id`, `first_at` and `last_at`. Other games get `game_server: null` and `game_server_errors: []`. |
717
+ | `GET /games/:slug/stats?period_duration_days=30` | How the game is played, up to 90 days (`play_stats`, see Play stats below), how many accounts have it in their favorites now (`favorite_count`, never who), how it runs on players' devices (`performance`, the same section), and multiplayer use per day in `multiplayer_days`: `date`, `room_count`, `room_play_duration_min`, `message_count` (messages and bytes players sent), the day's room traffic per player a second (`inbound_messages_per_player_sec`, `inbound_size_bytes_per_player_sec`, `outbound_messages_per_player_sec`, `outbound_size_bytes_per_player_sec`, divided by its player time, each message out counted once per player it reached) and `game_server_cpu_duration_sec`, the time the game's own game server ran in its rooms (each call's time less its waits on the database, other servers and its own timers). `hosting_use_this_month`: the game's month on its one hosting meter (see Hosting and credit): `free_used_pct`, `shares`, `is_paused`, `paused_reason`, `paused_at`, `resets_on_date`, `monthly_budget_cents`, `spent_from_credit_cents`, and the raw counts behind it, facts for tuning that are never priced on their own: `room_play_duration_hours` on Zaisma rooms, `relayed_size_bytes` (the data Zaisma's relay sent the game's players for their connections to each other, read from Cloudflare about once an hour), `game_server_cpu_duration_sec` (its rooms, and requests, schedule runs and webhooks past their first 10 ms), `request_count` (requests, webhook events and schedule runs), `written_row_count`, `read_row_count`, `database_size_bytes` and `adult_chat_check_count`. Rooms on your own server aren't counted. `room_traffic`: this month's traffic per player a second (the same four numbers), `message_types`, its 10 biggest message types by bytes (`message_type`: a message's `data.type`, or `(none)`, `(bytes)`, `(zaisma)` for Zaisma's own, `(state)` for state sync's updates (`stateSyncEnabled`) and `(other)` past a room's first 20; `direction` `inbound` or `outbound`; `message_count`, `size_bytes`, `largest_size_bytes`, `average_size_bytes`), and `traffic_hints`, each a `code` and a `message` with the game's numbers: `json_messages_large` (a JSON type averages 512 bytes or more at 5 or more a player-second: send it as bytes), `outbound_heavy` (each player gets 32 KB a second or more: send only what changed and what they can see, with `stateSyncEnabled` and `stateView`), `message_near_limit` (a message of 12 KB or more, near the 16 KB limit) `latest_only_available` (a type goes to each player 10 or more times a second, and 10% or more of it went to players whose connection was backed up: send it with `delivery: "latest_only"`) and `input_frequent` (players' games send 15 or more messages a second each: unless the game needs every one, send input when it changes and positions with `delivery: "latest_only"`). Messages inside a combined message (the SDK's `sendCombiningEnabled`) count one by one in `message_types`, and once in `message_count`. Rooms on your own server aren't counted. `schedules`: the live version's schedules (see "Schedules" in the README), read within a minute of it going live, each with `schedule_name`, `cron` (UTC), `version_id`, `next_run_at` and `last_run_at` (`null` until it first runs); `[]` when it has none or players can't play the game. For games whose own game server runs on Zaisma (rooms on `own`, or any requests or schedules), each day's `game_server` has `call_count` (calls from its rooms), `request_count` (requests to `onRequest`, see "Requests to your game server" in the README), `scheduled_run_count` (runs of `onSchedule`), `crash_count` (a handler threw; that call, request or run is lost), `stopped_count` (ran on too long, like an endless loop; the match froze about 2 seconds, or the request or run failed) and `ended_match_count` (stopped twice, or 20 of its calls in a minute went past their CPU: 50 ms, or 50 ms for each tick a call carries), and `game_server_errors` lists the 20 most recent distinct errors: `kind`, `message` with the file and line it came from (a game server that didn't start says why, like an option it doesn't take, with the ones it does, or a cron that doesn't read; a run's error starts with its schedule's name), `occurrence_count`, `version_id`, `first_at` and `last_at`. Other games get `game_server: null` and `game_server_errors: []`. |
708
718
  | `GET /games/:slug/history` | What happened to the game in `events`, newest first, up to 100: `description`, `version_id`, `subject_name` (what it was done to, like a secret's name), `done_by` (`you`, `api_key`, `ai` or `zaisma`), `api_key_name`, where it came from (`device`, `network_name`, `city_name`, `region_name`, `country_code`, `connection_address`: kept 90 days, and `null` with Keep where my account is used from off, except that uploads keep their address 90 days either way), `is_new_place` (a key's first change from a network and country it hadn't been used from), `occurrence_count` (SQL writes, imports, exports and save reads and changes from one key within the hour fold into one event), `happened_at`, `last_happened_at` and, for a hold, rejection or takedown, its `review_reason` (otherwise `null`). Besides uploads, scans and publishes it holds database writes, imports, exports and restores (a restore's `subject_name` is the time it went back to; an undo's, the restore it undid), a re-upload of the game by another developer that Zaisma stopped (its `subject_name` is their username; you also get an email), save reads and changes, secrets and tester links; a key that isn't limited to some games also sees your webhooks and sign-in apps. |
709
719
  | `GET /games/:slug/qr-code?room_code=` | The game's link as a QR code: `link_url` (the game page, or with `room_code` a room in it) and `qr_code_svg`, an SVG document, black on white with its margin, to save as a `.svg` file or turn into a PNG at any size for posters, booths and trailers. The dashboard has it under Details with SVG and PNG downloads, and players get the same code from Share on the game page. `room_code` that isn't a room's code answers `bad_room_code`. |
710
720
 
@@ -798,14 +808,14 @@ Everything a game runs on Zaisma's servers is on one meter per game, shown as a
798
808
  `hosting_use_this_month`, in `GET /games/:slug/stats` and `GET /games/:slug/database`:
799
809
 
800
810
  - `free_used_pct`: how much of the month's free hosting is used, 0 to 100. `resets_on_date` is when it starts again.
801
- - `shares`: what used it, each `{"kind", "share_pct"}` adding to 100, biggest first: `rooms`, `game_server`, `relayed_data`, `database`, `requests`, `adult_chat_checks` (the chat filter's checks between adults, with `adultChatFilterEnabled`), `page_previews` (Chrome drawing your AI's preview pictures, `preview_game_page`). `[]` before any use.
811
+ - `shares`: what used it, each `{"kind", "share_pct"}` adding to 100, biggest first: `rooms`, `game_server`, `relayed_data`, `database`, `requests`, `ai_reviews` (the AI reviews of its versions), `adult_chat_checks` (the chat filter's checks between adults, with `adultChatFilterEnabled`), `page_previews` (Chrome drawing your AI's preview pictures, `preview_game_page`). `[]` before any use.
802
812
  - `second_free_allowance_month_start_date`: the month the game had its second free allowance, the first time it filled its free hosting, or `null` until then. It comes once; that month `free_used_pct` counts both.
803
813
  - `is_paused`, `paused_reason` (`free_used`, `budget_used`, `credit_used`, `no_real_players`, `free_hosting_ended` or `null`) and `paused_at`.
804
814
  - `free_rooms_stopped_at`: when Zaisma's free room time for the month ran out across all games, for a game with no budget with credit; `null` otherwise. See the stop below.
805
815
  - `monthly_budget_cents` and `spent_from_credit_cents`: the game's budget and what credit paid for it this month.
806
816
  - **Where the hours went:** `play_hours`, this month's totals, never who: `total_duration_hours`, of it `new_player_duration_hours` and `returning_player_duration_hours`, and of it again `rented_network_duration_hours` and `other_network_duration_hours`, with `rented_share_used_pct`.
807
817
  - **Real players go last:** traffic from rented-server networks has its own share of 10% of the game's free hosting and of its budget, counting only its own use, and everyone else plays from the rest, with no extra free time and no gap in the meter. On that share: anyone on a rented-server network without history, and anyone at all whose browser shows no input and no graphics chip. An account a week old, or that played before or bought something, and a browser that played this game before, play from the rest on any network. Past it those players get `rented_share_used` from rooms, requests and the relay, and in a match they get an hour; everyone else plays on. A game on its own server isn't on the meter, and never hears any of it.
808
- - The counts behind it: `room_awake_duration_hours`, `room_connection_count`, `inbound_message_count`, `relayed_size_bytes`, `game_server_cpu_duration_sec` (of it `startup_cpu_duration_sec`), `game_server_session_count`, `game_server_invocation_count` (calls into it as Cloudflare counts them: each tick, message, join, request, schedule run, webhook event and start; the stats' `call_count` is only its rooms' calls, for its health), `loaded_version_count`, `outside_call_count`, `log_file_count`, `request_count`, `awake_duration_hours`, `database_call_count`, `written_row_count`, `read_row_count`, `bookkeeping_written_row_count` and `database_size_bytes`; and `room_play_duration_hours`, player time in rooms, a fact for tuning that isn't priced.
818
+ - The counts behind it: `room_awake_duration_hours`, `room_connection_count`, `inbound_message_count`, `relayed_size_bytes`, `game_server_cpu_duration_sec` (of it `startup_cpu_duration_sec`), `game_server_session_count`, `game_server_invocation_count` (calls into it as Cloudflare counts them: a real-time room's ticks, up to 30 to a call, each message, join, request, schedule run, webhook event and start; the stats' `call_count` is only its rooms' calls, for its health), `loaded_version_count`, `outside_call_count`, `log_file_count`, `request_count`, `awake_duration_hours`, `database_call_count`, `written_row_count`, `read_row_count`, `bookkeeping_written_row_count` and `database_size_bytes`; and `room_play_duration_hours`, player time in rooms, a fact for tuning that isn't priced.
809
819
 
810
820
  **A second free allowance, once.** The first time a game with real players fills its free hosting, it gets a second allowance free that month, so it doesn't stop before you can react: `second_free_allowance_started` tells you. A game with no real players doesn't get it yet, and doesn't lose it. A game with a budget isn't charged for it. From the next month it has one allowance again.
811
821
 
@@ -814,7 +824,7 @@ Everything a game runs on Zaisma's servers is on one meter per game, shown as a
814
824
  **Past the free hosting.** A game without a budget pauses at 100%. A game with one (`monthly_budget_cents` on `PATCH /games/:slug`, in cents: 5000 is $50) draws from your credit past it, never more than its budget in a month, at these prices:
815
825
 
816
826
  - **Rooms:** $23.04 per 1,000 hours a room is awake (a ticking room all the while it ticks; a turn-based room for 10 seconds after each event, a move or its check on its players every 30 seconds, and asleep in between), $0.03 per million messages players send, $1.80 per million times a player connects, $0.60 per million times a room wakes on its own or is called by another of the game's rooms, and the rows Zaisma writes for it (its listing, saves and seats) at the database's price.
817
- - **Game server calls:** $1.20 per million calls into it: each tick, message, join, request, schedule run, webhook event and start. Ticks are most of them: a room at 10 ticks a second is about $0.043 an hour, at 60 about $0.26, so tick only as fast as the game needs (`ticksPerSec`).
827
+ - **Game server calls:** $1.20 per million calls into it: each message, join, request, schedule run, webhook event and start, and a real-time room's ticks, up to 30 to a call. A room at 10 ticks a second makes about $0.002 an hour of them, at 60 about $0.01, so tick only as fast as the game needs (`ticksPerSec`).
818
828
  - **Game server:** $0.08 per 1,000 CPU-seconds wherever it runs (rooms, requests, schedule runs and webhooks), starting up included, counting only the time your code runs: its waits on the database, other servers (including reading their answers) and its own timers don't count, calls made at the same moment count only their own time, and each call it makes to another server counts 1 ms; $1.20 per million times it's started (a room starting it, a restart after a failure, its requests' object waking); $0.008 for each version loaded on a day (UTC); $18 per million files of its logs. A running room's ticks and messages to it cost only their CPU.
819
829
  - **Relayed data:** $0.20 per GB.
820
830
  - **Database:** $0.60 per million calls, $4 per million rows written, $0.004 per million read, $0.80 per GB-month stored, and $23.04 per 1,000 hours awake.
@@ -964,7 +974,7 @@ How a room and each player's game stay in touch, the same in Zaisma rooms and on
964
974
 
965
975
  - **The SDK pings** the room every 25 seconds (the room answers without waking up), and reconnects by itself when a ping goes unanswered for 15 seconds, or in a real-time room (one with `ticksPerSec`) after 8 seconds without a word from the room, which probes every 2 seconds (not while the player is away or the game is hidden).
966
976
  - **Reconnecting** waits half a second, then doubles each try up to 8 seconds, with no limit, and `room.connectionStatus` is `"reconnecting"` meanwhile. Your game keeps the same room object: the `players` event and your game server's messages carry on once it's back.
967
- - **The room drops** a connection with no ping or message for 75 seconds (a closed laptop, lost signal): Zaisma rooms check every 30 seconds, the Node runner every 5. The SDK says goodbye as the page closes, so most players who leave do so at once.
977
+ - **The room drops** a connection with no ping or message for 75 seconds (a closed laptop, lost signal): Zaisma rooms check when one is due (a connection's 75 seconds, an idle player's time, a held seat), sleeping in between, the Node runner every 5. The SDK says goodbye as the page closes, so most players who leave do so at once.
968
978
  - **`room.connectionStatus` is the socket only:** `"connecting"`, `"open"`, `"reconnecting"` or `"closed"`. Whether the player is in the match is `room.awayReason` (below), so a player who walked away with the socket still open stays `"open"`.
969
979
  - **Sends wait while it's down:** reliable `room.send` and `room.sendBytes` calls made while `connectionStatus` isn't `"open"`, or while the player is away, are kept in order and go once the room lets them back in, before any latest-only sends that waited. Up to 60 wait (the room's burst, so the flush never trips `too_fast`); past that the oldest is dropped and the `error` event says `send_queue_full` once per outage. Both calls return `false` only once the room is gone (ended, kicked or left).
970
980
 
@@ -1167,6 +1177,17 @@ Players sign in to your own site, server or app with their Zaisma account, and y
1167
1177
  - **What you get:** an ID token (RS256, keys at `/.well-known/jwks.json`, more than one so the next is out ahead of signing anything: pick by the token's `kid`, as OpenID Connect libraries do, and never pin one) with `sub` (the player ID, a `player_…` ID, the same as in their player passes and `GET /players/:player_id`), `name` and `preferred_username` (their Zaisma username) with the profile scope, `nonce` when you sent one, and `auth_time`; and an access token for `/oauth/userinfo`, which answers the same `sub`, `name` and `preferred_username`. Both last an hour; there are no refresh tokens, so keep your own session.
1168
1178
  - **Players decide:** the first sign-in to an app asks the player; later ones go straight back. Players see the apps they signed in to on their account page and can remove any, which stops `/oauth/userinfo` for that app at once. `prompt=none` answers `login_required` or `consent_required` instead of showing a page, and `prompt=consent` asks again. Codes work once, for 2 minutes. Deleting an account removes the player's yeses; deleting yours removes your apps.
1169
1179
 
1180
+ ## Link-out listings
1181
+
1182
+ A browser game that plays on another site (itch.io, your own site, another web portal) can be listed on Zaisma as it is: set `link_out_url` on `create_game` or `update_game` (`PATCH /games/:slug`) to the https page it plays on, or fill in Plays on another site on the game's Links in the dashboard. Free, no cut.
1183
+
1184
+ - **Its page and cards:** a full game page like a hosted game's (cover, gallery, favorites, What's on, the same lists and search, ranked by what players do on Zaisma), but it never says Play. Its cards carry a leaving mark and the site in their tag's place, and its page says where it plays and that Zaisma hasn't reviewed it, with Visit <site> instead of Play. Visit opens a stop sheet with the full address and what Zaisma doesn't check there; its Open opens the site in a new tab. It's never embedded. A listed game still needs a gallery picture.
1185
+ - **Browser games only:** store pages (Steam, the app stores, console stores), payment and video pages and downloads are refused with `link_out_not_browser`. A Steam game comes in as a hosted web build instead.
1186
+ - **Who it opens for:** `link_out_who_can_open` answers `everyone` (anyone may open it, guests and under-18 accounts too), `waiting_for_standing` (a site other than itch.io, Newgrounds or Game Jolt waits for your account's standing, `get_access`; until then it's off lists and its page shows players nothing) or `nobody` (its site is flagged). A game for 16 and up opens only for signed-in players that old.
1187
+ - **Checks:** the site is checked against Cloudflare's malware and phishing list when it's set and every day; a flagged site takes the listing down (`link_out_review_reason` `link_flagged`) until it's clean. A report that the site is harmful, or for malware, child safety or illegal content, holds the listing until a person at Zaisma looks.
1188
+ - **Hosting it here:** upload a version and publish it. The listing becomes a game hosted on Zaisma with the same page, link, favorites and pictures, and `link_out_url` goes back to `null`. A game with a live version can't link out (`game_hosted_here`).
1189
+ - **While it's a listing**, settings only a hosted game uses are refused with `hosted_only_setting`: `full_game_item_name`, `demo_game_slug`, a `multiplayer_mode` other than `none`, `own_server_urls` and `account_requirement` `multiplayer`. `null` removes the listing.
1190
+
1170
1191
  ## Registered links
1171
1192
 
1172
1193
  The sites a game opens: its store, Patreon, Ko-fi, Steam page, Bitcoin page or Discord. Games can't open pages themselves (their frame doesn't allow it), so a game opens one of its registered links with `Zaisma.links.open(link_name)`, right after the player taps or presses a key in it, and the game page shows a card over the game's top corner: "You're leaving Zaisma", the game's name, the full address, **Open <site>** and **Stay**. The game keeps running behind it and hears `"opened"` or `"stayed"`. A tick on the card opens that site straight away from then on, in that browser. See `Zaisma.links` in the SDK's reference (`_zaisma/v1.d.ts`).
@@ -1564,7 +1585,7 @@ The same handler can post a crash (`event.kind === "game_server_error_found"`, w
1564
1585
 
1565
1586
  Secret links that open the game for anyone who has them, once its AI review lets the version through or at once for a developer who has earned that (see The AI review), whatever its visibility, so a private or draft game can be played before it's public, and an update before players get it. Testers need no account. Make one per group (your team, playtesters, a streamer) and name it for them, so you can turn one off without the others.
1566
1587
 
1567
- Before a build reaches testers, try its online play on your own computer: `npx @zaisma/cli play-locally` in the game's folder runs it and its game server with a test bench, no key needed (README, "Play it on your own computer").
1588
+ Before a build reaches testers, try its online play on your own computer: `npx @zaisma/cli play-locally` in the game's folder runs it and its game server with a test bench, no key needed, holding the game server to the memory, CPU and modules a copy has on Zaisma's rooms, so one that fails there fails here first, with the same line (README, "Play it on your own computer"). When it starts, it asks npm whether a newer bench is out and, if one is, says so in one line: run it again to use it, or, where your project or computer installed an older one, the `npm install` that moves it up. Offline, or on the latest, it says nothing and never waits.
1568
1589
 
1569
1590
  | Call | What it does |
1570
1591
  | --- | --- |
@@ -33,7 +33,8 @@ Every error the developer API and MCP answer with, as `{ "error": { code, messag
33
33
  - `no_game` (HTTP 404): You have no game with that slug. Fix: Call list_games for your games' slugs, then call again with one of them. https://zaisma.com/developers/errors/no_game
34
34
  - `bad_slug` (HTTP 400): The link name isn't lowercase letters, numbers and single hyphens, or is reserved. Fix: Give a slug of lowercase letters, numbers and single hyphens, like space-race, that isn't one Zaisma keeps. https://zaisma.com/developers/errors/bad_slug
35
35
  - `slug_taken` (HTTP 409): Another game has that link name, or a deleted game had it. Fix: Give create_game another slug, or leave slug out to have one made from the title. https://zaisma.com/developers/errors/slug_taken
36
- - `too_many_games` (HTTP 403): The account has as many games as it can have. Fix: Delete a game you don't need with delete_game, then make the new one. https://zaisma.com/developers/errors/too_many_games
36
+ - `slug_locked` (HTTP 409): new_slug can't change the link: the game isn't a private draft, or was published, or has tester links or kept rooms. Fix: Make a new game for a new link: a link changes only while the game is a private draft never published, with no tester links or kept rooms (can_change_slug). https://zaisma.com/developers/errors/slug_locked
37
+ - `too_many_games` (HTTP 403): The account holds as many games that no players play as it can. Fix: Delete a game you don't need with delete_game, or get players on one: a game with real players frees its slot. https://zaisma.com/developers/errors/too_many_games
37
38
  - `account_banned` (HTTP 403): Zaisma banned the account's developer side, or the whole account: only get_access, list_games and export_game work, and for a whole-account ban nothing does. Fix: Export your games with export_game to keep them, and read the ban's reason in get_access. https://zaisma.com/developers/errors/account_banned
38
39
  - `account_paused` (HTTP 403): A person at Zaisma needs to look at the account: until then it can't make, upload or publish games, or post on the forum. Fix: Wait for a person at Zaisma to look at the account; get_access says why it's paused, and message_zaisma reaches them. https://zaisma.com/developers/errors/account_paused
39
40
  - `publishing_not_open` (HTTP 403): Until the beta, only accounts Zaisma adds can make, upload and publish games. Fix: Call get_access to see can_publish, and ask Zaisma for access with message_zaisma until the beta opens. https://zaisma.com/developers/errors/publishing_not_open
@@ -58,6 +59,10 @@ Every error the developer API and MCP answer with, as `{ "error": { code, messag
58
59
  - `accounts_needed_for_minimum_age` (HTTP 400): A game for 16 or 18 and up needs account_requirement whole_game, since only accounts have an age. Fix: Call update_game with account_requirement whole_game in the same call as a minimum age of 16 or 18. https://zaisma.com/developers/errors/accounts_needed_for_minimum_age
59
60
  - `content_needs_minimum_age` (HTTP 409): A version shows lifelike gore, which plays only in games for 16 and up. Fix: Call update_game with minimum_player_age_years 16 or 18 and account_requirement whole_game, or upload a version without lifelike gore. https://zaisma.com/developers/errors/content_needs_minimum_age
60
61
  - `gallery_picture_needed` (HTTP 409): A listed game needs at least one gallery picture. Fix: Add a gallery picture with add_image, kind screenshot, then list the game again. https://zaisma.com/developers/errors/gallery_picture_needed
62
+ - `bad_link_out_url` (HTTP 400): link_out_url isn't an https address of a site of its own: not a link shortener, an IP address, an address with a user name or a Zaisma address. Fix: Give the https page the game plays on, like "https://kit.itch.io/sky-hopper", or null to remove the listing. https://zaisma.com/developers/errors/bad_link_out_url
63
+ - `link_out_not_browser` (HTTP 400): link_out_url is a store, payment or video page, or a download, not a game that plays in a browser. Fix: Give the page players play the game on in the browser (itch.io, your own site), or upload a web build (upload_files) for a Steam or app store game. https://zaisma.com/developers/errors/link_out_not_browser
64
+ - `game_hosted_here` (HTTP 409): The game has a live version on Zaisma, so it plays here and can't link out. Fix: Leave link_out_url out, since a listing becomes hosted when a version is published and never the other way. https://zaisma.com/developers/errors/game_hosted_here
65
+ - `hosted_only_setting` (HTTP 409): The setting is for games hosted on Zaisma, and this game is a link-out listing (or the listing can't be set while the game has it). Fix: Leave the setting out while the game is a listing, or upload and publish a version to host it here first. https://zaisma.com/developers/errors/hosted_only_setting
61
66
  - `bad_links` (HTTP 400): links isn't a list of up to 20 { link_name, destination_url, is_on_game_page } with names of their own and https addresses that aren't link shorteners, IP addresses, addresses with a user name, or on Zaisma's own domains. Fix: Give links as a list of up to 20 { link_name, destination_url, is_on_game_page }, each with its own name and an https address on a name of its own. https://zaisma.com/developers/errors/bad_links
62
67
  - `bad_own_server_urls` (HTTP 400): own_server_urls isn't a list of up to 5 server addresses like wss://play.example.com, or one is an IP address, this computer or on Zaisma's own domains. Fix: Give own_server_urls as up to 5 addresses like wss://play.example.com, on a name of your own. https://zaisma.com/developers/errors/bad_own_server_urls
63
68
  - `bad_game_server_allowed_hosts` (HTTP 400): game_server_allowed_hosts isn't a list of up to 20 host names (like discord.com or *.example.com), or one is an IP address or on Zaisma's own domains. Fix: Give game_server_allowed_hosts as up to 20 host names like discord.com or *.example.com, with no IP addresses or Zaisma domains. https://zaisma.com/developers/errors/bad_game_server_allowed_hosts
@@ -4,7 +4,7 @@
4
4
 
5
5
  Write a game server once; run it in Zaisma's rooms or on your own Node server. Rooms, players, state sync, chat, the game's database and its requests behave the same in both.
6
6
 
7
- To play your multiplayer game on your own computer before you upload it, run `npx @zaisma/game-server@1 play-locally` in the game's folder (or `npx @zaisma/cli play-locally`, which runs it). It serves the game, runs its game server, and opens a test bench: each player on Zaisma's own game page, guests until they sign in with a name, and a dev bar whose Add a player opens another tab as a new player, with passes signed by a key of its own, so two tabs play together with no account, key or internet. Flags: `[folder]`, `--port 4800`, `--game <slug>`, `--on-network`, `--no-open`, `--json`; Zaisma's README has the whole of it under "Play it on your own computer".
7
+ To play your multiplayer game on your own computer before you upload it, run `npx @zaisma/game-server@1 play-locally` in the game's folder (or `npx @zaisma/cli play-locally`, which runs it). When it starts, it asks npm whether a newer bench is out and, if one is, says so in one line: run it again to use it, or, where your project or computer installed an older one, the `npm install` that moves it up. Offline, or on the latest, it says nothing and never waits. It serves the game, runs its game server, and opens a test bench: each player on Zaisma's own game page, guests until they sign in with a name, and a dev bar whose Add a player opens another tab as a new player, with passes signed by a key of its own, so two tabs play together with no account, key or internet. Flags: `[folder]`, `--port 4800`, `--game <slug>`, `--on-network`, `--no-open`, `--json`; Zaisma's README has the whole of it under "Play it on your own computer".
8
8
 
9
9
  ```ts
10
10
  // server.ts
@@ -122,6 +122,8 @@ export default {
122
122
 
123
123
  **Messages that can be dropped:** `{ delivery: "latest_only" }` on any send, from the game server or the game, marks a message only the newest of matters, like positions every tick or where a player aims: while a player's connection is backed up, a newer one with the same `latestKey` (which it needs, like `"position"`) replaces it, and the newest goes once they catch up. Zaisma's rooms carry them over the WebSocket today, and the same call moves to real datagrams once Cloudflare carries them; on your own server, the fast lane already sends them as datagrams (see [Run your game server yourself](#run-your-game-server-yourself)). `get_stats` says which of your message types would gain from it (`latest_only_available`).
124
124
 
125
+ **Sending less, by default:** a room is billed for each message players send, so the SDK sends less without being asked. What a game sends at once (in one frame of its loop, say) goes as one message of up to 8, and each still reaches `onMessage` on its own, in order; sends also keep under the room's 30 a second by themselves, so a game sending more waits a few milliseconds and goes combined instead of hearing `too_fast`. A `latest_only` send that's the same as the last one with its `latestKey` isn't sent at all, since the room already has it; reliable sends always go. A game that needs every send to go alone and at once turns either off: `Zaisma.joinRoom({ sendCombiningEnabled: false, unchangedSkippingEnabled: false })`. Rooms on your own server combine from game server 1.40. Send input when it changes, not every frame, and use 20 to 30 ticks unless the game truly needs 60; `get_stats` says when players send more than a game needs (`input_frequent`).
126
+
125
127
  Games without server code can use the built-in `relay` (up to 16 players), which passes each message on to everyone else as it was sent (your game's `message` event gets the message, then `fromPlayerId` as its second argument), and bytes the same way. See `examples/arena` (real-time) and `examples/four-in-a-row` (turn-based).
126
128
 
127
129
  #### Your game server on Zaisma
@@ -139,12 +141,12 @@ zaisma-server/
139
141
 
140
142
  - **Plain JavaScript ES modules:** `zaisma-server/index.js` default-exports the game server above, and can import the folder's other files by relative path: `.js` code, `.json` data (`import levels from "./levels.json"`) and `.wasm` WebAssembly, like a physics engine (`import mod from "./physics.wasm"` gives a `WebAssembly.Module`; `new WebAssembly.Instance(mod, imports)` starts it). Packages from npm (`import "lodash"`) and TypeScript need a build step: bundle into one `zaisma-server.js` at the top of the upload instead (`npx esbuild server.ts --format=esm --bundle --outfile=zaisma-server.js`), or into `zaisma-server/index.js` when it has data files. Up to 500 files and 64 MB in all, data files included, of which the code (`.js`, `.json` and `.wasm`) is up to 32 MB (`GAME_SERVER_LIMITS`).
141
143
  - **Data files:** every other file in `zaisma-server/` (`.bin`, `.gz`, `.txt`, anything but `.js`, `.json` and `.wasm`) ships beside the code as a data file, like prebuilt navigation meshes, level geometry or a dictionary. `room.readDataFile("maps/docks.bin")` (or `server.readDataFile` in `onRequest`, `onSchedule` and `onWebhook`) answers it as an `ArrayBuffer`, by its path from `zaisma-server/`: no base64, no download, and nothing on the meter, since it comes with the code. It's the same `ArrayBuffer` every time, shared by every room of the version running in the same place, so read it and never change it; keep what you build from it in a variable outside the handlers (`const meshes = new Map()`) and every room there shares it too. A path with no data file throws a `GameServerError` `bad_room_call`. On your own server, data files are read from the game server's folder (`--data-folder`, or `startServer({ dataFolder })`; `zaisma-server` by default).
142
- - **Time to start:** each call into the game server, a tick with the messages since the last one, a join, a request, has 50 ms of CPU (`GAME_SERVER_LIMITS.maximumCallCpuDurationMs`), as Cloudflare measures it. Cloudflare itself stops a call only at about 2 seconds, which freezes the match that long, so the room keeps the 50 ms: when 20 of a room's calls within a minute go past it, the game server stops and the match ends, as for one that keeps failing, and its logs say so. A start has 5 seconds (`maximumStartCpuDurationMs`): loading the game server, `setup`, `onRestored`, and a real-time room's first tick after any of them, or after the room puts its state back in a fresh copy of the game server (one that started again and lost its memory, or one opened again after a stop), whether or not the game has `onRestored`, so build what the match needs once (a map's navigation, its collision) in that first tick, not spread over many. The game server's top-level code, outside its handlers, has Cloudflare's 1 second as it loads (`maximumLoadCpuDurationMs`), so heavy work goes in that first tick. One copy of the game server, shared by the version's rooms in one place, has 128 MB of memory (`maximumMemorySizeBytes`), its data files included: they load from storage into that memory when the copy starts, so with 64 MB of files about 60 MB is left for the matches. Every second of CPU is on the game's hosting meter, starts included.
144
+ - **Time to start:** each call into the game server, a join, a request, has 50 ms of CPU (`GAME_SERVER_LIMITS.maximumCallCpuDurationMs`), as Cloudflare measures it, and a real-time room's ticks, each with the messages since the last one, go up to 30 to a call that shares 50 ms for each of them (1.5 seconds for 30, under Cloudflare's own stop). Cloudflare itself stops a call only at about 2 seconds, which freezes the match that long, so the room keeps the budget: when 20 of a room's calls within a minute go past theirs, the game server stops and the match ends, as for one that keeps failing, and its logs say so. A start has 5 seconds (`maximumStartCpuDurationMs`): loading the game server, `setup`, `onRestored`, and a real-time room's first tick after any of them, or after the room puts its state back in a fresh copy of the game server (one that started again and lost its memory, or one opened again after a stop), whether or not the game has `onRestored`, so build what the match needs once (a map's navigation, its collision) in that first tick, not spread over many. The game server's top-level code, outside its handlers, has Cloudflare's 1 second as it loads (`maximumLoadCpuDurationMs`), so heavy work goes in that first tick. One copy of the game server, shared by the version's rooms in one place, has 128 MB of memory (`maximumMemorySizeBytes`), its data files included: they load from storage into that memory when the copy starts, so with 64 MB of files about 60 MB is left for the matches. Every second of CPU is on the game's hosting meter, starts included.
143
145
  - **Sealed off:** nothing of Zaisma's but its own game's database and secrets, and other servers only on the hosts you list (below), so it talks to its players through `room` and its answers to their requests. State is plain JSON.
144
146
  - **Private:** players never get its files; the game domain refuses `zaisma-server/` and `zaisma-server.js`.
145
147
  - **Real-time rooms batch input:** in a room with `ticksPerSec`, the state stays inside the sandbox, and players' messages and bytes reach `onMessage` and `onBytes` just before the next `onTick`, in the order they came, with what they send going out then (at most a tick later). A handler that throws leaves the rest of the batch to run, and what it changed in the state before throwing stays, as on your own server, where they run as they come. Either way a room's handlers run one at a time: one that awaits (the database, say) finishes before the room's next message, bytes or tick reaches the game server.
146
148
  - **Kept in check:** an error in a handler loses that one message or tick and the match carries on. A call that runs past its CPU (above; a loop that never ends) is stopped, freezing the match meanwhile, and a match stopped twice ends. Your dashboard and the MCP's `get_stats` show these errors with the file and line they came from.
147
- - **Memory outside the handlers:** a room's state is plain JSON, and it's all Zaisma keeps of a room. What the game server keeps in its own variables, outside the handlers (`const worlds = new Map()`), lives in the copy of the version that runs the room: the version's rooms running in the same place share it, as they share data files, and rooms elsewhere have copies of their own. It's lost whenever that copy starts again, which can happen at any time (a while unused, Zaisma's own updates, a call stopped for running too long), and then the room carries on from its last state, with no `onRestored` (that runs only when the room itself restarts): a turn-based room's state as of its last call, a real-time room's as of its last copy, taken every 5 seconds. So a world that isn't JSON (typed arrays, a collision tree, a physics engine's bodies) goes there, keyed by `room.roomCode`; each handler that finds its room's entry missing rebuilds it from the state, and the room deletes its entry once its match is over, since every room in that copy shares its 128 MB. On your own server and in play-locally, one process runs every room, so they all share it; it's lost when the process starts again (play-locally starts it again on each change to the game server), and every room then comes back through `onRestored`.
149
+ - **Memory outside the handlers:** a room's state is plain JSON, and it's all Zaisma keeps of a room. What the game server keeps in its own variables, outside the handlers (`const worlds = new Map()`), lives in the copy of the version that runs the room: the version's rooms running in the same place share it, as they share data files, and rooms elsewhere have copies of their own. It's lost whenever that copy starts again, which can happen at any time (a while unused, Zaisma's own updates, a call stopped for running too long), and then the room carries on from its last state, with no `onRestored` (that runs only when the room itself restarts): a turn-based room's state as of its last call, a real-time room's as of its last copy, taken every 5 seconds. So a world that isn't JSON (typed arrays, a collision tree, a physics engine's bodies) goes there, keyed by `room.roomCode`; each handler that finds its room's entry missing rebuilds it from the state, and the room deletes its entry once its match is over, since every room in that copy shares its 128 MB. On your own server and in play-locally, one process runs every room, so they all share it; it's lost when the process starts again (play-locally starts it again on each change to the game server, and when it goes over its 128 MB, as Zaisma's rooms do), and every room then comes back through `onRestored`.
148
150
  - **Updates:** rooms keep the version they started with until they end; new rooms get the live version.
149
151
 
150
152
  The same file runs on your own machine too (below), so you can test it there or move off Zaisma any time.
@@ -420,7 +422,7 @@ How a room and each player's game stay in touch, the same in Zaisma rooms and on
420
422
 
421
423
  - **The SDK pings** the room every 25 seconds (the room answers without waking up), and reconnects by itself when a ping goes unanswered for 15 seconds, or in a real-time room (one with `ticksPerSec`) after 8 seconds without a word from the room, which probes every 2 seconds (not while the player is away or the game is hidden).
422
424
  - **Reconnecting** waits half a second, then doubles each try up to 8 seconds, with no limit, and `room.connectionStatus` is `"reconnecting"` meanwhile. Your game keeps the same room object: the `players` event and your game server's messages carry on once it's back.
423
- - **The room drops** a connection with no ping or message for 75 seconds (a closed laptop, lost signal): Zaisma rooms check every 30 seconds, the Node runner every 5. The SDK says goodbye as the page closes, so most players who leave do so at once.
425
+ - **The room drops** a connection with no ping or message for 75 seconds (a closed laptop, lost signal): Zaisma rooms check when one is due (a connection's 75 seconds, an idle player's time, a held seat), sleeping in between, the Node runner every 5. The SDK says goodbye as the page closes, so most players who leave do so at once.
424
426
  - **`room.connectionStatus` is the socket only:** `"connecting"`, `"open"`, `"reconnecting"` or `"closed"`. Whether the player is in the match is `room.awayReason` (below), so a player who walked away with the socket still open stays `"open"`.
425
427
  - **Sends wait while it's down:** reliable `room.send` and `room.sendBytes` calls made while `connectionStatus` isn't `"open"`, or while the player is away, are kept in order and go once the room lets them back in, before any latest-only sends that waited. Up to 60 wait (the room's burst, so the flush never trips `too_fast`); past that the oldest is dropped and the `error` event says `send_queue_full` once per outage. Both calls return `false` only once the room is gone (ended, kicked or left).
426
428
 
@@ -30,6 +30,7 @@ A card game, a board game or a word game needs only the first four: the server c
30
30
  A shooter is the measure: if a shooter feels fair on a 150 ms connection with a little loss, every other real-time game will too.
31
31
 
32
32
  - **Tick rate.** `ticksPerSec` on the game server runs `onTick(state, tickDurationSec, room)` that many times a second. 20 to 30 suits most action games; 60 only when the game truly needs it, since every tick is CPU on the game's hosting meter. Players' input reaches `onMessage` just before the next tick, in order.
33
+ - **Sending.** Send input when it changes, not every frame, and positions and aim with `{ delivery: "latest_only", latestKey }`. The SDK combines what the game sends at once into one message, keeps sends under the room's 30 a second by combining instead of failing, and skips a latest-only send that didn't change; leave both on unless the game server needs every send alone (`joinRoom({ sendCombiningEnabled: false, unchangedSkippingEnabled: false })`). Each message a room gets is billed.
33
34
  - **Interpolation.** Draw other players from `room.smoothedState()` (or `room.smoothedState({ delayMs: 150 })`), the state a moment behind, blended between updates, so they move evenly however packets arrive. Blend angles that wrap around yourself.
34
35
  - **Prediction.** Move the player's own character at once on their input, from the game's own copy of the rules, then correct it gently toward what the server says when its update arrives. Without prediction, every move waits a round trip and the game feels heavy. The SDK leaves prediction to the game.
35
36
  - **Lag compensation.** For hits, the game server checks a shot against where targets were when the shooter saw them: keep a short history of positions (a few hundred milliseconds), and rewind by the shooter's `room.pingDurationMs(playerId)`. Cap the rewind (about 200 ms), since a slower connection should never be an advantage.
@@ -233,7 +233,7 @@ One name per concept. The API and MCP column is snake_case; the SDK and game ser
233
233
 
234
234
  | Concept | API and MCP | SDK and game server |
235
235
  | --- | --- | --- |
236
- | A game's link name, as in zaisma.com/g/<slug> | `slug` | `slug` |
236
+ | A game's link name, as in zaisma.com/g/<slug> | `slug`; `new_slug` changes a private draft's (`can_change_slug`, else `slug_locked`) | `slug` |
237
237
  | A game's genres: up to 3 from one fixed list, which players filter Browse by | `genres` (a list of `action`, `adventure`, `role_playing`, `shooter`, `strategy`, `simulation`, `racing`, `sports`, `fighting`, `platformer`, `puzzle`, `horror`, `survival`, `sandbox`, `card_and_board`, `party`, `rhythm`, `visual_novel`); refused with `bad_genres`. Inside: `games.genres` (comma-separated), `GENRES`, `GENRE_LABELS`, `MAXIMUM_GENRE_COUNT` | |
238
238
  | A version of a game | `version_id` | |
239
239
  | An error code's page, with what it means and the general fix | `help_url` | |
@@ -326,14 +326,14 @@ One name per concept. The API and MCP column is snake_case; the SDK and game ser
326
326
  | A player's saved card and the purchase PIN that confirms it's them (the player side of the buy sheet; the sheet's own `/api/buy`, `/api/payment-methods` and `/api/account/purchase-pin` calls) | `saved_card` `{ card_brand, card_last_digits }` (`card_brand` Stripe's lowercase brand, like `visa`; `card_last_digits` the card's last four digits as text, never a number, so `0042` keeps its zeros), `purchase_pin` as the input (exactly 6 digits, as text, so `048213` keeps its zero) and only ever stored hashed as `purchase_pin_hash`, `has_purchase_pin`, `purchase_pin_failed_count`; how a buy confirms it's the player: `confirmation_method` one of `passkey`, `purchase_pin`, `password`, in the body as `passkey_tap`, `purchase_pin` or `password`, and a device's confirm kept in `purchase_confirmations` (15 minutes; a purchase PIN account's covers one buy, and so does one with no `buying_public_key_base64`); a browser's buying key, an ECDSA P-256 pair it keeps: `buying_public_key_base64` (the raw public half, sent to the sheet's start, confirm and pay calls, and kept by a confirm in `buying_keys`) and `buying_signature_base64` (its signature over the purchase, sent to the pay call), error `bad_buying_key`; on the sheet `is_confirmation_needed`, `confirmation_reason` (why: `purchase_pin`, `new_device` (no kept buying key signs this buy), `old_sign_in`, `big_spend`, or `null` when pressing Buy is enough; `is_confirmation_needed` is `confirmation_reason !== null`), `confirmation_methods` `{ has_passkey, has_purchase_pin, has_password, is_purchase_pin_locked }`, `is_eu_withdrawal_line_shown`, `refund_policy_words`, `has_account_email` (a saved card's receipts go to the account's email); player-side error codes `account_needed` (a guest), `account_protection_needed` (saving a card or setting a PIN needs a passkey or an email on the account), `already_owned` (a permanent item the player has), `purchase_confirmation_needed` (confirm it's you, then buy again), `purchase_pin_locked` (5 wrong PINs: a password confirm unlocks it), `wrong_purchase_pin`, `wrong_passkey`, `no_purchase_pin`, `bad_purchase_pin`, `card_not_saved`, `payment_declined` | `PURCHASE_PIN_LIMITS` `{ pinDigitCount, maximumFailedTryCount, confirmationDurationMin, signInMaximumAgeDays, dailySpendLimitUsdMinorUnits }`, `APPROXIMATE_USD_PER_CURRENCY_UNIT`, `approximateUsdMinorUnits`, `hashPurchasePin`, `isPurchasePin`, `purchasePinProblem`, `PURCHASE_LIMIT` (the 20-a-minute rate limit binding) (Zaisma's own code) |
327
327
  | How much of a sale to refund, and what is left | `amount_minor_units` in `refund_purchase` (left out: all that's left; a full refund takes the item back, a partial one leaves it), `refunded_minor_units` on the purchase; errors `bad_amount_minor_units`, `purchase_not_paid`, `already_refunded` | |
328
328
  | Bytes a game and its room send each other, and whose they are | | `room.sendBytes(bytes)` and the `"bytes"` event `(bytes, fromPlayerId)` in the SDK, error `code` `bad_bytes`; `onBytes(state, player, room, bytes)`, `room.broadcastBytes(bytes, { exceptPlayerId, fromPlayerId })`, `room.sendBytes(playerId, bytes)` on the game server |
329
- | A game's room traffic: messages and bytes each way per player a second, its message types, and what to change | `inbound_messages_per_player_sec`, `inbound_size_bytes_per_player_sec`, `outbound_messages_per_player_sec`, `outbound_size_bytes_per_player_sec`; `room_traffic` with `message_types` (`message_type`, `direction`: `inbound`, `outbound`, `average_size_bytes`, `largest_size_bytes`) and `traffic_hints` (`code`: `json_messages_large`, `outbound_heavy`, `message_near_limit`, `latest_only_available`); `message_type` `(state)` for state sync's updates. Inside: `room_message_types.backed_up_message_count` | `STATE_MESSAGE_TYPE`, `backedUpMessageCount` (Zaisma's own code) |
329
+ | A game's room traffic: messages and bytes each way per player a second, its message types, and what to change | `inbound_messages_per_player_sec`, `inbound_size_bytes_per_player_sec`, `outbound_messages_per_player_sec`, `outbound_size_bytes_per_player_sec`; `room_traffic` with `message_types` (`message_type`, `direction`: `inbound`, `outbound`, `average_size_bytes`, `largest_size_bytes`) and `traffic_hints` (`code`: `json_messages_large`, `outbound_heavy`, `message_near_limit`, `latest_only_available`, `input_frequent`); `message_type` `(state)` for state sync's updates. Inside: `room_message_types.backed_up_message_count` | `STATE_MESSAGE_TYPE`, `backedUpMessageCount` (Zaisma's own code) |
330
330
  | How many days a report or stats answer covers | `period_duration_days` | |
331
331
  | What the game check finds before an upload | `problems`, each `{ code, problem_kind, is_fixed_by_upload_command, message, path, quote, fix }`, `problem_kind` `refused` or `broken`; `omitted_problem_count` | |
332
332
  | A version's scan result, and what it found that holds or rejects it | `scan_status`: `scanning`, `held`, `approved`, `rejected`; `findings`, each `{ code, severity, message, content_rule, path, fix }` | |
333
333
  | Where a version stands with the AI review, and how long reviews usually take | `ai_review_status` (`not_started`, `waiting`, `reviewing`, `passed`, `stopped`, `skipped`), `ai_review_speed` (`at_once`, `batch`), `ai_review_requested_at`, `ai_review_finished_at`, `ai_review_waiting_reason`, `usual_ai_review_duration_min`, `ai_review_step` (`waiting_for_daily_review`, `in_line`, `reading_files`, `judging`), `ai_review_step_started_at`, `ai_review_waiting_ahead_count`, `daily_review_free_at`, `is_ai_review_needed_to_publish`, `is_open_before_ai_review`, `publish_after_ai_review_enabled`, `visibility_after_ai_review`, `publish_before_ai_review_enabled`. Inside: `ai_review_queued_at_ms`, `review_batches` (`anthropic_batch_id`, `request_count`, `review_step`: `reading`, `judging`, `ended_at_ms`, `collected_at_ms`), `read_files` (`file_sha256`, `reader_prompt_sha256`, `evidence_items`, `read_at_ms`) | `start_ai_review`, `AI_REVIEW_LIMITS`, `AiReviewStep`, `AiReviewProgress`, `aiReviewProgress`, `bad_publish_after_ai_review_enabled` |
334
334
  | How a version started in headless Chrome, and what would make it much smaller (notes, never holds) | `performance_check`: `{ check_status, checked_at, browser_description, loading_duration_sec, start_download_size_bytes, start_file_count, start_memory_size_bytes, longest_start_task_duration_ms, notes }`, `check_status` `waiting`, `checking`, `checked`, `over_daily_limit`, `could_not_run`; a performance note `{ code, message, path, saved_size_bytes, fix }`; the game check's `performance_notes`. Inside: `performance_checks.start_files`, each `{ path, destination, is_cors_request, downloaded_size_bytes }` | `PERFORMANCE_CHECK_LIMITS` |
335
335
  | How a game runs on players' devices, as totals (never per player), and the switch for it | `performance` in `get_stats`: `version_totals` and `device_totals`, each row `{ version_id, play_count, median_loading_duration_sec, slow_tenth_loading_duration_sec, median_frames_per_sec, low_tenth_frames_per_sec, long_frames_per_min, crashed_play_pct, error_stop_count, context_lost_count, stopped_responding_count, median_peak_memory_size_bytes, is_measured }`, a device row also `browser_name` (`chrome`, `edge`, `firefox`, `safari`, `samsung_internet`, `other`), `os_name` (`windows`, `macos`, `linux`, `chromeos`, `android`, `ios`, `other`), `device_kind` (`computer`, `phone`, `tablet`; `other` only in the folded row) and `graphics_family` (`nvidia`, `amd`, `intel`, `apple`, `qualcomm`, `arm`, `imagination`, `other`, `unknown`); the game's `performance_measuring_enabled`, error `bad_performance_measuring_enabled`. Inside: `performance_days` (`loading_counts`, `frame_rate_seconds`, `memory_counts`: JSON arrays of counts by bucket), `play_tickets.has_performance_loading`, `has_performance_crash`, `measured_duration_sec`; page messages `zaisma:performance`, `zaisma:alive` | `LOADING_BUCKETS_SEC`, `FRAME_RATE_BUCKETS`, `MEMORY_BUCKETS_BYTES`, `BROWSER_NAMES`, `OS_NAMES`, `DEVICE_KINDS`, `GRAPHICS_FAMILIES`, `CRASH_KINDS`, `PLAYER_PERFORMANCE_LIMITS`, `browserOf`, `osOf`, `percentileOf`, `frameRateAt` |
336
- | The AI review's two daily limits, and a version that steps aside for a newer one | a large review (read and judged: `daily_large_reviews_used`) and a small review (read alone: `daily_small_reviews_used`), never "judged review"; `replaced_by_version_id` (`version_replaced`). Inside: `read_at_ms` (when a version's small review ran), `is_small_review` in a scan report, and in the admin MCP `changes_since` with `added_paths`, `changed_paths`, `removed_paths` and their `*_path_count` | `PLAN_LIMITS.free.maximumLargeReviewsPerDay`, `maximumSmallReviewsPerDay` |
336
+ | The AI review's daily limits, and a version that steps aside for a newer one | a large review (read and judged: `daily_large_reviews_used`) and a small review (read alone: `daily_small_reviews_used`), never "judged review"; a game paused for money waits for its hosting to start again (`hosting_paused_for_money`); past Zaisma's monthly budget a version waits (`review_budget_used`); a small fix is one with 1 MB or less of new code to read (`ai_review_read_size_bytes`, reviewed `at_once`); reviews on the hosting meter (`ai_reviews`; `ai_review_cost_cents` in `room_usage`, `game_paid_review_cost_cents` in `ai_usage`); `replaced_by_version_id` (`version_replaced`). Inside: `read_at_ms` (when a version's small review ran), `is_small_review` in a scan report, and in the admin MCP `changes_since` with `added_paths`, `changed_paths`, `removed_paths` and their `*_path_count` | `PLAN_LIMITS.free.maximumLargeReviewsPerDay`, `maximumSmallReviewsPerDay`, `maximumAtOnceReadSizeBytes`, `HOSTING_PRICES.aiReviewCentsPerCostCent`, `pathWithoutContentHash` |
337
337
  | A sample game in the review test set, and what a run found | `is_honest`, `content_rule`, `protection`, `why` (in `case.json`); `outcome`: `held_bad`, `missed_bad`, `passed_honest`, `held_honest`, `inconsistent` (Zaisma's own code) | |
338
338
  | Zaisma's review of a game | `review_status`: `pending`, `live`, `held`, `removed` | |
339
339
  | Why Zaisma held, rejected or took down a game, version or image | `review_reason`: `{ code, message, content_rule, fix }`, its `code` from `REVIEW_CODES` | |
@@ -384,6 +384,8 @@ One name per concept. The API and MCP column is snake_case; the SDK and game ser
384
384
  | The fast lane to a game's own server (WebTransport), and what a room's connection uses | | `transport`: `websocket`, `webtransport` (`Zaisma.joinRoom`'s option, refused with `bad_transport`, and `room.transport`; `TRANSPORTS` in the SDK); `FAST_LANE_CONNECT_TIMEOUT_MS` (3000); `FastLane` (the SDK's adapter); `delivery` reaches the room's `send` and `sendBytes` (`Transport`) |
385
385
  | Sending each player the game server's state, then only what changed, and what each player sees of it | | `stateSyncEnabled`; `stateView(state, viewer, room)`; the room's `{ type: "state", serverTimeMs, full }` and `{ type: "state", serverTimeMs, changes }`; a `StateChange` `[path, value]` or `[path]`; `room.state`, the `"state"` event `(state, changes)` and `room.smoothedState({ delayMs })` (`SmoothingOptions`) in the SDK, error `code` `bad_delay`; `ROOM_LIMITS.maximumStateViewSizeBytes`; in Zaisma's own code `diffState`, `applyStateChanges`, `newStateTracker` |
386
386
  | A send that may be dropped for a newer one while a player's connection is backed up | | `delivery`: `reliable`, `latest_only`; `latestKey` (needed with `latest_only`); `SendOptions` in the SDK and on the game server, error `code` `bad_send_option`; a player's connection is backed up (`isBackedUp`, `ROOM_TUNING.backedUpSizeBytes`, `backedUpDelayMs`); `ROOM_LIMITS.maximumLatestOnlySlotCount`, `maximumLatestKeyCharacterCount` |
387
+ | What a game sends at once, going to the room as one message, and sends kept under the room's limit by waiting | | `sendCombiningEnabled` (joinRoom, on by default); the client message `{ type: "messages", data }` and welcome's `canCombineMessages`; `ROOM_LIMITS.maximumCombinedMessageCount`, `maximumCombinedGameMessagesPerSec`, `maximumCombinedGameMessageBurstCount` |
388
+ | A latest-only send the same as the last one with its latestKey, not sent | | `unchangedSkippingEnabled` (joinRoom, on by default) |
387
389
  | A message between a game and its room, the game's own message in it, and the player it came from | | `type`, `data`, `fromPlayerId` (a send option on the game server, `null` for the game server's own); the `"message"` event `(message, fromPlayerId)`; `ClientMessage`, `ServerMessage` |
388
390
  | Which room messages a game and its room speak | | `protocolVersionNumber` (a hello's and a welcome's), `PROTOCOL_VERSION_NUMBER` (1) |
389
391
  | A quick join's hello asking for a room without anyone the player blocked (an action, so a verb) | | `avoidBlockedPlayers` |
@@ -425,6 +427,7 @@ One name per concept. The API and MCP column is snake_case; the SDK and game ser
425
427
  | A game played off its Zaisma page (exported, on another site, in a store), and its players on the developer's own server | | `Zaisma.setUpOffZaisma({ gameSlug, playerToken })` answers `{ isOffZaisma }` (refused with `bad_game_slug`, `bad_player_token`); `playerToken`, a player's proof from somewhere other than Zaisma (a Sign in with Zaisma ID token or the game's own token, up to 8 KB; `null` for a guest), sent in a hello or request in place of `pass` (`REQUEST_LIMITS.maximumPlayerTokenSizeBytes`); the player's `kind` `outside_zaisma`; `startServer`'s `identifyPlayer(playerToken, { origin })` answering `{ id, name }` or null (`IdentifyPlayer`, `OutsidePlayer`) and `outsideGuestsEnabled`; `signInWithZaismaPlayers({ signInAppIds, siteUrl, loadKeys, loadProfile })` and `guestPlayer()`; refused with `bad_player_token`; `checkChat`'s `null` passes. Inside: `OUTSIDE_PLAYER_LIMITS`, `OUTSIDE_ZAISMA_CHAT_SETTINGS`, `checkedOutsidePlayer`, `isPlayerToken`, `ChatMessage.hasOutsideReceiver` |
426
428
  | A game's own servers that players' browsers connect to, named in the game's menu | `own_server_urls` (each `wss://` or `https://` and a host, like `wss://play.example.com`) | `serverUrl` in `Zaisma.joinRoom` and `Zaisma.friends.setRoom` |
427
429
  | The hosts a game's own game server can call (game server reach), and how a call it can't make fails | `game_server_allowed_hosts` (host names, or `*.example.com` for the names under one) | plain `fetch()`; a refused call throws an `OutsideCallError` with a `code` (`OutsideCallErrorCode`: `not_https`, `unreachable_host`, `host_not_allowed`, `outside_call_limit`, `too_big`, `outside_call_timeout`, `outside_call_failed`) and a `fix` (`OUTSIDE_CALL_LIMITS`: `maximumBodySizeBytes`, `timeoutSec`, `maximumCallsPerMin`) |
430
+ | A game listed from another site: where it plays, its check, who it opens for, and the report that its site is harmful | `link_out_url`, `link_out_who_can_open` (`everyone`, `waiting_for_standing`, `nobody`), `link_out_review_reason`; errors `bad_link_out_url`, `link_out_not_browser`, `game_hosted_here`, `hosted_only_setting`; the report reason `harmful_site`. Zaisma's own code: `games.link_out_checked_at_ms`, `LINK_OUT_TRUSTED_DOMAINS`, `checkLinkOutUrl`, `linkOutAudience`, `isOpenListing`, `HAS_SOMETHING_TO_PLAY_SQL` | |
428
431
  | A game's registered links: the name the game opens one by, its address, whether its game page shows it, and who it opens for | `links`, each `{ link_name, destination_url, is_on_game_page, who_can_open, review_reason }`; `who_can_open`: `everyone`, `signed_in_adults`, `waiting_for_standing`, `nobody` | `Zaisma.links.open(linkName, { path, queryParameters, ownSiteUrl })` answers a `LinkStatus`: `opened`, `stayed`; errors `unknown_link`, `bad_link_path`, `bad_link_query`, `bad_own_site_url`, `needs_player_tap` |
429
432
  | A game's secrets: a name like an environment variable's, its text, and when it was set | `secret_name`, `secret_value` in; a secret is `{ name, set_at }` out, never its value; `deleted_secret_name` | `server.secrets` and `room.secrets` (by name, read-only); on your own server, the environment variables |
430
433
  | A game server's data files: any file in `zaisma-server/` that isn't code, read whole, and what a game server can be and use | | `room.readDataFile(path)` and `server.readDataFile(path)` (the path from `zaisma-server/`, an `ArrayBuffer` back); `dataFolder` (`startServer`) and `--data-folder` on your own server; `GAME_SERVER_LIMITS` `{ maximumSizeBytes, maximumFileCount, maximumCallCpuDurationMs, maximumStartCpuDurationMs, maximumLoadCpuDurationMs, maximumMemorySizeBytes }`; `SERVER_CODE_FILE` (Zaisma's own code) |
@@ -1129,7 +1129,21 @@ interface JoinOptions {
1129
1129
  * @example
1130
1130
  * const room = await Zaisma.joinRoom({ isSpectator: Zaisma.rooms.isLinkedAsSpectator });
1131
1131
  */
1132
- isSpectator?: boolean;
1132
+ isSpectator?: boolean; /**
1133
+ * true (the default): what the game sends at once (in one frame of its loop, say) goes to the room as one
1134
+ * message of up to 8, and sends keep under the room's 30 a second by themselves: past that, they wait a few
1135
+ * milliseconds and go together instead of coming back "too_fast". Each still reaches the game server's
1136
+ * onMessage on its own, in order. A room is billed for each message it gets, so this costs the game less.
1137
+ * Rooms on your own server combine only when their game server says it can (game server 1.40 and later).
1138
+ * false: every send goes alone and at once, as it's made.
1139
+ */
1140
+ sendCombiningEnabled?: boolean;
1141
+ /**
1142
+ * true (the default): a { delivery: "latest_only" } send that's the same as the last one with its latestKey
1143
+ * isn't sent, since the room already has it; the first after a reconnect always goes. Reliable sends always go.
1144
+ * false: send every one, as when the game server expects a steady stream.
1145
+ */
1146
+ unchangedSkippingEnabled?: boolean;
1133
1147
  }
1134
1148
  ```
1135
1149
 
@@ -1436,7 +1450,9 @@ interface Room {
1436
1450
  * 30 a second at most. Send input when it changes, not every frame. While connectionStatus isn't "open"
1437
1451
  * or the player is away, reliable sends wait and go in order once the room is back, up to 60: past that
1438
1452
  * the oldest is dropped, and an "error" event says "send_queue_full" once. With
1439
- * { delivery: "latest_only", latestKey }, a message may be dropped for a newer one (SendOptions). A
1453
+ * { delivery: "latest_only", latestKey }, a message may be dropped for a newer one (SendOptions), and one
1454
+ * the same as the last with its latestKey isn't sent (JoinOptions.unchangedSkippingEnabled). What the game
1455
+ * sends at once goes as one message (JoinOptions.sendCombiningEnabled). A
1440
1456
  * spectator can't send: it throws error.code "spectator_cannot_send". Returns false only when the room
1441
1457
  * is gone (ended, kicked or left), so nothing will ever send.
1442
1458
  *
package/zaisma.mjs CHANGED
@@ -3,7 +3,7 @@
3
3
  // Docs: https://github.com/zaisma/zaisma-sdk/blob/main/docs/DEVELOPER-API.md#the-upload-command
4
4
 
5
5
  import { createHash } from "node:crypto";
6
- import { createReadStream, createWriteStream, readFileSync } from "node:fs";
6
+ import { createReadStream, createWriteStream, readFileSync, realpathSync } from "node:fs";
7
7
  import { mkdir, mkdtemp, open, readdir, readFile, rename, rm, stat, writeFile } from "node:fs/promises";
8
8
  import { homedir, tmpdir } from "node:os";
9
9
  import { dirname, extname, join, posix, relative, resolve, sep } from "node:path";
@@ -19,6 +19,53 @@ const API = (process.env.ZAISMA_API || "https://zaisma.com").replace(/\/+$/, "")
19
19
  const KEY = process.env.ZAISMA_KEY || "";
20
20
  /** This command's version, sent as its user agent so a game's history can say "the upload command 0.10.0". */
21
21
  const CLI_VERSION = JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8")).version;
22
+
23
+ /** How this copy was installed, from where its file sits: through npx, in a project, globally, or a source checkout (which checks nothing). */
24
+ function cliInstallKind() {
25
+ let path = fileURLToPath(import.meta.url);
26
+ try {
27
+ path = realpathSync(path);
28
+ } catch {}
29
+ path = path.replaceAll("\\", "/");
30
+ if (path.includes("/_npx/")) return "npx";
31
+ // A project has its package.json beside its outermost node_modules; npm's global folder (lib/ under its prefix) has none.
32
+ const index = path.indexOf("/node_modules/");
33
+ if (index === -1) return "checkout";
34
+ try {
35
+ readFileSync(`${path.slice(0, index)}/package.json`);
36
+ return "project";
37
+ } catch {
38
+ return "global";
39
+ }
40
+ }
41
+
42
+ /** How long a command waits for npm to say whether a newer CLI is out. */
43
+ const UPDATE_CHECK_TIMEOUT_MS = 3000;
44
+ /** How long upload waits for that answer once it's done. */
45
+ const UPDATE_CHECK_GRACE_MS = 300;
46
+
47
+ /**
48
+ * One line when npm has a newer CLI than this one, or null: this is the latest, npm didn't answer before signal stopped it, or
49
+ * this is a source checkout. What to do follows from how it was installed.
50
+ */
51
+ async function newerCliLine(installKind, signal) {
52
+ if (installKind === "checkout") return null;
53
+ const registryUrl = (process.env.npm_config_registry || "https://registry.npmjs.org").replace(/\/+$/, "");
54
+ let latestVersion;
55
+ try {
56
+ const response = await fetch(`${registryUrl}/@zaisma%2fcli/latest`, { signal });
57
+ latestVersion = response.ok ? (await response.json()).version : null;
58
+ } catch {
59
+ return null;
60
+ }
61
+ const numbers = (version) => /^(\d+)\.(\d+)\.(\d+)$/.exec(version ?? "")?.slice(1).map(Number);
62
+ const [latest, own] = [numbers(latestVersion), numbers(CLI_VERSION)];
63
+ const index = latest && own ? latest.findIndex((partNumber, i) => partNumber !== own[i]) : -1;
64
+ if (index === -1 || latest[index] < own[index]) return null;
65
+ if (installKind === "project") return `@zaisma/cli ${latestVersion} is out, and this project has ${CLI_VERSION}: run npm install @zaisma/cli@latest to move up.`;
66
+ if (installKind === "global") return `@zaisma/cli ${latestVersion} is out, and this computer has ${CLI_VERSION}: run npm install -g @zaisma/cli@latest to move up.`;
67
+ return `@zaisma/cli ${latestVersion} is out (this is ${CLI_VERSION}): npx @zaisma/cli runs it from the next command on.`;
68
+ }
22
69
  /** Files bigger than this go in parts; the server says how big each part is. */
23
70
  const DIRECT_BYTES = 95 * 1024 * 1024;
24
71
  // .zaisma-local held what play-locally keeps (its keys, saves and database) before it moved out of the game's folder: never sent.
@@ -2209,7 +2256,24 @@ async function run({ command, values, flags, globalFlags, rest }) {
2209
2256
  if (command === "check") return checkFolder(values, flags);
2210
2257
  if (command === "play-locally") return playLocally(values, flags);
2211
2258
  if (command === "export") return exportGame(values, flags);
2212
- if (command === "upload") return upload(values, flags);
2259
+ if (command === "upload") {
2260
+ // A newer CLI on npm: one line on stderr once the upload is done, never under --json.
2261
+ // A registry that hangs gets UPDATE_CHECK_GRACE_MS after the upload, never the whole timeout.
2262
+ const stopCheck = new AbortController();
2263
+ const timeoutTimer = setTimeout(() => stopCheck.abort(), UPDATE_CHECK_TIMEOUT_MS);
2264
+ const newerLine = isJson ? null : newerCliLine(cliInstallKind(), stopCheck.signal);
2265
+ const uploadExit = await upload(values, flags).catch((error) => {
2266
+ clearTimeout(timeoutTimer);
2267
+ stopCheck.abort();
2268
+ throw error;
2269
+ });
2270
+ const graceTimer = setTimeout(() => stopCheck.abort(), UPDATE_CHECK_GRACE_MS);
2271
+ const line = await newerLine;
2272
+ clearTimeout(graceTimer);
2273
+ clearTimeout(timeoutTimer);
2274
+ if (line) console.error(line);
2275
+ return uploadExit;
2276
+ }
2213
2277
  if (command === "shader") return sendShader(values, flags);
2214
2278
  if (command === "versions") {
2215
2279
  const answer = await api("GET", `/games/${values.slug}`);
@@ -2384,7 +2448,8 @@ async function playLocally(values, flags) {
2384
2448
  const [file, list] = local ? [process.execPath, [local, "play-locally", ...given]] : npxScript ? [process.execPath, [npxScript, ...npxArguments]] : ["npx", npxArguments];
2385
2449
  let child;
2386
2450
  try {
2387
- child = spawn(file, list, { stdio: "inherit" });
2451
+ // The game server's play-locally checks npm for a newer CLI too, and says so with its own (ZAISMA_CLI_VERSION, ZAISMA_CLI_INSTALL_KIND).
2452
+ child = spawn(file, list, { stdio: "inherit", env: { ...process.env, ZAISMA_CLI_VERSION: CLI_VERSION, ZAISMA_CLI_INSTALL_KIND: cliInstallKind() } });
2388
2453
  } catch {
2389
2454
  refuse("game_server_not_run", { message: "npx couldn't run @zaisma/game-server.", fix: "Check that Node 22.18 or newer and npm are installed, and that npm can reach its registry once to download the package." }, EXIT_CODES.failed);
2390
2455
  }