Agent instructions — create a Caught minigame
Follow these rules when drafting or generating a minigame for Caught. Prefer the reference patterns in Examples and the contracts in SDK overview and Bundle & manifest.
Download caught-minigame-agent-pack.zip — English docs + Pong reference for AI tools.
- Download the ZIP.
- Give it to your favourite AI coding tool together with your wishes for the minigame (theme, mechanics, win/lose rules, author inputs, languages, art style, …).
- Ask the model to follow
00_llm_instructions.mdand produce a conforming Caught minigame ZIP.
The pack is always English so the model gets a single unambiguous technical source of truth.
Hard requirements
- Vanilla, self-contained ZIP — HTML/CSS/JS (and allowed assets) only. No
node_modules, npm/bundler output that expects Node, CDN<script src="https://…">, or other external runtime dependencies. Everything the game needs must ship in the archive (Caught injects the SDK at publish). - Required files —
index.html+manifest.jsonat the archive root (or one root folder containing both). manifest.outcomes— declare the non-emptyresultsubset (win/lose/draw) your game will send inCaughtGame.complete. Rank is not supported yet. Runtime rejects undeclared outcomes.- No Property APIs — never invent score/property keys. Authors map your declared outcomes to Properties on the action.
- Limits — ZIP ≤ 5 MB, ≤ 50 files, allowed extensions only, no nested archives, relative asset URLs, no
connect-src/ external fetch.
Author inputs (manifest.inputs)
If the adventure author must supply configuration (e.g. memory card images, a title, a timer toggle), declare inputs in the manifest. Do not hardcode adventure-specific media when it should be configurable.
| Rule | Value |
|---|---|
| Max fields | 25 |
| Types | string | boolean | image | color | stringTranslateable | imageTranslateable | stringList | stringListTranslateable | stringImageList | stringImageListTranslateable |
| String UI | optional format: line (default) | paragraph | select; options (1–24) on string → admin dropdown |
| List UI | stringList* → pills; stringImageList* → sortable tag+image rows (itemMode: either | both) |
Stable id | [a-zA-Z][a-zA-Z0-9_]{0,31}, unique |
| Labels / help | en, nl, de required; label ≤ 40 chars, help ≤ 150 chars |
required | Per-field only. true = always mandatory in the action editor; omit/false = optional (editor prefills from mock). No general requiredIf / oneOf — use inputConstraints.matchColumns for column OR/length |
mock | Required on every field (optional and required) — review + editor + live fallback when the author has not set a value |
| String length | 0 ≤ minLength ≤ maxLength ≤ 2000 (also per item for stringList*) |
| Image / list count | minCount/maxCount, max 50 per field |
| Image size | minWidth/maxWidth/minHeight/maxHeight, each 1–2560. Mins = hard reject (no upscale); maxes = Caught auto-downscales on upload. Default mins to 1 unless the game needs a real floor. |
| Image mocks | { placeholder: true, label?, bg? } arrays — no PNG/JPG in the ZIP; Caught emits SVG data URLs |
Same-name updates | Must stay backward compatible. Rejected: remove/rename id, flip type, optional→required on an existing id, raise minLength/minCount/minWidth/minHeight, lower maxLength/maxCount/maxWidth/maxHeight, drop outcome results. OK: widen those bounds, add fields (new required needs a usable mock). Intentional breaks → new minigame name. |
Caught authors fill these in a modal of cards on playminigame. Values are validated again on the server and passed on init as:
CaughtGame.onInit((ctx) => {
const { inputs, locale } = ctx.context;
// string | boolean | string[] | { [lang]: string } | { [lang]: string[] }
const title = inputs.headline?.[locale] || inputs.headline?.en || inputs.boardTitle;
const tags = inputs.leftTexts?.[locale] || inputs.leftTexts?.en || [];
});
Translateable author values are Caught multilang maps; authors must fill every active GameType language. Translateable mock must include en, nl, and de.
Do not put mock image files in the bundle — use placeholder objects so review stays offline and CSP-safe.
Use stringList / stringListTranslateable for tag-only arrays (pills UI). Use stringImageList / stringImageListTranslateable when each row is a tag and/or image (itemMode: "either") or tag+image (itemMode: "both") — one reorderable list in admin (see Connect leftItems/rightItems). Prefer these over asking authors to type left | right lines in a paragraph.
Cross-field conditionals
Column length + text/image OR: declare top-level inputConstraints with type: "matchColumns" (see Bundle & manifest). Caught enforces that on save / preview / session. Keep the four column fields optional; put a valid combo in mock.
Other OR / AND-across-fields (e.g. “timer or attempt limit”) are still not platform-enforced. Use this pattern:
- Manifest — leave every branch
required: false. Do not invent keys likerequiredIf,dependsOn, oroneOf. Put the rule inhelp. Alignmockwith one valid combo. - Runtime — in
CaughtGame.onInit, validate the combination. On failure: setup/error overlay; no Start / no play. - When multiple branches are filled — use all provided content when the UX allows it.
- No silent refill of empty OR branches — do not inject
assets/or hard-coded demo rows. Optional empty = empty (stringList[]stays empty on soft-adapt). assets/— Prefer chrome-only. Required gameplay content → author inputs +mockfor preview (MemorycardImages, Connect columns). Not OK to paper over an unsatisfied OR.
// Pseudocode — see the Connect example (v2 columns)
const leftTags = inputs.leftTexts?.[locale] || [];
const leftImgs = inputs.leftImages || [];
// matchColumns already blocked bad saves; still guard in-game
if (!leftTags.length && !leftImgs.length) {
errors.push(t('configNeedContent'));
}
// texts + images on a side → show both per row
Reference: Connect in Examples and Bundle & manifest — inputConstraints.
Bundled default media → assets/
When the game ships its own fallback art/audio (used when an optional author image input is empty, or for always-on chrome the author cannot replace), put those files in a root folder named assets/:
my-minigame/
index.html
manifest.json
cover.png # catalog only — stay at root
assets/
pair-01.webp # gameplay defaults
back.webp
| Put here | Do not put here |
|---|---|
Embedded defaults the game references with relative URLs (assets/…) | Catalog cover.png / cover.jpg / cover.webp (archive root) |
| Optional logo/sprite/SFX the game always can fall back to | Author image mocks (use { placeholder: true } in the manifest) |
Loose media dumped next to index.html when an assets/ folder would fit |
References: Memory and Connect in Examples.
Context you may use (phase 1)
After CaughtGame.onInit, read from ctx.context (see SDK overview):
| Field | Spec | Notes |
|---|---|---|
locale | string | Active language code (e.g. en, nl) |
actionId | string | Configuring playminigame action _id — always present. Seed procedural maps/layouts for consistency. If you use it, set manifest.usesActionId: true so review preview can regenerate a Layout ID. |
team.name | string | Generic team label, always present |
player.displayName | string | Generic player label, always present |
inputs | object | Author config keyed by manifest.inputs[].id (may be {}). Use type color for hex colours (#rrggbb) — do not expect context.theme. |
Recommended label pattern: `${player.displayName} (${team.name})`.
Do not expect context.others (other teams) — not shipped yet.
CaughtGame.onInit((ctx) => {
const { team, player, locale, actionId, inputs } = ctx.context;
const label = `${player.displayName} (${team.name})`;
// Seed RNG / layout from actionId when generation must be stable per action.
// …
});
Lifecycle the game must implement
- Wait for
CaughtGame.onInitbefore using context / starting play that depends on inputs. - Keep the UI blank until images are ready: CSS
html:not(.cg-ready) body { visibility: hidden }, thenCaughtGame.preloadImages(urls)(author + bundled), thendocument.documentElement.classList.add('cg-ready'). No loading splash — show nothing until then. Canvas-only games still reveal afteronInit(empty preload is fine). - Finish with
CaughtGame.completeonce (declaredresult:win/lose/draw). - Prefer handling pause / resume / terminate if you use timers or audio.
Exact “start” UX is up to the game (auto-start after init is fine).
Complete vs abort (host behaviour)
| Path | Who triggers | What the game should do | Caught step result |
|---|---|---|---|
| Complete | Your game | Call CaughtGame.complete({ status: 'success', result }) once with a declared result (win / lose / draw) | Applies matching minigameOutcomeProperties; step succeeds |
| Fail status | Your game (optional) | CaughtGame.complete({ status: 'fail', … }) | Treated as wrong answer / fail (quiz mode may still continue) |
| Abort | Player taps host X (top-left) / back | Host confirms, then sends terminate; you clean up — do not call complete | Author On abort: fail = fail step; skip = advance without competitive outcomes; reset = remount session (play again, no step submit) |
Games own competitive outcomes via complete. Host Close is abort, not a game-reported lose. Do not implement your own close/quit that tries to leave the host; do not post a close message.
Host / review corner safe zones (required)
Caught overlays chrome the game does not own. Leave both corners free of HUD/controls:
HOST_CLOSE_SAFE_ZONE = 80— top-left 80×80 CSS px (host Close X; safe-area aware).REVIEW_SETTINGS_SAFE_ZONE = 80— top-right 80×80 CSS px (dev / review settings cog; clear in all builds).
In-play info / introduction (required pattern)
When the game has a start title + explanation, ship a small i control during play that reopens that introduction (same copy as the start screen).
| Rule | Detail |
|---|---|
| Corners | TR, BR, or BL only — never TL (host Close owns top-left) |
| Content | Title + explanation (introduction text); primary action is Continue (localized) |
| Timers | Pause all countdowns / attempt clocks while the info overlay is open; resume on Continue |
| Visibility | Hide the i while any blocking overlay is up (start / pause / end / info itself) |
| Reference | Codebreaker and Connect examples |
Do not put the info control in the top-left. Prefer BR when the footer is free; use TR only below the 80×80 review settings zone (or clear of it).
Win / lose end screen (required pattern)
Every game that can end in win or lose must use a full-screen overlay end screen (same shell as start / pause / info) — not footer-only copy.
Author inputs
Input id | Overlay role | Limits |
|---|---|---|
winCaption / loseCaption | Title | ≤40, stringTranslateable |
winText / loseText | Body under title | ≤80, stringTranslateable, format: "paragraph" |
Empty → localized defaults. Score/detail may fill the body only when author text is empty. Never ship a single title string alone.
Overlay structure
#overlay (.win | .lose | .interactive)
#overlay-title ← caption
#overlay-sub ← body text
#overlay-actions
#btn-end ← End / Finish → CaughtGame.complete
Behaviour
| Rule | Detail |
|---|---|
| Both lines | Always show title + body on win and lose |
| Complete | Defer CaughtGame.complete until End / Finish (auto-complete only when intentional, e.g. Maze — still use overlay title+body) |
| Tint | #overlay.win / #overlay.lose on the title (green / red) |
| Footer | Keep #message for in-play hints only; hide/disable submit while end overlay is up |
| Info / pause | Do not open help or treat pause as play once the end overlay is showing |
| Reference | Memory, Pong, Connect, Unblock Me examples |
Hide scrollbars (keep scrolling)
Scrollable boards / lists should hide the scrollbar when possible while remaining scrollable (touch + wheel). Use:
.scroll-area {
overflow-y: auto;
scrollbar-width: none; /* Firefox */
-ms-overflow-style: none; /* legacy Edge */
}
.scroll-area::-webkit-scrollbar {
display: none; /* Chrome, Safari, Chromium Edge */
width: 0;
height: 0;
}
Works in Chromium Edge, Chrome, Safari, and Firefox. Prefer this on game boards and long column lists (see Codebreaker and Connect examples).
Deliverable for review
- ZIP meeting the submission checklist
- Manifest
nameandversionset correctly (Caught reads them from the ZIP; they are required).versionmust be digits-onlyMAJOR.MINOR.PATCHand strictly greater than any prior version for thatname— see Versioning. Every follow-up edit to an example or shipped game must bumpversion(do not leave it unchanged). - Labels ≤ 40 / help ≤ 150 chars per language (en / nl / de); every input has a
mock - Code paths for every declared outcome and every declared input
id