The Role of AI in Creating Nonlinear Games Driven by Narratives

By
Convai Team
June 5, 2024

Over the last decade, gameplay and storytelling have become entwined. In fact, a game’s storyline — the back-story and the plot that unfolds can make or break a game—dazzling technical effects notwithstanding. An effective storyline arouses curiosity, engages the player, and helps them grasp the game’s flow. Convai helps you achieve this with the cutting-edge Narrative Design feature.

There are two primary types of storytelling: linear and nonlinear. Unlike many films and books, video games have commonly stuck to the former. That is, they follow a fixed and predetermined sequence of scenes, events, and outcomes. 

Games such as God of War, Mass Effect, and The Last of Us, emphasize scripted action, character development, and cinematic presentation. As a result, they flow smoothly in accordance with what the developer or designer wrote. This affords players little to no influence on the story’s direction or outcome.

AI-Driven Nonlinear Storylines

With generative artificial intelligence, it is possible to drive development of nonlinear storylines, which adapt to player choices. The player gets to shape the narrative with their decisions, actions, and interactions, creating a more customized gaming experience. 

Some early examples of nonlinear play include Colossal Cave Adventure and Superman from the 1970s, and Haunted House and The Hobbit of 1982.

Using AI, missions and quests that align with the game’s overall narrative can be created on the fly, giving players more freedom and agency to explore the game world, investigate different paths, and inform story consequences and endings. AI allows players to, for example, begin games with multiple characters, each of them telling a different story. You can watch Convai’s  Narrative Design in action in the Convai keynote on YouTube.

Further, these more open-ended games can have multiple ending sequences, optional paths to victory, or varying victory types. Optional side quests or subplots are also common in games like The Witcher, The Fallout, and The Elder Scrolls. Some games provide a sandbox mode that permits players to explore an open world game milieu independent of any game objectives.

The highly interactive nature of nonlinear gameplay can also help players avoid getting stuck -- wandering around during the game, trying to determine what the developers want them to do next. Not only does this halt progress but it can break the player’s “suspension of disbelief,” a key gaming draw.

AI Behavior Trees and Game Development

The role of AI in character performance extends to data structures called Behavior Trees, which permit developers to better control AI agents’ game world interaction. These tools came about as a way to define NPC behavior and have since entered the robotics space as robots’ capabilities have grown from basic repetitive tasks.

Behavior Trees comprise three primary components including individual nodes, with each node representing a particular behavior. Then there are branches, used to link the tree nodes, and leaves -- terminal nodes that perform actions. Leaves are the fundamental behavior units that drive AI agent actions. Learn more about the limitation of traditional Dialogue trees and Advantages of the upgrades brought by using Convai’s Narrative Design Feature in the Narrative Design Blog.

The Behavior Trees aim is to get the AI agent to execute a certain action based on current game conditions. Achieving this requires the evaluation of each node based on predefined conditions. The evaluation begins from the root node and proceeds downward until reaching a leaf node, triggering an AI agent action that may lead to another action, or to the game’s end.

Behavior Trees’ Benefits

While behavior trees can require extensive testing and be quite complex, they can be effective for AI due to their efficiency. They are easily understood, implemented, and maintained, paring the time and effort necessary for game development.

And because they permit the creation of complex behaviors, BTs are adaptable to different game environments. They are also modifiable, meaning the AI agent can adapt to changing game conditions. What’s more, they are easily debugged, as developers have a clear representation of AI agent behavior.

Adaptive Gameplay and Proactive Storylines

Now, generative AI is unlocking an evolving era of immersive experiences that can adapt to gameplay in real time based on player behavior, creating a whole new kind of personalized adventure. AI Gaming has evolved significantly in 2024, and keeps improving!

The technology is fueling nonlinear narratives and adaptive storylines, reshaping storytelling through procedurally generated content that ensures infinite possibilities and replay ability. Through the use of algorithms, developers can create expansive, diverse, and dynamic game worlds. Such algorithms can assess player actions, choices, and interactions to produce narrative elements, storylines, and quests that adapt to player decisions. 

This proactive content creation results in more personalized and immersive storytelling experiences, where players have more impact on the unspooling narrative and are more emotionally invested.

The Potential of LLMs

Enter the power of large language models. Integrated into NPC design, LLMs presage an era in which conversations are real world-like, dynamic and flowing. LLM-powered NPCs can produce real-time responses derived from an expansive pool of language understanding. This not only prevents conversational dead ends but expands a game’s narrative possibilities. There are challenges, however, including balancing such open-ended conversations with the need for narrative progression. 

Check out Convai’s flagship Unity demo - Project Neural Nexus.

New Horizons in Narrative Design

At Convai, we’re offering a new groundbreaking feature that harmonizes the vast prospects of LLMs with the structured demands of game storytelling. Our Narrative Design approach allows you to delineate high-level goals for LLM-driven characters. In other words, you can guide the narrative flow without the rigidity of dialogue trees. Thus, NPCs are free to engage in broad conversations while still guiding the interaction toward preset narrative milestones.

Such a balance enhances the player’s sense of agency and enriches the depth of the game’s narrative. It also decreases the risk of narrative stagnation associated with NPCs solely driven by LLMs. Each conversation adds to the player’s game progression, increasing the role of NPCs and revealing, with each playthrough, new paths for storytelling.

In Summary

Nonlinear games typically contain a number of challenges and side missions as well as multiple ways to reach primary goals, offering more player freedom and immersive gameplay.

As AI and machine learning advance, the gaming experience promises even more narrative engagement and proactive storytelling. The rollout of LLM-powered NPCs, combined with Narrative Design, promises a future in which games offer worlds in which each conversation is bounded only by imagination.