L1
Β·
Quiz
Β·
Lab
L2
Β·
Quiz
Β·
Lab
L3
Β·
Quiz
Β·
Lab
L4
Β·
Quiz
Β·
Lab
Module Test
Module 4 Β· Lesson 1

The Grammar of Branching Stories

Nodes, choices, and the structural logic that separates interactive narrative from ordinary prose.
What is a branching narrative really made of β€” and how do you prompt AI to build one?

In 1976, Will Crowther wrote a 700-line FORTRAN program called ADVENT β€” the first text adventure. Players typed commands; the program branched. Decades later, Twine games, HBO's Bandersnatch, and AI-driven chatbots all operate on the same structural skeleton Crowther sketched in that Fortran listing: a node, a set of exits, and a state machine tracking where the reader has been.

What Is a Branching Narrative?

A branching narrative is any story whose path through events is determined by choices β€” either reader choices, system state, or a combination of both. The defining unit is the node: a discrete story beat that presents information and, usually, one or more decision points that route the reader forward.

Three structural archetypes dominate the field. The linear branch offers choices that converge back to the same spine β€” the reader feels agency but the author controls the destination. The parallel branch sends readers down genuinely different paths that never reconverge, multiplying the writing required. The nested branch (or "diamond structure") opens up locally then closes back, a compromise that preserves authorial economy while still delivering meaningful divergence.

Opening Node
↙ ↓ β†˜
Choice A Choice B Choice C
β†˜ ↓ ↙
Convergence Node
Diamond / nested structure β€” local divergence, shared destination
Key Vocabulary
NodeA discrete unit of narrative content. Can be a scene, a line of dialogue, or a paragraph. Nodes are the atoms of branching structure.
Edge / LinkA directional connection between nodes, triggered by a player choice or automatic condition. The collection of edges forms the story graph.
State variableA stored value (flag, counter, relationship score) that the system can check when routing. State enables conditional branching without requiring a new physical path for every possibility.
Leaf nodeA terminal node with no outgoing edges β€” an ending. A well-designed game has multiple leaf nodes of varying emotional valence.
Bottleneck nodeA node that all or most paths must pass through. Used to reassert thematic control and reduce writing overhead.
Why Structure Matters Before You Write

The worst mistake new interactive authors make is writing prose first and inserting branch points later. Branching is structural, not ornamental. If you plan the graph after the writing, you will find that most of your prose only fits one path, and you will be forced either to rewrite everything or to make choices that feel cosmetic.

The professional workflow β€” validated by studios from Inkle to BioWare β€” is: graph first, prose second. Sketch nodes and edges as a flowchart or plain text outline. Identify bottleneck nodes early (they will anchor your theme). Only then write node prose.

This workflow maps directly onto how you should prompt AI. When you ask a language model to "write a branching story about X," you will get something that reads like a branching story but is structurally incoherent β€” choices that go nowhere, states that are never checked, endings that appear arbitrarily. The solution is to prompt for structure first: ask the AI to output a node/edge list, review it, correct the graph, then ask it to write prose for each node.

Prompt Pattern β€” Graph-First

"Generate a node/edge map for a 12-node branching story about [topic]. Format each node as: NODE_ID | summary (1 sentence) | choices: [label β†’ target_node_id]. Do not write prose yet. Identify which nodes are bottlenecks."

The Twine Ecosystem as a Reference Model

Twine, released by Chris Klimas in 2009 and now at version 2, became the dominant free tool for interactive fiction because it made the graph visible. Its visual editor shows nodes as boxes and links as arrows, making structural mistakes immediately apparent. By 2023 the Twine itch.io tag had over 30,000 games β€” making it the largest single repository of branching narrative work in existence.

Twine's two main story formats β€” Harlowe and Sugarcube β€” both support state variables through macro syntax. When prompting AI to generate Twine-compatible scripts, specifying the format (and pasting a short example of correct macro syntax) dramatically improves output quality.

Historical Note

The term "interactive fiction" was coined by Infocom co-founder Marc Blank in 1979 to distinguish their text adventures from arcade games. Infocom's Z-machine virtual machine β€” designed so one codebase could run on any platform β€” was a direct ancestor of today's platform-agnostic interactive story runtimes. The Z-machine specification is still publicly available and still used in IF competitions.

Mapping AI Capabilities onto Branching Tasks

Language models excel at certain branching tasks and struggle with others. Understanding the gap helps you design prompts that play to AI strengths.

AI Does Well

Writing node prose for a given context. Generating plausible choice labels. Expanding a one-sentence node summary into a full scene. Suggesting emotionally resonant leaf node outcomes. Maintaining voice consistency across nodes when given examples.

AI Struggles With

Tracking global state across a long conversation. Ensuring every edge leads to a valid node ID. Maintaining consistent character knowledge across non-linear paths. Avoiding "phantom choices" that appear to matter but don't change outcomes.

The practical implication: use AI as a node-level writer and a brainstorming partner for graph topology, but maintain the graph yourself in a separate document or spreadsheet. Never trust a language model to count its own nodes accurately β€” always verify the node/edge list before proceeding to prose.

Module 4 Β· Lesson 1

Quiz β€” The Grammar of Branching Stories

Four questions Β· Select the best answer
1. In branching narrative terminology, what is a "bottleneck node"?
Correct. Bottleneck nodes are structural anchors β€” all paths converge there, allowing the author to reassert theme or deliver necessary information without writing multiple redundant scenes.
Not quite. A bottleneck node is defined by convergence (all paths pass through it), not by choice count, premature endings, or visibility conditions.
2. What is the recommended professional workflow for designing a branching narrative?
Correct. "Graph first, prose second" is validated by professional studios from Inkle to BioWare. Planning structure before prose prevents choices that feel cosmetic or lead nowhere.
Not quite. Writing prose first and inserting branches later is described in the lesson as the worst mistake new interactive authors make. The graph should come first.
3. Which of the following is a task where AI language models excel in branching narrative work?
Correct. AI excels at node-level writing tasks β€” expanding summaries into prose, generating choice labels, maintaining voice β€” but struggles with structural consistency, state tracking, and accurate self-counting.
Not quite. State tracking, valid edge targets, and accurate node counting are all areas where AI struggles. Its strength is in node-level prose writing and brainstorming.
4. The tool Twine was significant for interactive fiction because it:
Correct. Twine's visual editor made structural mistakes immediately apparent by displaying the graph explicitly. Released in 2009 by Chris Klimas, it democratized IF authorship and by 2023 had over 30,000 games on itch.io.
Not quite. The first digital branching narrative was Will Crowther's ADVENT (1976). The term "interactive fiction" was coined by Infocom's Marc Blank in 1979. Twine (2009) was significant for its visual graph editor, not for being first.
Module 4 Β· Lab 1

Build a Node Map

Practice prompting AI to generate a graph-first branching structure Β· 3 exchanges to complete

Your Task

In this lab you will practice the graph-first workflow by prompting the AI assistant to generate a structured node/edge map for a short branching story. Focus on getting clean structure β€” node IDs, summaries, and labeled edges β€” before any prose is written.

Work through at least three exchanges: first request the graph structure, then ask for refinements (add a bottleneck node, adjust the number of endings), then request one node expanded to full prose.

Suggested opener: "Generate a node/edge map for a 10-node branching story set in [your chosen scenario]. Format: NODE_ID | summary | choices: [label β†’ target]. Mark any bottleneck nodes."
AI Narrative Lab
Graph Structure
Ready to help you build a branching story graph. Tell me your scenario β€” a setting, a central conflict, or just a premise β€” and I'll generate a structured node/edge map. We'll work graph-first: structure before prose.
Module 4 Β· Lesson 2

Choice Design and Player Agency

What makes a choice meaningful β€” and how AI can help you test whether yours are.
How do you ensure that giving readers a choice actually changes their experience β€” rather than just feeling like it does?

When BioWare shipped Mass Effect 3 in 2012, the ending offered three choices that β€” despite over 80 hours of prior branching β€” produced nearly identical outcomes. The player response became known as the "Indoctrination Theory" controversy and generated a formal petition of 65,000 signatures demanding revised endings. BioWare released an Extended Cut DLC. The episode is the most-cited case study in professional game writing curricula for what happens when choices fail to deliver on their implicit promise of consequence.

The Anatomy of a Meaningful Choice

Choice designer Richard Rouse III (Ubi Soft, The Suffering) identified three criteria for meaningful player choice, now standard in interactive narrative pedagogy: choices must be distinct (each option must feel genuinely different from the others), consequential (the choice must change something β€” the story, the world, the character), and informed (the reader must have enough context to make a real decision, not a blind guess).

A fourth criterion, added by narrative designer Anna Anthropy in her 2012 book Rise of the Videogame Zinesters, is expressive: the best choices let the reader say something about who they are, not just solve a puzzle. This distinction between expressive and instrumental choices maps onto the difference between RPG dialogue wheels and adventure game puzzles.

The Four Criteria

Distinct β€” each option genuinely differs Β· Consequential β€” something changes as a result Β· Informed β€” reader has enough context Β· Expressive β€” the choice reveals or constructs identity

The Illusion of Choice Problem

An illusory choice is one where all options produce the same narrative outcome. It can be literal (all paths converge at the same next node regardless of selection) or functional (paths diverge but the outcome is emotionally or informationally identical). Readers are surprisingly good at detecting both kinds, and the detection destroys trust in the narrative system.

In 2015, researchers at MIT's Comparative Media Studies program studied 200 Twine games and found that 61% of choice points were functionally illusory β€” they led to paths that reconverged within two nodes with no state change. The study concluded that most first-time authors default to the comfort of illusory choice because writing genuinely divergent paths is expensive.

61%
Illusory choices in sampled Twine games (MIT CMS, 2015)
3–4
Max meaningful choices per node before cognitive overload
2Γ—
Re-read rate for games with high-consequence choices vs. low
Using AI to Audit Choice Quality

One of the highest-value applications of AI in branching narrative work is choice auditing. Once you have a draft node/edge map, you can paste it to a language model and ask it to flag illusory choices, identify where consequences are missing, and suggest what state changes each choice should produce. This is faster and more systematic than manual review.

A well-formed audit prompt identifies the four criteria explicitly, so the model knows what to check. It also asks the model to suggest β€” not just identify β€” improvements, which produces more actionable output.

Prompt Pattern β€” Choice Audit

"Review the following node/edge map. For each choice point, evaluate: (1) Are the options truly distinct? (2) What does each option change (state, relationship, world)? (3) Does the reader have enough context to choose meaningfully? (4) Is there an expressive dimension? Flag any illusory choices and suggest a specific consequence that could be added to fix them."

Choice Architecture: Practical Heuristics

Two options create binary thinking but are easy to write and tend to feel high-stakes. Three options are the cognitive sweet spot β€” they imply a spectrum (typically: safe/cautious, risky/bold, and a lateral third option that reframes the problem). Four or more options require more cognitive load from the reader and are best reserved for moments where the choice is the point (character-defining moments, final decisions).

Avoid symmetrical consequences. If choosing A gains you an ally and choosing B gains you information, the choices feel distinct. If A gives you +5 strength and B gives you +5 intelligence, the choices feel like menu items β€” mechanically differentiated but narratively inert.

The technique of hidden state β€” where a choice plants a flag that only matters ten nodes later β€” is one of the most powerful tools in interactive narrative design. It creates the sensation of a world that remembers. When prompting AI to design choice consequences, explicitly ask it to include at least one "planted flag" per major choice cluster: a consequence that will manifest later, not immediately.

Industry Reference

Inkle's 80 Days (2014) features over 750,000 words of branching prose across 169 cities, yet maintains remarkably high choice quality. Lead writer Meg Jayanth described the approach in her 2015 GDC talk: every choice was stress-tested by asking "what does this tell the reader about Passepartout?" β€” keeping expressive weight on choices even when the informational stakes were low.

The "False Branch" Technique

Sometimes you want the sensation of agency without the writing cost of full divergence. The false branch technique β€” also called "bark variation" in game narrative writing β€” produces different prose for the same structural outcome. The reader experiences a unique path; the node graph stays manageable.

False branches are legitimate when used consciously and sparingly. They become a problem when they are the only tool in use. A well-designed interactive narrative should mix false branches (for texture and re-read value) with true branches (for genuine consequence) and use state variables to make the two kinds feel consistent.

Module 4 Β· Lesson 2

Quiz β€” Choice Design and Player Agency

Four questions Β· Select the best answer
1. Anna Anthropy's fourth criterion for meaningful choice β€” beyond distinct, consequential, and informed β€” is:
Correct. Anthropy's contribution from Rise of the Videogame Zinesters (2012) β€” expressive choices let readers construct or reveal identity, not just solve puzzles. This distinguishes RPG dialogue wheels from adventure game mechanics.
Not quite. The fourth criterion is "expressive" β€” the idea that the best choices let the reader say something about who they are, introduced by Anna Anthropy in her 2012 book.
2. What did the 2015 MIT Comparative Media Studies research on Twine games find?
Correct. The MIT CMS study found 61% of choices were functionally illusory β€” paths reconverged within two nodes with no state change β€” because writing genuinely divergent paths is expensive and first-time authors default to the comfort of illusory choice.
Not quite. The finding was that 61% of choices were functionally illusory, not that branching was over-done. The study highlighted under-investment in genuine consequence, not over-investment in complexity.
3. What is the "hidden state" technique in branching narrative design?
Correct. Hidden state β€” planting a flag that manifests much later β€” is one of the most powerful tools in interactive narrative because it creates the feeling that the world remembers choices. Authors are advised to include at least one planted flag per major choice cluster.
Not quite. Hidden state refers to a choice consequence that is deferred β€” planted now, manifested later β€” creating the sensation of a world that remembers. It's a design technique, not a prose style.
4. The Mass Effect 3 ending controversy (2012) is cited in narrative design curricula primarily because:
Correct. ME3's ending is the canonical industry case study for illusory choice at scale β€” 80+ hours of meaningful branching culminating in three options with nearly identical outcomes, generating 65,000 signatures demanding revised endings and an Extended Cut DLC.
Not quite. The problem was not too many endings but too few genuine differences between the available endings β€” a case study in illusory choice at the worst possible moment: the narrative's climax.
Module 4 Β· Lab 2

Choice Audit and Redesign

Use AI to audit your node map for illusory choices and add meaningful consequences Β· 3 exchanges

Your Task

Take a branching structure β€” either the one you built in Lab 1, or a short one you paste in now β€” and use the AI assistant to audit it for choice quality. The goal is to identify illusory choices and redesign at least two of them to include genuine consequences.

Work through at least three exchanges: paste your node map and request an audit, discuss specific problem choices, then ask for redesigned choice language and consequence specifications.

Suggested opener: "Here is my node/edge map: [paste map]. Please audit each choice point against the four criteria: distinct, consequential, informed, expressive. Flag any illusory choices and suggest a specific consequence or state change that would fix each one."
AI Narrative Lab
Choice Audit
Ready to audit your branching structure. Paste your node/edge map and I'll evaluate each choice point for distinctness, consequence, player information, and expressive weight. I'll flag illusory choices and suggest concrete fixes.
Module 4 Β· Lesson 3

State, Memory, and Continuity

How interactive stories track what has happened β€” and how to prompt AI to simulate persistent memory.
If a reader made a choice thirty nodes ago, how does the story know β€” and how do you make an AI hold that knowledge?

In 2018, Netflix released Black Mirror: Bandersnatch β€” a branching film with over five hours of recorded content, 250 segments, and more than a trillion possible orderings according to the production team. The film used a proprietary state engine called Branch Manager to track viewer choices and gate content behind prior decisions. A viewer who fed Stefan the wrong breakfast cereal early in the film would encounter different dialogue from his father seventy minutes later. The system made memory visible β€” viewers could feel the accumulation of their choices. Bandersnatch won the Emmy for Outstanding Television Movie in 2019.

State in Interactive Narrative

State is any information about the story world or the reader's history that persists across nodes. At its simplest, state is a set of boolean flags: "has the reader met Character X? Yes/No." At its most complex, it is a full simulation of character relationships, inventory, world conditions, and narrative history β€” a model of everything that has happened.

State enables two capabilities that pure branching cannot provide: conditional content (show this node only if state X is true) and accumulative consequence (a consequence that compounds across multiple prior choices). Both are central to the sensation that a branching story is a coherent world rather than a decision tree.

State Types

Flag β€” boolean, present/absent. "Has met the rebel leader." Simple and computationally cheap.

Counter β€” integer, tracks frequency. "Number of times player chose mercy." Enables graded outcomes.

Score β€” float or ranked value. "Relationship with Mara: 0–100." Enables nuanced relationship branching.

State Uses

Gate β€” block content behind a required state. "This option only appears if you have the key card."

Flavor β€” modify prose based on state. "If relationship score > 60, Mara smiles. Otherwise she looks away."

Consequence β€” trigger new content based on accumulated state. "If mercy_count > 3, unlock the pacifist ending."

The Problem with AI and State

Language models do not have persistent memory across sessions, and even within a session their ability to track complex state degrades as context length grows. This is the fundamental tension between AI's prose-writing strength and its state-management weakness.

The standard solution used by interactive narrative studios integrating AI (including Latitude for AI Dungeon and Inworld AI for NPC dialogue) is state externalisation: maintain state in a separate data structure (a JSON object, a spreadsheet, a custom game engine variable store), and inject the relevant state into each AI prompt as a context block. The AI never tracks state; the external system does. The AI reads state from the injected context and generates state-aware prose.

State Injection Pattern

"Current state: {player_name: 'Asha', met_rebel_leader: true, mercy_count: 4, mara_relationship: 72, current_node: 'NODE_17'}. Given this state, write the prose for NODE_17. Mara should acknowledge the player's history of mercy choices. Include a dialogue line where Mara's response reflects the relationship score above 70."

AI Dungeon and the Live State Problem

Latitude's AI Dungeon, launched in 2019 using GPT-2 and upgraded through GPT-3 and later models, was the first widely-used system to test AI as a live branching narrative engine. By 2021 it had over 1.5 million daily active users. The core product challenge was exactly the state problem: as stories grew longer, the AI model would forget early decisions, contradict established facts, or introduce characters that had been killed chapters earlier.

Latitude's engineering team published a 2021 post-mortem describing their solution: a "memory injection" system that maintained a structured summary of key facts and injected them into every prompt as a pinned context block. The summary included: character status (alive/dead/location), key choices made, relationship states, and world facts established. The system dramatically reduced continuity errors but required human curation to remain accurate.

Technical Note

Modern long-context models (Claude 3, GPT-4 Turbo, Gemini 1.5) have context windows of 100,000–1,000,000 tokens, reducing but not eliminating the state problem. Studies by Anthropic and Google show that models reliably recall injected facts placed at the beginning or end of context but show degraded recall for facts buried in the middle β€” the "lost in the middle" problem documented in Nelson Liu et al. (2023). For branching narrative, this means critical state should always be injected at the top of each prompt, not buried in story history.

Prompting for State-Aware Narrative

There are three practical prompt techniques for state-aware interactive narrative generation with current AI tools.

State block injection (described above) is the most reliable. Before each node prose request, prepend a structured state summary. Keep it compact β€” under 200 words β€” and use consistent key names so you can parse and update it programmatically.

Accumulative summary prompting asks the AI to maintain and output a running state summary at the end of each response: "After writing the prose, output a JSON state block reflecting any changes this node produces." You then feed that block back in the next prompt. This is useful for rapid prototyping but requires careful review β€” models will sometimes silently modify state values incorrectly.

Conditional prose variants ask the AI to write multiple prose versions of a single node, each corresponding to a different state condition: "Write three versions of NODE_22: one where the player has high trust with Mara (score > 70), one where trust is neutral (30–70), and one where trust is low (< 30)." You then select the appropriate version in your game engine based on actual state.

Twine State Syntax as a Prompt Aid

When asking AI to generate Twine-compatible content with state, including the correct macro syntax in your system prompt dramatically improves output. For Sugarcube: <<if $mercy_count gte 3>>...<</if>> and <<set $met_rebel to true>>. For Harlowe: (if: $mercy_count >= 3)[...] and (set: $met_rebel to true). Paste examples of both in your prompt and specify which format you want.

Module 4 Β· Lesson 3

Quiz β€” State, Memory, and Continuity

Four questions Β· Select the best answer
1. What is "state externalisation" in the context of AI-driven interactive narrative?
Correct. State externalisation means the AI never tracks state itself β€” an external system (JSON, spreadsheet, game engine) does. The AI reads state from injected context and generates state-aware prose. Studios including Latitude and Inworld AI use this approach.
Not quite. State externalisation means maintaining state outside the AI in a separate data structure and injecting it into each prompt, rather than relying on the AI's context window to track it reliably.
2. Netflix's Bandersnatch (2018) used a system called Branch Manager. What did this enable that standard branching cannot provide without state?
Correct. Branch Manager enabled accumulative consequence β€” a breakfast cereal choice early in the film affected dialogue from Stefan's father 70 minutes later. This made memory visible and created the sensation of a coherent world rather than a decision tree.
Not quite. Branch Manager's key function was tracking prior choices to gate and modify later content β€” creating visible, accumulative consequence across the film's timeline.
3. The "lost in the middle" problem (Liu et al., 2023) has what practical implication for branching narrative prompting?
Correct. Research shows models reliably recall facts at the beginning and end of context but show degraded recall for facts buried in the middle. For branching narrative, critical state blocks should always be prepended (or appended) to prompts, not mixed into story history.
Not quite. The implication is about placement of state within prompts β€” inject critical state at the top or bottom, not in the middle, where recall degrades. The problem is not about story length or the number of variables.
4. What is "accumulative summary prompting" and what risk does it carry?
Correct. Accumulative summary prompting is useful for rapid prototyping β€” ask AI to output a JSON state block after each node, feed it back next time β€” but requires careful review because models will sometimes silently change state values without flagging the modification.
Not quite. Accumulative summary prompting means asking the AI to maintain and output a running state block at the end of each response for reuse. The core risk is that the model may silently alter state values incorrectly.
Module 4 Β· Lab 3

State Injection and Memory

Practice injecting state blocks into prompts for state-aware node prose Β· 3 exchanges

Your Task

In this lab you will practice state injection prompting. Define a small state block for your story (3–5 variables), then ask the AI to write node prose that is explicitly shaped by that state. In subsequent exchanges, change one or two state values and ask for revised prose β€” observing how the output changes.

This models the real workflow: external state management feeding into per-prompt AI generation. Work through at least three exchanges with different state configurations.

Suggested opener: "Here is my current state block: {player_name: '[name]', [key_flag]: true, [relationship_score]: 65, [counter]: 2, current_node: '[NODE_ID]'}. Write 150-word prose for this node. The prose should explicitly reflect the relationship score and acknowledge the counter value."
AI Narrative Lab
State Injection
Ready to practice state injection. Give me a state block (JSON or plain key/value format) and a node context, and I'll write prose that explicitly reflects your state variables. Then try changing the state values and compare the output β€” that's the core of state-aware narrative generation.
Module 4 Β· Lesson 4

AI as Live Narrative Engine

From static branching to dynamic generation β€” how AI changes the authorship model and what creative control looks like.
When the AI generates the story in real time rather than executing a pre-written graph, what does "authorship" even mean?

In December 2019, Nick Walton and his team at Latitude released AI Dungeon built on OpenAI's GPT-2. Within two months, it had been played by over a million people. Unlike any prior interactive fiction system, AI Dungeon did not execute a pre-written graph β€” it generated narrative in response to any free-text player input. The player could type anything; the model would continue the story. This was the first mass-market demonstration that a language model could serve as a live narrative engine rather than a content retrieval system. The product also immediately surfaced the central tension of live generation: without a pre-written graph, authorial intent could only be enforced through the system prompt, not through structural constraints.

The Authorship Shift

In traditional interactive narrative, the author controls the story completely: every node is pre-written, every edge is pre-defined, every state change is intentional. The reader navigates a garden of forking paths, but all paths were planted by the author. Agency is real but bounded.

In AI-driven live narrative, the author becomes a system designer rather than a text producer. The author writes: the system prompt (tone, world rules, character personalities, content guidelines), the initial context (opening scene, world state, player character), and the constraints (what the AI should never do, what it should always maintain). The actual prose of the story is generated dynamically in response to player input.

This is a genuine creative shift, not just a technical one. It requires a different skill set: world-building rigor (because the AI will extrapolate from your rules relentlessly), constraint design (because prohibitions that aren't explicit will be violated), and quality auditing (because you cannot pre-read every possible path).

The Author-as-System-Designer Model

Pre-written IF: author controls every word. AI-driven IF: author controls the rules the AI follows to generate every word. Creative control moves from sentence-level to system-level. The author's voice is expressed through prompt engineering, not prose writing.

Inworld AI and NPC Dialogue

The commercial application closest to mainstream adoption as of 2024 is AI-driven NPC dialogue β€” using language models to generate character speech in response to player input rather than selecting from a pre-written dialogue tree. Inworld AI, founded in 2021, raised $50 million in Series A funding in 2023 and signed partnerships with Niantic and LG, among others.

Inworld's architecture is instructive: each NPC has a character brain β€” a structured document specifying personality, backstory, goals, speaking style, knowledge limits (what the character knows/doesn't know), and content guardrails. The character brain is injected into every AI call. Player speech is passed in; character response is generated out. The game engine manages state; Inworld manages generation. This is state externalisation applied to live NPC dialogue.

The Constraint Design Challenge

When the AI generates story content dynamically, the author cannot pre-vet every possible path. Constraints that are implicit in a pre-written graph must be made explicit in prompts. A character who "would never betray the player" in a pre-written IF is simply never written betraying the player. In live generation, that character will betray the player if the constraint isn't stated and the situation makes betrayal plausible to the model.

Effective constraint design for live narrative AI requires three layers: hard prohibitions (content the AI must never generate regardless of player input), soft style constraints (tone, register, vocabulary that should be maintained), and character integrity constraints (personality traits, knowledge limits, and motivations that must remain stable across the session).

System Prompt Anatomy

World rules β€” physics, magic, technology limits

Tone declaration β€” register, vocabulary, pacing

Hard prohibitions β€” explicit never-do list

Character dossiers β€” personality, goals, knowledge limits

Injected state block β€” current story state

Common Live-Gen Failures

Character drift β€” personality changes over turns

World inconsistency β€” established facts contradicted

Escalation β€” tone darkens beyond design intent

Constraint erosion β€” prohibited content generated after many turns

Repetition β€” same phrases recycled across nodes

Hybrid Architectures

The most sophisticated current implementations use hybrid architectures that combine pre-written structural nodes with AI-generated prose within those nodes. The graph is pre-designed (ensuring structural integrity), but the prose at each node is generated dynamically (ensuring responsiveness to player history and enabling variation on replay).

This hybrid approach was described by game designer Emily Short in her 2022 survey of AI in interactive narrative for the Electronic Literature Organization: "The emerging consensus is that AI generation works best when it is structurally framed. Give AI a room to furnish, not a building to design." Short's analogy is the best practical heuristic for where to draw the line between authored structure and AI generation.

Emily Short's Heuristic

"Give AI a room to furnish, not a building to design." β€” Use pre-authored graph structure to define what AI-generated prose must accomplish in each node, and use AI generation for the texture, variation, and responsiveness within that structure. This preserves authorial intent while gaining AI's strengths in variation and state-aware prose.

Evaluating Live-Generated Narrative Quality

Pre-written IF is evaluated by reading it. Live-generated IF cannot be fully read before release β€” the space of possible paths is too large. Instead, quality is evaluated through red-teaming (deliberately trying to break constraints), sampling (generating and reviewing hundreds of random play-throughs), and player feedback loops (monitoring what players do and say the AI generates).

The field of narrative quality metrics for AI-generated interactive fiction is nascent. Researchers at Georgia Tech's Expressive Intelligence Studio (EIS) have proposed five measurable dimensions: coherence (internal logical consistency), expressivity (variance and surprise), constraint adherence (prohibition compliance rate), character integrity (personality stability), and engagement (proxy-measured by session length and replay rate). Using these five dimensions as evaluation criteria β€” even informally β€” gives you a framework for iterating on your system prompt.

Module 4 Β· Lesson 4

Quiz β€” AI as Live Narrative Engine

Four questions Β· Select the best answer
1. What was historically significant about AI Dungeon (2019) compared to all prior interactive fiction systems?
Correct. AI Dungeon's significance was that it replaced the pre-written graph with live generation β€” the player could type anything, and the model would continue. This demonstrated for the first time at mass scale that a language model could serve as a live narrative engine.
Not quite. AI Dungeon's historical significance was replacing the pre-written graph with live generation β€” any free-text player input would receive a dynamically generated narrative continuation, unlike all prior IF which executed pre-authored content.
2. In the "author-as-system-designer" model for AI-driven narrative, creative control shifts from:
Correct. In AI-driven narrative, the author's voice is expressed through prompt engineering rather than prose writing β€” designing the world rules, constraints, and character specifications that govern AI generation. Creative control moves from sentence-level to system-level.
Not quite. The key shift is from sentence-level writing to system-level design β€” the author writes the rules (system prompt, constraints, character dossiers) that govern AI generation rather than writing the prose directly.
3. Emily Short's heuristic for where to draw the line between authored structure and AI generation is:
Correct. Short's heuristic β€” "give AI a room to furnish, not a building to design" β€” means pre-authored structure defines the what; AI generation handles the how within each node. This preserves authorial intent while gaining AI's variation and state-aware strengths.
Not quite. Short's heuristic is "give AI a room to furnish, not a building to design" β€” meaning pre-designed graph structure is the building, and AI generates the furnishings (prose texture, variation, state-responsive language) within each pre-defined node.
4. Inworld AI's "character brain" architecture is an example of:
Correct. Inworld's character brain β€” personality, backstory, goals, speaking style, knowledge limits, content guardrails, all injected into every AI call β€” is state externalisation applied to NPC dialogue. The game engine manages state; Inworld manages generation from a persistent character specification.
Not quite. The character brain is Inworld's implementation of state externalisation for NPC dialogue β€” a structured document injected into every AI call that maintains character personality, knowledge limits, and guardrails across dynamic generation.
Module 4 Β· Lab 4

Design a Live Narrative System Prompt

Build and test a system prompt for AI-driven interactive narrative Β· 3 exchanges

Your Task

In this lab you will draft a complete system prompt for an AI-driven interactive narrative β€” a "character brain" or world-system specification β€” and test it against the AI assistant. The goal is to design constraints robust enough that the AI maintains your intent across multiple exchanges.

Work through at least three exchanges: first draft your system prompt and ask for feedback on its constraint coverage (hard prohibitions, soft style, character integrity), then test it by roleplaying a player input and observing how the AI responds within your defined constraints, then iterate on one weakness you identify.

Suggested opener: "I am designing a system prompt for a live AI narrative set in [world/genre]. Here is my draft: [paste draft]. Please evaluate it against these dimensions: (1) hard prohibition clarity, (2) tone/style specification, (3) character integrity constraints, (4) state injection structure. Identify any gaps where the AI could drift from my intent."
AI Narrative Lab
Live Narrative Design
Ready to help you design a live narrative system prompt. Share your draft β€” or describe the world, tone, and characters you want to constrain β€” and I'll evaluate it for constraint coverage: hard prohibitions, style anchors, character integrity, and state injection structure. Then we can test it live and iterate on any gaps.
Module 4

Module Test β€” Interactive and Branching Narrative

15 questions Β· 80% to pass Β· Covers all four lessons
1. What is a "leaf node" in branching narrative structure?
Correct. A leaf node is a terminal node β€” it has no outgoing edges, making it an ending. Well-designed interactive narratives have multiple leaf nodes of varying emotional valence.
Not quite. A leaf node is a terminal node with no outgoing edges β€” an ending. The term comes from graph theory where leaf nodes are nodes with no children.
2. Will Crowther's ADVENT (1976) is significant in interactive narrative history because:
Correct. ADVENT (1976) was the first text adventure β€” the first digital implementation of the branching node/exit structure that underlies all subsequent interactive narrative systems. Crowther wrote it in 700 lines of FORTRAN.
Not quite. "Interactive fiction" was coined by Marc Blank at Infocom in 1979. ADVENT's significance is being the first digital text adventure using a branching structure β€” the ancestor of all modern interactive narrative systems.
3. The "diamond" or nested branch structure achieves what balance?
Correct. The nested/diamond structure opens divergent paths then converges back β€” local divergence, shared destination. It's the compromise structure that gives readers meaningful choices without the exponential writing cost of fully parallel branching.
Not quite. The diamond/nested structure is a compromise: divergence locally (real choices, different paths) but convergence at a shared node (managing writing overhead). It contrasts with linear branches (always converge quickly) and parallel branches (never converge).
4. Richard Rouse III's criteria for meaningful choice include all of the following EXCEPT:
Correct. Rouse III's three criteria are distinct, consequential, and informed. "Reversible" is not one of them β€” in fact, the permanent nature of choices is often central to their weight. Anthropy added "expressive" as a fourth criterion.
Not quite. Rouse III's criteria are distinct, consequential, and informed. "Reversible" is not among them β€” irreversibility is often what makes choices feel weighty. The fourth criterion (expressive) was added by Anna Anthropy.
5. What is a "functional illusion of choice" as distinct from a literal illusory choice?
Correct. Functional illusory choices diverge structurally (different paths exist) but the reader experience is identical β€” same emotional valence, same information gained β€” making the choice meaningless despite appearing to diverge. This is distinct from literal illusory choice where all options lead to the same node ID.
Not quite. A functional illusion of choice means paths diverge in the graph but converge in effect β€” the reader experience is the same regardless of which option they chose. Readers are surprisingly good at detecting this, and the detection destroys trust in the narrative system.
6. In Twine's Sugarcube format, which syntax correctly sets a state variable?
Correct. Sugarcube uses the <<set $variable to value>> macro syntax. The (set: $variable to value) syntax is Harlowe format. When prompting AI for Twine content, specifying the format and providing correct syntax examples dramatically improves output quality.
Not quite. In Sugarcube, the correct syntax is <<set $met_rebel to true>>. The (set: ...) syntax is Harlowe. JSON-style and @-prefix notations are not valid Twine syntax in either format.
7. The "lost in the middle" problem (Liu et al., 2023) describes:
Correct. Liu et al.'s research showed that even large-context-window models degrade at recalling facts buried in the middle of context. For interactive narrative, this means critical state information should be injected at the top (or bottom) of prompts, never buried mid-context.
Not quite. "Lost in the middle" is a finding from AI research β€” models reliably recall information at the beginning and end of their context window but show degraded recall for information in the middle. This is a technical constraint that affects how you should structure state injection prompts.
8. Meg Jayanth's approach to choice design in 80 Days (2014) stressed testing each choice by asking:
Correct. Jayanth's test β€” "what does this tell the reader about Passepartout?" β€” is a practical application of the expressive criterion. It keeps identity and character at the center of choice design even when the plot stakes are low. She described this approach in her 2015 GDC talk.
Not quite. Jayanth's stress-test question was "what does this tell the reader about Passepartout?" β€” using the expressive criterion to ensure every choice revealed character, not just redirected plot. 80 Days features over 750,000 words across 169 cities and is cited for unusually high choice quality.
9. Three choices per node is described as "the cognitive sweet spot" because:
Correct. Three options create a natural spectrum β€” typically safe/cautious, risky/bold, and a lateral option that reframes the problem β€” without the cognitive load of four or more choices. Binary choices create high stakes but constrain reader expression.
Not quite. Three choices work as a cognitive sweet spot because they naturally create a spectrum: cautious, bold, and a third option that reframes the situation. This gives readers a sense of genuine range without overwhelming them with options.
10. What is "constraint erosion" in AI-driven live narrative?
Correct. Constraint erosion is a live-generation failure mode β€” prohibited content appears after many turns as the model's attention to early system prompt instructions degrades. It is addressed through constraint re-injection (repeating key prohibitions in later prompts) and session length limits.
Not quite. Constraint erosion is a known failure mode in live AI narrative β€” over many turns, the model begins violating constraints stated early in the system prompt because those early instructions lose prominence relative to the recent conversation. It's one reason why live-gen systems periodically re-inject their system prompts.
11. Which statement about AI Dungeon's "memory injection" system (as described in Latitude's 2021 post-mortem) is accurate?
Correct. Latitude's solution was structured human-curated summaries β€” character status, key choices, relationship states, world facts β€” injected as a pinned context block into every prompt. It dramatically reduced continuity errors but required ongoing human curation to remain accurate.
Not quite. The memory injection system was a structured summary (character status, choices, relationships, world facts) prepended as a pinned block to every generation prompt. The key detail is that it required human curation β€” the AI couldn't maintain its own accurate state summary reliably.
12. "Bark variation" (also called "false branch technique") is legitimate when:
Correct. False branches / bark variation are legitimate tools when used consciously and in balance with true branches and state variables. Used exclusively, they destroy narrative trust. Used sparingly, they add texture and replay variation efficiently.
Not quite. False branches become problematic only when they are the only tool in use. Used sparingly and mixed with true branches, they legitimately add prose texture and replay value without the writing cost of full structural divergence.
13. The five narrative quality dimensions proposed by Georgia Tech's Expressive Intelligence Studio for evaluating AI-generated IF include all of the following EXCEPT:
Correct. The five EIS dimensions are: coherence, expressivity, constraint adherence, character integrity, and engagement. "Reversibility" is not among them β€” it's a design choice for individual games, not a quality metric for AI generation.
Not quite. The five dimensions are coherence, expressivity, constraint adherence (prohibition compliance), character integrity, and engagement (proxy-measured by session length and replay rate). Reversibility is a design affordance, not an AI quality metric.
14. "Conditional prose variants" as a state-prompting technique involves:
Correct. Conditional prose variants mean asking AI to produce three (or more) versions of a single node β€” one for high-trust state, one for neutral, one for low-trust β€” then selecting at runtime in the game engine. The AI writes all variants; the engine picks the right one based on actual state.
Not quite. Conditional prose variants: you ask AI to write multiple versions of the same node for different state conditions (high/neutral/low relationship, flag set/unset), then your game engine selects the right version at runtime. The AI generates all variants offline; selection happens live.
15. Why is quality evaluation of live-generated interactive fiction fundamentally different from evaluating pre-written IF?
Correct. Live-generated IF cannot be pre-read because the path space is effectively infinite. Evaluation methods shift to red-teaming (deliberately breaking constraints), sampling (generating hundreds of random playthroughs), and player feedback monitoring β€” systematic quality assurance rather than editorial review.
Not quite. The fundamental difference is that pre-written IF can be fully read before release; live-generated IF cannot because the path space is too large. Evaluation therefore uses red-teaming, sampling, and player feedback rather than reading β€” a systematic QA approach rather than an editorial one.