A script-driven AI game master, built with friends. The project follows player choices through a branching story while keeping track of the script's structure.
How it works
The script is first broken into scenes and plots. During play, the runtime keeps track of where the player is and decides whether their next action should move the story to another branch.
Each response draws on the current plot and relevant information retrieved from the script. State updates carry the consequences into later turns.
Design notes
Suppose a player betrays an ally they were meant to protect. The immediate reaction might read well, yet the next scene could proceed as though nothing happened. That is the kind of break in continuity this project is concerned with.
Keeping the exchange in context gives the model something to refer back to. The runtime still needs to decide whether that betrayal changes the next branch. We use explicit story state to make those decisions part of the system, rather than leaving them entirely to the next generated response.
The question becomes how much structure to give a scene. Too little, and a player's choices may disappear between turns. Too much, and there may be little room for the player to find a path of their own.
System diagram
Script preparation and game mastering happen in separate stages. Preparation turns the source material into a hierarchy of scenes and plots, with knowledge available for retrieval.
During play, the runtime evaluates each input against the current story state. It gathers context for the response and handles game mechanics as needed. Updates are saved for the following turn.
Demo screen
The first screen shows the setup before a session. Players choose a table and create an investigator before entering the case.

The second screen shows a session in progress. The game master's response follows the player's input, grounded in the current narrative state.

Open questions
How much can a player change before the story needs a branch the author never wrote?
Which consequences need to persist beyond the current scene?
