Blyth Playable
You turn a game idea into ONE self-contained index.html (≤ 5 MB, no network) that runs on
phones and desktops, exposes tunable parameters for marketers, and passes the automated
verification. You work in three phases (plus a fourth, Publish to Explore, inside the Blyth repo).
Each phase closes before the next one starts.
This skill's folder (the directory containing this SKILL.md) holds:
| Path | What |
|---|---|
references/kernel-api.md | The kernel contract. Read fully before writing code. |
references/game-design.md | How to plan a game that is fun in the first 5 seconds. Read in PLAN. |
references/genres.md | Core loop, controls, camera, params and bot strategy per genre. Read the section for your genre. |
references/verify.md | What verification checks and how to fix failures. |
references/ad-funnel.md | The L1 → L2 → L3 level skeleton, the scripted near-miss (ctx.ad) per genre, the ad end cards. Read in PLAN. |
references/art-direction.md | The toy-like "expensive" look: palette, light, characters, camera moments, poster. Read in PLAN. |
references/showcase.md | Which finished Blyth game to study for your genre, and the HUD / bot / juice patterns worth copying. |
kernel/kernel.js | The runtime. Never edit it. |
tools/build.mjs, tools/verify.mjs, tools/ad-check.mjs | Build to one HTML; verify in headless Chromium; check the ad near-miss. |
examples/runner-3d/main.js | Reference 3D game (three.js, lanes, pools, bot). |
examples/catcher-2d/main.js | Reference 2D game (Canvas 2D, drag control, bot). |
package.json | Pinned build deps (esbuild, three). |
Phase 1 — PLAN (no game code yet)
- Read
references/game-design.md, your genre inreferences/genres.md,references/ad-funnel.md,references/art-direction.mdandreferences/kernel-api.md. Skim the gamereferences/showcase.mdnames for your genre. - Decide in your reasoning: experience formula, core loop, controls (touch AND keyboard), win and lose conditions, the 3 levels (L1 teach-and-win, L2 harder win, L3 "HARD LEVEL!" trap), the near-miss (what "progress" means and what visibly goes wrong at ~90 %), 2D or 3D, orientation, palette (main, accent, neutral, sky/ground) and the poster moment.
- Write
design/plan.json(the only planning file). Shape:{ "title": "", "slug": "", "genre": "runner", "dimension": "3d", "orientation": "portrait", "experience": "The player feels ___ because the game constantly ___.", "coreLoop": "", "controls": { "touch": "", "keyboard": "" }, "win": "", "lose": "", "difficulty": "", "levels": [ { "goal": "", "duration": "20 s", "twist": "" }, { "goal": "", "duration": "25 s", "twist": "" }, { "goal": "", "duration": "25 s", "twist": "HARD LEVEL!" } ], "nearMiss": { "level": 3, "progress": "what 0..1 measures", "how": "what visibly goes wrong at ~90 %" }, "posterMoment": "", "params": [ { "key": "", "label": "", "group": "", "type": "float", "def": 0, "min": 0, "max": 1, "apply": "live", "marketer": true } ], "strings": ["title.hook", "hint.x"], "palette": { "role": "#rrggbb" }, "assets": [] }assetsstays empty in graybox builds (primitives + procedural sound). If reference images were uploaded to/mnt/session/uploads/, list the ones you will use as sprites.
Phase 2 — BUILD
Pick the working folder once:
- Claude Managed Agents / cloud sandbox (
/mnt/sessionexists):LAB=/workspace/lab. - Anywhere else (Claude Code, Claude Desktop):
LAB=./playable-work/<slug>inside the current project.
Set up once (one shell call):
SK="<this skill folder>"; LAB="<working folder>"; mkdir -p "$LAB" && cd "$LAB" \
&& cp -r "$SK/kernel" "$SK/tools" "$SK/package.json" . && cp -r "$SK/examples" ./examples \
&& npm install --silent --no-audit --no-fund && mkdir -p game design
No skill folder but the Blyth connector is connected? Read the kit with get_playable_kit (or the
blyth://playable/… resources) and write the files into the working folder, then npm install.
Verification needs Chromium: npx playwright install chromium once.
Then write game/main.js once, complete, starting from the closest example's structure.
Optional sprites/sounds go in game/assets/img|snd|models/ and are inlined by the build.
Hard rules:
- Import the kernel as
import { createGame } from 'blyth-play-kernel'. For 3D use named imports fromthree(tree-shaking keeps the file small). - Randomness only through
ctx.rng; time only throughdt/ctx.time. NeverMath.random,Date.now. - No network, CDN, fonts or external URLs. Everything is inside the HTML.
- Touch AND keyboard (
event.codenames likeArrowLeft,Space). One-thumb play on phones. - Params: ≥ 8 game params, ≥ 5 with
marketer: true, spread across groups (Player, Enemies, Economy, Difficulty, Timing, Colors, Camera). Every colour the game draws is a param. Every param must visibly change the game. Live params are applied inonParams. - Strings: every visible word comes from
strings.en(games open in English by default). Add other languages (e.g.tr) only when the user asks; thelanguageparam then lets the marketer switch. - The game is winnable and losable and calls
ctx.end({ win })well insidemaxPlayTime. - Implement
bot(ctx)so?testautoplay can play: it must score and survive for a while, and in?trailerwin L1 at least (setconfig.trailer.autoNext: trueso the trailer rolls into the next level). - Ad funnel: 3 levels;
ctx.ui.banner(ctx.t('ui.hard'), 1600)when L3 starts; in update callctx.ad.check(progress)and ontruestage a visible, genre-fitting failure, stop progress, thenctx.ad.fail({ progress, nearText })(seereferences/ad-funnel.md). Nothing changes in GAME mode. - Feedback on every action: sound (
ctx.audio.sfx), motion, banner or particles. - Performance: object pools, no allocation inside
update, instancing or pooling for many objects, no shadows/post-processing by default, low-poly primitives.
Phase 3 — VERIFY and DELIVER
cd "$LAB" && node tools/build.mjs game && node tools/verify.mjs game/dist/index.html --seconds 20 \
&& node tools/ad-check.mjs game/dist/index.html
- Fix every
FAILand rebuild (AD-CHECK: FAILtoo: the near-miss must fire in ≥ 2 of 3 seeds at 80–97 %). At most 3 fix rounds; if still failing, deliver anyway and say exactly which check fails and why. - Look at
game/dist/poster.png,shot-endcard.pngand onead-s<seed>-0.pngonce to judge readability. - Quality list (fix what is missing before you deliver):
- a satisfying moment in the first 3 seconds (burst, coins, growth on the first touch);
- L1 easy win with 3 stars, L2 harder win, L3 starts with the "HARD LEVEL!" banner;
- AD mode:
ctx.ad.checkdrives a near-miss the player can see (?trailer&adfail=3plays the funnel); - the poster shows the most exciting moment (big crowd, boss, near-miss), not the intro;
- the
?trailervideo shows a win or an "almost" within its first 8 seconds; - every visible word is English and comes from
strings.en.
- Deliver:
- Blyth MCP connected (
publish_playableexists), then give the user the editor link:- Through the connector (claude.ai, Claude Desktop, any HTTP connection):
publish_playable { title, genre, prompt, game_js: <the contents of game/main.js>, assets: { img, snd, models }, verify: <verify.json> }. Blyth builds the same page astools/build.mjson the server in under a second. Never send the builtindex.htmlashtml: it is 5–30× larger than main.js and takes many minutes to send. No shell at all? Write main.js straight intogame_js; build errors come back with line numbers. A later small fix to that game:publish_playable { playable_id, title, game_js_edits: [{ old, new }] }(exact snippets of the stored main.js) instead of the whole file. Images are shrunk to ≤ 512 px (sprites) / ≤ 1024 px automatically. - Local stdio server (it accepts
dist_dir):publish_playable { title, genre, prompt, dist_dir: "<LAB>/game/dist", plan_path: "<LAB>/design/plan.json" }.
- Through the connector (claude.ai, Claude Desktop, any HTTP connection):
- Managed Agents (one shell call):
and writemkdir -p /mnt/session/outputs && cp game/dist/index.html game/dist/poster.png game/dist/verify.json \ game/main.js design/plan.json /mnt/session/outputs//mnt/session/outputs/summary.md: title, one-paragraph pitch, controls, win/lose, the marketer params, verify result, known issues. - Otherwise: tell the user where
game/dist/index.htmlis (it opens in any browser).
- Blyth MCP connected (
- Final chat reply: 3–5 plain sentences for a non-technical user. No file paths, no tooling words.
Phase 4 — PUBLISH TO EXPLORE (only inside the Blyth repo, ~/Desktop/blythtr)
Explore cards live in public/playable-presets/<slug>/ and src/lib/playable-presets.ts.
- Poster and preview (pick
--atso the poster lands on the most exciting second):This writescd playable-lab && node tools/capture-preset.mjs showcase/<slug>/dist/index.html ../public/playable-presets/<slug> --seconds 8 --at <s>game.html,poster.jpg,poster-portrait.jpgandpreview.webm. Look at both posters. showcase/<slug>/preset.json:{ "title", "slug", "category", "game_type", "dimension", "tagline", "prompt" }.promptis a rich 90–140-word English prompt a user could paste to recreate the game;taglineis short, sentence case.- Add an entry to
PLAYABLE_PRESETSinsrc/lib/playable-presets.ts(beforelane-dash):{ slug: 'sky-hop', title: 'Sky Hop', category: 'adventure', gameType: 'adventure', dimension: '2d', priority: 18, tagline: 'Bounce to the stars', prompt: '<preset.json prompt>', files: files('sky-hop') },category∈ shooters | runners | adventure | puzzles | strategy | maze | simulation | action | crowd | racing | party | pull-the-pin | eat-grow | arcade. A smallerpriorityshows first. npx tsc --noEmitandnpx eslint src/lib/playable-presets.ts, then open/playableand try the card, the viewer and Customize (the Ad group must be there).- When the kernel changes, rebuild every game and copy
showcase/<slug>/dist/index.htmltopublic/playable-presets/<slug>/game.html(the HTML carries the kernel).
Art and sound with Blyth (optional, spends the user's credits)
Shapes, colours, pixel sprites drawn in code and the kernel's procedural sound cost nothing and are the default. Use Blyth models only when the user wants real art, real sound, a brand look or 3D characters. You pick the models (the user does not have to); you never spend credits without telling the user first.
- Plan the smallest set that makes the game look finished: the hero, one or two enemies, one pickup, one background; three to five sound effects (the main action, hit, pickup, win) and one music loop.
- Price it:
get_account(balance) andestimate_costwith that list. Then send one short message with two or three options and wait for the answer, for example:- Free: shapes and the kernel's sound, 0 credits.
- Blyth art and sound: for example 5 images, 4 sound effects and 1 music loop, N credits.
- With a 3D hero: the same plus a rigged, animated 3D character, N credits. Use the numbers estimate_cost returns, never guesses, and show the balance. A rigged 3D character costs about as much as a dozen sprites, so offer it only when 3D matters to the game. If the user already chose (for example "use Blyth art, up to 60 credits"), stay inside that and don't ask.
- Models (
list_models { kind: "guide" }marks which are on; take the next pick when one is off):- 2D sprites:
generate_imagewithgpt-image-2.5-flare,settings: { background: "transparent" }, 1:1, one centered subject, no text, no ground shadow. - Backgrounds:
nano-banana-2.1(orseedream-v5-lite), 9:16 portrait / 16:9 landscape, calm play area. - Seamless tiles:
ideogram-v4-tiling. UI icons and logos:recraft-v4/recraft-v4-vector(SVG). - Same character, new pose or colour:
nano-banana-2.1-editwith the first sprite as reference. - 3D characters only when asked (the most expensive asset): a front-view A-pose reference image, then
generate_3d_modelwithmeshy-v7-image-to-3d,rig: true, an animation,options: { face_limit: 6000 }. 3D props:tripo-h31-text-to-3dwithoptions: { face_limit: 3000 }. - Sound effects:
generate_sound_effect(Stable Audio, cheap). One sound per prompt, 0.5–3 s, end the prompt with "isolated, no music, no voice". - Music:
generate_music, one instrumental loop, 20–30 s, mood + tempo + instruments + "no vocals". Then setmusicStyle: 'off'and play it withctx.audio.play('music', { loop: true, vol: 0.35 }).
- 2D sprites:
- Pass
max_creditson every image, start the jobs together and tell the user how many credits you used. Getting the files into the game: locally,save_asset/save_tointogame/assets/img|snd|models/; through the Claude connector, don't download or paste anything: pass the image/GLB URLs and theaudio_asset_ids topublish_playableasassets: { img, snd, models }(by the name the game uses) and Blyth embeds them. Paid calls are retry-safe: if one times out or comes backpending, pollget_job/get_soundor checkrecent_jobs; never generate the same asset again just because the answer was slow. Keep each image ≤ 512 px, each model ≤ 1.5 MB, each sound short (mono, ≤ 128 kbps); the whole build must stay under 5 MB. - Mix: sound effects around 60 %, music around 25–35 %. The game must still work with sound off.
Turn economy
Write each file once, complete. Batch shell commands. Don't re-read files you just wrote.
Don't edit kernel/ or tools/; if you find a kernel bug, work around it and mention it in summary.md.