Branching Storylines in AI RPGs: How Authored Adventures Work
Most AI RPGs cannot run an authored branching story. They either improvise every scene — no designed structure — or play a fixed script that never adapts. LoreKeeper's Trama editor is the hybrid: you design the adventure as a graph of story nodes, write each branch's condition in plain language, and then the AI narrates while a rule engine decides which branch the players actually earned — with every transition logged. This is how it works, and why it is hard for a freeform AI Game Master to do.
The two failure modes: pure improv and pure script
There are two easy ways to build story into an RPG tool, and both fall short of an authored branching adventure.
Pure improvisation is what a freeform AI Game Master does. Every scene is generated on the spot from the world and the recent transcript. It is flexible and never hits a wall, but there is no designed structure underneath — no planned midpoint, no branch you crafted, no ending you built toward. The story is wherever the conversation drifted, and two playthroughs share nothing but the setting.
Pure scripting is the classic branching narrative: a tree of pre-written passages with choices at each node. It has real structure, but it cannot adapt. The text is fixed, the choices are a menu, and anything the players try that the author did not anticipate simply is not an option.
An authored branching adventure needs both halves: a structure the designer controls, and narration that still reacts to how a specific table plays it. That is the gap a Trama fills.
What a Trama is: a graph of story nodes
A Trama is an adventure built as a directed graph. Each node is one designed moment:
- Intro — the opening scene that sets the hook
- Scene / exploration — a location or situation the players move through
- Dialogue — a scripted encounter with a specific NPC
- Combat — a prepared encounter with defined enemies and rewards
- Merchant, trap, lore — a shop stop, a hazard with a skill check, or a lore reveal
- Finale — an ending. A Trama can have several, reached from different branches
Nodes connect forward — a Trama is a forward-flowing graph from intro to finale, not a loop — and a node can fork: a safe branch and a risky branch, each with its own condition, or a default branch that the players fall through when nothing else fires. The AI Game Master runs the node you are on with full access to the world's rules, NPCs and mechanics; it just does not get to rewrite which node comes next.
The practical effect is that a Trama feels like a published module. There is a beginning, a middle and an end that someone designed, and the player can tell.
How branches fire: events plus predicates
This is the part that makes a Trama more than a flowchart. Branch transitions are decided by a two-layer system — one neural, one symbolic.
Layer one: the AI extracts events
As the table plays, the AI reads what actually happened and extracts narrative events: the captain was killed, the vault was reached, the amulet changed hands, the truce was broken. Each event is recorded with a type, the entity it involves, and a confidence score. This is the flexible half — it does not matter whether the players got there the way the author expected, only that the event occurred.
Layer two: predicates decide the branch
Every branch carries an activation condition you wrote in plain language when authoring — “the players sided with the smugglers” or “the relic was destroyed.” That prose is compiled into a logical predicate. After each turn, the engine checks the recorded events against the predicates of the branches leaving the current node. When one is satisfied, the Trama transitions.
Because the branch decision is deterministic logic over logged events, the same choices always lead to the same place, and you can reason about your own adventure. The AI never silently picks a path — it produces the events; the rules do the routing.
Publishing, stats, and the transition log
A finished Trama can be published so other players run it inside your world. Published adventures track play statistics — unique players, total turns, completions — so you can see whether people finish your story or stall halfway.
Every playthrough also keeps a transition log: which branch fired, what triggered it, which event satisfied the predicate. That log is what makes an authored adventure debuggable — if playtesters keep missing your best ending, you can see exactly which condition never fired and fix the wording, rather than guessing at a black box.
Who authored adventures are for
- Creators who want to design a specific story, not just a setting for the AI to wander
- Groups who want a module-style experience with a real ending, played by an AI Game Master
- Worldbuilders who build a world first and then author a flagship adventure set in it
- Anyone who wants their adventure to be replayable and shareable, with stats on how it plays
If you have not built the world yet, start there — see the AI world builder guide and the comparison of AI world building tools. Then author the Trama as the adventure that shows it off.
Frequently Asked Questions
Can AI RPGs have branching storylines?
Most cannot, in the authored sense. A freeform AI Game Master improvises every scene, so there is no designed branch structure — just wherever the conversation drifts. A static choose-your-own-adventure has branches but no adaptation. LoreKeeper's Trama editor is the hybrid: you design the story as a graph of nodes with branch conditions written in plain language, then the AI narrates each node while a rule engine decides which branch the players actually earned. You get a real authored structure and an AI that still reacts to how the table plays it.
What is a Trama in LoreKeeper?
A Trama is an authored adventure that runs as a graph of connected nodes — an intro, exploration scenes, NPC dialogues, prepared combat encounters, merchants, traps, lore reveals, and one or more finale nodes. You decide how the nodes connect and what has to happen in the story for the players to move from one to the next. The AI Game Master follows your structure instead of improvising the whole plot, so the result feels like a published adventure module: a real beginning, middle and end.
How does a Trama decide which branch the players take?
Through a two-part system. As you play, the AI extracts narrative events from what actually happens at the table — an NPC was killed, a location was reached, an item was handed over, a faction was betrayed — and records each one with a confidence score. Separately, each branch carries an activation condition you wrote in plain language, which is compiled into a logical predicate. When the recorded events satisfy a branch's predicate, the Trama transitions down that branch. The narration is AI; the branch decision is deterministic rules over logged events, so the same choices always lead to the same place.
Can a Trama have multiple endings?
Yes. You can create several finale nodes and connect them from different branches of the story. Players reach whichever ending they earned through their choices during the adventure. The editor validates the graph automatically — it checks that the structure is a valid forward graph and that every branch has at least one reachable ending, so you cannot accidentally publish an adventure a player can get stuck in.
Do I need to code to build a branching adventure?
No. The editor is visual: you drag node blocks onto a canvas, connect them with arrows, and fill in the text. Branch conditions are set with a rule builder — you pick an entity (an NPC, a location, an item) and the event that needs to happen — and the plain-language condition is compiled to logic behind the scenes. No formulas, no scripting.
What can other players do with a Trama I build?
You can publish a finished Trama so other players run it inside your world. Published Tramas track play stats — unique players, total turns, completions — so you can see how your adventure performs and where players drop off. Every playthrough also keeps a transition log recording which branches fired and why, which is what makes a Trama debuggable and replayable rather than a black box.
How is this different from a normal LoreKeeper campaign?
In a normal campaign the AI Game Master improvises the story in real time from the world you defined. In a Trama, you designed the key moments, encounters and endings in advance and the AI runs your script. Same engine, same rules, same world tools — different authoring model. Many creators build their world first, then author a Trama as the flagship adventure set in it.
Build an Adventure Someone Can Play
The Trama editor turns your story into a branching adventure an AI Game Master runs — authored nodes, plain-language branch conditions, multiple endings, publishable in your own world. Start with 20 free daily turns. No credit card required.
Play Free →Related guides
The AI World Builder Bot
A tool-using agent that builds your world from conversation — races, classes, spells, monsters, factions and magic schools as playable entities.
How to Design a Custom Magic System for Your RPG
Schools, casting stats, class access and per-school progression — designed deliberately and enforced by the rules engine.
Building Factions and a Custom Bestiary for an AI RPG
Factions with goals and leaders the AI acts on, and monsters with real stat blocks the combat engine enforces.
