Should AI Game Memory Persist Across Chapters? A Practical Design for What to Keep and Reset
For a chapter-based game, AI memory should cross a chapter boundary only when it represents a durable fact the game intends to matter later. Keep player commitments, established relationships, and confirmed world facts in a structured, authored record. Let the AI retrieve a small relevant view of that record, along with any intentionally retained recollections. Reset scene-specific context, temporary goals, and moment-to-moment details unless the next chapter explicitly needs them. The game’s saved state should remain the authority; generated dialogue can describe it, but should not silently rewrite it.
Separate enduring canon from scene memory
“Memory” can refer to different things: a record of events, a summary or interpretation of those events, and the facts the game treats as true. Mixing them makes chapter transitions hard to reason about. A character may have heard a rumor, for example, but the rumor should not automatically become a confirmed world fact simply because the AI recalls it confidently.
A useful design is to keep two related layers. The first is a canonical state owned by the game: structured facts such as promised_to_return: true, gave_map_to: Mira, or bridge_status: repaired. These are saved and changed through game rules or explicit authoring. The second is an AI retrieval view: selected facts, memories, and current scene context provided to shape a response. This view can be concise and character-specific without becoming the save file itself.
This recommendation is an architectural inference, not a feature guaranteed by any one engine. Narrative scripting systems already distinguish story variables that can be read across a story from temporary values with a narrower scope; Ink, for example, documents global variables and temporary variables separately. Its runtime also exposes a way to serialize and restore story state. Those capabilities provide a useful model: represent state deliberately, then decide what scope and persistence each value needs. Ink’s variable and logic documentation and Ink’s runtime saving and loading documentation
Decide what earns a place in the cross-chapter record
For each candidate memory, ask: could a later scene correctly depend on this fact, and is there a clear game event or authored rule that can confirm it? If yes, consider storing it as durable state. A player’s chosen name for a companion, a completed promise, or whether a gate was opened may qualify when the story uses it later. Store a value and its scope, not an unbounded transcript, whenever the underlying fact can be expressed clearly.
A practical record can identify the subject, fact, source event, and persistence scope. For example: subject: Mira; fact: player shared the map; source: chapter_2_choice_14; scope: campaign. The source event helps resolve disagreements: if a later generated line claims the player gave the map away but the recorded choice says otherwise, the game can prefer the event record. This schema is a design suggestion, not a format mandated by the cited tools.
Keep uncertain or unconfirmed material distinct. “The guard suspects the player took the key” and “the player took the key” are different facts. A character may remember a suspicion after a chapter ends, while the canonical world record still says the key remains in its original location. Use labels such as rumor, observation, inference, and confirmed event if later dialogue needs to preserve those distinctions.
Reset what belongs to the current scene
Scene state often includes the immediate topic of conversation, a temporary objective, the last few exchanges, local staging, and short-lived details such as which door is currently open. These details may help the AI answer the next line, but they rarely need to become campaign memory. Clear them at scene exit or reconstruct them from the next scene’s authored setup.
The boundary matters because persistence has different meanings. Unity’s data-persistence tutorial distinguishes data that follows a player between scenes during one session from progress saved and restored across sessions; it also notes that scene-created data is typically lost when moving to another scene unless the game carries it forward. A chapter transition is therefore a deliberate transfer decision, not an automatic reason to preserve every active value. Unity Learn: Implement data persistence between scenes
Try a four-part transition routine: finalize confirmed chapter events; update the canonical campaign record; discard temporary scene context; then build the next chapter’s AI context from its authored setup plus relevant durable facts. This limits stale details from leaking into a new scene while preserving continuity the story explicitly supports.
Keep authored save state authoritative
At chapter start, give the AI the current state as read-only context for narration and dialogue. If player actions can change durable facts, have the game validate the action against its own rules and update the save record through the normal state-changing path. Treat model output as a proposed line or action, not as proof that an event happened. This separation is a design recommendation derived from the need to distinguish saved state from generated text; it should be implemented and tested in the game’s own architecture.
There is a useful precedent in narrative research: the Generative Agents paper describes storing experiences, synthesizing reflections, and retrieving selected memories dynamically to guide behavior. That supports using retrieval and synthesis to shape what an agent considers. It does not establish that a generated recollection should be canonical game state. The distinction is important: a summary can be useful context while still being revisable or incomplete. Park et al., “Generative Agents: Interactive Simulacra of Human Behavior”
For reproducible saves, persist the game’s structured facts and the story runtime state the game needs to resume. Ink’s runtime documentation demonstrates serializing story state to JSON and loading it again. A generated summary can also be stored as a convenience, but rebuild or check it against the structured record when loading; do not let a stale summary overrule a newer saved choice. Ink runtime: Saving and loading
Make the boundary visible to players
Players need not see internal memory structures, but they should be able to understand which choices carried forward. Show consequences in the fiction where they naturally belong: a companion recalls the map, or a later scene reflects the earlier promise. When the save or chapter recap provides a suitable place, summarize a few consequential confirmed facts in plain language. Avoid implying that every improvised line has become permanent canon.
Give players a way to correct consequential mistakes when the game offers one: reload a save, revisit a decision, or use an explicit correction interaction. If an AI character misremembers something, dialogue should not force the player to accept that error as a new world fact. Whether such correction options exist is a product decision, but the underlying principle is stable: a remembered claim and a saved event are not interchangeable.
Test chapter transitions with concrete cases
Build a small transition checklist around the facts your game actually tracks. For each case, inspect both the saved record and the AI context supplied after the chapter changes.
A confirmed player choice persists and can affect the next chapter where authored content uses it.
A rumor or character inference remains labeled as uncertain rather than becoming a confirmed event.
A temporary scene goal and recent conversational details disappear unless the next scene explicitly requires them.
A newly loaded save restores the same canonical choices even if the AI previously generated contradictory prose.
A new chapter with no relevant connection does not receive unrelated memories just because they exist.
These checks are a proposed diagnostic method, not a reported experiment. They make it easier to find two common defects: continuity loss, where durable facts vanish, and memory leakage, where old scene details appear in a context that should have reset. When either occurs, check the persistence scope and context-building step before trying to fix it with a longer prompt.
A compact rule for chapter-based memory
Persist a fact when the authored game can name it, confirm its source, and define a later use for it. Keep personal recollections as retrieved context when they add character or continuity, while preserving uncertainty and provenance. Reset scene-local state at the boundary. At every stage, let the saved, authored game state determine what is true; let AI memory help the character respond to that truth.
