Tree narrative and AI interaction: Optimization and narrative bias handling prospects

Research Article
Open access

Tree narrative and AI interaction: Optimization and narrative bias handling prospects

Yifeng Bi 1*
  • 1 Stony Brook Institute, Anhui University    
  • *corresponding author tsukirin@qq.com
Published on 10 September 2024 | https://doi.org/10.54254/2755-2721/71/20241616
ACE Vol.71
ISSN (Print): 2755-273X
ISSN (Online): 2755-2721
ISBN (Print): 978-1-83558-481-1
ISBN (Online): 978-1-83558-482-8

Abstract

This paper reviews the current research on interactive narratives, particularly the tree narrative structure, analyzing the methods of player-AI interaction, the design of narrative branches, and the mechanisms by which player decisions influence the story's progression. It explores the definitions, classifications, and applications of tree narratives in gaming, emphasizing the significance of player-AI interaction and its impact on narrative outcomes. The study identifies and analyzes potential narrative deviations resulting from player-AI interactions within tree structures and introduces an AI-assisted automatic scoring system based on hypothesis testing and Bayesian analysis to effectively identify narrative biases.

Keywords:

game entertainment, tree narrative, machine learning, AI interaction

Bi,Y. (2024). Tree narrative and AI interaction: Optimization and narrative bias handling prospects. Applied and Computational Engineering,71,163-167.
Export citation

1. Introduction

In the current digital entertainment landscape, interactive narratives represent an innovative storytelling form that significantly enhances player experience, immersion, and engagement. Particularly in video game design, allowing players to interact with AI characters within the story environment enables them to directly influence the story's direction and outcomes, providing unprecedented freedom and creativity. However, traditional tree narrative structures often require players to follow predetermined options and narrative nodes. While this ensures story quality, it can limit player freedom and potentially weaken the player experience. This study aims to explore and address narrative deviations that may arise from player-AI interactions within tree narrative structures, especially when such deviations lead to differences between the player experience and the game designer's original intentions. To this end, the study proposes the introduction of large-scale stochastic optimization and message-passing algorithms to determine safeguard nodes among narrative nodes, optimally preventing significant deviations between user and AI-generated content and the author's intended narrative nodes. Additionally, combining advanced message-passing algorithms and an automatic scoring framework, the study will evaluate the impact of player inputs on narrative progression in real-time, determining whether safeguard nodes should be triggered based on scoring results. This ensures that AI-generated game narratives can adapt flexibly to player choices and behaviors while maintaining alignment with the game designer’s predetermined ending.

2. Analysis of the Current State of Interactive Narratives

2.1. Definitions and Classifications of Interactive Narratives

Narrative structures can be classified into linear narratives, tree narratives, and open narratives. Linear narratives unfold along a predetermined script, where player choices and actions only affect some details without impacting the overall story direction or character arcs. This structure is widely used in games that prioritize gameplay feedback over narrative depth, such as some traditional single-player RPGs, where game designers provide a clear narrative path, and players simply need to complete assigned tasks to experience the entire story. Examples include shooting games like "Call of Duty" and traditional platformers like "Mario."

Tree narratives offer players different ways to experience the story through key choices, dialogue trees, branching tasks, and behavior points, determining the story's direction and conclusion. This type of game allows for greater player freedom, enabling players to achieve unique endings through their choices. Game designers can enhance player experience by incorporating characters and narratives triggered by different choices. Games like "Detroit: Become Human" that focus on player narrative experience widely employ this storytelling method.

Open narratives are typically used in large RPGs, where player freedom is extremely high, and there are no clear task directives, allowing players to fully immerse themselves in the game roles and freely advance the storyline. Alternatively, adopting the tabletop RPG framework, players maximize their freedom of action within limited rules, enhancing narrative engagement. Examples include games like "Baldur's Gate 3."

2.2. Characteristics and Applications of Tree Narrative Structures

The key to tree narratives lies in multi-branch paths, multi-ending designs, interactivity, replay value, and non-linear structures. Multi-branch paths form the foundation of tree narratives, with each branch representing a player choice. As choices accumulate, the predetermined game script increasingly aligns with the player's personal inclinations, resulting in game endings that match the player’s imagination and personal style. Multi-ending designs are crucial, requiring designers to consistently monitor how different choices impact outcomes, ensuring a logical relationship between choices and game endings, thus providing a highly adaptive narrative experience.

Interactivity and replay value are main attractions in tree narratives. Traditional single linear narratives often require designers to embed numerous details and hidden plots to create a realistic world and encourage replay. In contrast, tree narratives, with their choice-driven plot and outcome determination, offer a sense of immersion and realism superior to linear narrative games. This frees players from a predetermined, inflexible framework, allowing for more diverse and personalized game experiences. Non-linear structures differentiate tree narratives from linear ones, allowing plot development through intertwined branching paths. Even if players fail at crucial moments, they can make up for it through subsequent choices, or take the same action at different times to affect the game. This allows players greater freedom in game progression.

2.3. The Role and Function of AI in Interactive Narratives

AI can adjust the story’s direction in real-time based on player choices and actions, generating adaptive plotlines while ensuring story coherence and logic. This prevents player choices from causing inconsistencies or errors in the narrative, enhancing replayability and immersion.

AI-driven virtual characters can make autonomous decisions based on player interactions and environmental changes, exhibiting complex behaviors and emotional responses. AI can generate dynamic dialogues based on player choices, providing a more natural and realistic interactive experience, where each dialogue option affects character responses and story development, leading to more personalized and free interactions.

AI can monitor player actions and choices in real-time, analyzing their preferences and habits. This data can be used to adjust game difficulty, offer personalized content, and improve game design, providing real-time suggestions and instructions tailored to individual players, helping them better understand game mechanics and narratives.

In multi-ending design and world generation, AI can track all player choices and actions throughout the game, assessing their impact on final outcomes to better manage and generate diverse endings. It dynamically adjusts the game environment based on player behavior and narrative development, modifying scene setups, or generating new interactive elements, making the game world more vivid and realistic. Post-main storyline, AI can create and manage interactive elements like puzzle-solving tools and NPC tasks, enhancing playability and adding realism to the game world, crucial in contemporary open-world games.

3. Identifying Narrative Deviations in Interactive Storytelling

3.1. Definition and Types of Narrative Deviations

In interactive storytelling, narrative deviations refer to instances where the story development diverges from the predefined trajectory, leading to issues in narrative logic or user experience. Narrative deviations can be classified into logical deviations, continuity deviations, emotional deviations, and system deviations. The simplest and most easily addressed is system deviation, which occurs due to coding errors or technical malfunctions that prevent important NPCs from being located or crucial actions from being triggered, causing the player to be unable to proceed. These can usually be resolved with simple code fixes. However, the other types of narrative deviations are more complex and require specific handling techniques.

Logical deviations occur when the player's choices or actions result in inconsistencies or contradictions in the story development, characterized by broken causal relationships and plot contradictions. For instance, if a player kills a key character in one chapter, but that character reappears as a main character in the next chapter due to AI-driven plot advancement, it could cause significant logical inconsistencies from the player's viewpoint.

Continuity deviations refer to a lack of coherence in the storyline, resulting in a fragmented or disjointed player experience, characterized by abrupt transitions and unexplained plot jumps, and inconsistent character motivations. This may result from inadequate AI training, where the system fails to consider narrative continuity and consistent character behavior across different scenarios, affecting the overall storytelling experience for players.

Emotional deviations occur when the story development fails to effectively guide or respond to the player’s emotional experiences, reducing their emotional engagement. For instance, injecting humor into what should be a somber scene may disrupt the intended emotional tone.

3.2. AI-Generated Narrative Scoring System

To enhance the rationality of AI-generated narratives, a method employed in experimental applications can be used: a human-assisted scoring system. This involves generating narratives through machine learning and then providing feedback in the form of a score, with higher scores indicating better alignment with expectations and logic. This method is widely used in machine learning, and two scoring methods for AI-generated game narratives are proposed here. This paper focuses on the hypothesis testing scoring method.

Hypothesis testing scoring methods typically include one-sample t-tests, two-sample t-tests, and chi-square tests, all of which follow similar steps: defining hypotheses, collecting data, calculating test statistics, and determining critical values and p-values. The one-sample t-test evaluates whether there is a significant difference between the AI-generated narrative and the expected narrative quality standard, while the two-sample t-test compares the quality differences between two different AI-generated narrative versions. The chi-square test assesses the independence between AI-generated narrative events and expected event distributions.

The Bayesian scoring method uses Bayesian principles to update the model by comparing prior data with new data, gradually improving the accuracy and reliability of the scores. Bayesian inference and Bayesian networks can effectively manage and control the complexity of multi-branch narratives, preventing deviations and inconsistencies. To enable the AI to independently score and adjust narratives, a Bayesian network is required. First, define the structure of the Bayesian network for narrative scoring, identifying variables and their dependencies, such as narrative continuity and logical consistency. Next, define conditional probability tables for each node to reflect the dependencies between variables. Finally, collect new data and update the conditional probability tables within the network. Using Bayesian inference, calculate posterior probabilities to obtain the final scoring results.

4. Addressing Narrative Deviations in Interactive Storytelling

4.1. Large-Scale Random Optimization and Message Passing Algorithms

Large-scale random optimization is a method for solving high-dimensional and complex problems through random search and optimization algorithms. In interactive storytelling, this method can be used to find the optimal narrative paths and node configurations to minimize narrative deviations. The general steps for using large-scale random optimization to oversee narrative deviations are as follows: first, define the objective function to be optimized, ensuring that player choices result in minimal narrative deviations. Then, initialize the population or sample, generate a set of initial narratives, and evaluate them. Based on the scoring results, select the higher-scoring paths. Generate new paths through crossover and mutation, and iteratively optimize the narrative by realigning initially deviated paths with the expected trajectory.

Message passing algorithms are a class of methods used for inference and optimization in graph structures, such as Bayesian networks or Markov random fields. These algorithms update and optimize the state of the overall system by passing information (messages) between nodes. The main methods used include belief propagation (updating posterior probabilities for each node in a Bayesian network) and max marginalization (finding the maximum probability paths and optimal configurations). The general steps for using message passing algorithms are as follows: first, construct the graph model by representing narrative nodes and player choices as nodes and edges in the graph. Initialize messages for each node, typically as prior probabilities. Then, iterate message passing within the graph, updating node states and probability distributions until convergence. Determine the optimal narrative path based on the posterior probability distribution at convergence.

4.2. Setting and Function of Guard Nodes

Guard nodes are crucial in tree structures, preventing exponential growth of deviations when a single node fails, thus avoiding severe problems. Narrative nodes in a game can be likened to network nodes, with each narrative node corresponding to a key event or plot development in the game. Failures refer to deviations in the jointly created narrative by the AI and the player, moving too far from the author’s intended plot. Guard nodes function as checkpoints or triggers in the game or may be the critical narrative nodes themselves. The goal of these guard nodes is to prevent players from deviating excessively from the established narrative line, ensuring smooth story progression. Control over the narrative flow can be maintained by these guard nodes, much like how system risks and cascading failures are managed in network systems. By using guard nodes, it is possible to ensure that even if players make atypical choices, the game story can still return to the main narrative arc.

5. Conclusion and Outlook

This paper proposes the use of hypothesis testing and Bayesian theories for AI scoring training, leveraging advanced research both within and outside the industry, utilizing large-scale random optimization, message passing algorithms, and guard nodes to ensure that AI can effectively correct narrative deviations in practical applications. These approaches aim to enable better self-correction of game narratives in the future when AI is fully integrated into the gaming industry, providing players with an excellent gaming experience. This study not only aims to optimize the interaction between players and AI, enhancing playability and immersion but also strives to maintain narrative consistency and depth, ensuring that the game story reflects the designer's artistic intentions even during the player's free exploration. Achieving this goal will provide a new narrative framework for the game design field, promoting further integration and innovation between game design and artificial intelligence technology.

Acknowledgments

This is my first time publishing an article. During this research process, many friends provided me with assistance. Here, I would like to thank everyone who has helped me, with special thanks to Xianhao Gao and Quan Yan. I appreciate Xianhao Gao's guidance in my research, and I am grateful to Quan Yan for bringing me drinks when I was writing late into the night.

Additionally, I want to thank the music game "maimai." It has given me a lot of inspiration.


References

[1]. Yu, Pei-Duo, et al. “Averting Cascading Failures in Networked Infrastructures: Poset-Constrained Graph Algorithms.” IEEE Journal of Selected Topics in Signal Processing, vol. 12, no. 4, Aug. 2018, pp. 733–48. https://doi.org/10.1109/jstsp.2018.2844813.

[2]. Zhao, Runcong, et al. “NarrativePlay: An Automated System for Crafting Visual Worlds in Novels for Role-Playing.” Proceedings of the ... AAAI Conference on Artificial Intelligence, vol. 38, no. 21, Mar. 2024, pp. 23859–61. https://doi.org/10.1609/aaai.v38i21.30589. Riedl, Mark Owen, and Vadim Bulitko. "Interactive narrative: An intelligent systems approach." Ai Magazine 34.1 (2013): 67-67.

[3]. Magerko, Brian, et al. “AI characters and directors for interactive computer games.” Innovative Applications of Artificial Intelligence, July 2004, pp. 877–83. ai.eecs.umich.edu/people/laird/papers/magerko-2004-IAAI-Haunt.pdf.

[4]. Ammanabrolu, Prithviraj, et al. “Bringing Stories Alive: Generating Interactive Fiction Worlds.” Proceedings, vol. 16, no. 1, Oct. 2020, pp. 3–9. https://doi.org/10.1609/aiide.v16i1.7400.

[5]. Ling, Lin, and Chee Wei Tan. Human-Assisted Computation for Auto-Grading. Nov. 2018, https://doi.org/10.1109/icdmw.2018.00059.


Cite this article

Bi,Y. (2024). Tree narrative and AI interaction: Optimization and narrative bias handling prospects. Applied and Computational Engineering,71,163-167.

Data availability

The datasets used and/or analyzed during the current study will be available from the authors upon reasonable request.

Disclaimer/Publisher's Note

The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of EWA Publishing and/or the editor(s). EWA Publishing and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

About volume

Volume title: Proceedings of the 6th International Conference on Computing and Data Science

ISBN:978-1-83558-481-1(Print) / 978-1-83558-482-8(Online)
Editor:Alan Wang, Roman Bauer
Conference website: https://www.confcds.org/
Conference date: 12 September 2024
Series: Applied and Computational Engineering
Volume number: Vol.71
ISSN:2755-2721(Print) / 2755-273X(Online)

© 2024 by the author(s). Licensee EWA Publishing, Oxford, UK. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license. Authors who publish this series agree to the following terms:
1. Authors retain copyright and grant the series right of first publication with the work simultaneously licensed under a Creative Commons Attribution License that allows others to share the work with an acknowledgment of the work's authorship and initial publication in this series.
2. Authors are able to enter into separate, additional contractual arrangements for the non-exclusive distribution of the series's published version of the work (e.g., post it to an institutional repository or publish it in a book), with an acknowledgment of its initial publication in this series.
3. Authors are permitted and encouraged to post their work online (e.g., in institutional repositories or on their website) prior to and during the submission process, as it can lead to productive exchanges, as well as earlier and greater citation of published work (See Open access policy for details).

References

[1]. Yu, Pei-Duo, et al. “Averting Cascading Failures in Networked Infrastructures: Poset-Constrained Graph Algorithms.” IEEE Journal of Selected Topics in Signal Processing, vol. 12, no. 4, Aug. 2018, pp. 733–48. https://doi.org/10.1109/jstsp.2018.2844813.

[2]. Zhao, Runcong, et al. “NarrativePlay: An Automated System for Crafting Visual Worlds in Novels for Role-Playing.” Proceedings of the ... AAAI Conference on Artificial Intelligence, vol. 38, no. 21, Mar. 2024, pp. 23859–61. https://doi.org/10.1609/aaai.v38i21.30589. Riedl, Mark Owen, and Vadim Bulitko. "Interactive narrative: An intelligent systems approach." Ai Magazine 34.1 (2013): 67-67.

[3]. Magerko, Brian, et al. “AI characters and directors for interactive computer games.” Innovative Applications of Artificial Intelligence, July 2004, pp. 877–83. ai.eecs.umich.edu/people/laird/papers/magerko-2004-IAAI-Haunt.pdf.

[4]. Ammanabrolu, Prithviraj, et al. “Bringing Stories Alive: Generating Interactive Fiction Worlds.” Proceedings, vol. 16, no. 1, Oct. 2020, pp. 3–9. https://doi.org/10.1609/aiide.v16i1.7400.

[5]. Ling, Lin, and Chee Wei Tan. Human-Assisted Computation for Auto-Grading. Nov. 2018, https://doi.org/10.1109/icdmw.2018.00059.