The Future of NPC Interaction with Convai's Narrative Design

Convai Team
March 18, 2024

In the realm of game design, the evolution of non-player character (NPC) interaction stands as a testament to the industry's relentless pursuit of immersion and narrative depth. Traditional dialogue trees have long served as the backbone for player-NPC interactions. Yet, as we venture further into the era of advanced artificial intelligence, the limitations of these pre-scripted pathways become increasingly apparent. Enter the transformative potential of Large Language Models (LLM) in powering conversational NPCs, a shift that promises to redefine our engagement with virtual worlds.

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 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 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.

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.