A Multi-Agent Dynamic Narrative System Based on Flow Theory and Its Cooperative Optimization Method

By using a multi-agent collaborative processing module and asynchronous user modeling, the system addresses the issues of insufficient flexibility, fragmented narrative, and lack of flow in existing interactive narrative systems, achieving a dynamic, personalized, and immersive interactive narrative experience applicable to fields such as games, education, virtual reality, and psychological therapy.

CN122308797APending Publication Date: 2026-06-30LISHUI UNIV

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
LISHUI UNIV
Filing Date
2026-04-08
Publication Date
2026-06-30

AI Technical Summary

Technical Problem

Existing interactive narrative systems rely on pre-set scripts, resulting in insufficient flexibility; single-model-driven systems cause narrative fragmentation; neglecting user psychological states leads to a lack of flow; real-time performance and in-depth analysis are difficult to balance; and the lack of modularity and scalability limits the promotion and evolution of the system in diverse application scenarios.

Method used

It adopts a modern software architecture that separates the front-end and back-end, and combines a multi-agent collaborative processing module, including a topic manager, scene builder, conflict generator, narrative generator, and analyzer. Through semantic parsing, scene construction, challenge design, and asynchronous user modeling, it achieves flexible user interaction, narrative coherence, and personalized experience.

Benefits of technology

It achieves dynamic adaptability, narrative coherence, personalized experience, and high scalability, and can respond to unexpected user input, maintain a flow state, adapt to various application scenarios, and reduce promotion and iteration costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122308797A_ABST
    Figure CN122308797A_ABST
Patent Text Reader

Abstract

This invention discloses a multi-agent dynamic narrative system based on flow theory and its collaborative optimization method, relating to the intersection of artificial intelligence and interactive digital entertainment. The system adopts a front-end / back-end separation architecture, with the front-end based on the Vue.js framework and the back-end relying on the Python Quart asynchronous web framework. The core is the multi-agent collaborative processing module (FlowMAS Core). This module includes four essential agents—a topic manager, a scene builder, a conflict generator, and a narrative generator—executed in a fixed order, as well as an asynchronously running analyzer that optimizes the agent. Through a collaborative mechanism of topic hierarchy maintenance, scene logic constraints, dynamic calibration of challenge difficulty, narrative text generation, and iterative updates of user profiles, a dynamic balance between skills and challenges is achieved, maintaining the user's flow state. The system supports modular hot-swappable design, balancing real-time interaction and deep analysis, solving problems such as insufficient flexibility and fragmented narrative in existing systems. It can be widely applied in fields such as games, education, and psychological therapy.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the intersection of artificial intelligence and interactive digital entertainment technology, specifically to a multi-agent dynamic narrative system based on flow theory and its collaborative optimization method. Background Technology

[0002] With the rapid development of artificial intelligence technology, interactive narrative systems have been widely applied in various fields such as digital entertainment, education and training, virtual companionship, and psychological therapy. The core objective of these systems is to enhance user immersion and engagement through computer-generated or assisted-generated storylines, enabling users to freely explore and interact in virtual environments. However, most existing interactive narrative systems still rely on pre-set scripts, branching storylines, or single large language models. While this approach can meet basic story presentation needs to some extent, it has significant limitations. On the one hand, pre-set script-based narratives cannot adapt to unexpected user input and free behavior, resulting in a limited user experience and a lack of flexibility and personalization. On the other hand, single-model-driven narratives often lack multi-dimensional logical deduction and character collaboration, easily leading to monotonous narratives, fragmented content, or logical inconsistencies. Furthermore, traditional systems typically focus on content generation itself in scene construction, plot progression, and interaction design, neglecting real-time modeling and feedback adjustment of the user's psychological state. This makes it difficult to maintain a "flow" state in the narrative experience, easily causing user anxiety or boredom, thus reducing interaction stickiness.

[0003] Meanwhile, existing research and applications present a significant challenge in balancing real-time performance with in-depth analysis. On one hand, interactive narrative systems need to rapidly generate response content after user input to ensure a smooth interactive experience, requiring the system to complete semantic parsing, plot organization, and language generation within a short timeframe. On the other hand, truly achieving personalized and immersive experiences necessitates in-depth analysis of users' historical behavior, preferences, and psychological characteristics. However, such analyses often require substantial computation time and complex model support, making them difficult to execute instantly in high-frequency interactions. Furthermore, existing systems generally lack modularity and scalability at the architectural level, necessitating significant modifications to the core framework to introduce new features (such as emotion recognition and cultural background adaptation), thus limiting the system's promotion and evolution across diverse application scenarios. In conclusion, how to ensure real-time performance while simultaneously achieving in-depth user modeling, how to achieve an adaptive balance between skills and challenges in dynamic narratives, and how to construct a modular and scalable multi-agent collaborative architecture have become critical technical challenges that urgently need to be addressed in the field of interactive narrative systems. Summary of the Invention

[0004] The core objective of this invention is to provide a multi-agent dynamic narrative system and collaborative optimization method based on flow theory. Through innovative architecture design and agent collaboration mechanism, it solves the core technical problems of existing interactive narrative systems, such as insufficient flexibility due to reliance on preset scripts, narrative fragmentation caused by single model driving, lack of flow due to neglect of user psychological state, and difficulty in balancing real-time performance and in-depth analysis. Ultimately, it achieves a dynamic, personalized, and immersive interactive narrative experience.

[0005] To achieve the above objectives, the present invention provides the following technical solution:

[0006] The system adopts a modern software architecture that separates the front-end and back-end, decoupling user interaction from core processing and ensuring flexibility in deployment, expansion, and maintenance.

[0007] Front-end layer: Based on the Vue.js framework and combined with component libraries, it is mainly responsible for the implementation of user interface interaction logic and visual rendering tasks, providing users with an intuitive and smooth operation entry point;

[0008] Backend layer: Built on the Python Quart asynchronous web framework, its core responsibilities include receiving and scheduling user requests, real-time management of session state, and calling and coordinating the core modules to ensure response efficiency in high-concurrency scenarios;

[0009] The core processing layer, the FlowMAS Core, is the core carrier for the system's functionality. It contains five clearly defined agents: the TopicManager, SceneBuilder, TroubleMaker, and Writer are necessary agents that execute in a fixed order, forming the main interaction loop; the Analyzer is an independently running, asynchronously selected agent responsible for deep user modeling. All agents inherit from a unified Agent base class, supporting modular hot-swappability. Agents can be replaced, added, or their execution order adjusted without modifying the core architecture, giving it strong scalability.

[0010] II. Core Intelligent Agent Functions and Collaborative Logic

[0011] (a) Main interaction loop: the sequential execution flow of necessary intelligent agents

[0012] The main interaction loop is the core process of the system responding to user input. Each time a user initiates input, the intelligent agent is called in strict order to ensure the standardization, traceability, and interpretability of the generated content:

[0013] (1) Topic Manager

[0014] As the primary module for user input parsing and narrative logic control, its core function is to receive user input data, accurately identify the core intent behind the input through semantic parsing algorithms, and maintain a multi-layered topic structure with parent-child dependencies. This module supports topic creation, updating, shelving, and reactivation, achieving precise control over topic status through structured tools. It can dynamically build and maintain a parent-child topic hierarchy, effectively managing the relationship between macro-goals and sub-tasks, fundamentally ensuring the narrative logic continuity between user behavior and system-generated content, and avoiding narrative breaks caused by improper topic switching or omissions.

[0015] (2) SceneBuilder

[0016] The system receives updated topic information from the topic manager and generates or updates scene descriptions according to a predefined scene construction protocol. To ensure consistency in cross-module parsing, all output data strictly adheres to YAML format and fully complies with the predefined YAML Schema protocol. The scene generation process adheres to the "absolute accessibility principle," prohibiting the introduction of any interaction barriers not explicitly defined in the user's historical data. At the same time, it ensures that scene elements are highly relevant to user behavior logic and that the scene environment is semantically consistent with the current topic, guaranteeing both the logical self-consistency of the scene and the user's freedom of action and smooth interaction.

[0017] (3) Trouble Maker

[0018] As the core execution module for implementing flow theory, its inputs include currently active topic data, scene information generated by the scene builder, and user psychological profile data provided by the analyzer. This module dynamically calibrates the user's skill level with the narrative challenge difficulty through a pre-set difficulty matching algorithm, strictly adhering to the principle of "predictable risk, unexpected reward"—dynamically adjusting the challenge difficulty based on the user's psychological profile and round performance to ensure that the challenge content is neither too difficult, causing user anxiety, nor too easy, causing boredom, thereby helping users maintain a flow state. The final output is a structured logical framework containing the narrative stopping point location, challenge type, difficulty level, and logical association rules, providing clear guidance for subsequent narrative generation.

[0019] (4) Narrative Generator (Writer)

[0020] As the sole external interface for system-user interaction, it receives the structured logic framework output by the conflict generator and expands it into continuous narrative text conforming to language norms and contextual logic through a natural language generation algorithm. The generation process strictly adheres to the "Show, Don't Tell" principle, depicting the event process through sensory details rather than directly narrating the outcome. The narrative text is at least 400 characters long, and at least three user interaction options with differentiated choice paths are designed based on the narrative stopping points in the framework to ensure user freedom of choice. The final output consists of two parts: first, natural language text that meets the word count requirement; and second, JSON structured data covering turn-based information, interaction option parameters, and narrative logic tags, satisfying user interaction needs while providing support for subsequent system tracking, analysis, and verification.

[0021] (II) Optimal Agent Selection: Asynchronous User Modeling and Analysis

[0022] Analyzer

[0023] Running periodically as an asynchronous background thread, triggered every 5 rounds of user interaction, the module executes without blocking the main interaction flow, achieving a balance between real-time response performance and deep analysis capabilities. This module collects historical user interaction data, topic status change records, scene feedback information, and narrative selection behavior data. Using Bayesian iterative analysis and update methods, it refines existing user profiles with evidence, gradually improving their accuracy. The generated user profiles encompass multi-dimensional quantitative indicators, including the Big Five personality traits, language and reasoning abilities, decision-making style, motivational preferences, cognitive level, risk tolerance, gaming motivation, and content preferences. Each dimension includes a quantitative score, confidence level, and evidence description. The final output is a standardized JSON object, providing core data support for difficulty calibration of the conflict generator and style adaptation of the narrative generator.

[0024] III. Key Technology Innovation and Implementation Mechanisms

[0025] (1) Dynamic maintenance mechanism of flow state: Through the closed-loop design of “analyzer modeling → conflict generator adaptation”, the user’s psychological state is quantified into callable model parameters, so that the difficulty of the challenge is dynamically adjusted with the user’s skill level, rather than a static assumption. This realizes the core requirement of “skill and challenge balance” in flow theory from a technical point of view, and ensures the sustainability of the narrative experience.

[0026] (2) Asynchronous analysis and main loop separation mechanism: In response to the contradiction between real-time interaction and in-depth analysis, the analyzer is placed in an independent asynchronous thread. Through periodic triggering and cache update, the delay caused by complex calculations in the main loop is avoided, and the user profile can be gradually optimized in long-term interaction to achieve continuous upgrade of personalized experience, thus solving the core technical pain point of the existing system.

[0027] (3) Modular and scalable architecture: Based on the design of a unified Agent base class, combined with front-end and back-end containerized deployment and microservice architecture, it not only supports the independent expansion and distributed operation of each agent, but also adds functional modules (such as emotion recognition and cultural background adaptation) without changing the core architecture, so that the system can flexibly adapt to various application scenarios such as games, education, psychological healing, and virtual companionship, and reduce promotion and iteration costs.

[0028] (4) Narrative Logic Consistency Guarantee Mechanism: Through the multi-layer topic structure maintenance of the topic manager, the strict constraint principle of the scene builder, and the fixed sequence execution process of the agent, a complete logical chain of "intent recognition → scene construction → challenge design → narrative generation" is formed to ensure that the content generated by the system always revolves around the user's intent, avoid narrative fragmentation or logical contradictions, and lay the foundation for immersive experience.

[0029] The essential technical features of this system are guaranteed by the fixed-order collaboration and functional constraints of four essential intelligent agents, ensuring the stable implementation of the core narrative function. The optimized technical features, through asynchronous analysis, modular expansion, and multi-dimensional profile modeling, further enhance the system's personalization, adaptability, and engineering maintainability, forming a technical solution that is both innovative and practical.

[0030] Invention Effects

[0031] This invention addresses the core technical shortcomings of existing interactive narrative systems by deeply integrating a multi-agent collaborative architecture with flow theory.

[0032] (1) Dynamic adaptability: It breaks free from the limitations of preset scripts, can respond to unexpected user input, dynamically adjust the narrative path, and meet the needs of free exploration;

[0033] (2) Narrative coherence: Through the multi-layered topic structure of the topic manager and the logical constraints of the scene builder, the content is ensured to be coherent and logically consistent;

[0034] (3) Personalized experience: Based on asynchronous analysis, user psychological modeling is used to achieve precise matching between challenge difficulty and narrative style, and maintain the flow state;

[0035] (4) High efficiency and scalability: The front-end and back-end are separated and modularly designed, taking into account both real-time interaction efficiency and multi-scenario adaptability, reducing promotion and iteration costs.

[0036] This invention can be widely applied in fields such as games, education, virtual reality, and psychological healing, providing interactive platforms with dynamic, personalized, and immersive narrative solutions, and has significant technological innovation and practical value. Attached Figure Description

[0037] Figure 1 This is a schematic diagram of the overall architecture of the multi-agent dynamic narrative system based on flow theory as described in an embodiment of the present invention.

[0038] Figure 2 This is a schematic diagram illustrating the multi-agent collaborative mechanism described in an embodiment of the present invention and its information interaction relationship in the story model. Detailed Implementation

[0039] The FlowMAS (Flow Dynamic Narrative System) based on flow theory proposed in this invention possesses strong universality and scalability. To facilitate understanding, this section provides several specific embodiments in different application scenarios, demonstrating the system's operational flow and technical effects in interactive games, education and training, and psychological therapy and companionship. These embodiments provide a more intuitive illustration of the invention's innovation and practical value.

[0040] Example 1: Dynamic Story Generation in Interactive Game Scenarios

[0041] In one specific embodiment of the present invention, the proposed multi-agent dynamic narrative system based on flow theory can be applied to interactive game scenarios to support free user input and dynamic narrative generation in an open environment. Users input natural language commands through a front-end interactive interface. This input is first transmitted to the system back-end and processed by the topic manager in the multi-agent pipeline. The topic manager undertakes the core functions of user intent recognition and topic structure updating. It determines the relationship between the command and the existing topic model by parsing the input content. If the input is related to an existing topic, the progress information of that topic is updated; if the input introduces a new goal, a new sub-topic is added to the topic hierarchy, and a dependency relationship is established through parent and child fields. This process ensures consistency between user input and narrative logic, thereby avoiding breaks in the narrative process caused by topic jumps or improper management.

[0042] After the topic update is completed, the processing flow enters the scene builder stage. The scene builder generates new scene information based on the currently active topic state. The output of this scene uses a strict YAML data structure to ensure reliable parsing and utilization in subsequent modules. During the generation process, the scene builder adheres to the accessibility principle, meaning that unless explicitly defined in historical data, it prohibits the introduction of environmental elements that might hinder user interaction, such as temporarily closed passages or undefined obstacles. This mechanism ensures the logical consistency and interactive continuity of the scene, thus avoiding the problem of user input failing to be responded to appropriately by the system due to unreasonable environmental settings. In this way, the system can maintain the consistency of the narrative environment's rules while ensuring freedom of interaction.

[0043] After the scenario is constructed, the conflict generator designs appropriate challenges and narrative endpoints for the narrative process based on the current topic and user profile. The conflict generator's input includes not only environmental data from the scenario builder but also user psychological and behavioral profiles accumulated by the analyzer during asynchronous operation. Because the analyzer runs periodically in the background, its output data does not immediately affect the current round but rather serves as parameters influencing challenge design in subsequent rounds. This asynchronous analysis mechanism avoids delays in the main loop's execution while gradually increasing personalization over medium to long-term interactions. The conflict generator adjusts the challenge difficulty based on the user's historical performance; for example, it designs more complex choice paths for high-performing users and reduces obstacle difficulty for lower-performing users to maintain a balance between skill and challenge. This design is a key step in translating the psychological flow theory into a system implementation, ensuring that narrative generation dynamically adapts to the user's ability state.

[0044] After designing the challenges and stopping points, the Writer module receives the structured output from the conflict generator and transforms it into natural language narrative text. During the generation process, the Writer must not only restore the logical framework but also ensure that the narrative text conforms to language conventions and contextual logic. The final output consists of two parts: a continuous natural language narrative showcasing the story's development in the current round; and a structured JSON object containing metadata for the current round, a description of the narrative stopping point, and user-selectable interactive options. This dual-output mechanism satisfies user interaction needs while providing structured support for subsequent tracking, analysis, and verification, thereby enhancing the system's traceability and engineering maintainability.

[0045] Through the above-described fixed-sequence pipeline execution, user input is parsed, reconstructed, and expanded layer by layer, forming a logically consistent interactive game round. In this process, essential technical features are reflected in the collaborative operation of the five core modules and their fixed-sequence processing logic, while preferred technical features are reflected in the asynchronous operation mechanism of the analyzer and the structured output data format. Based on this, this embodiment can achieve dynamic narrative generation in interactive game scenarios and gradually form personalized user profiles while ensuring real-time response. Therefore, from an engineering perspective, it provides a scalable, maintainable, and logically closed-loop implementation path for game applications.

[0046] Example 2: Foreign Language Oral Learning in Educational and Training Scenarios

[0047] In this example, the multi-agent dynamic narrative system can be applied to educational and training scenarios, such as language learning dialogue systems or skill training simulation environments. In this application model, user input is typically sentences in the target language or instructions related to a specific training task. The system needs to generate corresponding teaching dialogues or training scenarios while ensuring logical consistency and technical traceability. Similar to interactive game scenarios, this process strictly follows the execution order of a fixed pipeline and gradually improves the personalization and targeting of training through asynchronous analysis mechanisms.

[0048] When learners input text or voice on the front-end interface, the topic manager first parses the input to identify its corresponding learning topic. For example, when a learner inputs "I want to order a meal," the topic manager matches the input with the predefined learning topic "ordering food at a restaurant" and updates the status of the currently active topic in the topic hierarchy. If the input is related to an existing topic, progress information is updated and logical coherence is maintained; if the input introduces a new learning objective, such as "payment," the topic manager creates a sub-topic and establishes a parent-child relationship with the main topic. This mechanism ensures the continuity and scalability of the educational process across topics, thereby avoiding logical breaks in training caused by inappropriate switching of objectives.

[0049] After a topic update, the scene builder generates corresponding scene information based on the currently active topic. For example, in a restaurant dialogue scene, the scene builder constructs an interactive environment containing basic elements such as tables, chairs, menus, and waiters, and outputs the results in YAML format for subsequent module parsing and invocation. The scene builder must adhere to the accessibility principle, meaning it must not introduce any historically defined obstructive elements into the scene. For example, if the event "restaurant power outage" was not previously defined, such anomalies must not be introduced into the scene to avoid affecting learners' input freedom. This principle ensures the logical consistency and predictability of interactions within the teaching scene, enabling learners to train in a relatively stable and structured environment.

[0050] Subsequently, the conflict generator adjusts the difficulty of the learning task based on the current topic and user profile. The input to this process includes scenario data as well as user profile information generated asynchronously by the analyzer. Because the analyzer runs periodically in the background, its results do not directly affect the current round, but rather gradually influence the difficulty adjustment over several rounds. Therefore, the difficulty design of the conflict generator is progressive, rather than providing immediate feedback. For example, for a language learning task, the initial stage might only require learners to repeat short sentences; after several rounds of user modeling, the conflict generator will gradually introduce complex sentences, conditional sentences, or situational simulation tasks to increase the challenge. In this way, the system can gradually match the learner's ability level over long-term operation, maintaining a dynamic balance between skill and challenge.

[0051] After adjusting the difficulty and setting the narrative stopping point, the Writer module receives the logical framework provided by the conflict generator and transforms it into natural language output. For language learning scenarios, Writer generates instructional text containing dialogue between the waiter and the customer, ensuring that the information in the logical framework is presented in a form consistent with the target language's conventions. Furthermore, Writer generates several interactive options for learners to choose from, such as "order a drink," "pay the bill," and "continue ordering," and encapsulates these options along with turn-based information into a JSON object for system storage and subsequent analysis. Through this dual output mechanism, the system can both meet learners' immediate interactive needs and ensure the structured and traceable nature of the output results at the data level.

[0052] The analyzer runs continuously in the background, modeling learners' input data and historical behavior, and progressively refining the user profile using Bayesian updates. This profile encompasses multiple dimensions, including learners' language proficiency, error types, cognitive habits, and decision-making styles, and is provided to the conflict generator and writer in structured JSON data format after periodic analysis. Because this process is asynchronous, it does not affect the real-time performance of the main loop, but it can gradually improve the personalization of task design and text generation over long-term interaction. For example, during language learning, the analyzer might detect a high frequency of errors in tense usage by the learner; subsequently, the conflict generator will add tense-related tasks in later rounds, and the writer will generate more sentences containing tense variations for practice. This mechanism, in its technical implementation, ensures the dynamic adaptability and targeted nature of educational training.

[0053] In summary, this embodiment achieves a closed-loop processing flow of topic management, scenario construction, difficulty adjustment, and text generation in education and training scenarios through a fixed-sequence multi-agent pipeline and an asynchronous analysis mechanism. Essential technical features are reflected in the sequential execution of the five core agents and their respective functional constraints, while preferred technical features include the asynchronous operation of the analyzer, structured data output, and a progressive difficulty adjustment mechanism. Through this architecture, the system can gradually achieve accurate modeling of learner states and dynamic adjustment of task difficulty while maintaining real-time interaction, thus providing a scalable, traceable, and engineering-feasible technical path for education and training.

[0054] Figure 1 This is a schematic diagram of the overall architecture of the multi-agent dynamic narrative system based on flow theory, as described in this embodiment of the invention. The diagram illustrates the interaction path between the user and the system. Starting with an HTTP request initiated by the user, the request is transmitted via the front-end webpage (Vue.js) and the back-end service (Quart) to the FlowMAS core module. Then, the TopicManager, SceneBuilder, TroubleMaker, Writer, and Analyzer work together to form a fixed-sequence pipeline-like content generation and feedback mechanism. Specifically, user input is processed by the FlowMAS core module, transformed into narrative content, and fed back to the front-end interface. The Analyzer runs asynchronously and periodically, updating the user's psychological profile based on user behavior to achieve a dynamic balance between skills and challenges, thereby maintaining the user's flow experience.

[0055] Figure 2 This diagram illustrates the multi-agent collaborative mechanism and its information interaction relationships within the story model, as described in this embodiment of the invention. Centered on the StoryModel, the diagram shows the data flow and dependencies between player input, topic manager, scene builder, conflict generator, narrative generator, and analyzer. Player input first updates the story model; the topic manager identifies and adjusts the current topic; the scene builder generates logically consistent scenes based on the topic; the conflict generator combines user psychological profiling to calibrate challenges and offer writing suggestions; the narrative generator expands the suggestions into complete narrative text and provides user choices; and the analyzer updates the psychological profile based on user historical behavior and topic data. The operation of each module follows a principle combining sequential execution and asynchronous analysis, forming a closed-loop mechanism of "topic, scene, challenge, narrative, and analysis."

Claims

1. A multi-agent dynamic narrative system based on flow theory, characterized in that, The system adopts a front-end and back-end separation software architecture. The front-end is based on the Vue.js framework and uses a component library to implement the user interface interaction logic and visual rendering. The back-end is based on the Python Quart asynchronous web framework, which is responsible for user request scheduling, session state management, and the invocation and coordination of core modules. The core of the system is the multi-agent collaborative processing module (FlowMAS Core), which includes four necessary agents that execute in a fixed order, and one independent asynchronous preferred agent. The functions of each agent are defined as follows: TopicManager: Receives user input data, identifies the core intent behind the input through semantic parsing algorithms, maintains a multi-layered topic structure with parent-child dependencies, dynamically updates the state parameters of the currently active topic, manages the relationship between macro goals and sub-tasks, and ensures the narrative logic continuity between user behavior and system-generated content. SceneBuilder: Receives updated topic information from the topic manager, generates or updates scene descriptions according to predefined scene building protocols, and strictly uses YAML format for output data to ensure consistency in cross-module parsing. The scene generation process follows preset constraint principles, including prohibiting the introduction of interaction barriers not defined in historical data, ensuring that scene elements are highly relevant to user behavior logic, and maintaining semantic consistency between the scene environment and the current topic. TroubleMaker: As the core execution module for implementing flow theory, it takes into account the currently active topic data, scene information generated by the scene builder, and user psychological profile data. Through a preset difficulty matching algorithm, it dynamically calibrates the user's skill level with the difficulty of the narrative challenge, and generates a structured logical framework that includes the location of the narrative stopping point, the type of challenge, the difficulty level, and logical association rules. Narrative Generator (Writer): Receives the structured logic framework output by the conflict generator, expands it into continuous narrative text that conforms to language norms and contextual logic through natural language generation algorithms, and designs at least two user interaction options with differentiated selection paths based on the narrative stopping points in the framework. The output includes natural language text that meets the minimum word count requirement, as well as JSON structured data containing turn-based information, interaction option parameters, and narrative logic tags, serving as the only external interface for system-user interaction. The Analyzer runs periodically in an asynchronous background thread, collecting historical user interaction data, topic status change records, scene feedback information, and narrative choice behavior data. It uses a Bayesian update method to correct existing user profiles with evidence, generating a quantitative user profile that covers multiple dimensions such as personality traits, language and reasoning abilities, decision-making style, motivational preferences, cognitive level, and risk tolerance. The output is a standardized JSON object.

2. The system according to claim 1, characterized in that, The TopicManager supports the creation, updating, shelving, and reactivation of topics. It uses structured tools to achieve precise control over topic status and supports the dynamic construction and maintenance of parent-child topic hierarchies.

3. The system according to claim 1, characterized in that, All outputs of the SceneBuilder must conform to the predefined YAML Schema protocol and strictly adhere to the "absolute accessibility principle," prohibiting the addition of any obstructive elements not explicitly defined in the user history in the scene description, thus ensuring user freedom of action and smooth interaction.

4. The system according to claim 1, characterized in that, Based on the user psychological profile generated by the Analyzer and the user's performance in each round, TroubleMaker dynamically adjusts the difficulty of the narrative challenge, following the principle of "predictable risk and unexpected reward," to ensure that the challenge content neither causes user anxiety nor boredom, thereby maintaining a state of flow.

5. The system according to claim 1, characterized in that, The Writer generates narrative text of no less than 400 words, strictly adhering to the "Show, Don't Tell" principle. It describes the event process through sensory details rather than directly narrating the result, and provides at least three action options that match the user's style. Finally, it outputs a structured JSON summary.

6. The system according to claim 1, characterized in that, The Analyzer employs a Bayesian iterative analysis method, dynamically updating user psychological profiles based on historical user behavior and topic data. It covers dimensions such as the Big Five personality traits, reasoning ability, game motivation, and content preferences. Each dimension includes quantitative scores, confidence levels, and evidence descriptions.

7. The system according to claim 1, characterized in that, The Analyzer runs as an asynchronous background task, triggered once every 5 rounds of interaction. The execution process does not block the main interaction flow, ensuring that the system's real-time response performance and deep analysis capabilities are both taken into account.

8. The system according to claim 1, characterized in that, The core module of the multi-agent system is executed in a fixed-order pipeline structure. Each user input is strictly called in the order of TopicManager, SceneBuilder, TroubleMaker, and Writer to ensure that the content generation process is standardized, traceable, and interpretable.

9. The system according to claim 1, characterized in that, The system supports a modular hot-swappable mechanism, with each agent inheriting from a unified Agent base class. This allows for the replacement, addition, or adjustment of agent execution order without modifying the core architecture, enabling flexible expansion and customization of system functions.