MysteryForgeby Insurrection Studios

Blueprints — a mystery as one document

A blueprint says what is in a game and leaves where to the tool. You write the truth, the cast, the rooms and what is in them, the puzzles and the clues; the tool lays every room out, draws a placeholder picture for each thing in it, writes the hotspots (a door that is locked until a key is used, a drawer that gives an item once, a puzzle that opens when you click it), wires the accusation, and writes the whole game folder — engine, scenes, dialogues, puzzles, clues, mystery, hints, endings, a map. It is the file CASE_FILE.md asks you to write, in a form a machine can build.

node mcp/dist/cli.js blueprint-template --out my_case.json            # a small valid blueprint to start from  (or: make blueprint BP=template OUT=my_case.json)
node mcp/dist/cli.js blueprint my_case.json                           # validate it (nothing is written)
node mcp/dist/cli.js blueprint my_case.json --out /abs/path/my_case   # …and write the game  (or the MCP tool scaffold_from_blueprint)

The MCP has the same three steps — blueprint_template, validate_blueprint, scaffold_from_blueprint (which writes only with apply: true, only into a folder with no game in it, and writes nothing when the blueprint has errors). Afterwards the usual loop: validate_project, analyze_game, find_softlocks, autoplay_game (records a walkthrough), then the real art.

samples/pennyfold.blueprint.json is a whole case written this way — seven rooms, four puzzle types, a phone call, the accusation — and make blueprint-proof builds a game from it and holds the result to the game's whole check suite. samples/larkspur.blueprint.json is a second whole case, written by an agent that had only these documents (AUTHORING_TRIAL.md — what it found and what was fixed). Pennyfold's is generated by samples/gen/pennyfold/blueprint.mjs, which shares its dialogues, puzzles and clues with the hand-built version of the same game: the two can only differ in how the rooms were made.

The shape#

{
  blueprint: 1,                                    // the format version
  game: {                                          // the game
    id: "the_missing_key", title: "The Missing Key", author: "Your Name", credits: "…",
    start: "hall",                                 // the room the game opens in
    intro: "The opening narration.",
    objectives: [{ id: "find_key", text: "Find the missing key." }],
    mail: [{ id: "brief", from: "The Constable", subject: "The key", text: "…" }],      // optional: the first email
    difficulty: { /* optional, SPEC "Difficulty" — the default is Junior (hints) and Senior (none) */ },
    skin: { /* optional, SPEC "Skin" — one look for the menus and every puzzle */ },
    verbs: { list: [{ id: "examine", name: "Examine" }, { id: "open", name: "Open" }] },   // optional, SPEC "Verbs" — play by picking a verb, then the thing
    viewport: { rect: [0.05, 0.06, 0.7, 0.7], default: "full" },                          // optional, SPEC "Framed viewport" — the window a framed room is drawn in
    party: { members: ["dan", "tom"], lead: "dan" },                                       // optional, SPEC "Party" — more than one playable character
  },
  truth: {                                         // what really happened — the player never sees this
    culprit: "vera", means: "…", motive: "…", opportunity: "…", secret: "…", attempts: 3,
  },
  cast: [{ id: "vera", name: "Vera Holt", suspect: true, bio: "…", color: "#d8d0c0", look: { skin, hair, coat, accessory } }],
  items: [{ id: "brass_key", name: "Brass Key", icon: "key", description: "…", combine: [] }],   // icon: the picture drawn (key, note, book, magnifier, swan…)
  variables: { met_vera: false },                  // flags your dialogues and conditions use; the tool declares the ones its own hotspots need
  rooms: [ /* below */ ],
  dialogues: { /* the game's own dialogue JSON: id → { start: {speaker, text, choices, next, actions}, … } */ },
  puzzles: [{ id: "safe_code", type: "keypad", name: "The Study Safe", config: { code: "1234" }, on_solve: [ /* actions */ ] }],
  clues: [{ id: "the_key", title: "The key", text: "…" }],
  mystery: {
    suspects: [
      { id: "vera", means: ["the_key"], motive: ["…"], opportunity: ["…"] },      // the culprit: a clue (two is better) for each leg
      { id: "tom", clears: ["vera_kitchen"] },                                      // everyone else: what clears them
    ],
    accusation: { available_if: [], attempts: 3, win_text: "…", weak_text: "…", wrong_text: "…", lose_text: "…", on_solved: [ /* extra actions before the win */ ] },
  },
  hints: [], contacts: [], endings: [],            // the game's own JSON (the defaults are one hint and the two endings the accusation needs)
  topics: [], deductions: [], achievements: [],    // the game's own JSON too (SPEC "Topics & conversations", "Clues & deductions", "Achievements"); a cast member's `talk` table uses the topics
  walkthrough: [], walkthrough_alt: [], text_route: [],   // optional: recorded routes (each a list of steps, or { name, difficulty, steps }) and a typed route, written into game/walkthroughs
}

Rooms#

{
  id: "study", name: "The Study", group: "House", look: ["interior", 210, 2], map: [0.7, 0.5], music: true,
  exits:  [{ id: "door_hall", to: "hall", label: "Back to the hall", kind: "door", back: true }],
  people: [{ id: "vera", label: "Vera Holt", talk: "vera_intro" }],
  things: [{ id: "desk", kind: "desk", label: "Desk", text: "…", take: { item: "brass_key", clue: "the_key" } }],
  on_first_enter: [ /* actions */ ],
}

look is [kind, hue, seed] — kind interior, stone, outdoor, cave, dusk_sea or shore. Nothing has coordinates. Exits, people and things are laid out in the order written: things that hang on a wall (window, painting, board, shelf, clock, bell, net, pigeonholes, lens, wheel) along the upper row, everything that stands on the floor (doors, people, desks, chests…) along the lower one, spaced evenly. A room holds at most 14; the validator says so. An author who wants a box of their own writes at: [x, y, w, h].

Playable characters. With game.party, a thing may carry requires: { lead: "tom" } (and/or present: ["dan", "tom"]) and a refusal — a sentence, or one per member — and its text may be written per member ({ "dan": "…", "tom": "…", "*": "…" }), which becomes the lead's own spoken line. The written game gets the party bar, a switch hotspot per member in every room (party_<id>), and for a thing with requires a twin <id>__refused that answers while it is not met. A walkthrough says { "lead": "tom" } to switch.

Ids you will type later. A thing that changes (a pickup, a locked door, a puzzle, states, a person with variants) is several hotspots shown one at a time, and each after the first gets a suffix: desk, then desk_2. A walkthrough or a typed route clicks the id of the one showing — click door_workshop while the door is shut, click door_workshop_2 once it is open. (click <name> in the text front end also finds a thing by what it is called.) A cast member's look is { skin, hair, coat, accessory }: colours as #rrggbb, accessory one of glasses, beard, cap, collar.

An exit
to, label the room it leads to, what the player sees
kind door (default), building, tower, stairs, gate, sign, path (an invisible way on)
back: true the cursor shows "back" rather than "forward"
locked: {text, key?, until?} two hotspots: while shut it says text — and, with key (an item), the player uses that item on the door to open it for good (holding it is not enough); until is one variable condition ({var, eq}, or a list holding just that) that opens it instead, e.g. after a conversation. Without until the tool declares <id>_open
if a condition list for the whole exit
A person
talk the dialogue a click starts
variants: [{if, talk}] a different conversation under different conditions (shown one at a time: pike, pike_2)
converse: true instead of talk: the cast member's own ask / show menu — Ask about… each topic they have a reply for, Show something… each item they react to (SPEC "Topics & conversations"). Needs a talk table on the cast entry (below); talk and converse are one or the other, and a variant may use either
A thing
kind what is drawn: desk table chair bed chest crate barrel boat safe rug lamp plinth wheel fireplace altar pew tree rocks gravestone house lighthouse and the wall kinds above
text what looking says
take: {item?, clue?, journal?, objective?, flag?, after?, actions?} gives the item and the clue once (then says after); flag names the variable it sets (default <id>_taken)
puzzle, solved_text clicking opens the puzzle until it is solved, then says solved_text
use: [{item, consume, actions}], wrong an item used on it
states: [{if, text, actions, talk, goto}] several hotspots shown one at a time
hotspots the game's own hotspot JSON, for anything the above cannot say
decor: true drawn and not clickable (a lamp, a tree)
container: "desk_drawer" the thing is one of the room's containers: a click opens it, and in a game that has an open verb that verb does too (its verbs may still add or replace answers)
verbs: {examine: "…", open: [steps]} what each of the game's verbs does to it (any exit, person or thing): a sentence is shown (show_text), a list is the steps to run. A verb the game does not define is an error; a verb a thing has no entry for refuses with the verb's own line. What you write here beats what the thing's own click gave it (next two rows)
verb: "grab" in a verb game, which verb does the thing's own click — what take gives, a puzzle opening, its actions. Default: Take for a take thing, Open (else Use) for a puzzle; a game without that verb leaves the click as it was
verbs_only: true the plain click does nothing (it asks the player to choose a verb): what it did moves under its verb (take → Take, a puzzle → Open, text → Examine). An error when there is no verb to move it to, or with states / hotspots

An item in items may carry the same table — items: [{ id: "wallet", name: "Wallet", icon: "note", verbs: { examine: "Three receipts and a train ticket." } }] — answered when the player arms a verb and presses the item in the inventory.

A room may list containers (SPEC "Containers") — containers: [{ id: "desk_drawer", name: "Desk drawer", items: ["brass_key"], accepts: [], on_take: { brass_key: [ /* steps, e.g. the clue it gives */ ] } }] — drawers, trunks and boxes that open to show items the player takes out and puts back. Something opens one with the step { "action": "open_container", "container": "desk_drawer" } (usually a thing's verb: verbs: { open: [{ action: "open_container", container: "desk_drawer" }] }); { "contains": "desk_drawer", "item": "brass_key" } is the matching condition. Container ids are unique across the game and their items must be items.

A room may say viewport: "framed" (drawn in the game's framed window) or "full" (the whole screen). Both settings are plain game settings, written to project.json as they stand — SPEC "Verbs" and "Framed viewport" say everything else. In a verb game a thing answers its verbs by itself: a thing with take answers Take with what taking gives (the text, the item, the clue — once; afterwards its after line, state by state), a puzzle answers Open by opening, and a plain thing's text is what Examine says — so a verb game needs no more writing than a one-click game; add verbs only for what you want said differently. The thing's plain click (text, take, puzzle…) still works with no verb armed, so a verb game and a one-click game are the same blueprint; add verbs_only: true to make the thing answer only to a verb (the classic verb-adventure way: nothing happens until you say what to do).

Asking and showing#

To let a player put a clue or an item in front of someone, give the cast member a talk table and declare the topics it answers; the person's hotspot says converse: true:

topics: [{ id: "the_alarm", name: "The alarm", known_if: [{ has_clue: "alarm_log" }] }],
cast:   [{ id: "voss", name: "Alma Voss", suspect: true,
           talk: { ask:  { the_alarm: [{ text: "Everyone has the code.", once: true }, { text: "…Fine. It was mine." }] },
                   show: { scarf_scrap: { text: "Half the town knits.", actions: [{ action: "add_clue", clue: "scarf_match" }] }, "*": { text: "Never seen it." } } } }],
rooms:  [{ id: "office", /* … */ people: [{ id: "voss", label: "Alma Voss", converse: true }] }],

The validator checks that every topic a table answers is declared, every item it reacts to exists, a reply's dialogue exists, and that learn_topic / converse steps name real topics and people. A first meeting is still a dialogue: variants: [{ if: [{ var: "met_voss", eq: false }], talk: "voss_intro" }, { if: [{ var: "met_voss", eq: true }], converse: true }].

What the validator says#

validate_blueprint runs before anything is written, cheap and pure (no Godot). Errors stop the build: a missing id or a duplicate; an exit, dialogue speaker, dialogue target (goto, next), puzzle, item, dossier character or clue that does not exist; a culprit not in the cast or with no clue for means, motive or opportunity; a room with more than 14 things; a bad look or kind; and a key a blueprint does not carry — a misspelt walkthroughs, or a document it has no slot for (regions, a score, locales) — because it would otherwise be left out of the game without a word (keys starting _, $ or // are notes to yourself and are ignored). Those documents are added to the written game with the MCP tools or the Studio. Warnings are the case file's fairness rules: only one clue for a leg of the case (one is a coincidence, two is a case); a suspect with nothing that clears them (a red herring with no way out is a lie, not a puzzle); a clue nobody gives; a room you cannot reach by walking; a door you cannot come back through; a thing that says nothing; a task (an objective) that nothing ever ticks off.

The deep checks stay where they were, because they need the engine: what a puzzle's settings mean (a word lock's solution may only use letters; a gear train must connect) is checked by the game's own validator once it is written. Run it before anything else:

cd <the new game> && godot --headless --path . --import      # once, so the new pictures load
SKIP="fuzz lint" bash tools/check.sh                          # validate, story, softlocks, puzzles, walkthrough, autoplay… (drop SKIP for the full suite)

validate_project, analyze_game (can it be won? does every clue matter?), find_softlocks and autoplay_game are the same checks one at a time. Read the failures in that order: a typo in a puzzle is validate, a case that cannot be finished is story/softlocks.

Why a blueprint is not a cage#

Everything the sugar cannot say is written in the game's own JSON, in the same file: dialogue nodes and choices with conditions, action lists on puzzles, rooms and pickups, raw hotspots, any puzzle config. The blueprint adds layout and wiring; it takes nothing away. A game made from one is an ordinary game — nothing in it points back at the blueprint — and from then on it is edited in the Studio or through the MCP like any other.

This page as Markdown: /docs/blueprint.md · Engine 0.101.0