@zaisma/cli 0.67.0 → 0.69.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/check.mjs CHANGED
@@ -47,7 +47,7 @@ export const CHECK_PROBLEM_CODES = {
47
47
  file_download: { problemKind: "broken", isFixedByUploadCommand: false, meaning: "A file download, which the game's frame doesn't allow." },
48
48
  outside_link: { problemKind: "broken", isFixedByUploadCommand: false, meaning: "A link that opens another site or a new window, which the game's frame doesn't allow." },
49
49
  outside_frame: { problemKind: "broken", isFixedByUploadCommand: false, meaning: "A frame of another site, which games can't show." },
50
- blocked_feature: { problemKind: "broken", isFixedByUploadCommand: false, meaning: "Camera, microphone, screen capture, location, payments, USB, serial, Bluetooth or HID, which games on Zaisma can't use." },
50
+ blocked_feature: { problemKind: "broken", isFixedByUploadCommand: false, meaning: "Camera, screen capture, location, payments, USB, serial, Bluetooth or HID, which games on Zaisma can't use." },
51
51
  // Zaisma's fixed checks (fixed-checks.mjs): the scan refuses a version with any of these, the same answer every time.
52
52
  crypto_miner: { problemKind: "refused", isFixedByUploadCommand: false, meaning: "The code mines cryptocurrency." },
53
53
  disguised_code: { problemKind: "refused", isFixedByUploadCommand: false, meaning: "The code runs text it decodes (base64, character codes or bytes) as code, which hides what it runs." },
@@ -293,7 +293,8 @@ function findAddresses(text) {
293
293
  }
294
294
 
295
295
  const FEATURES = [
296
- { pattern: /\bgetUserMedia\b/, name: "the camera or microphone (getUserMedia)" },
296
+ // The microphone is the game's to ask for (voice chat, a game played by voice: Julius, Nov 26, 2026); the camera isn't.
297
+ { pattern: /\bgetUserMedia\s*\(\s*\{[^}]*\bvideo\s*:\s*(?!false\b)/, name: "the camera (getUserMedia with video)" },
297
298
  { pattern: /\bgetDisplayMedia\b/, name: "screen capture (getDisplayMedia)" },
298
299
  { pattern: /\bnavigator\.geolocation\b/, name: "location (navigator.geolocation)" },
299
300
  { pattern: /\bnew\s+PaymentRequest\b/, name: "payments (PaymentRequest)" },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zaisma/cli",
3
- "version": "0.67.0",
3
+ "version": "0.69.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",
@@ -16,7 +16,7 @@ claude mcp add --transport http zaisma https://zaisma.com/mcp --header "Authoriz
16
16
 
17
17
  Apps that can't send a key connect by signing in instead. In claude.ai: Settings → Connectors → Add custom connector, with `https://zaisma.com/mcp`; ChatGPT and other apps the same way, wherever they add a remote MCP server. The app opens a Zaisma page where you choose what it may do and tap your passkey, then you're back in the app with every tool working. The key command above stays the way for Claude Code and the upload command.
18
18
 
19
- Every tool is a call to this API (`apps/site/src/mcp.ts`): `list_games`, `create_game`, `get_game`, `get_playing_now`, `get_whats_on`, `update_game`, `check_game` (what Zaisma would refuse in a game and what won't work on Zaisma, before uploading; see Checking a game below), `upload_files` (small games up to 5 MB, sent as file contents), `get_version`, `update_version` (a version's notes before it's live), `publish_version` (also rolls back and publishes later), `cancel_scheduled_publish`, `end_preview_links`, `add_image`, `remove_image`, `add_shader`, `check_shader` (a shader drawn as the check would, before it's sent; see Backgrounds below), `remove_shader`, `set_background`, `preview_game_page` (pictures of every place players meet the game, from what you're still designing; see Seeing it as players do below), `add_tester_link`, `update_tester_link`, `remove_tester_link`, `get_reports`, `get_stats`, `get_history`, `get_qr_code` (the game's link, or a room's, as a QR code), `export_game` (everything about a game as one .zip; see Export everything below), `get_logs` (what the game server printed, see A game server's logs below), `get_player`, `get_access` (what the key can do), `get_activity` (your account's activity, needs a full key), the inbox's `list_inbox`, `update_inbox_notice`, `delete_inbox_notice` and `set_inbox_settings`, a game's `announce_event` and `reply_to_bug_report` (see The inbox below), `list_api_keys` (your keys and connected apps with their end dates, last use and whether Zaisma turned one off; needs a full key), the sign-in apps' `list_sign_in_apps`, `create_sign_in_app`, `update_sign_in_app` and `delete_sign_in_app`, hosting credit's `get_credit`, `top_up_credit`, `refund_top_up`, `start_credit_plan`, `change_credit_plan`, `stop_credit_plan` and `get_spending_request` (see Hosting and credit below), Zaisma Pro's `get_pro`, `start_pro`, `cancel_pro`, `resume_pro` and `refund_pro` (see Zaisma Pro below), `get_storage`, `set_storage_budget`, `delete_version` and `delete_game`, `bring_back_game`, `erase_game_now`, `get_game_deletion_request` (see Storage below), the Stripe account's `get_stripe_account`, `connect_stripe_account`, `update_stripe_account` and `disconnect_stripe_account` (see Selling with the buy sheet below), the webhooks' `list_webhooks`, `create_webhook`, `update_webhook`, `delete_webhook`, `test_webhook` and `list_webhook_deliveries` (see Webhooks below), a game's secrets' `list_secrets`, `set_secret` and `delete_secret` (see Secrets below), the items' `list_items`, `set_item`, `remove_item`, `set_purchase_settings`, `grant_item`, `list_purchases`, `get_purchase`, `refund_purchase`, `mark_purchase_handled` and `get_player_items` (see Items and purchases below), a game's kept rooms' `list_kept_rooms`, `delete_kept_room`, `bring_back_kept_room` and `erase_kept_room_now`, `restore_kept_room`, `undo_kept_room_restore`, `list_kept_room_restores`, `restore_every_kept_room`, `get_kept_room_restore_batch`, `undo_every_kept_room_restore` (see Kept rooms below), a game's live rooms' `list_rooms`, `get_room`, `send_room_message`, `send_to_every_room`, `list_room_messages`, `cancel_room_message`, `kick_player` and `end_room` (see Reaching live rooms below), the game database's `get_database`, `query_database`, `batch_database`, `export_database`, `import_database`, `erase_player`, `restore_database` and `undo_database_restore` (see The game database below), cloud saves' `list_saves`, `get_save`, `change_save`, `replace_save`, `reset_save`, `list_save_copies`, `get_save_copy` and `restore_save_copy` (see Cloud saves below), and the developer forum's `search_forum`, `get_topic`, `post_topic`, `message_zaisma`, `reply_to_topic`, `vote`, `rate_post`, `bookmark_post`, `report_post`, `forum_people`, `still_happening`, `flag_misplaced`, `follow_topic` and `mark_answer` (see The developer forum below). Bigger builds go through the upload command. Making a game players can play private or a draft again, and ending a live room (`end_room`), need `"confirm": true`, so the AI asks you first.
19
+ Every tool is a call to this API (`apps/site/src/mcp.ts`): `list_games`, `create_game`, `get_game`, `get_playing_now`, `get_whats_on`, `update_game`, `check_game` (what Zaisma would refuse in a game and what won't work on Zaisma, before uploading; see Checking a game below), `upload_files` (small games up to 5 MB, sent as file contents), `get_version`, `update_version` (a version's notes before it's live), `publish_version` (also rolls back and publishes later), `cancel_scheduled_publish`, `end_preview_links`, `add_image`, `remove_image`, `add_shader`, `check_shader` (a shader drawn as the check would, before it's sent; see Backgrounds below), `remove_shader`, `set_background`, `preview_game_page` (pictures of every place players meet the game, from what you're still designing; see Seeing it as players do below), `add_tester_link`, `update_tester_link`, `remove_tester_link`, `get_reports`, `get_stats`, `get_history`, `get_qr_code` (the game's link, or a room's, as a QR code), `export_game` (everything about a game as one .zip; see Export everything below), `get_logs` (what the game server printed, see A game server's logs below), `get_player`, `get_access` (what the key can do), `get_activity` (your account's activity, needs a full key), the inbox's `list_inbox`, `update_inbox_notice`, `delete_inbox_notice` and `set_inbox_settings`, a game's `announce_event` and `reply_to_bug_report` (see The inbox below), `list_api_keys` (your keys and connected apps with their end dates, last use and whether Zaisma turned one off; needs a full key), the sign-in apps' `list_sign_in_apps`, `create_sign_in_app`, `update_sign_in_app` and `delete_sign_in_app`, hosting credit's `get_credit`, `top_up_credit`, `refund_top_up`, `start_credit_plan`, `change_credit_plan`, `stop_credit_plan` and `get_spending_request` (see Hosting and credit below), Zaisma Pro's `get_pro`, `start_pro`, `cancel_pro`, `resume_pro` and `refund_pro` (see Zaisma Pro below), `get_storage`, `set_storage_budget`, `delete_version` and `delete_game`, `bring_back_game`, `erase_game_now`, `get_game_deletion_request` (see Storage below), the Stripe account's `get_stripe_account`, `connect_stripe_account`, `update_stripe_account` and `disconnect_stripe_account` (see Selling with the buy sheet below), the webhooks' `list_webhooks`, `create_webhook`, `update_webhook`, `delete_webhook`, `test_webhook` and `list_webhook_deliveries` (see Webhooks below), a game's secrets' `list_secrets`, `set_secret` and `delete_secret` (see Secrets below), `create_ticket_secret` (the secret a game's own server signs voice tickets with; see Voice below), the items' `list_items`, `set_item`, `remove_item`, `set_purchase_settings`, `grant_item`, `list_purchases`, `get_purchase`, `refund_purchase`, `mark_purchase_handled` and `get_player_items` (see Items and purchases below), a game's kept rooms' `list_kept_rooms`, `delete_kept_room`, `bring_back_kept_room` and `erase_kept_room_now`, `restore_kept_room`, `undo_kept_room_restore`, `list_kept_room_restores`, `restore_every_kept_room`, `get_kept_room_restore_batch`, `undo_every_kept_room_restore` (see Kept rooms below), a game's live rooms' `list_rooms`, `get_room`, `send_room_message`, `send_to_every_room`, `list_room_messages`, `cancel_room_message`, `kick_player` and `end_room` (see Reaching live rooms below), the game database's `get_database`, `query_database`, `batch_database`, `export_database`, `import_database`, `erase_player`, `restore_database` and `undo_database_restore` (see The game database below), cloud saves' `list_saves`, `get_save`, `change_save`, `replace_save`, `reset_save`, `list_save_copies`, `get_save_copy` and `restore_save_copy` (see Cloud saves below), and the developer forum's `search_forum`, `get_topic`, `post_topic`, `message_zaisma`, `reply_to_topic`, `vote`, `rate_post`, `bookmark_post`, `report_post`, `forum_people`, `still_happening`, `flag_misplaced`, `follow_topic` and `mark_answer` (see The developer forum below). Bigger builds go through the upload command. Making a game players can play private or a draft again, and ending a live room (`end_room`), need `"confirm": true`, so the AI asks you first.
20
20
 
21
21
  Every tool has an output schema, and answers are compact JSON. Arguments are closed: one a tool doesn't take is refused (`unknown_field`, with the arguments it does take), never quietly dropped, and a missing required one is `missing_field`. A refused call is a tool result with `isError: true`, the error object below as its `structuredContent` and its message, fix and code as its text; each tool's listed output schema is its answer or that error, because MCP clients check both against it. The tools that are easy to get wrong (`update_game`, `check_game`, `upload_files`, `publish_version`, `search_forum`, `post_topic`, `change_save`, `replace_save`, `set_secret`) carry good examples in their input schema and bad ones at the end of their description.
22
22
 
@@ -104,6 +104,7 @@ The HTTP status goes with the code, as listed. The list lives in `ERROR_CODES` (
104
104
  | `bad_deleted_account_erase_enabled` | 400 | deleted_account_erase_enabled isn't true or false. |
105
105
  | `bad_friend_joins_enabled` | 400 | friend_joins_enabled isn't true or false. |
106
106
  | `bad_performance_measuring_enabled` | 400 | performance_measuring_enabled isn't true or false. |
107
+ | `bad_microphone_enabled` | 400 | microphone_enabled isn't true or false. |
107
108
  | `bad_room_browsing` | 400 | room_browsing isn't page, game or off. |
108
109
  | `bad_multiplayer_mode` | 400 | multiplayer_mode isn't none, relay or own. |
109
110
  | `bad_account_requirement` | 400 | account_requirement isn't none, multiplayer or whole_game. |
@@ -669,11 +670,11 @@ Every call is checked before any of it runs, in this order: the key's access, wh
669
670
  | Call | What it does |
670
671
  | --- | --- |
671
672
  | `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. |
672
- | `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. |
673
+ | `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"?, "microphone_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. |
673
674
  | `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`. |
674
- | `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`. |
675
+ | `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`, `microphone_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`. |
675
676
 
676
- A game looks like: `slug`, `page_url`, `can_change_slug`, `title`, `description`, `visibility`, `is_waiting_for_zaisma_lists` (a listed game from a new developer, waiting for real players and a few quiet days before Zaisma's own lists show it; its link plays meanwhile), `zaisma_lists_wait` (where a live waiting game stands, null when it isn't waiting or isn't live: `is_held_by_reports`, true when reports a person or triage upheld hold it, never who reported or what they wrote, and `progress`, null when only a report holds it: `live_duration_days` of `minimum_live_duration_days`, `counted_player_count` of `minimum_counted_player_count` and `quiet_duration_days` of `minimum_quiet_duration_days`, the same limits that open the lists every hour), `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` (a title or description from before Nov 25, 2026 still waiting for a person; new words apply at once), `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`.
677
+ A game looks like: `slug`, `page_url`, `can_change_slug`, `title`, `description`, `visibility`, `is_waiting_for_zaisma_lists` (a listed game from a new developer, waiting for real players and a few quiet days before Zaisma's own lists show it; its link plays meanwhile), `zaisma_lists_wait` (where a live waiting game stands, null when it isn't waiting or isn't live: `is_held_by_reports`, true when reports a person or triage upheld hold it, never who reported or what they wrote, and `progress`, null when only a report holds it: `live_duration_days` of `minimum_live_duration_days`, `counted_player_count` of `minimum_counted_player_count` and `quiet_duration_days` of `minimum_quiet_duration_days`, the same limits that open the lists every hour), `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`, `microphone_enabled`, `multiplayer_mode`, `room_browsing`, `account_requirement`, `minimum_player_age_years`, `game_server_allowed_hosts`, `own_server_urls`, `has_ticket_secret` (whether its own server has a ticket secret for voice, see Voice), `links`, `link_out_url`, `link_out_who_can_open`, `link_out_review_reason`, `details_waiting_for_review` (a title or description from before Nov 25, 2026 still waiting for a person; new words apply at once), `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`.
677
678
 
678
679
  - **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.
679
680
  - **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.
@@ -689,6 +690,7 @@ A game looks like: `slug`, `page_url`, `can_change_slug`, `title`, `description`
689
690
  - **room_browsing:** for games on Zaisma rooms (`multiplayer_mode` other than `none`), where open rooms are listed so players can join them: `page` (the default) on the game page and to the game through `Zaisma.rooms.list()`, `game` only to the game (for games with their own lobby or server browser), or `off`. Room codes and invite links work either way, and the game can hide single rooms itself (see Multiplayer in the README). Whatever the setting, every game's page and the home say how many are playing now once it's 3 or more, for every game and not only multiplayer ones (no names); `GET /games/:slug` gives you the exact number. Rooms on your own servers aren't listed or counted.
690
691
  - **friend_joins_enabled:** `true` (the default) lets Join on zaisma.com (a friend's face on /friends, "Alex is playing" on the game page, a profile's Playing now) and `Zaisma.friends.list()` take a player into the room their friend is in, for any game with rooms (Zaisma rooms, or its own servers through `Zaisma.friends.setRoom`). `false` grays Join as "This game doesn't take joins". One room turns it off instead, shown as "Private room": `Zaisma.joinRoom({ friendJoinsEnabled: false })` from the player who makes it, or `room.setFriendJoinsEnabled(false)` (the game server's, or the host's with the relay). It isn't a lock: a room's code or link still reaches it, so close the room (`setOpen(false)`) or answer `false` from `canJoin` to keep players out.
691
692
  - **performance_measuring_enabled:** `true` (the default) has Zaisma measure how the game runs on players' devices, for `performance` in the stats (Play stats, below). `false` stops Zaisma adding its measuring script to the game's pages at all, and the stats answer `performance: null`.
693
+ - **microphone_enabled:** `false` (the default) means the game is never allowed the microphone. `true` lets it ask players for it, for voice chat in rooms (`room.voice`) or a game played by voice. Browsers keep a player's yes for zaisma.com, not for one game, so where the browser already keeps one from another game, the game page asks the player once for this game before it plays (on that device); Not now plays without the microphone.
692
694
  - **account_requirement:** what the game needs a Zaisma account for. `none` (the default): guests play everything, and signed-in players play as their account. `multiplayer`: guests play alone; only signed-in players get player passes, so a guest's `Zaisma.player.getPass()` and `Zaisma.joinRoom()` fail with `error.code` `"account_needed"` (show your own message, or ask them to sign in without leaving the game with `Zaisma.player.signIn()`), and room links ask guests to sign in first. That's part of v1: a guest never gets a pass in such a game. `whole_game`: the game page says "Needs a Zaisma account" and Play asks guests to sign in first; only signed-in players get player passes. Passes are the backstop: Zaisma rooms also turn away guest passes given before the change, and your own servers can check a pass's `kind` claim for the same. Players under 13 can't make accounts, so they can't play games that need one.
693
695
  - **minimum_player_age_years:** the youngest age that can play, even when the game's content suits everyone. `13` (the default): everyone, guests included as `account_requirement` allows. `16` or `18`: only accounts that old; younger accounts don't find the game on Zaisma (home, More games, friends' Playing now, profiles), and a link to it says "This game isn't open to your account." Only accounts have an age, so above 13 the game needs an account for the whole game: giving `16` or `18` alone sets `account_requirement` to `whole_game` too, and any other `account_requirement` while it's above 13 is refused with `accounts_needed_for_minimum_age` (set it back to `13` first; that leaves `account_requirement` as it is). Zaisma enforces it: Play, player passes, the relay and requests to your game server turn away younger accounts with `game_not_open_to_player`, and Zaisma rooms remove ones already playing when you raise it. Tester links follow it (testers then need an account); your own previews don't. Neither your game nor your own servers ever learn a player's age: a pass never carries it, and a younger account never gets one. Lifelike gore needs `16` or `18`: see "Allowed, even where other platforms ban it" under the content rules.
694
696
  - **game_server_allowed_hosts:** the hosts the game's own game server can call with plain `fetch()` (game server reach): your own server, a payment provider, Discord, GitHub. Up to 20 host names, like `["discord.com", "api.github.com"]`, or `"*.example.com"` for every name under example.com (not example.com itself); `[]` (the default) for none, and the whole list each time. No `https://`, paths or ports: every call is https, never to an IP address, this computer or Zaisma's own domains. Live within a minute, with no approval by Zaisma, and kept in the game's history; players don't see it (the game page names only servers their browser connects to). Calls send up to 5 MB, get 10 seconds, aren't redirected (a redirect comes back to your code), and a game makes up to about 600 a minute in each place. A call to anything else throws an `OutsideCallError` in the game server, with a `code` (`not_https`, `unreachable_host`, `host_not_allowed`, `outside_call_limit`, `too_big`, `outside_call_timeout` or `outside_call_failed`) and a `fix`; the stats' `game_server_errors` show it. Raw sockets (`connect()` from `cloudflare:sockets`, `node:net` and `node:tls`) aren't offered: opening one throws. The game server reaches the game's database, receipts and rooms through `room` and `server` while a handler runs, and `env` from `cloudflare:workers` is empty. The tokens it needs go in its secrets (below).
@@ -789,19 +791,19 @@ Account-wide things (webhooks, sign-in apps, API keys) aren't in it: they belong
789
791
 
790
792
  ## Hosting and credit
791
793
 
792
- Everything a game runs on Zaisma's servers is on one meter per game, shown as a percentage of its free hosting for the month, never in dollars: its rooms, its game server, data Zaisma's relay sends its players, its database, and requests, webhook events and schedule runs to its game server. Every game gets the same free hosting each calendar month (UTC), with no card: 8 friends playing a real-time game 2 hours every night use about a third of it; it covers about 1,300 player-hours of an 8-player real-time game at 60 ticks a second (over 300 players playing 4 hours a month), or about 2,500 player-hours of a 4-player turn-based game. A demo or a test never uses up another game's month. Free on purpose, for every game and off the meter: game files (downloads and storage, so a game never stops loading), cloud saves, accounts and sign-in, publishing and its reviews, spectators, and anything on your own servers (rooms, a relay, an API).
794
+ Everything a game runs on Zaisma's servers is on one meter per game, shown as a percentage of its free hosting for the month, never in dollars: its rooms, its game server, data Zaisma's relay sends its players, voice, its database, and requests, webhook events and schedule runs to its game server. Every game gets the same free hosting each calendar month (UTC), with no card: 8 friends playing a real-time game 2 hours every night use about a third of it; it covers about 1,300 player-hours of an 8-player real-time game at 60 ticks a second (over 300 players playing 4 hours a month), or about 2,500 player-hours of a 4-player turn-based game. A demo or a test never uses up another game's month. Free on purpose, for every game and off the meter: game files (downloads and storage, so a game never stops loading), cloud saves, accounts and sign-in, publishing and its reviews, spectators, and anything on your own servers (rooms, a relay, an API).
793
795
 
794
796
  `hosting_use_this_month`, in `GET /games/:slug/stats` and `GET /games/:slug/database`:
795
797
 
796
798
  - `free_used_pct`: how much of the month's free hosting is used, 0 to 100. `resets_on_date` is when it starts again.
797
- - `shares`: what used it, each `{"kind", "share_pct"}` adding to 100, biggest first: `rooms`, `game_server`, `relayed_data`, `database`, `requests`, `ai_reviews` (AI reviews of its versions from before the fixed checks became the review; nothing new is charged), `page_previews` (Chrome drawing your AI's preview pictures, `preview_game_page`). `[]` before any use.
799
+ - `shares`: what used it, each `{"kind", "share_pct"}` adding to 100, biggest first: `rooms`, `game_server`, `relayed_data`, `voice` (voice Cloudflare's media server sent your players, `room.voice`), `database`, `requests`, `ai_reviews` (AI reviews of its versions from before the fixed checks became the review; nothing new is charged), `page_previews` (Chrome drawing your AI's preview pictures, `preview_game_page`). `[]` before any use.
798
800
  - `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.
799
801
  - `is_paused`, `paused_reason` (`free_used`, `budget_used`, `credit_used`, `no_real_players`, `free_hosting_ended` or `null`) and `paused_at`.
800
802
  - `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.
801
803
  - `monthly_budget_cents` and `spent_from_credit_cents`: the game's budget and what credit paid for it this month.
802
804
  - **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`.
803
805
  - **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.
804
- - 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.
806
+ - The counts behind it: `room_awake_duration_hours`, `room_connection_count`, `inbound_message_count`, `relayed_size_bytes`, `voice_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.
805
807
 
806
808
  **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.
807
809
 
@@ -891,7 +893,7 @@ An account over its limit keeps its live versions. New uploads must fit: `storag
891
893
 
892
894
  ## Players
893
895
 
894
- A signed-in player plays as their Zaisma account in every game, with the same player ID (`player_…`) everywhere; anyone else is a guest with a new ID for each pass. Your game sees the ID in `room.players`, in `Zaisma.player.getPass()` and as the `sub` of the player pass your own server checks, with `kind` saying `account` or `guest`. Your server checks a pass with `verifyPass(pass, keys, { gameSlug })` from `@zaisma/game-server` (your game's own keys at `https://rooms.zaisma.com/v1/pass-keys/<gameSlug>`: every game's passes are signed with a key of its own, so a pass for another game never checks out against them; the list holds more than one so the next key is out ahead of signing anything: pick by the token's `kid`, as `verifyPass` does, and never pin one; `issuerUrl` defaults to `https://rooms.zaisma.com`): a JWT with header `typ` `pass+jwt` and claim `pass_version_number` `1`, refused with a `PassError` whose `code` is `malformed`, `unknown_key` (fetch the keys again), `bad_signature`, `expired`, `wrong_game`, `wrong_issuer`, `wrong_kind` (a receipt, or another JWT) or `wrong_version`. `kind`, `who_reads_my_chat` and `who_can_chat` may gain values, so treat one you don't know as a guest and as `nobody`. An account's pass says how its chat reaches (`who_reads_my_chat`, `chat_reading_enabled`, its age band's opaque `chat_group_id`, its sealed `network_seal`, and v1's `who_can_chat` as a stricter stand-in), its own opaque `player_tag_id` and its friends' and blocks' tags (`friend_player_tag_ids`, `block_player_tag_ids`), all different in every game. Zaisma never tells a game anyone's age; a game could guess which chat group is the younger one from its size.
896
+ A signed-in player plays as their Zaisma account in every game, with the same player ID (`player_…`) everywhere; anyone else is a guest with a new ID for each pass. Your game sees the ID in `room.players`, in `Zaisma.player.getPass()` and as the `sub` of the player pass your own server checks, with `kind` saying `account` or `guest`. Your server checks a pass with `verifyPass(pass, keys, { gameSlug })` from `@zaisma/game-server` (your game's own keys at `https://rooms.zaisma.com/v1/pass-keys/<gameSlug>`: every game's passes are signed with a key of its own, so a pass for another game never checks out against them; the list holds more than one so the next key is out ahead of signing anything: pick by the token's `kid`, as `verifyPass` does, and never pin one; `issuerUrl` defaults to `https://rooms.zaisma.com`): a JWT with header `typ` `pass+jwt` and claim `pass_version_number` `1`, refused with a `PassError` whose `code` is `malformed`, `unknown_key` (fetch the keys again), `bad_signature`, `expired`, `wrong_game`, `wrong_issuer`, `wrong_kind` (a receipt, or another JWT) or `wrong_version`. `kind`, `who_reads_my_chat` and `who_can_chat` may gain values, so treat one you don't know as a guest and as `nobody`. An account's pass says how its chat reaches (`who_reads_my_chat`, `chat_reading_enabled`, its age band's opaque `chat_group_id`, its sealed `network_seal`, and v1's `who_can_chat` as a stricter stand-in), its own opaque `player_tag_id` and its friends' and blocks' tags (`friend_player_tag_ids`, `block_player_tag_ids`), all different in every game. It also says who hears it talk (`who_hears_my_voice`, the same choices, `nobody` while its chat is stopped) and whether it hears others (`voice_hearing_enabled`): see Voice. Zaisma never tells a game anyone's age; a game could guess which chat group is the younger one from its size.
895
897
 
896
898
  | Call | What it does |
897
899
  | --- | --- |
@@ -952,6 +954,44 @@ Every answer from the filter is `{ isAllowed, reason, message, hasSwearing, hasS
952
954
 
953
955
  Contact details stopped toward under-18 accounts five times in a day pause the sender's chat for an hour. A paused account's next pass says `who_reads_my_chat: "nobody"` (and `who_can_chat: "nobody"`), so `canChat` stops it on your server too. Zaisma keeps no chat.
954
956
 
957
+ ### Voice
958
+
959
+ Players talk to each other in a room with `room.voice`, through Cloudflare's media server, so nobody sees anyone's address. Your game holds the microphone and plays the voices, with its own volumes, placement and effects; Zaisma decides whose voice reaches whom, by chat's rules, and keeps none of it.
960
+
961
+ - **Who hears whom:** each player chooses who hears them talk (Friends, My age band or Everyone, starting where their typed chat is, `who_hears_my_voice` on their pass) and whether they hear others (`voice_hearing_enabled`). A voice reaches the players that choice takes in, with no block either way and not muted by them. Guests and spectators have no voice (`room.canTalk` is `false`; a player who can't talk can still listen).
962
+ - **The witness rule, for voice:** anyone under 18 is heard, and hears adults, only while at least two independent players hear that voice too (the same independent players as chat's). In a duo, in proximity voice with one other player in range, or on a team of two, an under-18's voice goes quiet both ways, and the moment a witness leaves it's cut. No filter listens to voice: a report carries the last 30 seconds the reporter heard instead.
963
+ - **In the game:** `await room.voice.join()` (call it from a tap: browsers play sound only after one) asks for the microphone when the player can talk (the game needs `microphone_enabled` on), and rejects with `microphone_refused`, `voice_not_allowed`, `voice_unavailable` or `hosting_paused`. `room.on("speaking", ({ playerId, isSpeaking }) => …)` says who's talking, this player included; `room.voice.speakerPlayerIds` (and the `voiceSpeakers` event) is whose voices reach this player now. `room.voice.setMicrophoneMuted(isMuted)` for a mute button or push-to-talk; `room.voice.leave()`, or leaving the room, ends it.
964
+ - **Proximity and effects:** `room.voice.setSpeakerVolume(playerId, volumePct)` (0 to 100; at 0 the voice isn't sent at all, so nobody pays for it) and `room.voice.setSpeakerPan(playerId, panPct)` (-100 left to 100 right) place each voice; `room.voice.audioNodeOf(playerId)` hands you its sound to run through your own Web Audio nodes (a radio's crackle, a muffled wall) to `room.voice.outputNode`.
965
+ - **Echo:** voices play through `room.voice.outputNode`, which the browser's echo cancellation hears, so a player on speakers doesn't send the others' voices back. Route your game's own sound there too (made in `room.voice.audioContext`), or a phone's microphone picks it up.
966
+ - **Your game server's rules, the backstop:** `room.setVoiceGroup(playerId, groupName)` puts a player in a group (a team, a squad's radio: 1 to 40 characters, `null` for none), who then hears and is heard only within it; `room.setHeardSpeakers(listenerPlayerId, speakerPlayerIds)` limits whom a player hears (proximity: only those in range; `null` for everyone allowed); `room.setHeardSpeakerCount(count)` sets how many voices each player hears at once, 1 to 32 (16 unless you set it), the loudest past that. A changed game can't hear past these: Zaisma's room makes every connection itself.
967
+ - **What it sends:** Opus at about 24 kbps in 40 ms packets, nothing while a player is silent: about 33 kbps on the wire while talking, 1 kbps silent. Voice is its own line on the meter, `voice`, at $0.20 per GB Cloudflare's media server sends your players (four times Cloudflare's $0.05): 12 players all shouting nonstop for 5 minutes, each hearing the other 11, is about 3 cents; a normal lobby, under 1 cent.
968
+ - **Reports:** a report about a player, from Zaisma's report sheet or a game's own `room.report`, can carry the last 30 seconds this player heard (the SDK keeps them in memory only, as they play). Only Zaisma hears it; it's never passed to you, and it's deleted with the report.
969
+ - **On your own server:** your players join a voice channel on Zaisma with a ticket your server signs: make the game's ticket secret once with `create_ticket_secret` (`POST /games/:slug/ticket-secret`, shown once; keep it only on your server), then `voiceTicket(playerPass, channelName, ticketSecret, { voiceGroupName, heardSpeakerPlayerIds, heardSpeakerCount })` from `@zaisma/game-server` for a player whose pass you checked, and send it to their game, which joins with `room.voice.join({ ticket })`. A ticket lasts 5 minutes, enough to join; for a new team or range, send a new one (`room.voice.updateTicket(ticket)`). Channel names are 1 to 40 of `a-z 0-9 - _ :`, like `match-12`. Without a ticket a room on your own server answers `voice_ticket_required`; a ticket for another player, channel or game, expired, or signed with another secret is `voice_ticket_refused`. `canVoiceChat(speakerPass, listenerPass)` is the pass rule if you pass voice yourself; Zaisma applies it and the witness rule on its channels.
970
+ - **Trying it:** voice goes through Zaisma's media server, so the local bench (`npx @zaisma/cli play-locally`) has none: your game's `room.voice.join()` answers `voice_ticket_required` there. Try voice on Zaisma, through a tester link (`add_tester_link`), with a friend or a second browser.
971
+
972
+ ```js
973
+ // Push-to-talk with proximity: the game holds the microphone, Zaisma decides who hears it.
974
+ const room = await Zaisma.joinRoom();
975
+ joinButton.addEventListener("click", async () => {
976
+ try {
977
+ await room.voice.join({ isMuted: true });
978
+ } catch (error) {
979
+ showNote(error.message);
980
+ }
981
+ });
982
+ addEventListener("keydown", (event) => event.key === "v" && room.voice.setMicrophoneMuted(false));
983
+ addEventListener("keyup", (event) => event.key === "v" && room.voice.setMicrophoneMuted(true));
984
+ room.on("speaking", ({ playerId, isSpeaking }) => setMicIcon(playerId, isSpeaking));
985
+ function everyFrame() {
986
+ for (const other of room.players) {
987
+ if (other.id === room.me.id) continue;
988
+ const distanceM = distanceTo(other.id);
989
+ room.voice.setSpeakerVolume(other.id, Math.max(0, Math.round(100 - distanceM * 5)));
990
+ room.voice.setSpeakerPan(other.id, Math.round(directionTo(other.id) * 100));
991
+ }
992
+ }
993
+ ```
994
+
955
995
  ## Room connections
956
996
 
957
997
  How a room and each player's game stay in touch, the same in Zaisma rooms and on your own server (the Node runner): how a dead connection is noticed, what happens to a player whose connection drops or who walks away, the limits on what players send, and why a connection closes.
@@ -1095,6 +1135,12 @@ A room answers a refusal with `{ type: "error", code, message }`, then closes th
1095
1135
  | `chat_empty` | `room.chat` with nothing but spaces. |
1096
1136
  | `chat_too_long` | `room.chat` over 2000 characters. |
1097
1137
  | `chat_too_fast` | More than 20 chat messages in 10 seconds from one player. |
1138
+ | `voice_not_here` | A voice message reached a room whose server doesn't take voice (your own server: voice goes through a ticket, see Voice). |
1139
+ | `microphone_refused` | The SDK's own: `room.voice.join` couldn't use the microphone (the player or the browser said no, or the game's `microphone_enabled` is off). |
1140
+ | `voice_not_allowed` | `room.voice.join` from a guest or a spectator. |
1141
+ | `voice_unavailable` | Voice couldn't start or connect: try again. |
1142
+ | `voice_ticket_required` | `room.voice.join` in a room on your own server without a ticket from that server. |
1143
+ | `voice_ticket_refused` | A voice ticket for another player, channel or game, expired, or signed with another secret. |
1098
1144
  | `bad_region` | The SDK's own: a `region` that isn't a continent code (`"AF"`, `"AN"`, `"AS"`, `"EU"`, `"NA"`, `"OC"` or `"SA"`). |
1099
1145
  | `bad_idle_timeout` | The SDK's own: an `idleTimeoutSec` that isn't from 30 to 86400. |
1100
1146
  | `bad_transport` | The SDK's own: a `transport` that isn't `"websocket"` or `"webtransport"`. |
@@ -1141,6 +1187,8 @@ Every event the game's room object has, and what its listener gets. Within v1, e
1141
1187
  | `error` | `{ code, message }` |
1142
1188
  | `versionUpdate` | `{ versionId, appliesAt, isReloading }` |
1143
1189
  | `roomMessage` | `{ message, senderKind, fromRoomCode, sentAt }`: a room message for a room whose game server has no `onRoomMessage` (see Reaching live rooms) |
1190
+ | `speaking` | `{ playerId, isSpeaking }`: a voice started or stopped speaking, this player's own included (see Voice) |
1191
+ | `voiceSpeakers` | `{ playerIds }`: whose voices reach this player now changed |
1144
1192
 
1145
1193
  The SDK and rooms say which messages they speak with `protocolVersionNumber` (1 today): the SDK sends it in its hello, and the welcome answers the room's. A room skips a message type it doesn't know, so a newer SDK still plays in an older room.
1146
1194
 
@@ -1199,6 +1247,7 @@ Tokens and keys a game's own game server needs, like a Discord webhook URL, a Gi
1199
1247
  | `GET /games/:slug/secrets` | The game's `secrets`, by name, each `{"name", "set_at"}`: never the value. |
1200
1248
  | `PUT /games/:slug/secrets/:secret_name` | Set one, replacing any of that name: `{"secret_value"}`. Answers the `secret` and `next_steps`. |
1201
1249
  | `DELETE /games/:slug/secrets/:secret_name` | Delete one. Answers `deleted_secret_name` and `next_steps`. |
1250
+ | `POST /games/:slug/ticket-secret` | A new ticket secret for the game, answered once as `ticket_secret` (with `next_steps`) and never again: its own server signs voice tickets with it (see Voice). A new one replaces the old at once, and tickets signed with the old stop working. `GET /games/:slug` says `has_ticket_secret`. Needs `game_access` write. |
1202
1251
 
1203
1252
  - **Names** are like environment variables: capitals, digits and underscores, starting with a capital, up to 64 characters (`DISCORD_WEBHOOK_URL`). **Values** are text, up to 8 KB; put several values in one as JSON text if you like. Up to 50 a game.
1204
1253
  - **When it changes:** requests and schedules use the new value from their next call; running rooms get it within a minute.
@@ -1857,7 +1906,7 @@ Each problem is `{ code, problem_kind, is_fixed_by_upload_command, message, path
1857
1906
  | `file_download` | broken | no | A file download, which the game's frame doesn't allow. |
1858
1907
  | `outside_link` | broken | no | A link that opens another site or a new window, which the game's frame doesn't allow. |
1859
1908
  | `outside_frame` | broken | no | A frame of another site, which games can't show. |
1860
- | `blocked_feature` | broken | no | Camera, microphone, screen capture, location, payments, USB, serial, Bluetooth or HID, which games on Zaisma can't use. |
1909
+ | `blocked_feature` | broken | no | Camera, screen capture, location, payments, USB, serial, Bluetooth or HID, which games on Zaisma can't use. |
1861
1910
 
1862
1911
  `performance_notes` are the asset notes of How it started in Chrome (`images_could_be_ktx2`, `audio_could_be_opus`, `models_could_be_smaller`, `development_build`), each `{ code, message, path, saved_size_bytes, fix }`. They never stop an upload, and `zaisma check` prints them under "Could be smaller" without changing its exit code. Image sizes, sound lengths and models are read from the files' first bytes, so the API, which gets only sizes for them, gives only `development_build`; `zaisma check` gives them all.
1863
1912
 
@@ -53,6 +53,7 @@ Every error the developer API and MCP answer with, as `{ "error": { code, messag
53
53
  - `bad_deleted_account_erase_enabled` (HTTP 400): deleted_account_erase_enabled isn't true or false. Fix: Give deleted_account_erase_enabled as true or false. https://zaisma.com/developers/errors/bad_deleted_account_erase_enabled
54
54
  - `bad_friend_joins_enabled` (HTTP 400): friend_joins_enabled isn't true or false. Fix: Give friend_joins_enabled as true or false. https://zaisma.com/developers/errors/bad_friend_joins_enabled
55
55
  - `bad_performance_measuring_enabled` (HTTP 400): performance_measuring_enabled isn't true or false. Fix: Give performance_measuring_enabled as true or false. https://zaisma.com/developers/errors/bad_performance_measuring_enabled
56
+ - `bad_microphone_enabled` (HTTP 400): microphone_enabled isn't true or false. Fix: Give microphone_enabled as true or false. https://zaisma.com/developers/errors/bad_microphone_enabled
56
57
  - `bad_room_browsing` (HTTP 400): room_browsing isn't page, game or off. Fix: Give room_browsing as page, game or off. https://zaisma.com/developers/errors/bad_room_browsing
57
58
  - `bad_multiplayer_mode` (HTTP 400): multiplayer_mode isn't none, relay or own. Fix: Give multiplayer_mode as none, relay or own. https://zaisma.com/developers/errors/bad_multiplayer_mode
58
59
  - `bad_account_requirement` (HTTP 400): account_requirement isn't none, multiplayer or whole_game. Fix: Give account_requirement as none, multiplayer or whole_game. https://zaisma.com/developers/errors/bad_account_requirement
@@ -313,7 +313,7 @@ Zaisma.joinRoom({ idleCheckEnabled: false }); // no "Still there?" in this game
313
313
 
314
314
  Every number behind this (pings, timeouts, reconnecting, held seats, message limits, close codes) is in [Room connections](docs/DEVELOPER-API.md#room-connections).
315
315
 
316
- Your own clients follow the same protocol: send the text `ping` every 30 seconds or so (the room answers `pong`), `{"type":"idle"}`, `{"type":"hidden"}` and `{"type":"shown"}` as they happen, and `{"type":"back"}` when the player returns. Their hello carries `"protocolVersionNumber":1`. Errors from the room are `{"type":"error","code":"room_full","message":"This room is full."}`, with codes in lowercase snake_case, one of: `rented_share_used`, `room_full`, `room_closed`, `ended`, `too_big`, `too_fast`, `bad_message`, `bad_pass`, `bad_player_token`, `no_hello`, `not_allowed`, `game_unavailable`, `busy`, `kept_out`, `refused`, `room_not_running`, `hosting_paused`, `account_needed`, `game_not_open_to_player`, `blocked_player_here`, `other_version`, `spectators_full`, `spectator_cannot_send`, `already_playing`, `bad_origin`, `send_queue_full`, `chat_not_here`, `chat_not_allowed`, `chat_empty`, `chat_too_long` or `chat_too_fast`. The SDK's types explain each one (`RoomErrorCode`); codes only grow within v1.
316
+ Your own clients follow the same protocol: send the text `ping` every 30 seconds or so (the room answers `pong`), `{"type":"idle"}`, `{"type":"hidden"}` and `{"type":"shown"}` as they happen, and `{"type":"back"}` when the player returns. Their hello carries `"protocolVersionNumber":1`. Errors from the room are `{"type":"error","code":"room_full","message":"This room is full."}`, with codes in lowercase snake_case, one of: `rented_share_used`, `room_full`, `room_closed`, `ended`, `too_big`, `too_fast`, `bad_message`, `bad_pass`, `bad_player_token`, `no_hello`, `not_allowed`, `game_unavailable`, `busy`, `kept_out`, `refused`, `room_not_running`, `hosting_paused`, `account_needed`, `game_not_open_to_player`, `blocked_player_here`, `other_version`, `spectators_full`, `spectator_cannot_send`, `already_playing`, `bad_origin`, `send_queue_full`, `chat_not_here`, `voice_not_here`, `chat_not_allowed`, `chat_empty`, `chat_too_long` or `chat_too_fast`. The SDK's types explain each one (`RoomErrorCode`); codes only grow within v1.
317
317
 
318
318
  #### Requests to your game server
319
319
 
@@ -557,6 +557,12 @@ A room answers a refusal with `{ type: "error", code, message }`, then closes th
557
557
  | `chat_empty` | `room.chat` with nothing but spaces. |
558
558
  | `chat_too_long` | `room.chat` over 2000 characters. |
559
559
  | `chat_too_fast` | More than 20 chat messages in 10 seconds from one player. |
560
+ | `voice_not_here` | A voice message reached a room whose server doesn't take voice (your own server: voice goes through a ticket, see Voice). |
561
+ | `microphone_refused` | The SDK's own: `room.voice.join` couldn't use the microphone (the player or the browser said no, or the game's `microphone_enabled` is off). |
562
+ | `voice_not_allowed` | `room.voice.join` from a guest or a spectator. |
563
+ | `voice_unavailable` | Voice couldn't start or connect: try again. |
564
+ | `voice_ticket_required` | `room.voice.join` in a room on your own server without a ticket from that server. |
565
+ | `voice_ticket_refused` | A voice ticket for another player, channel or game, expired, or signed with another secret. |
560
566
  | `bad_region` | The SDK's own: a `region` that isn't a continent code (`"AF"`, `"AN"`, `"AS"`, `"EU"`, `"NA"`, `"OC"` or `"SA"`). |
561
567
  | `bad_idle_timeout` | The SDK's own: an `idleTimeoutSec` that isn't from 30 to 86400. |
562
568
  | `bad_transport` | The SDK's own: a `transport` that isn't `"websocket"` or `"webtransport"`. |
@@ -603,5 +609,7 @@ Every event the game's room object has, and what its listener gets. Within v1, e
603
609
  | `error` | `{ code, message }` |
604
610
  | `versionUpdate` | `{ versionId, appliesAt, isReloading }` |
605
611
  | `roomMessage` | `{ message, senderKind, fromRoomCode, sentAt }`: a room message for a room whose game server has no `onRoomMessage` (see Reaching live rooms) |
612
+ | `speaking` | `{ playerId, isSpeaking }`: a voice started or stopped speaking, this player's own included (see Voice) |
613
+ | `voiceSpeakers` | `{ playerIds }`: whose voices reach this player now changed |
606
614
 
607
615
  The SDK and rooms say which messages they speak with `protocolVersionNumber` (1 today): the SDK sends it in its hello, and the welcome answers the room's. A room skips a message type it doesn't know, so a newer SDK still plays in an older room.
@@ -281,6 +281,10 @@ One name per concept. The API and MCP column is snake_case; the SDK and game ser
281
281
  | Who reads what an account types, whether it reads others' chat, and the opaque group of its age band (never an age) | `who_reads_my_chat`: `friends`, `my_age_band`, `everyone` (the social setting, outside the presets, `defaultWhoReadsMyChat`), `chat_reading_enabled` (Zaisma's own code: `accounts.who_reads_my_chat`, `accounts.chat_reading_enabled`, `PRESET_SOCIAL_SETTINGS`) | player pass claims `who_reads_my_chat` (`WhoReadsMyChat`, or `nobody` while stopped), `chat_reading_enabled`, `chat_group_id` (a `chat_group_…` ID, different in every game), v1's `who_can_chat` (`WhoCanChat`: `nobody`, `friends`, `anyone`) as a stricter stand-in; checked with `canChat(first, second)`, first the sender and second the reader; inside, `ChatReach` (`nobody`, `friends`, `my_age_band`, `everyone`), `chatReachOf`, `isWithinChatReach`, `PlayerChatSettings` (`sending`, `reading`, `chatGroupId`, `networkSeal`) |
282
282
  | A chat message: a line a player typed, sent with room.chat through the room to the players who may read it, after the game server's onChat and Zaisma's chat filter | `chat_messages` on a player report (`from_player_id`, the reported player's or `null`, `text`, `sent_at`); Zaisma's own code: `reports.reported_chat_json`, `ReportedChatMessage`, `REPORTED_CHAT_LIMITS` | `room.chat(text, { toPlayerIds })` answers `{ sentAt }` (`ChatSent`); the `chat` event's `ChatMessage`: `fromPlayerId`, `text`, `hasSwearing`, `hasSlur`, `sentAt`; game server `onChat(state, player, room, chatInfo)` with `ChatInfo` `{ text, toPlayerIds }`, answering a `ChatAnswer` (`true`, `false`, `{ toPlayerIds }`); option `adultChatFilterEnabled`; `CHAT_ROOM_LIMITS` (`maximumChatMessageCount`, `chatWindowDurationMs`); wire messages `chat`, `chat_sent`, `chat_stopped` with a `chatNumber`; error codes `chat_stopped` (with `reason`, `stopped_by_game` for onChat), `chat_not_allowed`, `chat_empty`, `chat_too_long`, `chat_too_fast`, `chat_not_here` |
283
283
  | Anyone under 18 types only where two independent players read it: who counts, and a player's network for it (never shown to a game) | Zaisma's own code: `CHAT_WITNESS_LIMITS` (`minimumWitnessCount`, `minimumWitnessAccountAgeDays`, `minimumWitnessCountedDayCount`), `isEstablishedWitness`, `independentWitnessCount`, `WitnessReader`; a network is `v4:<address>` or `v6:<the /56>` (`networkOfAddress`, `networkOf`, `sealNetwork`, `openNetworkSeal`); the filter's answer in rooms adds `readerPlayerIds` and `isEveryReaderNeeded` | player pass claim `network_seal`; `deliverChat`'s `isEveryReaderNeeded` |
284
+ | Voice in a room: a player's voice going through Cloudflare's media server to the players who may hear it, by chat's rules; who hears whom is decided by Zaisma, never the game | `who_hears_my_voice` (`friends`, `my_age_band`, `everyone`, outside the presets, starting where `who_reads_my_chat` is), `voice_hearing_enabled`; a game's `microphone_enabled` (off by default: only then may its frame use the microphone; `bad_microphone_enabled`); `voice_size_bytes` and the meter share `voice`; Zaisma's own code: `VOICE_LIMITS`, `voicePulls`, `accounts.who_hears_my_voice`, `voice_sessions` | `room.voice` (`join`, `leave`, `setMicrophoneMuted`, `setSpeakerVolume(playerId, volumePct)`, `setSpeakerPan(playerId, panPct)`, `audioNodeOf`, `speakerPlayerIds`, `canTalk`), events `speaking` and `voiceSpeakers`; `room.canTalk`; `canVoiceChat(speaker, listener)`; errors `microphone_refused`, `voice_not_allowed`, `voice_unavailable`, `voice_not_here` |
285
+ | A voice group: the players who hear one another only, like a team or a squad's radio; heard speakers: whom one player hears, for proximity; how many voices a player hears at once, the loudest past it | | `room.setVoiceGroup(playerId, groupName)`, `room.setHeardSpeakers(listenerPlayerId, speakerPlayerIds)`, `room.setHeardSpeakerCount(count)`, `VOICE_ROOM_LIMITS` |
286
+ | A voice channel: voice for players of a game on its own server, joined with a voice ticket the server signs with the game's ticket secret | `create_ticket_secret`, `ticket_secret`, `has_ticket_secret`; errors `voice_ticket_required`, `voice_ticket_refused`; Zaisma's own code: `games.sealed_ticket_secret` | `voiceTicket(playerPass, channelName, ticketSecret, voiceTicketOptions)`, `VoiceTicketClaims` (`ticket_kind` `voice`, `channel_name`, `voice_group_name`, `heard_speaker_ids`, `heard_speaker_count`), `room.voice.join({ ticket })`, `room.voice.updateTicket` |
287
+ | A report's voice clip: the last 30 seconds of voice the reporter heard, from their game; only Zaisma hears it | Zaisma's own code: `reports.reported_audio_key`, `reportAudioKey` | `voiceClipBase64` on a report a game sends |
284
288
  | An account's Zaisma friends, and the invite that makes two accounts friends | | player pass claim `friend_player_tag_ids` (their `player_tag_id`s, never their player IDs), checked with `passesAreFriends(first, second)`; `room.areFriends(firstPlayerId, secondPlayerId)`; a friend invite's `invite_code` is 8 letters and digits, shown as `K7Q2-MX9P` |
285
289
  | A player's friends playing this game, the room to join each in, and why not | `server_url` (in Zaisma's own code: a room on the game's own servers) | `Zaisma.friends.list()` answers `{ friends }`, each `{ id, name, username, roomCode, serverUrl, joinRefusal }`; `joinRefusal`: `game_not_taking_joins`, `friend_not_taking_joins`, `private_room`, `room_closed`, `room_full`, `spectators_full`, `friend_not_in_room`; `Zaisma.friends.setRoom({ serverUrl, roomCode, friendJoinsEnabled })` (null when the player left), refused with `unlisted_server`; a friend's Join link's `?server=`, read as `Zaisma.rooms.linkedServerUrl` |
286
290
  | A block between two players, either way (never who made it, never anyone's list of blocks) | | `room.hasBlockBetween(firstPlayerId, secondPlayerId)`; player pass claims `player_tag_id` (the account's own `player_tag_…` ID, different in every game) and `block_player_tag_ids` (the player tags of the accounts it has a block with), checked with `passesHaveBlockBetween(first, second)`; the room's `{ type: "blocks", playerIds }` to each player; a game's `{ type: "block", playerId }` and `{ type: "unblock", playerId }`; `room.block(playerId)`; quickJoin's hello `avoidBlockedPlayers: true`, turned away with `blocked_player_here` |
@@ -1386,6 +1386,24 @@ interface Room {
1386
1386
  * nobody, playing (not watching). False for guests: hide your chat box, and offer preset phrases or emotes.
1387
1387
  */
1388
1388
  readonly canChat: boolean;
1389
+ /**
1390
+ * Whether this player can talk in voice ({@link Room.voice}): a Zaisma account whose voice setting reaches someone,
1391
+ * playing (not watching). A player who can't talk can still join voice to listen.
1392
+ */
1393
+ readonly canTalk: boolean;
1394
+ /**
1395
+ * Voice in this room: your game holds the microphone, and Zaisma's room decides whose voices reach this player, by
1396
+ * chat's rules (who each player lets hear them, blocks, mutes, and anyone under 18 only where two independent
1397
+ * players hear them too), plus your server's teams and ranges (room.setVoiceGroup, setHeardSpeakers). It goes
1398
+ * through Cloudflare's media server, so nobody sees anyone's address, and it's on your game's meter as voice.
1399
+ * Each player hears up to 16 voices at once (your server can set 1 to 32), the loudest past that.
1400
+ * @example
1401
+ * await room.voice.join();
1402
+ * room.on("speaking", ({ playerId, isSpeaking }) => showMicIcon(playerId, isSpeaking));
1403
+ * // Proximity voice: fade and place each voice by distance.
1404
+ * for (const other of room.players) room.voice.setSpeakerVolume(other.id, volumeByDistance(other));
1405
+ */
1406
+ readonly voice: RoomVoice;
1389
1407
  /**
1390
1408
  * When Zaisma will end this match, an ISO time, or null: set once the game's hosting pauses for the
1391
1409
  * month, an hour after the pause (the "ending" event); null again if Zaisma calls the end off (the
@@ -1683,6 +1701,80 @@ interface RoomEvents {
1683
1701
  * them if your game doesn't. (Optional here only so games written for v1's events still fit.)
1684
1702
  */
1685
1703
  chat?: (chatMessage: ChatMessage) => void;
1704
+ /** A voice started or stopped speaking, this player's own included, from its level on this device ({@link Room.voice}). */
1705
+ speaking?: (speaking: Speaking) => void;
1706
+ /** The voices this player hears changed: who's in {@link RoomVoice.speakerPlayerIds} now. */
1707
+ voiceSpeakers?: (voiceSpeakers: { playerIds: string[] }) => void;
1708
+ }
1709
+ ```
1710
+
1711
+ ### Speaking
1712
+
1713
+ ```ts
1714
+ /** The "speaking" event's answer. */
1715
+ interface Speaking {
1716
+ playerId: string;
1717
+ isSpeaking: boolean;
1718
+ }
1719
+ ```
1720
+
1721
+ ### VoiceOptions
1722
+
1723
+ ```ts
1724
+ /** What {@link RoomVoice.join} takes. */
1725
+ interface VoiceOptions {
1726
+ /** Join with the microphone muted (push-to-talk starts here). */
1727
+ isMuted?: boolean;
1728
+ /**
1729
+ * For a room on your own server: a voice ticket your server signed (voiceTicket in @zaisma/game-server, with the
1730
+ * game's ticket secret from create_ticket_secret), naming the voice channel and this player's team and range. Rooms
1731
+ * on Zaisma need none.
1732
+ */
1733
+ ticket?: string;
1734
+ }
1735
+ ```
1736
+
1737
+ ### RoomVoice
1738
+
1739
+ ```ts
1740
+ /** A room's voice: {@link Room.voice}. */
1741
+ interface RoomVoice {
1742
+ /**
1743
+ * Join the room's voice: asks for the microphone when the player can talk ({@link Room.canTalk}), else joins to
1744
+ * listen. Resolves once connected; rejects with microphone_refused (the player or browser said no, or the game's microphone_enabled
1745
+ * setting is off), voice_not_allowed
1746
+ * (a guest or a spectator), voice_unavailable or hosting_paused. Call it from a tap or key press: browsers play
1747
+ * sound only after one.
1748
+ */
1749
+ join(voiceOptions?: VoiceOptions): Promise<void>;
1750
+ /** Leave voice: the microphone stops and nobody's voice comes. Leaving the room does it too. */
1751
+ leave(): void;
1752
+ /** On your own server: new rules for this player (a team switch, a range), as a new ticket from your server for the same channel. */
1753
+ updateTicket(ticket: string): void;
1754
+ /** Mute or unmute this player's microphone, for push-to-talk or a mute button. Muted, it sends almost nothing. */
1755
+ setMicrophoneMuted(isMuted: boolean): void;
1756
+ /** A voice's volume here, 0 to 100 (100 unless you set it), for proximity voice or a volume slider. At 0 it isn't sent at all. */
1757
+ setSpeakerVolume(playerId: string, volumePct: number): void;
1758
+ /** Where a voice sits left to right, -100 (left) to 100 (right), 0 unless you set it. */
1759
+ setSpeakerPan(playerId: string, panPct: number): void;
1760
+ /**
1761
+ * A voice's sound after its volume, for your own effects (a radio's crackle, a muffled wall): disconnect it and
1762
+ * connect it through your own nodes to {@link RoomVoice.outputNode}. Null while that voice isn't heard.
1763
+ */
1764
+ audioNodeOf(playerId: string): AudioNode | null;
1765
+ /** The Web Audio context voices play through, or null before joining. */
1766
+ readonly audioContext: AudioContext | null;
1767
+ /**
1768
+ * Where voices go to the speakers, in {@link RoomVoice.audioContext}, or null before joining. Echo cancellation
1769
+ * hears what plays through it, so the microphone doesn't send it back: connect your effects here, not to the
1770
+ * context's destination, and your game's own sound too, made in this context, while players talk on speakers.
1771
+ */
1772
+ readonly outputNode: AudioNode | null;
1773
+ /** The players whose voices reach this player now (the "voiceSpeakers" event says when it changes). */
1774
+ readonly speakerPlayerIds: readonly string[];
1775
+ readonly isJoined: boolean;
1776
+ /** Whether this player can talk, as {@link Room.canTalk}. */
1777
+ readonly canTalk: boolean;
1686
1778
  }
1687
1779
  ```
1688
1780
 
@@ -2083,6 +2175,7 @@ interface RoomError {
2083
2175
  * - spectator_cannot_send: a spectator tried to send to the room ({@link Room.send}, {@link Room.sendBytes}).
2084
2176
  * - send_queue_full: the SDK's own: more than 60 reliable sends waited while the room wasn't reachable, so the oldest were dropped. Send less while connectionStatus isn't open, or use latest_only for updates that replace each other.
2085
2177
  * - chat_not_allowed, chat_empty, chat_too_long, chat_too_fast: {@link Room.chat} refused (they reject its promise, not the "error" event); chat_not_here: the room's server doesn't take chat.
2178
+ * - microphone_refused, voice_not_allowed, voice_unavailable: {@link RoomVoice.join} refused (they reject its promise); after joining, the "error" event says when voice stopped. voice_not_here: the room's server doesn't take voice. voice_ticket_required, voice_ticket_refused: on your own server, join needs a ticket your server signed, for this player and game, not expired.
2086
2179
  *
2087
2180
  * More codes may come within v1: handle one you don't know like an error you can show (its message).
2088
2181
  *
@@ -2124,7 +2217,13 @@ type RoomErrorCode =
2124
2217
  | "chat_not_allowed"
2125
2218
  | "chat_empty"
2126
2219
  | "chat_too_long"
2127
- | "chat_too_fast";
2220
+ | "chat_too_fast"
2221
+ | "voice_not_here"
2222
+ | "microphone_refused"
2223
+ | "voice_not_allowed"
2224
+ | "voice_unavailable"
2225
+ | "voice_ticket_required"
2226
+ | "voice_ticket_refused";
2128
2227
 
2129
2228
  /**
2130
2229
  * The codes a request's errors have ({@link Server.request}), from Zaisma or the Node runner alike: