This guide is for everyone who writes LexVM content packs: people writing by
hand, people prompting a chat LLM, and the lexvm generate pipeline. The pack
format is specified in content-pack.md; this guide
is about making the game good: fair, solvable, and pleasant to play on a
phone. How to generate packs with an LLM is described in
pipeline.md.
Maintainers: the parts between
<!-- prompt:begin … -->and<!-- prompt:end … -->markers are embedded into the LLM prompts bylexvm promptandlexvm generate(guideregions as the condensed guide, thechecklistregion as the self-check list). Keep them terse, imperative and self-contained; put explanations for humans outside the markers. After editing, runnpm run promptsto regenerateprompts/oneshot.md(a test fails while it is out of date).
LexVM players mostly tap: they tap an object, pick a verb from its action sheet, and for two-object verbs ("use … with …", "show … to …") pick a second object. A text parser exists but is optional. That has consequences for design: the player can see every possible action, so puzzles cannot rely on obscure verbs, and every tap should be answered with something worth reading.
A text adventure is also a story that is read. Verification proves that a
pack can be won; it cannot prove that a reader can follow it. The first noir
pack showed the failure mode: logically sound puzzles wrapped in telegram-style
fragments, while the actual story lived in the design documents and never
reached the player. Section 2 ("Story and scenes") and the pacing setting
exist to prevent that (ADR 0012).
A LexVM game is short and dense: it is played in a few sittings on a phone, often offline. The first pack targets 30–45 minutes.
- A 30–45 minute game has about 10–12 rooms, 6–8 puzzles, 3–5 characters and 8–15 clues or key items. Scale proportionally for other lengths (15 minutes: ~5 rooms, 3–4 puzzles).
- The intro states a clear goal; the first small success comes within the first few minutes.
- Structure the game in 2–3 chapters separated by bottlenecks (a key event everything converges on). Within a chapter several puzzles are open at once.
- End with a climax that uses what the player learned (a confrontation, a deduction), then a winning ending.
- Score is a progress signal: usually 1 point per solved puzzle, 2 for a major deduction. Award each point exactly once (guard with a flag, a
not: { has: … }condition or aoncerule).maxScoreequals the total score collected by the walkthrough.
A pack has two layers: the mechanics (rooms, items, rules, the puzzle chart) and the story (what happened, who wants what, what the player character comes to understand). The mechanics are verified; the story is only as good as the text the player actually reads. Two habits lose it:
- writing text one data field at a time (a description here, a rule message there) instead of one scene at a time, and
- keeping the real story in design notes (the truth, the motives, the backstory) and handing the player only the facts a puzzle needs.
Write the story first, as scenes, then cut it into the data model. Review it
the way the player meets it: lexvm transcript <pack> prints the whole text
of a winning play in order. Read it from start to end, or give it to an
editor (the review prompt stage does that with an LLM). Could a reader
retell what happened and why?
- Write the story before the data: the truth in causal order (who did what, and why), the player character's goal and how their understanding changes, and a scene plan in play order. Then derive room, object, dialogue and rule texts from the scenes.
- Everything the ending relies on reaches the player in game text. Motives, relationships and backstory that only live in the design notes do not exist for the player.
- Every scene has an arrival (where am I, who is here, what is at stake), a turn (something learned or changed) and a way out (why the player goes on, and where). Write the transitions: the first entry to a room, the moment after a key clue, the move from one chapter to the next (a
oncerule onenter, or the response that solves the puzzle). - Give the player character an inner voice in moderation: after a key clue or deduction, one or two sentences on what it means and what follows from it. That is how a reader keeps track of a case.
- Characters want something the player can see, and speak like themselves. A conversation has a turning point; write it out as a scene, not as one line of information.
- Prose rhythm: vary sentence length. Short sentences are accents, not the default; join thoughts that belong together with their logic (because, but, so, while). No telegram style, no chains of fragments, no adjective padding.
- Review the transcript of the walkthrough (
lexvm transcript): it must read as a story a reader can follow from start to end.
playtime is the length a pack aims for, and LexVM checks it: lexvm check
estimates the play time from the walkthrough and the texts (spec section 17)
and warns when the estimate misses playtime by more than 25%. The warning
says how much is missing or too much, in puzzles, walkthrough commands or
words. To see the budget for a length before you write, print a stage prompt
(npm run lexvm -- prompt --stage concept --minutes 40 --lang de) or look at
the table in prompts/oneshot.md.
- LexVM estimates the play time of a pack: reading the text the walkthrough shows (German 200, English 230 words per minute), about 10 seconds per walkthrough command and 6 per dialogue choice, plus part of the optional content (descriptions the walkthrough never examines, unchosen dialogue options, custom responses) and about one wrong attempt per productive command.
lexvm checkwarns when the estimate missesplaytimeby more than 25%; setplaytimeto the target length. pacingsays how that time divides between reading and acting:narrative(about 60% reading: mysteries, dramas, character stories),balanced(about 45%, the default),puzzle(about 30%: puzzle boxes, escape rooms). Declare it in the metadata;lexvm checkthen warns when the reading share leaves the band (±10 points). A narrative pack with the same play time has fewer puzzles and more story.- Follow the size budget the prompt gives for the target length and pacing (walkthrough steps and words of player-visible text). About a quarter of the walkthrough steps are dialogue choices; optional text is about 60% of the walkthrough's text.
- Length comes from content, never from padding. Content is both mechanics (a puzzle, a character to question, custom responses) and story (an arrival, a turning point, what a clue means, a transition between acts). Padding is adjectives, repeated atmosphere and summaries of what the player just saw. To shorten a narrative pack, cut a side puzzle before you cut a scene.
Ron Gilbert's puzzle dependency chart is the tool for designing adventure puzzles. Start at the end — the winning ending — and ask: what has to be true right before it? And what before that? Each answer is a node; an arrow means "is needed for". The result is a graph that shows at a glance whether the game is a boring corridor (a single chain) or an open space where the player always has something else to try when stuck.
A small example for a detective story. Two independent branches (the bar and the harbour) run in parallel and meet in a deduction, which unlocks the confrontation:
flowchart TD
intro([Start: the office]) --> photo[Find the photo in the desk]
intro --> harbour[Walk to the harbour]
photo --> barkeeper[Show the photo to the barkeeper]
barkeeper --> lie((Clue: the barkeeper lied))
harbour --> logbook[Read the harbour logbook]
logbook --> night((Clue: the ship left at night))
lie --> deduce{Deduction: combine both clues}
night --> deduce
deduce --> confront[Confront the captain]
confront --> win([Ending: case solved])
When you draw the chart, check three things: every leaf can be reached from the start, every node has a concrete solution in game commands, and there is no long stretch where only one node is open.
- Design the puzzles as a dependency chart (Ron Gilbert): start from the winning ending and work backwards — what must be true right before it, and what before that. Nodes are puzzles, events, items and clues; an arrow means "is needed for".
- The chart must branch: at nearly every point the player has 2–3 open puzzles in parallel. Never build one long linear chain.
- Every node has a concrete solution in canonical commands, a place in the text where it is signposted, and a hint.
- Every item or clue a puzzle needs is obtainable before that puzzle and can never be lost afterwards.
- Example (Mermaid):
Loading
flowchart TD intro([Start]) --> photo[Find photo in desk] intro --> harbour[Go to harbour] photo --> lie((Clue: barkeeper lied)) harbour --> night((Clue: ship left at night)) lie --> deduce{use clue_lie clue_night} night --> deduce deduce --> confront[Confront captain] --> win([Ending])
LexVM follows the design philosophy that Ron Gilbert summarised in Why
Adventure Games Suck and that LucasArts games made famous: the player should
never be punished for exploring. In LexVM this is not a style recommendation
but a verified property: lexvm check explores every reachable state of the
game and fails the pack if any ending is not a win, or if any reachable state
can no longer lead to a win.
- No deaths and no losing endings: every ending has
win: true. Danger is a narrow escape ("You step back just in time.") that leaves the game state as it was. - No dead ends: from every reachable state the game stays winnable. Never consume, destroy or give away an item that is still needed; if an action uses an item up, record the result permanently (a flag) instead of needing the item again. Never lock the player out of a room they still need.
- Players can drop carried items. If one the solution needs could be left behind a one-way exit, keep it with the player: a rule
on: { verb: drop, object: key }that only says why (lexvm checkexplores dropping as well). - Progress never depends on
inventoryor another command that no action sheet offers: the inventory button only shows the bag. - Essential information must stay obtainable. Dialogue options with
once: trueare fine when the optionlearns the clue (clues are permanent); otherwise keep a repeatable way to get the information. - No "guess the verb": solutions use the core verbs (look, take, open, close, use, talk, give, show, push, pull, go) or a pack verb that the object lists in its
verbs, so it appears in the action sheet. - No pixel hunting: every object the player can interact with is visibly mentioned. Hidden objects are revealed with a clear message (
say+reveal). - No timed puzzles, no mazes, no randomness (the engine has none).
A puzzle is fair when an attentive player could solve it from what the game has shown them. The test: could you write the hint for it by quoting the game's own text?
- Signpost every puzzle in the text before the player must solve it: describe the obstacle, and hint at the solution through an observation, a character's remark or a document. Important solutions get two independent hints.
- Answer plausible wrong attempts with specific rules that teach something:
use rusty_key cellar_door→ "The key is far too small for this lock." Reserve the engine's default "That doesn't work." for implausible ideas. - Examine texts carry the clues: an object description says what is odd or useful about the object.
- Reflect state changes with text variants (
when) in room and object descriptions (the door now stands open, the drawer is empty).
Rules are the heart of a pack. Read section 10 of the spec ("Turn processing") once carefully; most logic bugs come from forgetting that rules replace the default behaviour and that only the first matching command rule fires.
- Rules replace defaults: a rule for
take xmustmovex toinventoryitself if the player should get it. - Only the first matching command rule whose
whenholds fires. Put specific rules before general ones; add a second rule for the "already done" response (seepull_red_book/pull_red_book_againin the example). - Remember progress in flags; guard one-time effects (score, reveal, learn) with
when: { not: { flag: … } }oronce: trueplus anid. - Doors: an openable, non-container object with
locked: trueandunlockedBy: key_id; the defaultuse key_id door_idunlocks it,open door_idopens it; both exits name the door. - Containers:
container: true,openable: true,open: false; contents are only present while open. - Counters changed by
turnrules must be bounded by theirwhen. Prefer flags over counters.
Dialogue-heavy games (interrogations, negotiations) live from the feeling that conversations progress as the player learns more. In LexVM that is done with options that appear when the player holds a clue.
- Hub and spoke: a dialogue starts at a hub node (e.g.
hello) that offers topics; each topic node leads back to the hub ("I see." →goto: hello). The hub always has a way out: an option withoutgoto("Goodbye."). - Interrogations progress by knowledge: options with
when: { has: clue_x }appear once the player knows something.once: truehides an option after use. - Confrontations: let the player show evidence — a rule
on: { verb: show, object: clue_x, with: npc_id }— or offer a dialogue option gated byhas: clue_x. Give characters a reaction to every clue that plausibly concerns them, and one generic reaction (on: { verb: show, with: npc_id }) placed after the specific rules. - Characters remember: change greetings and descriptions with flags after key events.
- Names the player knows: call a character by name only once the player knows the name and that this person has it — it falls in conversation, or it follows compellingly from what the player knows (the missing man found where the confession said he lies). Before that, describe the character by appearance or role. Give such a character a
namewith variants, the real name first:name: [{ when: { flag: knows_graves }, text: Graves }, { text: porter }];setthe flag in the node or rule where the name falls, and give every text that mentions the present character before that a variant without the name. Hearing a name ("ask Graves at the gate") is not meeting its owner. - Node
say≤ 300 characters, option text ≤ 80. Options are the player's words; narration belongs insayordo.
The notebook is LexVM's answer to "where do I keep what I learned?". Clues are objects that live in the notebook part of the inventory. Because they are objects, every verb works with them: the player can use two clues together to deduce something, or show a clue to a character to confront them.
- A clue is a piece of knowledge: an object with
clue: trueandlocation: nowhere, acquired with thelearneffect (reading a document, examining something, a dialogue). Clues sit in the notebook and cannot be dropped or lost. - Clue names are short and telling (≤ 24 characters: "Torn ticket", "Alibi gap"); the description states the fact.
- A clue says only what the player has read by the time it is learned: the notebook can be opened in the middle of a conversation, so an entry must not name a person, place or fact that a later line introduces. Put the
learnafter the last line the entry sums up (in a dialogue: in the node or option that says it), or cut the entry down. The exception is a document whose entry is the document itself (a letter, a list): there the notebook is where it is read. - Deductions combine two clues: a rule
on: { verb: use, object: clue_a, with: clue_b }withwhen: { not: { has: clue_c } }thatlearns the conclusionclue_c(rules are tried in both orders). Only ask for deductions a player can reasonably see; answer plausible wrong combinations gently. - Players tap a clue and choose "Combine with …" ("Kombinieren mit …"), which sends
use; typed, "combine X with Y" / "kombiniere X mit Y" / "vergleiche X mit Y" work. If the story depends on deductions, teach combining once early (a line of inner voice or the first hint step). - Interrogations and confrontations use clues as evidence (see dialogue).
Every LexVM game has a hint button. A good hint system means nobody has to search the web for a walkthrough, and nobody gets the answer before they want it.
- Every puzzle has a hint:
when= the puzzle is known (room visited, clue held),until= the puzzle is solved (flag set, item held, room visited). - 2–3 progressive steps: a nudge ("The butler seems to know more than he says."), a direction ("Ask him about last night."), the explicit solution ("Talk to Graves and ask where your uncle is.").
- The first hint whose
whenholds and whoseuntildoes not is shown, so order hints in the usual solving order, and make sure some hint applies at every point until the ending.
LexVM is read on a phone held in portrait mode, in a book-like layout. Long
paragraphs become walls of text; references ({id}) become tappable words.
- Budgets: room descriptions ≤ 600 characters, object descriptions ≤ 400, dialogue lines ≤ 300 (
pacing: narrative: 1,000, 600 and 600); option texts ≤ 80, names ≤ 24 for every pacing. The player scrolls like a book; a long text needs paragraphs, not cuts. - Paragraphs of 1–4 sentences, separated by a blank line. In descriptions the first sentence says what matters; atmosphere second.
- First visits get the full scene; return visits to a room get one or two sentences (a text variant with
visited). - Mention exits naturally in the room description ("The library lies to the west.").
- Every interactable object appears as
{id}(or{id|inflected text}) in its room's description or in its ownroomText. Portable objects withoutroomTextare listed automatically. - Names are short, without articles, and distinct: "brass key", not "the small brass key".
- Rule messages (
say) are 1–3 sentences; the response that solves a puzzle or reveals a clue may be a short scene.
Ids are always ASCII lower_snake_case; English ids are fine for every pack
language and make diagnostics easier to read. Everything the player sees is in
the pack's language.
- All player-facing text is in the pack
language. Ids are ASCIIlower_snake_case(English ids are fine for any language). - German (
de): narrate in the du-form, present tense ("Du stehst im Kontor.") unless the pack deliberately decides otherwise — then stay consistent. Each character consistently says "Sie" or "du" to the player, as fits the setting. Object names without articles ("Logbuch", "Messingschlüssel"). Inflected references use{id|text}:{logbook|des Logbuchs},{door|die Tür}. Quotes »…« or „…“ — choose one style and use it everywhere. Real umlauts and ß. Add inflected and short forms tosynonyms([Logbuchs, Buch]). - English (
en): second person, present tense ("You are in the hall."). Names lower case except proper nouns ("brass key", "Graves"). One quote style throughout. - Pack verbs need a
labelin the pack language and parsersynonyms(German: imperative and infinitive, e.g.[lies, lese, lesen]).
YAML is friendly until it is not. Almost every pack that fails to load does so because of one of the following.
- Prefer block style. Use flow style (
{ … },[ … ]) only for short, simple values like{ to: hall },{ has: brass_key },[pull]. - Inside a flow mapping,
,and:end the value:do: { say: Hello, world }is broken. Write effects that contain text in block style:do: - say: "Hello, world: nice to see you."
- Quote a string with double quotes if it contains
:or#, ends with:, or starts with",',{,[,*,&,!,|,>,%,@, a backtick,-,?or:. Inside double quotes escape"as\"(or use »…« / “…” quotes, which need no escaping). Inside single quotes write an apostrophe as''. - Multi-paragraph text: a literal block
|-with a blank line between paragraphs. version: 1.0.0(three numbers;1.0would be a number). Booleans aretrue/falseonly.- Indent with two spaces, never tabs.
The walkthrough is the pack's proof of solvability. lexvm check replays it
from a new game, so it has to be exact.
- A list of canonical commands with ids — never display names or translated words:
take brass_key,go north,use brass_key study_door,give coin ferryman,show clue_ticket inspector,talk graves,choose ask_uncle,read letter(pack verb). - Two-object commands list both ids without a preposition:
use a b,give a b,show a b. - Replay it in your head from the start: be in the right room; open doors and containers before going through or taking from them; reveal hidden objects before taking them; inside a dialogue only
choose <option_id>works, for an option available at that moment; leave the dialogue (an option withoutgoto) before the next non-dialogue command. - It ends with the command that triggers the winning ending, and collects every point (total =
maxScore). - Write it last, after all rooms, objects, rules and dialogues exist.
Run through this list before you run lexvm check — and run lexvm check
anyway. The LLM prompts ask the model to go through the same list.
- Undeclared flags or counters. Every flag used in
set,clearor aflag:condition is declared underflags:with its initial value; every counter undercounters:. - Flow-mapping quoting. No unquoted
:,,or#inside{ … }; texts with punctuation are in block style or double-quoted. - Missing reverse exits. Exits are one-way: every exit has a way back in the destination room. A door is in both rooms (
location+alsoIn) and both exits name it withdoor:. - Walkthrough uses names instead of ids. Every command is
verb id [id]with exit, object and option ids — no display names, articles, prepositions or translated verbs. oncerules withoutid. Every rule withonce: truehas anid(better: every rule has one).- Losing endings. Every ending has
win: true; no deaths, no failure endings. - Dead ends. No reachable state from which the game cannot be won: needed items cannot be used up, given away, locked away or lost; essential clues stay obtainable.
- Missing hints. Every puzzle has a hint with
untiland 2–3 progressive steps; some hint applies at every stage until the ending. - Texts too long for phones. Room descriptions ≤ 600 characters, object descriptions ≤ 400, dialogue lines ≤ 300, option texts ≤ 80, names ≤ 24.
- Unreferenced scenery. Every non-portable object (scenery, character, container, door) appears as
{id}in its room's description or has aroomText; every{id}in a text names an existing object. - Broken references. Every id used in exits,
door,unlockedBy,dialogue,goto, conditions and effects exists; characters withdialogue:have that dialogue; every dialogue node is reachable and every dialogue can be left. - Invisible verbs. Every pack verb is declared under
verbs:and listed in theverbsof each object it applies to. - One key per condition and effect.
{ set: a, score: 1 }is two effects; two conditions go in a list orall: […]. - Score. Each point is awarded once;
maxScoreequals the walkthrough's total. - Notebook entries ahead of the story. Every clue description states only what the player has read when its
learnruns. A dialogue thatlearns a summary in an early node and says the rest later gives the game away; move thelearnto the node that says the last fact. - Names before introductions. A character the player meets as a stranger has a
namewith variants (real name first, the description last) and a flag set where the name falls; no text calls the present character by name before that.
lexvm check proves that a pack is correct. Whether it is good is up to
you. Before you publish, play it on a phone and ask:
- Is the goal clear after the intro? Is there an early success?
- When stuck, are there always other things to try (look at the chart)?
- Is every puzzle solvable from the text alone, without the hints?
- Do characters react to the evidence you show them?
- Read the transcript (
lexvm transcript <pack>) from start to end: could a reader retell what happened, who wanted what, and why the player went where they went? Is there a moment where something happens without a reason? - Does any notebook entry run ahead of the story? The transcript shows each entry where it is learned; it may only say what the text above it has said.
- Is any character called by name before the player could know it? Read the commands in the transcript too: "Talk to Graves" before Graves has said who he is gives the name away.
- Does the text read well on a small screen, in the chosen narrative voice, with consistent quotes? Does the rhythm vary, or is it a chain of fragments?
- Are there plausible actions that get a bland default answer where a custom response would be better?
- Does the ending pay off what the player found out?
LLM-generated packs fail in two opposite directions: wordy description with too many atmosphere adjectives, or, under tight length budgets, a telegram style that keeps the story in the model's head and gives the player only the facts a puzzle needs. Both get caught by reading the transcript. LLMs also tend to forget custom responses for wrong attempts. A careful edit pass is part of the job; see pipeline.md for provenance and licensing.