--- name: openmotion-game description: Build, remix, validate, and port playable 2D, 3D, and 9:16 browser games (including Playable Ads, WeChat Mini Games, and TapTap H5 packages) across both Stage 1 Cloud MCP local workspaces and Stage 2 cloud-hosted workspaces. Search free 2D/3D game asset catalogs, browse official game templates and starter kits, generate real art, music, SFX, and voice assets, and preview existing game files cleanly. --- # OpenGame / OpenMotion Game Studio For requests to **find a 2D game asset or acquire a 3D model**, follow [model sourcing](references/game-model-sourcing.md) (`openmotion://workflow/game/sourcing`). For models already available in the conversation workspace, continue with preview below. ## Execution Mode (Auto-Detect From `tools/list` — Zero Fork) This 21-section handbook is single-source across Stage 1 and Stage 2. Inspect `tools/list` once at turn start and route automatically: - **Stage 1 — Cloud MCP Supply + Local Workspace** (active when `openmotion_game_catalog` / `openmotion_game_asset_search` are exposed and `openmotion_game_create` / `openmotion_game_write_files` are absent): - **Official Templates & 4 Kits**: Call `openmotion_game_catalog` (`action: "list_templates" | "get_template" | "list_kits" | "get_kit"`) to browse the 274 official templates (`topEarning: true` filters the 243 `TOP赚钱` hits; 3 withdrawn templates are excluded) and 4 official kits (`arcade-2d`, `coop-3d`, `characters`, `vendor`). Download the template ZIP or kit files into a fresh local folder (`.//`) and extract locally. - **Free 2D/3D Asset Library**: Call `openmotion_game_asset_search` (`dimension: "2d" | "3d"`, `query`, `kind`, `provider`, `cursor`) to search 10 open/free sources with allowlisted direct URLs and licenses; download selected assets directly into `./assets/` and retain license/attribution files. - **Local Authoring, Verification & Preview**: Create and edit game files directly in the user's local workspace (`index.html`, `client.js`, `style.css`, `src/*.js`, `logic.js`, `design/*`). Verify with local Node ESM/logic checks, `window.__omGame.runSelfTests()`, and a headless browser if installed, then start a zero-dependency local HTTP preview server (`node serve.mjs`, `npx --yes serve`, or `python3 -m http.server` — never `file://`, which breaks ESM/CORS) so the user can open and play immediately. - **Mandatory One-by-One Local Download for Cloud Multimodal Assets**: Generate AI images, video, BGM, SFX, and voice via Cloud MCP (`openmotion_media_use` + `openmotion_assets_use`). Immediately after each job completes, **download every generated file individually one-by-one** (Stage 1 has no batch download tool) into `./assets/` (e.g. `./assets/art/`, `./assets/audio/`, `./assets/video/`) and reference it strictly through **relative local paths** (`./assets/...`). Never leave temporary signed URLs or `/motion-api/assets/...` URLs in local Stage 1 code (zero 404s or expired links). - **Stage 1 3D & Transparent Cutout Ladder** (when live AI 3D or dedicated `remove-background` is absent): 1. **3D models**: `openmotion_game_asset_search` (`dimension: "3d"`) → official free character/3D kits (`openmotion_game_catalog` `action: "get_kit"` for `characters` & `vendor`) → procedural PBR materials + Three.js geometry (`VisualKit.js` + downloaded seamless 2D textures). 2. **Transparent 2D cutouts**: native `parameters.background: "transparent"` when supported by the live image model, otherwise flat chroma-key background + in-code Canvas alpha cutout and despill. - **Local Porting**: Package TapTap H5 (`-taptap.zip`) or port WeChat Mini Game (`wechat-minigame/`) directly inside the local game directory per [taptap-h5-publish.md](references/taptap-h5-publish.md) and [wechat-minigame-port.md](references/wechat-minigame-port.md). - **Stage 2 — Cloud-Hosted Shelf / Sandbox** (active automatically when `openmotion_game_create`, `openmotion_game_write_files`, `openmotion_game_validate`, and `openmotion_game_playtest` appear in `tools/list`): - Seamlessly use the full hosted lifecycle (`openmotion_game_create` → `write_files` → `validate` → `simulate` → `playtest` → `capture_cover` → `update_meta` → `set_status("ready")` → authorized `publish` / `web_publish` / `openmotion_game_wechat` / `openmotion_game_trailer`), persisting generated media directly into the hosted project (Shelf) and wiring literal `/motion-api/assets//versions//media` URLs. ## Preview existing assets in chat When the user asks to inspect existing files, finish with the preview. Game creation, media generation and edits belong to separate requests. - **Discuss or compare files.** Link each existing file naturally in the answer, using its path relative to the conversation workspace. For example, if the files exist, write `Follow the [coastal path](./maps/coast.tmj) and listen for the [beacon bell](./sound/beacon-chime.wav).` The reader chooses which preview to open. For a sprite atlas or Tiled map, link the manifest and keep its companion images and tilesets at the referenced paths. - **Open a specific asset now.** When `openmotion_asset_manage` is exposed, call it with `action: "present_asset"` and the target Studio `conversationId` (supply workspace-relative `path` or exact `assetId` + `versionId`); in Stage 1 local mode, share the workspace-relative path and local HTTP preview link. - **Show an animation.** For a named clip embedded in a GLB, pass its exact name as `animation`. If the tool reports an unknown name, use the returned available names to resolve the request. Open a standalone BVH by its own path to show the skeleton; applying that motion to a character requires a separate retargeting step. ## Build or remix a game Turn a brief or official template into a verified single-player browser game. In **Stage 1**, create a clean local folder (`.//`) seeded from `openmotion_game_catalog` (`get_template` or `list_kits` / `get_kit`, always grabbing `coop-3d` + `vendor` + `characters` for 3D briefs). In **Stage 2**, resume an explicitly supplied game id or call `openmotion_game_create` (**pass `style: "3d"` on any 3D brief** so vendored Three.js and the shared 3D runtime kits — `vendor/HumanoidRigController.js`, `vendor/VisualKit.js`, `vendor/CollisionProbe.js`, `vendor/VfxKit.js`, `vendor/GameFeel.js` — are scaffolded) and read `openmotion_game_get` before editing. If the user asks for multiplayer, explain that authoring is single-player and ask before adapting (existing multiplayer games remain playable/inspectable). Starter drafts (`plan.md`/`verification.md`) are inputs to revise, never evidence. For community external game links ("inspired by"), treat the request strictly as an **original remake inspired by the gameplay vibe**: preserve credit to the original author and **never** fetch, scrape, or copy source code or copyrighted assets from the external site. ## 0. Fast-to-First-Play Path (10s Template Copy & Whitebox First) Eliminate 5–10 minute blank-screen waits by getting a playable build into the player's hands immediately: - **10s Official Template Copy Instant Play (Remix):** - Fetch the exact official template (`openmotion_game_catalog` `action: "get_template"` → download & extract ZIP to `.//` + start local HTTP server in Stage 1; or reuse the owned `remixOf` copy in Stage 2). - **No custom modifications requested** (unchanged template or generic "remix/build this game" as-is): deliver the playable game immediately with zero rebuild. In Stage 2, do **not** call `openmotion_game_write_files`, `validate`, `playtest`, `simulate`, or `capture_cover` — silently call `openmotion_game_set_status(id, "ready")`. - **Custom modifications requested**: open a playable baseline right away, inspect existing files (`game.json`, `index.html`, `client.js`, `src/*`), **edit in place** instead of rewriting from scratch, then verify and deliver. - **New Game — Whitebox / Greybox Prototype Preview First, Then Layer Art & Audio:** - When building a new game from scratch (especially multi-asset or 3D games), stand up a **playable whitebox/greybox prototype first** (core 3C controls, rules, win/loss loop, crisp readable shapes, and Web Audio placeholder SFX) and give the user a live preview URL fast (~60 s) while approved cloud multimodal generation jobs run concurrently in the background. - Once art, sprites, seamless textures, BGM, and SFX finish, download (Stage 1: one-by-one into `./assets/`) or wire (Stage 2: Shelf URLs) and integrate them cleanly over the same playable chassis without throwing away core code. - **Reply voice (all paths):** Open your final reply in the user's language as the builder who just finished the game (e.g. `"《》已为你制作完成……"` / `"I've built <title> for you — ..."`), summarize gameplay highlights, controls, and preview link/command, and invite next edits. Never narrate template-copy mechanics, internal skills/tools, or skipped checks, and never fabricate checks you did not run. ## 1. Route First — Read Only What Applies Ask **at most two short questions** only when missing: local-market publication consent and (when paid multimodal assets are planned) one batched spend confirmation. Load **only matching references** via MCP resources (`openmotion://workflow/game/<section>`, never stale local plugin caches) — read each needed section completely without slicing off later sections: | Decision | Options & Rule | Read Only When Matched | |---|---|---| | **3C & Space** | `discrete-ui` / `realtime-2d` / `realtime-3d` | [game-3c-modules.md](references/game-3c-modules.md) + [game-feel-craft.md](references/game-feel-craft.md) | | **Core Loop** | 1 primary (+ ≤ 1 secondary): `puzzle-pressure` / `strategy-combo` / `skill-flow` / `progression-rng` / `sandbox-explore` | [game-genres.md](references/game-genres.md) | | **Runtime** | Rule/score/turn-heavy → deterministic `logic.js` + `simulate`. Realtime 3D / sandbox → modular local ESM (`src/*.js`) verified via `window.__omGame.runSelfTests()` + `playtest`. Hybrid is also valid. | [game-flow.md](references/game-flow.md) | | **Track** | **`Full Track`** for `realtime-3d`, `puzzle-pressure`, `strategy-combo`, multi-level/playable-ad, or generated visual/multi-asset packs (BGM-only generation does not upgrade an otherwise **`Fast Track`** game) | [game-gates.md](references/game-gates.md) | | **Audio & BGM** | Read whenever the game includes music, SFX, or voice (default unless silence is requested) | [game-audio.md](references/game-audio.md) | | **Specialty Visuals** | Load strictly on demand (`openmotion://workflow/game/animation` mandatory on `realtime-3d` before asset planning) | [sprites](references/game-2d-animation.md), [textures](references/game-textures.md), [3D](references/game-3d-animation.md), [procedural](references/game-procedural-animation.md) | | **Playable Ad** | Only when brief says **Format: playable ad** | [game-playable-ad.md](references/game-playable-ad.md) | | **External Lookup** | Only when naming a reference game ("like X") or non-trivial genre/physics/solvable-deal math | [game-lookup.md](references/game-lookup.md) | **Priority order:** `1. Safety / IP / runtime / spend boundaries` > `2. Explicit user intent ([locked])` > `3. Genre authenticity, 3C readability & invariants` > `4. Open creative exploration` (when style is unlocked, reject generic starter-kit clichés). ## 2. Core Workflow (Concurrent Overlap → Single Integration) 1. **Plan & Genre Authenticity** ([brief](references/game-brief.md), [style](references/game-stylization.md)). In `design/plan.md`, answer: *first-glance identity*, *native fun engine*, and *native outcome model*; list **1 Signature Twist + 1 Peak Moment**, 3–5 concrete invariants (Hard Fails), top `config` levers, `design/style.md` (concise English visual direction), and `design/assets.csv` (tag 3D targets with `priority` `P0-focal` / `P1-instanced` and `reuse_count`, with isolated concept images in Batch 1). 2. **Multimodal-First Asset Routing.** Prioritize generated multimodal assets by default (focal art/sprites/textures, looping BGM/voice/signature SFX, and concept or orthographic 3-view turnaround images → Image-to-3D when live 3D is available) unless the user explicitly requested pure-code / zero-asset output: - **Discover live capabilities first (mandatory read-only check):** Run live capability discovery for each planned modality (`"image"`, `"audio"`, `"video"`, plus `"3d"` on 3D briefs) via `openmotion_capability_discover` when exposed, otherwise `openmotion_media_use` (`action:"inspect"` passing `modality`, then `models` with `refresh:true` and `reference`). Prefer usable signed-in OpenDesign (`account` → `opendesign`, `mediaEntitlement` `"included"`, signed-in `"unknown"`, or live models listed in `entitledModelIds` for the requested modality), then configured BYOK providers. Use only live-returned IDs. - **Route by visual dominance, audio & 3D:** Focus generation on focal anchors (key art/cover, characters, sprites, seamless PBR textures, looping BGM, voice, and live `sound-effects` for signature SFX; synthesize instant UI/micro-SFX in Web Audio). Wire a looping BGM track alongside SFX for every playable game (including playable ads) unless silence is requested. On 3D briefs, read `openmotion://workflow/game/animation` ([game-3d-animation.md](references/game-3d-animation.md)) completely before asset planning: allocate 3D calls strictly to P0 focal actors/weapons and 1–2 P1 instanced props (P2 floors/water/skyboxes stay procedural + 2D PBR), generate isolated concepts or orthographic 3-view turnarounds in Batch 1, use `operation:"rig_retarget"` (plus 1-step `retarget` reusing `rigTaskId`) + `vendor/HumanoidRigController.js` for animated humanoids, and reserve `rigPreset:"none"` for rigid objects. If no live 3D executor is available, fall back only the 3D mesh step to imported/CC0 `.glb` or procedural Three.js while keeping image/audio generation active. - **Unavailable, plan-gated, or low-balance recovery (mandatory onboarding):** - *Usable Plus+ (`mediaEntitlement:"included"` or signed-in `"unknown"`) or BYOK*: generate normally; never prompt for sign-in or upgrades. - *Signed out with no usable API key (`agent_media_signed_out`)*: even if the user did not ask for AI assets, you **must** call `openmotion_open_preview` with the modality-scoped `settingsHandoff` (`target:"providers"`, `entry:"agent_media_signed_out"`), guide the user to sign in (or save an API key), and pause until they reply to continue. - *Signed in without multimodal subscription for the planned modality (`mediaEntitlement:"not-included"` with no matching model in `entitledModelIds`, Free → `agent_media_upgrade_free`, Go → `agent_media_upgrade_go`) and no BYOK*: you **must** call `openmotion_open_preview` with the modality-scoped `settingsHandoff` (and share `upgrade.url` if returned), explicitly state that their current plan requires subscribing/upgrading to OpenDesign Plus (or adding an API key), and pause until they reply to continue. - *Rejected API key (`agent_media_key_rejected`)*: call `openmotion_open_preview` with `settingsHandoff` and ask to replace the key (or sign in with OpenDesign Plus). - *Pause and wait (no proactive fallback)*: ask the user to sign in / subscribe to OpenDesign Plus (or save/replace an API key) and reply once done (then re-inspect with `refreshAccount: true`). Do **not** proactively offer or fall back to code-placeholder assets to bypass official multimodal generation. Only fall back to procedural/CC0 visuals and WebAudio SFX/BGM when the user explicitly declines generation or requests pure-code output (or for 3D meshes alone when no live 3D model exists); record the reason in `design/assets.csv`. - *Plus+ low balance*: never pre-block on cached `hasBalance`; if a real job fails with low balance (`balance is too low` / `insufficient_balance`), stop without retrying, call `openmotion_open_preview(target:"providers", entry:"agent_media_balance_low")`, and ask the user to top up and reply. - **One consent → concurrent launch → whitebox preview → asset integration:** Ask spend consent once for the planned batch (skip if already granted or managed by host approval; stop after planning if waiting). Submit independent assets concurrently with unique `requestId`s (`openmotion_capability_run` / `openmotion_assets_use action:"generate"`), **build and preview the playable whitebox core & 3C chassis while jobs run**, poll `openmotion_job_manage` / `action:"status"` (resume timed-out `3d-asset`/`3d-world` calls with the exact same `requestId` and inputs without re-billing), and inspect images together via batch contact-sheet `read`. In **Stage 1**, download each completed file one-by-one into `./assets/` and reference relative local paths (`./assets/...`); in **Stage 2**, embed literal `/motion-api/assets/<assetId>/versions/<versionId>/media` URLs (never base64 or dynamic concatenation). 3. **Build** ([gates](references/game-gates.md), [flow](references/game-flow.md)). Write modular files directly in `./<game-slug>/` (Stage 1) or batch cohesive multi-file edits into single `openmotion_game_write_files` calls after `set_status("building")` (Stage 2). Wire completed assets into active gameplay with graceful load fallbacks. Expose `window.__omGame = { getState, getStats, sendAction, runSelfTests }`. 4. **Verify & Polish.** - **Stage 1 (Local Workspace):** Verify local ESM imports, run deterministic Node sweeps for `logic.js` (if used), test `window.__omGame.runSelfTests()` and `390×844` mobile layout via local browser/headless runner when available, confirm zero 404s on relative `./assets/...` files, and verify the local HTTP preview server serves the game cleanly. - **Stage 2 (Hosted Sandbox):** Run `openmotion_game_validate` (checks ESM import graph, CSP/hosts, optional `logic.js` VM, and 3D kinematics static warnings), 3-tier `openmotion_game_simulate` (`reference` win, explicit weak route struggling/losing, `idle` loss `< 2500` ticks) for `logic.js` games, and consolidated `openmotion_game_playtest` with explicit `scripts` (`action`, `screenshot`, and on 3D action games a 3–4 frame `{ type: "burst", count: 4, intervalMs: 100 }` motion capture), `waitForReadyMs` for async builds, and `runSelfTests()` checking your 3–5 core invariants (plus `stats.kinematics` on 3D humanoid builds). - For `Full Track` / `realtime-3d`, audit screenshots against [review-rubric.md](references/review-rubric.md), fix top defects in one focused polish pass, re-verify, and log real measurements + `Known gaps (P2)` in `design/verification.md`. 5. **Deliver.** In **Stage 1**, confirm the local folder path, exact local HTTP preview command/URL (`http://127.0.0.1:<port>`), and `design/verification.md`. In **Stage 2**, run `capture_cover` (game-only 1280×720 via `openmotion_game_capture_cover`, never the user's browser/desktop) → `verification.md` → `validate` → `update_meta` (concise metadata + `zh-CN` translations) → `ready` → authorized `publish` (remember `write_files` demotes `ready` to `building`). 6. **Sharing, WeChat Mini Game & TapTap H5 Export.** In **Stage 1**, package local TapTap H5 zips (`<slug>-taptap.zip`) or port WeChat Mini Game folders (`wechat-minigame/`) directly inside the local project per [taptap-h5-publish.md](references/taptap-h5-publish.md) and [wechat-minigame-port.md](references/wechat-minigame-port.md). In **Stage 2**, `openmotion_game_publish` is workspace-local only; for a public link (only when requested and signed in), call `openmotion_assets_use` (`action:"web_publish"`, `targetKind:"game"`). If `web_publish` fails with `OPENDESIGN_SIGN_IN_REQUIRED` / `AUTH_REQUIRED`, do not retry — direct the user to click the inline "Sign in & publish" card (inside Studio do not also open `/settings/providers`; external MCP-only hosts may call `openmotion_open_preview(target:"providers", entry:"agent_media_signed_out")`). Both `web_publish` and `exportZip` exclude `design/`, `trailer/`, `publish/`, `assets/playtests/`, `assets-raw/`, rewrite literal `/motion-api/assets/...` URLs, and auto-optimize large images and GLB textures to WebP. For Stage 2 WeChat Mini Game upload, follow [wechat-minigame-port.md](references/wechat-minigame-port.md) one step at a time with `openmotion_game_wechat`; for TapTap upload with the user's own TapTap CLI login, follow [taptap-h5-publish.md](references/taptap-h5-publish.md) (`--dry-run` first). 7. **Final message** (plain language, user's language, no tool names/ids/JSON): bold playable summary; local preview URL/command (Stage 1) or play link (Stage 2); real controls + 3–5 `config` levers; verified vs unverified (human fun, real GPU/touch, audio); spend note & cover path; up to 5 numbered P2 items per [game-gates.md](references/game-gates.md#reporting-p2-to-the-user). ## MCP Resources & Optional Post-Publish Trailer MCP-only hosts read all 21 sections via `openmotion://workflow/game/<section>` (`start`, `provenance`, `brief`, `gates`, `controls`, `craft`, `lookup`, `sourcing`, `genres`, `playable`, `flow`, `design`, `style`, `sprites`, `animation`, `procedural`, `audio`, `textures`, `review`, `wechat`, `taptap`) and `openmotion://workflow/media/*`. After publishing, optionally offer `openmotion_game_trailer` (`{ id, action: "start" | "status" }`). Wait for `status: "ready"`, inspect the silent 1280×720 MP4/clips, and report `projectId` and `videoUrl`. ## Mandatory Multiplayer Entry Acceptance For diagnosing or verifying existing multiplayer projects only: clients must auto-join from `?room=` within 5 seconds without room-code inputs or a Join room button, expose Copy invite link + Start, pass `openmotion_game_validate` room checks, and pass `openmotion_game_playtest` `autoJoin` assertions before inputs. See [PROVENANCE.md](PROVENANCE.md) and [LICENSE-HIGGSFIELD](LICENSE-HIGGSFIELD).