Multi-agent driven game script generation method

Through the multi-agent-driven game script generation method, the repetition and logical breakage of script generation in the prior art are solved, and efficient and controllable script generation and dynamic adjustment are achieved, which is suitable for the rapid iteration of game development.

CN120373457APending Publication Date: 2025-07-25GIANT MOBILE TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510448750.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-04-10
Publication Date
2025-07-25

AI Technical Summary

Technical Problem

The existing game script generation technology has problems such as high repetition, logical breakage, lack of creativity, difficulty in dynamic adjustment and structured output, which increases development costs.

Method used

Using a multi-agent-driven method, a script knowledge distillation framework based on inference model is built, training data is generated through topic-driven development, reinforcement learning and retrieval tools are introduced, and expansion, magic modification and polishing agents are built to realize script sequel and magic modification tasks.

Benefits of technology

It improves the controllability and practicality of script generation, supports dynamic adjustment, reduces manual conversion costs, adapts to different styles of plot adaptation, and is suitable for rapid iteration of game development.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120373457A_ABST
    Figure CN120373457A_ABST
Patent Text Reader

Abstract

The invention relates to a multi-agent driven game script generation method. The method comprises the following steps: S1, constructing a script knowledge distillation framework based on an inference model; s2, automatically generating training data containing a four-layer structure through a topic-driven instruction fine tuning data set generation method; s3, training a lightweight downstream model by using the fine-tuned data set to realize knowledge distillation so as to reduce the reasoning cost; s4, introducing a reinforcement learning technology, designing a training model through a pure rule reward function, and enabling the training model to actively call a retrieval tool; and S5, on the basis of the training model, constructing a writing expansion agent, a magic modification agent, a summary agent and a retouching agent, and realizing a script continuous writing task and a script magic modification task through cooperation of the agents. According to the method, an efficient and controllable script generation scheme supporting dynamic adjustment can be provided for game developers, and the whole process from main line plot generation, branch line task design to user interactive plot reorganization can be covered.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the cross - technical field of artificial intelligence and digital entertainment, and particularly relates to a method for generating game scripts driven by multiple agents. Background Art

[0002] Existing game script generation technologies mainly rely on the following methods, but all have significant defects:

[0003] 1. Rule - based template generation: By filling content into preset plot templates, the generated scripts have high repeatability, lack creativity, and cannot respond flexibly to user input, such as tools like "Plot Generator";

[0004] 2. Single - model end - to - end generation: Using a single large - language model (such as the GPT series) to directly generate text. Although it can improve diversity, there are problems such as logical breaks, inconsistent character behaviors, and it is difficult to control the plot direction;

[0005] 3. Limited interactivity: Existing systems mostly adopt a single - round generation mode and cannot dynamically adjust plot branches according to user feedback (such as the fixed context window limit of AI Dungeon);

[0006] 4. Lack of structured output: The generated result is unstructured text, which needs to be manually processed into formatted data (such as a JSON plot tree) that can be used by the game engine, increasing the development cost.

[0007] Therefore, it is necessary to provide a method for generating game scripts driven by multiple agents, which can provide an efficient, controllable and dynamically adjustable script generation solution for game developers, covering the entire process from main plot generation, side - mission design to user - interactive plot adaptation. Summary of the Invention

[0008] The purpose of the present invention is to provide a method for generating game scripts driven by multiple agents, which can provide an efficient, controllable and dynamically adjustable script generation solution for game developers, covering the entire process from main plot generation, side - mission design to user - interactive plot adaptation.

[0009] To solve the problems existing in the prior art, the present invention provides a method for generating game scripts driven by multiple agents, including the following steps:

[0010] S1: Construct a script knowledge distillation framework based on an inference model;

[0011] S2: Automatically generate training data containing a four - layer structure of "worldview setting - character relationship - plot conflict - dialogue behavior" through a method of generating a topic - driven instruction fine - tuning data set;

[0012] S3: Train a lightweight downstream model using the fine-tuned dataset to achieve knowledge distillation and reduce the inference cost;

[0013] S4: Introduce reinforcement learning techniques, and design a training model through a pure rule reward function to enable the training model to actively call retrieval tools;

[0014] S5: Based on the training model, construct an expansion agent, a modification agent, a summary agent, and a polishing agent. Each agent collaborates to complete the script continuation task and the script modification task.

[0015] Optionally, in the multi-agent driven game script generation method, the inference model is DeepSeek-R1.

[0016] Optionally, in the multi-agent driven game script generation method, the downstream model is TinyLlama.

[0017] Optionally, in the multi-agent driven game script generation method, the reinforcement learning technique is DirectPreference Optimization, and the pure rule is rule-based.

[0018] Optionally, in the multi-agent driven game script generation method, the reward function includes: logical coherence score, plot conflict intensity, and user intention matching degree.

[0019] Optionally, in the multi-agent driven game script generation method, all agents support calling the Internet retrieval API to obtain knowledge in real time.

[0020] Optionally, in the multi-agent driven game script generation method, the steps to complete the script continuation task are as follows:

[0021] The expansion agent reads the entire existing script, extracts the time and space background, character status, and unsolved conflicts;

[0022] Based on the reinforcement learning strategy, perform multi-branch expansion on the end section of the script, and supplement reasonable details through retrieval tools;

[0023] Output candidate plot segments, which are selected by the user and then update the global plot graph;

[0024] After the final draft is generated, the polishing agent performs literary optimization.

[0025] Optionally, in the multi-agent driven game script generation method, the steps to complete the script modification task are as follows:

[0026] The summary agent analyzes the original script and generates a structured outline that includes key event nodes, character motivations, and worldview rules. The structured outline is stored in JSON format.

[0027] The modified agent, based on user instructions, performs element replacement and logical reconstruction on the structured outline and obtains stylized corpus through a retrieval tool.

[0028] Dynamically verify the internal consistency of the modified plot, and after generating the final draft, perform literary optimization by the polishing agent. Finally, output a JSON file that conforms to the game engine interface specification. The JSON file that conforms to the game engine interface specification includes plot node fields, character attribute fields, and branch condition fields.

[0029] Compared with the prior art, the present invention has the following advantages:

[0030] Through multi-agent collaboration and knowledge enhancement technology, the controllability and practicality of game script generation are significantly improved.

[0031] (1) Dynamically controllable generation: Through reinforcement learning and retrieval mechanisms, users can intervene in the plot direction in real time through natural language instructions, significantly improving the controllability of the script.

[0032] (2) Multi-granularity structured output: The generated JSON file conforms to the game engine interface specification and can be directly imported into the Unity / Unreal engine. It includes plot node fields, character attribute fields, branch condition fields, etc., reducing the manual conversion cost by about 70%.

[0033] (3) Style adaptability: In the test set, the modified agent makes the plots of cross-style adaptation tasks such as "fantasy to science fiction" and "modern to alternate history" highly reasonable.

[0034] (4) Industrial deployment: The lightweight model (parameter count < 3B) supports real-time generation on a single GPU card and is suitable for rapid prototype iteration in game development. Description of the Drawings

[0035] Figure 1 It is a flowchart of the game script generation method provided by the embodiment of the present invention. Detailed Embodiments

[0036] The following will describe the specific embodiments of the present invention in more detail with reference to the schematic diagrams. According to the following description, the advantages and features of the present invention will be clearer. It should be noted that the drawings are all in a very simplified form and use non-precise scales, only for the purpose of facilitating and clearly assisting in explaining the objectives of the embodiments of the present invention.

[0037] In the description of this application, it should be understood that the orientation or positional relationships indicated by terms such as "center", "longitudinal", "lateral", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", "clockwise", "counterclockwise", etc. are based on the orientation or positional relationships shown in the drawings. They are only for the convenience of describing this application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation. Therefore, it should not be construed as a limitation to this application.

[0038] Existing game script generation technologies all have many defects.

[0039] To solve the problems existing in the prior art, the present invention provides a multi-agent-driven game script generation method. As Figure 1 shown, the game script generation method includes the following steps:

[0040] S1: Construct a script knowledge distillation framework based on an inference model (such as DeepSeek-R1).

[0041] S2: For the characteristics of the game script field, through a topic-driven instruction fine-tuning dataset generation method, automatically generate training data including a four-layer structure of "world view setting - character relationship - plot conflict - dialogue behavior" (such as inputting the topic "Medieval Magic War" and outputting corresponding instruction data).

[0042] Among them, fine-tuning refers to the process of further training a pre-trained model in deep learning to adapt to a specific task or dataset. Fine-tuning trains on a small new dataset based on the pre-trained model, enabling the model to better perform a specific task without having to train the entire model from scratch. This method not only saves time and computing resources but also effectively improves the performance of the model on specific tasks.

[0043] S3: Use the fine-tuned dataset to train a lightweight downstream model (such as TinyLlama) to achieve knowledge distillation and reduce the inference cost.

[0044] S4: Introduce reinforcement learning technology (such as Direct Preference Optimization, abbreviated as DPO), and design a training model through a pure rule (such as rule-based) reward function to enable the training model to actively call retrieval tools; among them, the reward function includes: logical coherence score, plot conflict intensity, and user intention matching degree.

[0045] Specifically, an example of the training model actively invoking the retrieval tool is as follows: If the training model outputs <search>The tag will trigger the retrieval API interface call and automatically embed the retrieval results into the subsequent generated <document> ... <document>Between the tags. For another example: When generating a "science fiction cyberpunk" script, the training model can automatically retrieve relevant terms of the background of the era through this mechanism to ensure the rationality of the content and improve controllability.

[0046] Preferably, align the preferences for retrieval to directly optimize the retrieval preferences.

[0047] S5: Based on the training model, construct an expansion agent, a modification agent, a summary agent, and a polishing agent. Each agent collaborates to complete the script continuation task and the script modification task. All agents support calling the Internet retrieval API interface to obtain knowledge in real time (such as historical events, cultural customs).

[0048] Furthermore, S51: Implementing the script continuation task includes the following steps:

[0049] S511: The expansion agent reads the full text of the existing script, extracts the time and space background, character status, and unsolved conflicts.

[0050] S512: Based on the reinforcement learning strategy, perform multi-branch expansion on the end section of the script (for example, when the protagonist is defeated, branches such as "retreat and rebirth", "ally rescue", and "villain's surrender" can be derived), and supplement reasonable details through a retrieval tool (such as the description of the battle with a specific weapon).

[0051] S513: Output candidate plot segments, which are updated to the global plot graph after being selected by the user.

[0052] S514: And after the final draft is generated, the polishing agent performs literary optimization (adjusting the dialogue rhythm, adding foreshadows and hints) and format constraints.

[0053] S515: After the literary optimization and format constraints by the polishing agent, a formatted script is formed. The formatted script includes the title: {}, the beginning: {}, the climax: {}, and the ending: {}.

[0054] S52: Implementing the script modification task includes the following steps:

[0055] S521: The summary agent reads the script story and analyzes the original script to generate a structured outline containing key event nodes, character motivations, and world view rules (that is, the story outline in Figure 1 ), and the structured outline is stored in JSON format.

[0056] S522: Based on the user's instructions (such as "changing the martial arts plot to a steampunk style"), the modification agent performs element replacement and logical reconstruction on the structured outline (such as replacing "inner strength" with "steam core" and "sect" with "industrial group"), and obtains stylized corpus through a retrieval tool.

[0057] S523: Dynamically verify the internal consistency of the modified plot (e.g., ensure that the energy setting of the "steam core" runs through the entire script), and after generating the final draft, perform literary optimization (adjust the dialogue rhythm, add foreshadows and hints) and format constraints by the polishing agent, and finally output a JSON file that conforms to the game engine interface specification. The JSON file that conforms to the game engine interface specification includes plot node fields, character attribute fields, branch condition fields, etc.

[0058] S524: After being literary optimized and format constrained by the polishing agent, a formatted script is formed. The formatted script includes: Title: {}, Beginning: {}, Climax: {}, and End: {}.

[0059] The present invention is mainly applied to the automated creation and adaptation of game scripts, and is particularly suitable for the development scenarios of role-playing games (RPGs), open-world games, and interactive narrative games. With the increasing demand of the game industry for plot complexity, dynamic interactivity, and content update efficiency, the present invention aims to provide a game developer with an efficient, controllable, and dynamically adjustable script generation solution through multi-agent collaboration technology, which can cover the entire process from main plot generation, side mission design to user interactive plot adaptation.

[0060] In summary, compared with the prior art, the present invention has the following advantages:

[0061] Through multi-agent collaboration and knowledge enhancement technology, the controllability and practicality of game script generation are significantly improved;

[0062] (1) Dynamically controllable generation: Through reinforcement learning and retrieval mechanisms, users can intervene in the plot direction in real time through natural language instructions, significantly improving the controllability of the script;

[0063] (2) Multi-granularity structured output: The generated JSON file conforms to the game engine interface specification and can be directly imported into the Unity / Unreal engine. It includes plot node fields, character attribute fields, branch condition fields, etc., reducing the manual conversion cost by about 70%;

[0064] (3) Style adaptability: In the test set, the modified agent makes the plots of cross-style adaptation tasks such as "fantasy to science fiction" and "modern to alternative history" highly reasonable;

[0065] (4) Industrial deployment: The lightweight model (parameter count < 3B) supports real-time generation on a single GPU card and is suitable for rapid prototype iteration in game development.

[0066] The above are only the preferred embodiments of the present invention and do not impose any limitation on the present invention. Any person skilled in the art, within the scope of the technical solution of the present invention, makes any form of equivalent replacement or modification and other changes to the technical solution and technical content disclosed by the present invention, which are all within the content of the technical solution of the present invention and still fall within the protection scope of the present invention.< / document> < / document> < / search>

Claims

1. A method for generating game scripts driven by multiple agents, characterized in that, It includes the following steps: S1: Construct a script knowledge distillation framework based on an inference model; S2: Automatically generate training data with a four-layer structure of "worldview setting - character relationship - plot conflict - dialogue behavior" through a topic-driven instruction fine-tuning dataset generation method; S3: Use the fine-tuned dataset to train a lightweight downstream model to achieve knowledge distillation and reduce the inference cost; S4: Introduce reinforcement learning technology and design a training model through a pure rule reward function to enable the training model to actively call retrieval tools; S5: Based on the training model, construct an expansion agent, a modification agent, a summary agent, and a polishing agent, and each agent collaborates to complete the script continuation task and the script modification task.

2. The multi-agent-driven game script generation method according to claim 1, wherein The inference model is DeepSeek-R1.

3. The multi-agent-driven game script generation method according to claim 1, wherein The downstream model is TinyLlama.

4. The multi-agent-driven game script generation method according to claim 1, wherein, The reinforcement learning technology is DirectPreference Optimization, and the pure rule is rule-based.

5. The multi-agent-driven game script generation method according to claim 1, wherein The reward function includes: logical coherence score, plot conflict intensity, and user intention matching degree.

6. The multi-agent driven game script generation method according to claim 1, wherein All agents support calling the Internet retrieval API to obtain knowledge in real time.

7. The multi-agent-driven game script generation method according to claim 6, wherein, The steps to complete the script continuation task include: The expansion agent reads the entire existing script, extracts the time and space background, character status, and unresolved conflicts; Based on the reinforcement learning strategy, perform multi-branch expansion on the end section of the script and supplement reasonable details through the retrieval tool; Output candidate plot segments, which are selected by the user and then update the global plot graph; And after the final draft is generated, the polishing agent performs literary optimization.

8. The multi-agent-driven game script generation method according to claim 6, wherein, The steps to complete the script modification task include: The summary agent analyzes the original script and generates a structured outline containing key event nodes, character motivations, and worldview rules, and the structured outline is stored in JSON format; The modification agent, based on the user's instructions, performs element replacement and logical reconstruction on the structured outline and obtains stylized corpus through the retrieval tool; Dynamically verify the internal consistency of the modified plot, and after the final draft is generated, the polishing agent performs literary optimization, and finally outputs a JSON file that conforms to the game engine interface specification. The JSON file that conforms to the game engine interface specification includes plot node fields, character attribute fields, and branch condition fields.