Convai Narrative Design: How to Build Structured LLM-Powered NPC Story Flows Without Dialogue Trees

By
Convai Team
March 18, 2024

Key Takeaways

  • Convai Narrative Design replaces dialogue trees with objective-driven Narrative Graphs: NPCs pursue goals rather than follow scripts.
  • Three node types do all the work: Sections define objectives, Triggers advance the narrative based on events, Decisions branch based on player choices.
  • Narrative objectives are injected into the LLM via Dynamic Context at each turn, so the character always knows what it is trying to accomplish.
  • Useful for games, training simulations, museum tours, digital twin walkthroughs, and any scenario requiring both open conversation and narrative progress.
  • The same Narrative Graph infrastructure powers Convai Sim's Tour Guide mode, making it accessible without a game engine.

Convai's Narrative Design solves the hardest problem in LLM-powered NPCs: giving characters genuine conversational freedom without losing narrative control. Players can say anything. The NPC can handle it. And the story still moves forward.

The Limitations of Dialogue Trees

Dialogue trees, for all their structured simplicity, inherently constrain the narrative experience. Each branch, meticulously crafted, anticipates player responses, guiding them along a finite set of pathways. This approach, while effective in maintaining narrative coherence, inevitably caps the player's exploratory freedom. Encounters with NPCs feel less like genuine interactions and more like navigating a maze of preordained choices. The result? A gameplay experience that, despite its best efforts, often fails to fully mask the seams of its construction.

The primary drawback here lies in the static nature of dialogue trees. They can neither adapt to the player's unique conversational style nor accommodate unanticipated inquiries or actions. This rigidity not only stifles player creativity but also diminishes replay value, as the illusion of choice wears thin upon subsequent playthroughs.

LLM-Powered NPCs: A New Horizon

The integration of LLMs into NPC design marks a significant leap forward, promising an era where conversations can flow as dynamically as they do in the real world. Unlike their dialogue tree-based predecessors, LLM-powered NPCs possess the capability to generate responses in real-time, drawing from a vast pool of language understanding. This leap overcomes the feeling of hitting a conversational dead-end but also vastly expands the narrative possibilities within a game.

However, this innovation is not without its challenges. The primary concern lies in balancing the open-ended nature of LLM conversations with the need for narrative progression. Without a defined path, there's a risk that player interactions with NPCs could meander aimlessly, potentially stalling the game's progress or diluting its narrative focus.

Introducing Narrative Design: A Novel Solution

To harmonize the expansive potential of LLMs with the structured demands of video game storytelling, we propose a groundbreaking feature: Narrative Design. Narrative Design enables game developers to outline high-level objectives for LLM-driven NPCs, thereby guiding the narrative flow without constraining it to rigid dialogue trees. This approach allows NPCs the freedom to engage in a wide array of conversations while still steering the interaction toward predefined narrative milestones.

How Does Narrative Design Connect to Dynamic Context and Prompt-to-Action?

Narrative Design does not operate in isolation. It is one of the inputs that flows into Convai's Dynamic Context at each conversation turn.

The active Section's objective gets injected alongside the character's backstory, knowledge bank excerpts, personality traits, and long-term memory. The LLM receives the full picture: who the character is, what it knows, and what it is currently trying to achieve. This is what keeps characters purposeful without being robotic.

When a Narrative Section includes actions, not just dialogue, this is where Prompt-to-Action becomes relevant. A tour guide NPC does not just tell the player where the next exhibit is. With Convai's Action System connected, it physically navigates there. A training simulation NPC does not just describe the correct procedure. It demonstrates it.

You can inspect exactly which Narrative objectives were active on any given turn using Mindview. If the NPC got off track, Mindview shows whether the current Section objective was present in the LLM call or if a context assembly issue caused the drift.

How Script Design Works

Building on the established foundation of dialogue trees, our system introduces a refined concept we term the Narrative Graph. This innovative approach retains the tree structure familiar to designers and players alike but diverges significantly in its content. Rather than embedding predetermined dialogues, our tree is designed around objectives. Below is an example of a simple Narrative Graphs.

Narrative Graph

A Narrative Graph is structured around three fundamental elements: Sections (black node), Triggers (blue node) and Decisions (edges). In the above Museum Tour Guide graph we have three sections (Welcome Section, Museum Section and End Section), three decisions (shown by the edges) and a trigger (Initiation Trigger). The above simple graph is designed for the Museum Tour Guide Use case.

A section consist of two components:

  • Objective: This defines the overarching goal that the character aims to fulfill. For instance, the initial objective for a museum tour guide NPC, upon a player's entry, is to extend a warm welcome and inquire whether the player is interested in taking a guided tour.
  • Decisions: As the conversation unfolds, it becomes essential to adapt to the player's preferences and responses, adjusting the NPC's objectives accordingly. Decisions are critical in this context. Taking the tour guide example further, when the NPC poses the question about taking a tour, the player's affirmative or negative response will lead the NPC to pursue a different objective, tailored to the player's choice.

Triggers

Triggers are categorized into three types: Spatial Triggers, Time-Based Triggers, and Event-Based Triggers. These are essential mechanisms that enable NPCs to discern when certain conditions have been met or events have occurred. For instance, referring to the previously mentioned Narrative Graph, a Spatial Trigger could be employed to alert the NPC of a player's arrival into the scene. This classification of triggers plays a crucial role in ensuring that NPCs can react appropriately to developments within the game environment.

The interplay of sections, decisions, and triggers within the Narrative Graph framework empowers game developers to craft deeply engaging scenarios that respond dynamically to player actions. For instance, in a scenario where a player encounters a mysterious character in an ancient ruin, the game could use spatial triggers to initiate this encounter, sections to outline the character's objectives (such as guiding the player to a hidden artifact), and decisions to adapt the narrative based on the player's choices (e.g., showing interest in the character's story or choosing to explore alone). This cohesive system ensures that the game world feels alive and responsive, offering players a unique experience that evolves based on their interactions, ultimately enhancing the depth and immersion of the game's storytelling.

The Best of Both Worlds

Narrative Design represents a fusion of structured dialogue design and the dynamic, unpredictable nature of human conversation. By setting objectives for NPCs, developers can ensure that interactions remain relevant to the game's overarching narrative, all while granting players the freedom to explore conversations in a more organic and engaging manner. This balance not only enhances the player's sense of agency but also enriches the overall narrative depth of the game.

Furthermore, Narrative Design mitigates the risk of narrative stagnation associated with purely LLM-driven NPCs. By guiding these interactions towards specific goals, it ensures that every conversation, no matter how divergent, contributes to the player's progression within the game. This feature not only elevates the role of NPCs from mere narrative waypoints to active participants in the story but also opens up new avenues for storytelling, where player choices and NPC interactions weave a unique tapestry with each playthrough.

What Can You Build With Narrative Design Today?

Narrative Design works across every Convai deployment surface:

  • Games: Quest givers that guide players through objectives without locking them to a script. Companion NPCs that remember past decisions via Long-Term Memory and adapt their objectives accordingly.
  • Training simulations: Sales roleplay scenarios with compliance checkpoints. De-escalation exercises that escalate or de-escalate based on trainee tone. Pharmaceutical training with Knowledge Bank-grounded clinical accuracy.
  • Digital twin walkthroughs: Factory onboarding guides that navigate to each station, demonstrate the procedure, and checkpoint whether the trainee understood before advancing.
  • Museum and campus tours: Convai Sim's Tour Guide mode is built on Narrative Design, letting you deploy no-code guided tours without a game engine.
  • Customer service simulations: Evaluation API scoring for whether the learner met the Narrative Section's de-escalation objective, tracked across every turn.

Also read: Build an AI-Powered Virtual Tour Guide in Convai Sim (No Code)

Looking Ahead

The introduction of LLM-powered NPCs, bolstered by the strategic direction of Narrative Design, heralds a new era in video game narrative. As we stand on the brink of this exciting frontier, it's clear that the potential for storytelling within digital worlds is boundless. With the continued refinement of these technologies, we can anticipate a future where video games offer not just stories to be played but worlds to be lived in, where every conversation, every interaction, is as limitless as our imagination.

Try it now: open Convai Playground, create a character, go to Narrative Design, and build your first Section with a single objective. Add a Spatial Trigger. Preview it in the browser. Then check Mindview to see how the objective reached the LLM.

Frequently Asked Questions

What is Convai Narrative Design and how does it differ from dialogue trees?

Convai Narrative Design replaces rigid dialogue trees with an objective-driven Narrative Graph. NPCs pursue goals rather than follow scripts, so they can handle unexpected player inputs without hitting dead ends.

What are the three components of a Convai Narrative Graph?

Sections (objective nodes defining what the NPC is trying to achieve), Triggers (spatial, time-based, or event-based conditions that advance the narrative), and Decisions (branching edges that redirect the story based on player choices).

How do Triggers work in Convai's Narrative Design?

Spatial Triggers activate when a player enters a zone. Time-Based Triggers fire after a duration. Event-Based Triggers respond to game events. All three allow NPCs to advance narrative automatically without waiting for a player prompt.

Can Convai Narrative Design be used for enterprise training simulations?

Yes. Narrative Design lets you define scenario objectives and compliance checkpoints while preserving natural unscripted roleplay. The Evaluation API can score whether the trainee met each narrative objective.

How does Narrative Design connect to Convai's Dynamic Context API?

Each active Narrative Section injects its objective into the LLM context via Dynamic Context alongside backstory, knowledge, and memory. Inspect what was injected on any turn using Mindview.