Scaling Stories: How Adventures Stay Coherent Over Time

AI language models have a fundamental limitation: they can only "see" a fixed amount of text at once. This is called the context window. For a game that can span hours of gameplay across dozens of chapters, this creates a real challenge.
The Problem
Imagine playing an adventure for three hours. You've made hundreds of choices, met dozens of NPCs, visited multiple locations, gained and lost items, and shaped the political landscape of a fantasy city. The full transcript of your adventure might be tens of thousands of words.
If you fed all of that to the AI at once, it would either:
- Exceed the context window and fail
- Lose track of important details buried in the middle
- Become prohibitively expensive (more tokens = more cost)
The Chapter Solution
Embertold breaks adventures into chapters. When a chapter completes, the AI generates a detailed summary that captures:
- Key events — What happened, in what order
- Decisions made — What the player chose and why it mattered
- State changes — Items gained/lost, health changes, NPC relationships
- Narrative threads — Ongoing plotlines, unresolved questions, foreshadowing
These summaries are carefully written to preserve the information that matters for future storytelling while being much more compact than the full transcript.
How Context Is Built
On each turn, the AI receives:
- Chapter summaries — Condensed versions of all previous chapters
- Current chapter messages — The full transcript of the current chapter
- Character state — Current stats, inventory, health, equipped items
- Adventure context — The premise, objectives, and key NPCs
This gives the AI both the big picture (summaries) and the immediate detail (current chapter) — the same way a human dungeon master remembers the broad strokes of past sessions while being fully present in the current one.
What Gets Preserved
The summary system is designed to never lose information that could matter later:
- A seemingly minor NPC mentioned in chapter 2 who might return in chapter 15
- A decision that seemed small but has cascading consequences
- Items picked up and not yet used
- Promises made to NPCs
- Overarching quest objectives and sub-goals
Automatic Chapter Titles
Each chapter gets an AI-generated title when it completes. These titles serve as bookmarks in your adventure history, making it easy to find specific moments: "The Betrayal at Moonstone Bridge," "A Dark Bargain," "Into the Deep."
The Balance
There's a tension between compression and fidelity. Too much compression and the AI forgets important details. Too little and you burn through context on backstory instead of current gameplay.
We've tuned this balance through extensive testing. The summaries are detailed enough to maintain narrative threads but compact enough to leave plenty of room for the current chapter's interaction.
The Result
Players can run adventures that span dozens of chapters and hours of gameplay without the AI "forgetting" what happened. The story stays coherent. NPCs remember their relationships with you. Consequences from early choices ripple through late-game events.
It's not perfect — no compression is lossless. But it's good enough that most players never notice the machinery behind the curtain. They just experience a long, coherent, personalized story.
And that's the point.
Related Posts

The Art of Choice: How Your Decisions Shape the Story
In Embertold, there are no scripted paths. Every decision you make — from dialogue choices to combat tactics — shapes a story that's uniquely yours.

Building an AI Game Master from Scratch
The journey of creating an AI that can run tabletop RPG sessions — the challenges, breakthroughs, and design philosophy behind Embertold's Game Master.

From Text to World: Generating Fantasy Art in Real-Time
How we turn narrative descriptions into beautiful scene illustrations on the fly — the prompt engineering, style consistency, and caching that make it work.