Behavior tree generation method and device, electronic equipment, storage medium and program product

By generating and deploying behavior trees using a decision model, and combining this with closed-loop iterative optimization of a cognitive model, the problem of low efficiency in behavior tree design in traditional methods is solved, enabling efficient adaptive decision-making in complex game environments.

CN121998042APending Publication Date: 2026-05-08NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NETEASE (HANGZHOU) NETWORK CO LTD
Filing Date
2026-01-16
Publication Date
2026-05-08

AI Technical Summary

Technical Problem

Existing technologies struggle to achieve efficient and flexible decision-making in complex and ever-changing game environments when designing behavior trees for virtual objects. Traditional methods suffer from difficulties in collecting training data, complex parameter tuning, long training cycles, and high design and maintenance requirements.

Method used

A decision model is used to generate a behavior tree and deploy it to the game environment. A cognitive model is used to summarize and describe the game data, forming a closed-loop iterative optimization to achieve the self-iteration and evolution of the behavior tree.

Benefits of technology

It improves the efficiency of behavior tree generation, reduces the dependence on a single model, enhances the focus and efficiency of task execution, and can adapt to complex and ever-changing game scenarios.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121998042A_ABST
    Figure CN121998042A_ABST
Patent Text Reader

Abstract

The invention discloses a behavior tree generation method and device, electronic equipment, a storage medium and a program product, and relates to the technical field of computers.The method comprises the steps that an initial cue word corresponding to a virtual object and a target game environment where the virtual object is located are obtained; inputting the initial cue word into a pre-trained decision model to generate a first behavior tree corresponding to the virtual object; deploying the first behavior tree to a target game environment to obtain game match data; inputting the game playing data into a pre-trained cognitive model, and generating data description information corresponding to the game playing data; and optimizing the first behavior tree based on the data description information to obtain a target behavior tree of the virtual object in the target game environment. By implementing the technical scheme of the invention, automatic generation and optimization of the game virtual object behavior tree can be realized based on collaborative closed-loop iteration of the decision model and the cognitive model, and the intelligent level and the generation efficiency of the game virtual object are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, specifically to behavior tree generation methods, apparatus, electronic devices, storage media, and program products. Background Technology

[0002] In the fields of game development and artificial intelligence applications, endowing virtual objects (such as non-player characters and competitive robots) with efficient, human-like, and dynamic decision-making capabilities has always been key to enhancing the game experience and the realism of interaction. Traditionally, there are two main technical paths to achieve such intelligent behavior: one is based on deep learning methods, which train neural network models to cope with complex high-dimensional state spaces, but this usually faces challenges such as difficulty in collecting training data, complex parameter tuning, and long training cycles; the other is based on manually designed behavior tree models, which have a clear structure, are easy to understand and modify, and can organize simple behaviors in a modular way. However, when dealing with highly complex and dynamically changing game environments, simply relying on manually constructed behavior trees is often difficult to adapt flexibly, while designing behavior trees that can handle complex scenarios places excessive demands on manual design and maintenance. Summary of the Invention

[0003] This application provides a behavior tree generation method, apparatus, electronic device, storage medium, and program product to solve the problem of balancing the construction efficiency and adaptability of game intelligent decision-making models.

[0004] In a first aspect, this application provides a behavior tree generation method, comprising: obtaining an initial prompt word corresponding to a virtual object and the target game environment in which the virtual object is located; inputting the initial prompt word into a pre-trained decision model to generate a first behavior tree corresponding to the virtual object; deploying the first behavior tree into the target game environment to obtain game data; inputting the game data into a pre-trained cognitive model to generate data description information corresponding to the game data; and optimizing the first behavior tree based on the data description information to obtain a target behavior tree of the virtual object in the target game environment.

[0005] In one optional implementation, the initial prompt words are input into a pre-trained decision model to generate a first behavior tree corresponding to the virtual object, including: obtaining an initial knowledge base corresponding to the virtual object; and using the initial prompt words to guide the decision model in the behavior tree generation process based on the policy knowledge information in the initial knowledge base, thereby obtaining the first behavior tree.

[0006] In one optional implementation, based on the strategy knowledge information in the initial knowledge base, the decision model is guided by initial prompts to generate a behavior tree to obtain a first behavior tree. This includes: generating a second behavior tree based on the strategy knowledge information in the initial knowledge base and using initial prompts to guide the decision model to generate a behavior tree; converting the format of the second behavior tree based on a preset parsing method to obtain a conversion result; if the conversion result indicates that the second behavior tree has been successfully converted, then the first behavior tree after the second behavior tree has been converted is obtained.

[0007] In one optional implementation, if the conversion result indicates that the second row tree conversion failed, an error message is generated; the second row tree is modified based on the error message to obtain the modified second row tree.

[0008] In one alternative implementation, the data description information is analyzed based on a cognitive model to generate game experience information corresponding to the data description information.

[0009] In one optional implementation, the first behavior tree is optimized based on data description information to obtain the target behavior tree of the virtual object in the target game environment, including: obtaining the current optimization round for the first behavior tree; if the current optimization round is the first round of optimization for the first behavior tree, then establishing an initial experience pool corresponding to the virtual object based on game experience information; optimizing the first behavior tree based on the initial experience pool and game data description to obtain the target behavior tree of the virtual object in the target game environment.

[0010] In one optional implementation, if the current optimization round is a non-first round optimization for the first behavior tree, then the first experience pool corresponding to the previous optimization round is obtained; the game experience information is written into the first experience pool to obtain the target experience pool; the first behavior tree is optimized based on the target experience pool and the game data description to obtain the target behavior tree of the virtual object in the target game environment.

[0011] In one optional implementation, the first behavior tree is optimized based on the initial experience pool and the game data description to obtain the target behavior tree of the virtual object in the target game environment. This includes: generating an update instruction for the initial knowledge base based on the response results of the decision model to the game data description and the initial experience pool; updating the initial knowledge base using the update instruction to obtain the target knowledge base; and optimizing the first behavior tree based on the target knowledge base, the initial experience pool, and the game data description to obtain the target behavior tree of the virtual object in the target game environment.

[0012] Secondly, this application provides a behavior tree generation device, comprising: an acquisition module for acquiring initial prompt words corresponding to a virtual object and the target game environment in which the virtual object is located; a first generation module for inputting the initial prompt words into a pre-trained decision model to generate a first behavior tree corresponding to the virtual object; a deployment module for deploying the first behavior tree into the target game environment to obtain game data; a second generation module for inputting the game data into a pre-trained cognitive model to generate data description information corresponding to the game data; and an optimization module for optimizing the first behavior tree based on the data description information to obtain a target behavior tree of the virtual object in the target game environment.

[0013] Thirdly, this application provides an electronic device, including: a memory and a processor, which are communicatively connected to each other. The memory stores computer instructions, and the processor executes the computer instructions to perform the behavior tree generation method described in the first aspect or any corresponding embodiment.

[0014] Fourthly, this application provides a computer-readable storage medium storing computer instructions for causing a computer to execute the behavior tree generation method described in the first aspect or any of its corresponding embodiments.

[0015] Fifthly, this application provides a computer program product, including computer instructions for causing a computer to execute the behavior tree generation method described in the first aspect or any corresponding embodiment thereof.

[0016] The behavior tree generation method provided in this application directly generates a behavior tree based on initial prompts using a decision model. This automates the process from understanding the game environment to constructing behavioral logic, avoiding the extensive manual design and debugging required for traditionally hand-written behavior trees, and significantly improving the generation efficiency. By deploying the generated behavior tree to an actual game environment and collecting game data, and then using a cognitive model to summarize and describe the game process, comprehensible feedback information is formed, enabling the behavior tree to be continuously optimized based on actual performance. This closed-loop mechanism allows the behavior tree to have the ability to self-iterate and evolve, gradually adapting to complex and ever-changing game scenarios. Furthermore, this application adopts a dual-model collaborative strategy: the decision model focuses on the generation and optimization of the behavior tree, while the cognitive model focuses on the understanding and description of game data. Each model performs its specific function, reducing dependence on the context length of a single model and improving the focus and efficiency of task execution. Attached Figure Description

[0017] To more clearly illustrate the technical solutions in the specific embodiments of this application or the prior art, the drawings used in the description of the specific embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0018] Figure 1 This is a schematic diagram illustrating an application scenario according to an embodiment of this application; Figure 2 This is a schematic diagram of the first flowchart of the behavior tree generation method according to an embodiment of this application; Figure 3 This is a second flowchart illustrating the behavior tree generation method according to an embodiment of this application; Figure 4 This is a schematic diagram of the third process of the behavior tree generation method according to the embodiments of this application; Figure 5 This is a structural block diagram of a behavior tree generation apparatus according to an embodiment of this application; Figure 6 This is a schematic diagram of the hardware structure of an electronic device according to an embodiment of this application. Detailed Implementation

[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0020] It is understood that before using the technical solutions disclosed in the various embodiments of this application, users should be informed of the types, scope of use, and usage scenarios of the personal information involved in this application in an appropriate manner in accordance with relevant laws and regulations, and user authorization should be obtained.

[0021] The terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the number of technical features indicated. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of this application, "multiple" means two or more, unless otherwise explicitly specified.

[0022] As one optional application scenario in this application embodiment, Figure 1 This diagram illustrates an application scenario of the behavior tree generation system. For example... Figure 1As shown, the system may include at least one terminal device and at least one server. Figure 1 The system is illustrated in the example, which includes a computer 101, a mobile terminal 102, and a server 103, and the terminal devices such as the computer 101 and the mobile terminal 102 are connected to the server 103 through a network 110.

[0023] Specifically, the terminal device can be a smartphone, tablet, laptop, PDA, desktop computer, game console, smart TV, smart wearable device, in-vehicle terminal, VR (Virtual Reality) device, AR (Augmented Reality) device, etc. Server 103 can be a standalone physical server, a server cluster, a distributed system, or a cloud server providing cloud services. Network 110 can be a wired or wireless network, examples of which include, but are not limited to, the Internet, corporate intranet, local area network, wide area network, mobile communication network, and combinations thereof.

[0024] Taking multiplayer cooperative games as an example, the terminal device runs the game's client program, rendering a 3D virtual scene containing elements such as spaceships, player characters, resource points, and artifacts, and displaying it to the real player through a graphical user interface. Players can control their characters to move, fire, pilot spaceships, and compete against other players or system-controlled robot opponents.

[0025] In highly competitive games like these, gaming bots are often introduced as opponents to match players of different skill levels, maintain match queues, or provide practice partners. Currently, the implementation of gaming bots mainly relies on three types of technologies: traditionally hand-written behavior trees, supervised learning-based models, and reinforcement learning-based agents.

[0026] Traditional behavior tree models are mostly manually written by developers. While simple in structure and highly interpretable, they struggle to handle complex and ever-changing real-time states. For example, they require simultaneous consideration of multi-dimensional information such as player position, health, ship status, and artifact location, and rapid decision-making. This results in bots exhibiting rigid performance and lacking generalization ability in highly dynamic environments. Supervised learning, on the other hand, requires collecting a large amount of human player combat data to train the model to mimic their actions. However, the effectiveness of such methods is highly dependent on data quality, and their performance ceiling is limited by the skill level of the imitated players, making it difficult to discover new strategies that surpass human capabilities. Furthermore, if the data distribution is not comprehensive enough, the model is prone to abnormal behavior when faced with unseen situations; and supervised learning typically lacks long-term planning capabilities, only learning the mapping from state to action, making it difficult to make coherent strategic deployments in complex games. While reinforcement learning possesses the ability for long-term planning and autonomous exploration, its training process suffers from significant bottlenecks: extremely low sample efficiency, requiring millions to billions of interactions with the game environment, resulting in lengthy training times and high computational costs; unstable training processes, prone to oscillations, non-convergence, or getting stuck in local optima, and sensitive to hyperparameter settings; furthermore, the design of the reward function itself is a major challenge, and improper design can easily lead to the agent learning unintended behaviors such as "score farming" instead of truly achieving the game objective.

[0027] The behavior tree generation method provided in this application effectively overcomes the limitations of related technical solutions by introducing a large language model to construct an automated closed-loop iterative chain. Specifically, it utilizes a decision model to understand game mechanics and objectives, and automatically generates a complex and highly adaptable high-dimensional behavior tree based on initial prompts, overcoming the bottleneck of insufficient generalization ability of manually written behavior trees when dealing with complex state spaces. By deploying the generated behavior tree to a real game environment and collecting game data, it can obtain effective feedback from the environment, avoiding the dependence of supervised learning on fixed human datasets and its performance ceiling problem, enabling the behavior tree to have the possibility of autonomous exploration and long-term strategy planning. Furthermore, the cognitive model summarizes and abstracts massive game data in real time, generating refined data description information to guide behavior tree optimization. This process significantly improves learning efficiency, eliminating the need for massive trial-and-error interactions like reinforcement learning, and avoiding inherent problems such as difficulty in reward function design and unstable training. Therefore, through a closed-loop iteration of "generation-deployment-evaluation-optimization," this application can continuously and efficiently generate and improve high-quality game competitive robot behavior trees without human intervention.

[0028] According to an embodiment of this application, a behavior tree generation method embodiment is provided. It should be noted that the steps shown in the flowchart in the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. Furthermore, although a logical order is shown in the flowchart, in some cases, the steps shown or described may be executed in a different order than that shown here.

[0029] This embodiment provides a behavior tree generation method, which can be used in electronic devices, such as server 103. Figure 2 This is a flowchart of a behavior tree generation method according to an embodiment of this application, such as... Figure 2 As shown, the process includes the following steps: Step S201: Obtain the initial prompt word corresponding to the virtual object and the target game environment in which the virtual object is located.

[0030] Virtual objects refer to entities controlled by generated behavior trees within a game environment; they can also be called game robots or heroes, such as player characters in a game. Initial prompts refer to the pre-defined, fixed initial prompts set by the system before the closed-loop iteration begins. They consist of three parts: task description (informing the model of its responsibilities and iteration logic), game introduction (explaining the game mechanics and gameplay), and state / action space (defining available game state variables and executable operation instructions). Specifically, the initial prompts for virtual objects are a predefined, structured set of text instructions and knowledge, rooted in the design of the target game. They are not generated ad-hoc but are orchestrated all at once by system developers or configuration personnel based on the rules of the target game, the attributes and abilities of the virtual object (such as a hero, unit, or character), and the goals to be achieved by the expected behavior tree. This set of prompts stably guides the work of the large model throughout the subsequent entire process.

[0031] The target game environment refers to the specific game itself and its runtime environment for which competitive robots need to be generated. For example, it could refer to a game using the UE engine, encompassing all its rules, scenes, physics logic, and interaction interfaces. Specifically, acquiring the target game environment means that the electronic device can identify and access a specific, interactive game instance or simulator. This is typically achieved by configuring the game client's path, network address, or specific software interface (API), ensuring that the electronic device can load and run the generated behavior tree module within that specific game, and read its state and feedback results. In short, the electronic device automatically acquires the initial prompts and the target game environment by reading preset configuration files and connection parameters.

[0032] Step S202: Input the initial prompt words into the pre-trained decision model to generate the first behavior tree corresponding to the virtual object.

[0033] The decision model is used to generate and optimize behavior trees. It receives inputs such as initial prompts and outputs behavior trees. The first behavior tree refers to the behavior tree initially generated by the decision model. Specifically, the acquired, complete initial prompts are used as the core instructions and constraints, and are fed into the decision model as a whole. This decision model is a large language model that has been pre-trained on massive amounts of text and code data and possesses strong logical reasoning and structured generation capabilities. It is not trained from scratch for a specific game, but relies on its general capabilities to understand the detailed descriptions of tasks, game rules, states, and actions in the initial prompts. Based on this understanding, the decision model uses its inherent code generation and logical planning capabilities to perform initial deduction and creation, outputting a machine-readable structured description of the decision-making logic of virtual objects in the game, i.e., the first behavior tree. This description can be understood as a preliminary draft of the source code for a battle plan or decision-making procedure.

[0034] Step S203: Deploy the first row of the tree to the target game environment to obtain game match data.

[0035] Game match data refers to the collection of all game state information recorded at fixed frame rates after the first-row tree is deployed to the game environment and a game is played. This information includes player position, health, and spaceship status, and is typically saved as a JSON file. Specifically, the generated first-row tree is loaded or injected into the running target game environment instance, replacing or controlling the native logic of the target virtual object. Subsequently, one or more complete game match simulations are initiated. During the match, electronic devices comprehensively capture state snapshots within the game at a fixed time frequency (e.g., per frame or per second), including the virtual object's own state, environmental information, and interaction results with other entities, and serialize and record them. At the end of the match, all these time-series arranged state snapshots constitute the raw game match data used for subsequent analysis.

[0036] Step S204: Input the game data into the pre-trained cognitive model to generate data description information corresponding to the game data.

[0037] The cognitive model is used to understand and summarize game data. It receives raw game data, analyzes and summarizes it, and outputs data descriptions of the performance of the behavior tree. These data descriptions are textual descriptions generated by the cognitive model after analyzing and summarizing the raw game data. They extract key performances, problems, and highlights from the game; for example, "the behavior tree failed to dodge in time when encountering an enemy, resulting in a sudden drop in health," which is one of the direct bases for the decision-making model to optimize in the next round. Specifically, the game data collected from the game environment is a raw, complex, and low-level sequence of states. To extract meaningful insights for optimizing the behavior tree, another specialized large language model, the cognitive model, is introduced. The electronic device inputs the recorded raw game data completely into the cognitive model. The cognitive model uses its natural language understanding and reasoning capabilities to comprehensively scan and analyze the entire game data sequence. Its objectives may include, for example, understanding the actual performance trajectory of virtual objects under the control of the behavior tree, identifying successful behavior patterns, inefficient decision-making processes, key moments leading to failure, and the gap between the behavior tree logic and the actual game feedback. Ultimately, the cognitive model condenses these analytical results into a highly summarized, key-point-focused, and naturally language-expressed evaluative summary—the data description. This description transforms complex data into a performance report that both humans and machines can intuitively understand, indicating potential directions for optimization.

[0038] Step S205: Optimize the first behavior tree based on the data description information to obtain the target behavior tree of the virtual object in the target game environment.

[0039] The target behavior tree refers to the behavior tree that meets the expected results after multiple iterations through an automated closed-loop chain of "generation-deployment-evaluation-optimization". It is the final output that can effectively control virtual objects to perform high-quality gameplay in the target game environment. Specifically, the data description information generated by the cognitive model, along with the original first behavior tree description and any accumulated previous optimization experience (if any), are submitted to the decision model as new input. The decision model's task changes in this round; it needs to comprehensively understand the problems and suggestions raised in the performance report, review the shortcomings of the existing behavior tree draft, and then revise, adjust, or reconstruct the draft to output an optimized, new version of the behavior tree description. Subsequently, the electronic device automatically repeats the above deployment, testing, and analysis process: deploying the new behavior tree to the game environment for testing, generating new gameplay data, and analyzing it with the cognitive model to obtain new descriptive information. This "generation-deployment-analysis-optimization" cycle continues automatically. In each cycle, the decision model improves the behavior tree based on the latest feedback. The termination condition of the loop is set externally, such as reaching a preset performance indicator, an upper limit on the number of iterations, or manual review confirming satisfactory results. When the loop terminates, the last generation of behavior trees, which has undergone multiple rounds of iteration optimization and has been verified to perform as expected or optimally in the target game environment, is the final target behavior tree.

[0040] The behavior tree generation method provided in this application directly generates a behavior tree based on initial prompts using a decision model. This automates the process from understanding the game environment to constructing behavioral logic, avoiding the extensive manual design and debugging required for traditionally hand-written behavior trees, and significantly improving the generation efficiency. By deploying the generated behavior tree to an actual game environment and collecting game data, and then using a cognitive model to summarize and describe the game process, comprehensible feedback information is formed, enabling the behavior tree to be continuously optimized based on actual performance. This closed-loop mechanism allows the behavior tree to have the ability to self-iterate and evolve, gradually adapting to complex and ever-changing game scenarios. Furthermore, this application adopts a dual-model collaborative strategy: the decision model focuses on the generation and optimization of the behavior tree, while the cognitive model focuses on the understanding and description of game data. Each model performs its specific function, reducing dependence on the context length of a single model and improving the focus and efficiency of task execution.

[0041] This embodiment provides a behavior tree generation method, which can be used in electronic devices, such as server 103. Figure 3 This is a flowchart of a behavior tree generation method according to an embodiment of this application, such as... Figure 3 As shown, the process includes the following steps: Step S301: Obtain the initial prompt word corresponding to the virtual object and the target game environment in which the virtual object is located. For details, please refer to [link to relevant documentation]. Figure 2Step S201 of the illustrated embodiment will not be described again here.

[0042] Step S302: Input the initial prompt words into the pre-trained decision model to generate the first behavior tree corresponding to the virtual object.

[0043] Specifically, step S302 includes: Step S3021: Obtain the initial knowledge base corresponding to the virtual object.

[0044] The initial knowledge base refers to a foundational, initial set of knowledge pre-configured for the decision-making model before initiating the automated closed-loop iterative process. It contains initial guiding information such as basic strategies, general rules, and behavior tree syntax specifications for the target game, serving as the heuristic knowledge foundation for the decision-making model's first round of behavior tree generation. Specifically, when initiating the entire automated generation process, a basic knowledge framework, i.e., the initial knowledge base, needs to be pre-loaded for the virtual objects to be generated. This knowledge base is not dynamically generated during the process but exists as a pre-set, static initial configuration resource. It can be stored in an electronic device in the form of a database, configuration file, or specific data structure. The retrieval process typically involves the electronic device automatically retrieving and loading the corresponding knowledge base template based on the virtual object's unique identifier (such as character ID, name, etc.). This knowledge base template contains general behavioral guidelines, basic strategy logic, and basic rules for behavior tree construction for the virtual object in the target game, providing a reliable and game-design-compliant initial reference and constraint boundary for the subsequent generation of larger models.

[0045] Step S3022: Based on the strategy knowledge information in the initial knowledge base, the decision model is guided by the initial prompt words to generate the behavior tree, and the first behavior tree is obtained.

[0046] Strategic knowledge information refers to knowledge entries directly related to game strategy stored in the initial knowledge base (and subsequent iterations). This information can include understanding different game situations, optimal action choices in specific contexts, role positioning, resource management principles, etc., and is the core content guiding the decision-making model to construct effective behavioral logic. Specifically, structured initial prompts and initial knowledge base content rich in strategic logic are integrated and input into the decision-making model. As a model with powerful logic and code generation capabilities, the decision-making model's workflow is as follows: First, it deeply understands and integrates these two parts of input information to form a complete cognitive framework about "how to act for a specific virtual object in a specific game"; then, based on this cognitive framework, it uses its inherent planning and structured generation capabilities to deduce and construct a complete, machine-readable description of behavioral decision-making logic.

[0047] The behavior tree generation method provided in this application significantly improves the relevance, reliability, and knowledge utilization efficiency of the generated behavior tree by introducing an initial knowledge base as an auxiliary input to the decision-making model. When generating the first behavior tree, this application does not rely solely on initial prompts but first acquires an initial knowledge base specifically constructed for virtual objects, which contains prior knowledge information related to game strategies and behavioral logic. During the generation of the behavior tree, the decision-making model can be guided and reasoned based on the existing structured strategy knowledge in this knowledge base, thereby giving the generated first behavior tree a more reasonable initial structure, better conforming to the core logic of the game mechanics, and effectively reducing invalid or erroneous behavior branches caused by blind spots in model knowledge or misunderstandings.

[0048] In some optional implementations, step S3022 above includes: Step a1: Based on the strategy knowledge information in the initial knowledge base, the decision model is guided by the initial prompt words to generate a second behavior tree.

[0049] The second behavior tree refers to the behavior tree directly generated by the decision model based on the initial prompts and initial knowledge base, described in a specific text format (such as JSON). It is an intermediate product of the behavior tree generation process and cannot yet be directly run in the game engine. Specifically, the integrated initial prompts and initial knowledge base strategy information are submitted to the decision model as a complete instruction set. Guided by this instruction set, the decision model executes an independent reasoning and generation task. Its goal is to produce a complete, self-consistent behavior tree logical description that conforms to the input specifications. This description uses an intermediate text format (such as JSON) agreed upon between the electronic device and the model, which is convenient for the model to process and output—the second behavior tree. It carries all the model's ideas for the game strategy but has not yet undergone format validation and game engine compatibility processing.

[0050] Step a2: Based on the preset parsing method, the second row tree is formatted and the conversion result is obtained.

[0051] The pre-defined parsing method refers to the standardized conversion rules and procedures for converting the text-formatted second-line tree into binary assets that can be recognized and executed by the target game engine (such as UE). This is typically implemented by a separate parsing tool, responsible for syntax checking, structure mapping, and format compilation. The conversion result refers to the output status of the parsing tool after performing format conversion on the second-line tree; it primarily characterizes the success or failure of the conversion process. Specifically, the text-formatted second-line tree produced by the decision model is submitted to a dedicated, pre-developed format conversion tool (i.e., the parsing tool). This tool embeds complete conversion rules that map a specific text format to the binary asset format required by the target game engine. The conversion process is executed automatically; the tool parses the text content of the second-line tree line by line, checks its grammatical and structural correctness, and generates corresponding binary data blocks according to the engine's specifications. After the conversion is complete, the tool outputs a clear result status, i.e., the conversion result, whose core function is to objectively report the success or failure of this conversion task. This result is a signal that determines the direction of subsequent processes.

[0052] Step a3: If the conversion result indicates that the second row tree has been successfully converted, then the first row tree after the second row tree has been converted is obtained.

[0053] The first-line tree refers to the behavior tree instance obtained after the second-line tree has been successfully converted by the parsing tool, and can be directly deployed to the target game environment. Specifically, when the parsing tool returns the conversion result, and determines that the result explicitly indicates successful conversion, it means that the text description of the second-line tree is syntactically and structurally correct, and has been losslessly converted into a format recognizable by the game engine. At this point, the final binary format behavior tree file generated by the parsing tool is the first-line tree.

[0054] In the above implementation, the intermediate result (second behavior tree) directly output by the decision model is not used as the final usable first behavior tree. Instead, a pre-defined parsing and transformation process is used to perform a special format conversion on the second behavior tree, and the result is only adopted if the conversion is successful. This mechanism effectively solves the gap between the text output of the large language model and the specific runtime format of the game engine. Through automated format adaptation and syntax verification, behavior tree structures with format errors or that do not conform to engine specifications are filtered out in the early stages of generation, ensuring the technical correctness and direct integrability of the output product, and providing a reliable guarantee for seamless deployment to the game environment.

[0055] In some optional implementations, step S3022 above further includes: Step b1: If the conversion result represents the second row of the tree conversion failure, an error message is generated.

[0056] Error messages are generated by the parsing tool when the conversion of the second-line tree fails (the conversion result represents a failure). These messages provide specific information about the cause and location of the error. Examples include syntax errors, undefined nodes, and parameter type mismatches. This information is fed back to the decision model to guide its correction of the second-line tree. Specifically, when the conversion result indicates failure, it means a problem was encountered during parsing, such as syntax errors, undefined nodes, or parameter type mismatches. In this case, the parsing tool will not generate a valid behavior tree file but will proactively generate a detailed diagnostic report, i.e., the error message. This information clearly indicates the specific location of the failure (e.g., line number, node name) and the root cause of the failure (e.g., the definition of the firing action was not found). The electronic device captures this error message to provide precise and actionable feedback for subsequent corrections, rather than to terminate the process.

[0057] Step b2: Modify the second row tree based on the error message to obtain the modified second row tree.

[0058] The error messages generated by the parsing tool, along with the problematic second-line tree text that caused the conversion failure, are submitted to the decision model again as new input. The decision model's task changes to: carefully reading the error messages, locating the root cause of the problem, and then making targeted corrections to the original second-line tree text. After correction, the model outputs a new version of the corrected second-line tree text. The electronic device then sends it back to the parsing tool for format conversion. If the conversion is successful, a new, usable first-line tree is obtained; if it fails again, this correction cycle is repeated until the conversion succeeds. This process ensures that the behavior tree finally deployed in the game is syntactically correct.

[0059] In the above implementation, when the format conversion step identifies an error in the second behavior tree, causing conversion failure, it can automatically generate specific error messages and use these messages to directly drive the modification of the problematic behavior tree. This mechanism achieves a closed loop from error detection to targeted correction, ensuring that the generation process can self-correct and continue moving forward when the initial output does not meet technical requirements, without relying on additional manual intervention to analyze and resolve format or compatibility issues. This not only guarantees the continuity and integrity of the entire automated process but also enables the behavior tree generation and optimization process to more intelligently handle specific obstacles encountered in engineering implementation, improving the success rate and overall efficiency of producing a usable behavior tree.

[0060] Step S303: Deploy the first row of the tree to the target game environment to obtain game match data. For details, please refer to [link to relevant documentation]. Figure 2 Step S203 of the illustrated embodiment will not be described again here.

[0061] Step S304: Input the game data into the pre-trained cognitive model to generate data description information corresponding to the game data. For details, please refer to [link to details]. Figure 2 Step S204 of the illustrated embodiment will not be described again here.

[0062] Step S305: Optimize the first behavior tree based on the data description information to obtain the target behavior tree of the virtual object in the target game environment.

[0063] In some optional implementations, the behavior tree generation method further includes: analyzing the data description information based on a cognitive model to generate game experience information corresponding to the data description information.

[0064] Game experience information refers to refined experience entries further distilled and condensed by the cognitive model based on the analysis of game data and the generation of data description information. It is more abstract and generalized than the data description information and is stored in the experience pool as long-term memory input for the decision-making model. Specifically, the data description information is submitted to the cognitive model again as input, and given a new instruction: extract the most core lessons, the most effective strategy patterns, or the most critical turning points from this summary text, and format or simplify them into independent experience statements. The cognitive model then performs a secondary analysis based on this, outputting a more concise list of experiences, i.e., game experience information. For example, from a detailed post-match report (data description), reusable points can be extracted, such as the high returns of camping a certain resource point and prioritizing finding cover rather than engaging in firefights when low on health.

[0065] In the above implementation, based on the data description information generated by the cognitive model, the model is further driven to conduct in-depth analysis of the description information and generate corresponding game experience information accordingly. This realizes the transformation from specific game performance to abstract experiential knowledge. By generating game experience information, the successful strategies, lessons learned, or key decision points contained in each game can be condensed into more refined and easily usable knowledge units. This not only deepens the understanding of the effects of one's own behavior but also accumulates more instructive experiential materials for the continuous optimization of the behavior tree, thereby improving the knowledge transformation efficiency and knowledge base construction quality of the entire learning and optimization cycle.

[0066] In some optional implementations, step S305 above includes: Step c1: Obtain the current optimization round for the first row of the tree.

[0067] The current optimization round refers to the loop number in which the first behavior tree (or its underlying logic) has been iteratively optimized. It distinguishes between the first optimization (first round) and subsequent optimizations (non-first rounds) to determine the initialization or update method of components such as the experience pool. Specifically, in the entire automated closed-loop chain, the electronic device maintains a counter or state variable to record the cumulative number of optimization attempts on the current first behavior tree. Whenever a complete loop of "generate / modify behavior tree - deploy testing - learn and summarize" is completed, and a new round of optimization is about to begin, this counter is automatically read and incremented to determine the current optimization attempt number, i.e., the current optimization round.

[0068] Step c2: If the current optimization round is the first round of optimization for the first row tree, then establish the initial experience pool corresponding to the virtual object based on the game experience information.

[0069] The initial experience pool refers to the initial version of the experience pool established at the start of the first round of optimization for the first row of the tree, based on the game experience information generated in the first game. It is the starting point for experience accumulation. Specifically, when the current optimization round is determined to be 1 (i.e., the first round of optimization), it means that there has been no historical experience accumulation before. The electronic device will create a new storage structure dedicated to this virtual object, using the game experience information generated after the first game as the sole content. This structure is the initial experience pool.

[0070] Step c3: Optimize the first behavior tree based on the initial experience pool and game data description to obtain the target behavior tree of the virtual object in the target game environment.

[0071] The game data description reflecting details of the previous game's performance, along with the newly established initial experience pool containing core insights, are submitted to the decision model as input. The decision model's task is to comprehensively analyze the data description and experience pool, diagnose problems with the existing behavior tree (the first behavior tree), and devise optimization solutions. Based on this, the decision model outputs instructions to modify the behavior tree logic or directly generates a new behavior tree description. After format conversion and subsequent verification cycles, the final satisfactory version becomes the target behavior tree. This is a process of targeted improvement based on initial feedback.

[0072] In the above implementation, when optimizing the first behavior tree for the first time, the game feedback is not used directly. Instead, a dedicated initial experience pool is created for the virtual object based on the game experience information generated by the cognitive model. This mechanism enables the optimization process to manage historical experience from the very beginning, systematically storing and organizing the core strategies, key successes and failures, and other experience information obtained from the initial game analysis. Optimization based on this initial experience pool combined with game data descriptions ensures that the modification of the behavior tree is not only based on the surface phenomena of the current game but also incorporates deep experience knowledge extracted from historical performance. This makes the first round of optimization more targeted and strategically continuous, and provides a scalable and accumulative experience information framework for subsequent possible multiple rounds of iterative optimization, effectively improving the systematic nature of the optimization process and the coherence of knowledge utilization.

[0073] In some alternative implementations, step c3 above includes: Step c31: Based on the decision model's response to the game data description and the initial experience pool, generate update instructions for the initial knowledge base.

[0074] Update instructions refer to a set of specific operational instructions output by the decision-making model after receiving the game data description and reviewing the experience pool, outlining how to modify the knowledge base. These instructions typically include natural language commands such as deleting knowledge XX, adding knowledge YY, or modifying knowledge ZZ. Specifically, while or after analyzing the game data description and initial experience pool to optimize the behavior tree, the decision-making model further examines the existing initial knowledge base to determine which knowledge was validated or invalid in the current game, and which new knowledge should be added. The model outputs this reflection as a series of specific natural language commands, such as "Add a knowledge: 'When an artifact appears in area X, the team should prioritize gathering before contesting it'," or "Modify knowledge Y, changing the trigger condition from 'health below 30%' to 'health below 40%'." These commands are the update instructions, guiding the evolution of the knowledge base.

[0075] Step c32: Update the initial knowledge base using the update command to obtain the target knowledge base.

[0076] The target knowledge base refers to the new version of the knowledge base formed during the optimization process, after the decision model performs add, delete, and modify operations on the initial knowledge base according to update instructions. It contains the new knowledge learned in the iterations and will be used to guide the generation of the next generation of behavior trees. Specifically, it receives update instructions (add, delete, and modify commands in natural language form), automatically parses these instructions, and translates them into actual operations on the initial knowledge base data structure. For example, adding a record, deleting a record, or modifying the field content of a record in a database. After the operation is completed, the initial knowledge base evolves into a new version of the knowledge base containing new experiences and correcting old knowledge—the target knowledge base. It will provide the decision model with higher-quality prior knowledge in the next iteration.

[0077] Step c33: Optimize the first behavior tree based on the target knowledge base, the initial experience pool, and the game data description to obtain the target behavior tree of the virtual object in the target game environment.

[0078] The decision-making model receives three inputs: a newly evolved, more intelligent target knowledge base; an initial experience pool extracted from the first game; and detailed game data describing the previous game's performance. The model integrates these three aspects of information, re-evaluating and optimizing the first behavior tree from a higher cognitive starting point. It utilizes updated knowledge, combined with specific battle reports and insights, to conduct deeper strategic reasoning, ultimately outputting a superior next-generation behavior tree solution.

[0079] In the above implementation, the decision model is required to analyze the game data description and initial experience pool, and generate specific update instructions for the initial knowledge base accordingly. This step elevates the optimization process from the level of specific behavioral adjustments to the level of abstract strategy knowledge extraction and reconstruction. Subsequently, the target knowledge base updated using these instructions is combined with experience and descriptive information to optimize the behavior tree. This ensures that every structural adjustment of the behavior tree is rooted in a recently updated knowledge system that has been reflected upon and verified, making the evolution of the behavior tree not only an imitation or correction of historical actions, but also a synchronous iteration and deepening of its internal decision-making logic and strategy understanding, thereby making the optimization results more principled, consistent, and adaptable in the long term.

[0080] In some optional implementations, step S305 above further includes: Step d1: If the current optimization round is a non-first round optimization for the first row tree, then obtain the first experience pool corresponding to the previous optimization round.

[0081] The previous optimization round refers to the iteration preceding the current optimization round. The first experience pool refers to the state of the experience pool retained after the previous optimization round ended (excluding the first optimization round). It is the old version of the experience pool at the start of the current optimization round. Specifically, when the current optimization round is greater than 1, it means that the experience pool has existed and has undergone multiple updates. The electronic device will locate and load the snapshot of the experience pool saved after the previous optimization round (i.e., the current round minus 1) based on the stored version or round information. This loaded historical experience pool is the first experience pool. It represents the sum of all historical experience accumulated by the model up to the previous round.

[0082] Step d2: Write the game experience information into the first experience pool to obtain the target experience pool.

[0083] The target experience pool refers to the updated experience pool formed after adding newly generated game experience information from the current round to the first experience pool (i.e., the old experience pool) during non-initial optimization rounds. It contains richer historical experience. Specifically, after obtaining newly generated game experience information (new insights), the old experience is not overwritten; instead, it is added as a new entry to or merged into the first experience pool inherited from the previous round. This addition operation results in a new, richer set of experience encompassing a longer historical period—the target experience pool. It achieves continuous accumulation of experience, preventing the model from forgetting past lessons.

[0084] Step d3: Optimize the first behavior tree based on the target experience pool and game data description to obtain the target behavior tree of the virtual object in the target game environment.

[0085] The target experience pool, which aggregates historical experience from multiple rounds, is input into the decision-making model along with the latest game data descriptions. The decision-making model then not only refers to the latest battle reports but also reviews all important experiences from the entire training history, thereby making more robust and long-term-oriented optimization decisions and outputting a new generation of behavior trees.

[0086] In the above implementation, in each subsequent round of optimization, past experience is not discarded. Instead, the historical experience pool formed after the previous round of optimization is first retrieved, and the newly generated game experience information of the current round is integrated and written into it, thereby constructing a target experience pool with continuously expanding content and evolving knowledge. Optimization is performed based on this updated target experience pool, ensuring that each adjustment of the behavior tree can fully absorb and learn from the strategic essence of all historical games, effectively avoiding optimization cycles or strategy degradation caused by forgetting historical experience. This mechanism ensures that the optimization process has the ability to retain long-term memory and reuse knowledge, making the evolution of the behavior tree exhibit strong cumulative characteristics and gradually improving adaptability, significantly enhancing the reliability and efficiency of obtaining stable performance improvements through continuous iteration in complex game environments.

[0087] In the following embodiment, the above behavior tree generation method will be illustrated by way of example in the specific scenario of a multiplayer online tactical battle game.

[0088] These games typically employ a team-based competitive mode, integrating core elements such as character control, skill casting, resource acquisition, and strategic objective achievement. The game's state space is complex, usually simultaneously including multi-dimensional dynamic information such as the positions, health, skill cooldowns, key map resource points, and team economy of multiple player units; the action space is rich, encompassing various operations such as movement, attacking, releasing different skills, using items, and interacting with the environment.

[0089] like Figure 4 As shown, firstly, based on the general mechanics of the target game type, structured initial prompts are configured for the robot character to be generated. The prompts clearly state that its core task is "to control a designated character to participate in team combat and maximize the team's probability of winning." This includes detailed explanations of the common winning objectives of this type of game (such as destroying the base, achieving a specific score, or capturing key points), definitions of a set of perceptible state variables (such as the character's and teammates' health and position, enemy unit visibility information, map key object status, and resource counts for both sides), and a list of executable basic action commands (such as moving to a coordinate point, casting a skill on a target, or using an item from the inventory). Simultaneously, an initial knowledge base pre-set for this character is loaded, containing basic tactical common sense for this type of game, such as "when health is too low, retreat to a safe area first" and "before the team's final battle, ensure that key skills are available."

[0090] In the first round of generation, the decision-making model, based on the initial prompts and knowledge base, outputs a preliminary behavior tree in JSON format through reasoning. This behavior tree is then validated by a dedicated parsing tool and converted into a format executable by the game engine before being successfully deployed to the game simulation environment. A complete adversarial simulation is initiated, and snapshots of the game state are recorded at a high frequency (e.g., 10 times per second), ultimately generating a large time-series state data file (e.g., in JSON format).

[0091] After the simulated match ends, the cognitive model receives all the match data and performs in-depth analysis. It can identify the strengths and weaknesses of the behavior tree strategy, for example, summarizing that "the behavior tree is responsive and accurate in solo encounters; however, in the mid-game team resource contention phase, its positioning is too aggressive, often resulting in being focused down and eliminated due to being isolated from teammates; furthermore, it pays insufficient attention to periodically spawning buff items on the map, resulting in a low acquisition rate." Based on this analysis, the cognitive model generates structured data descriptions and further refines concise match experience information, such as "Experience 1: When participating in team pushes, your position should be in the middle of the team formation to avoid solo advances," and "Experience 2: When the game time approaches the minute mark, you should actively move towards the fixed buff item spawn points on the map," etc.

[0092] Subsequently, the optimization process is initiated. The decision model receives the data description information and the initial experience pool built based on the aforementioned experience. Combining this with the initial knowledge base, it first outputs an update instruction for the knowledge base, for example: "Add knowledge: 'During the team's collective movement phase, it is necessary to continuously calculate the distance between oneself and the average position of teammates. If it exceeds the threshold X, move towards the center'; Modify knowledge Y, increasing the threshold for judging 'low health' from 30% to 40%." The electronic device automatically executes the knowledge base update. Then, the decision model integrates the new knowledge base, experience pool, and data description to generate the optimized next-generation behavior tree.

[0093] In subsequent automated iterations, a closed loop of "deployment testing - data recording - cognitive summarization - decision optimization" is continuously run. The experience pool accumulates and refines strategic experience with each iteration, and the knowledge base continuously evolves to accommodate a deeper understanding of the game. The performance of the behavior tree also gradually improves. For example, after several iterations, the robot can learn to dynamically adjust its item build order based on the enemy lineup; after even more iterations, it can even demonstrate simple tactical coordination, such as a jungler proactively coordinating with lane teammates to launch a surprise attack at a specific time.

[0094] Finally, after several rounds of closed-loop iteration, when the robot controlled by the behavior tree performs stably in simulated battles, and its tactical decision-making, operational level, and teamwork ability reach preset standards (such as a win rate exceeding a certain threshold, or human review confirming that its behavior conforms to the characteristics of a high-level human player), the iteration stops. The target behavior tree generated at this point is a high-quality, generalizable game competition robot logic that can be directly integrated into game products for use.

[0095] This embodiment also provides a behavior tree generation method apparatus, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that implements a predetermined function. Although the apparatus described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.

[0096] This embodiment provides a behavior tree generation device, such as... Figure 5 As shown, it includes: The acquisition module 501 is used to acquire the initial prompt word corresponding to the virtual object and the target game environment in which the virtual object is located; The first generation module 502 is used to input the initial prompt words into the pre-trained decision model to generate the first behavior tree corresponding to the virtual object; Deployment module 503 is used to deploy the first row of the tree to the target game environment to obtain game match data; The second generation module 504 is used to input game data into a pre-trained cognitive model and generate data description information corresponding to the game data. The optimization module 505 is used to optimize the first behavior tree based on the data description information to obtain the target behavior tree of the virtual object in the target game environment.

[0097] In some alternative implementations, the first generation module 502 includes: The first acquisition submodule is used to acquire the initial knowledge base corresponding to the virtual object; The generation submodule is used to guide the decision model in the generation process of the behavior tree based on the strategy knowledge information in the initial knowledge base and the initial prompt words, so as to obtain the first behavior tree.

[0098] In some alternative implementations, the generation submodule includes: The first generation unit is used to generate a second behavior tree by using initial prompts to guide the decision model in the behavior tree generation process based on the strategy knowledge information in the initial knowledge base. The first conversion unit is used to perform format conversion on the second row tree based on a preset parsing method to obtain the conversion result; The second transformation unit is used to obtain the first row tree after the transformation of the second row tree if the transformation result indicates that the second row tree transformation is successful.

[0099] In some optional implementations, the generation submodule further includes: The second generation unit is used to generate an error message if the transformation result representing the second row tree fails. The modification unit is used to modify the second row tree based on the error message to obtain the modified second row tree.

[0100] In some alternative implementations, the behavior tree generation apparatus further includes: The third generation module is used to analyze the data description information based on the cognitive model and generate game experience information corresponding to the data description information.

[0101] In some alternative implementations, the optimization module 505 includes: The second acquisition submodule is used to acquire the current optimization round for the first row tree; Establish a submodule to create an initial experience pool for virtual objects based on game experience information if the current optimization round is the first round of optimization for the first row tree. The first optimization submodule is used to optimize the first behavior tree based on the initial experience pool and game data description, so as to obtain the target behavior tree of the virtual object in the target game environment.

[0102] In some optional implementations, the optimization module 505 further includes: The third acquisition submodule is used to acquire the first experience pool corresponding to the previous optimization round if the current optimization round is a non-first round optimization for the first row tree. The write submodule is used to write game experience information into the first experience pool to obtain the target experience pool; The second optimization submodule is used to optimize the first behavior tree based on the target experience pool and game data description to obtain the target behavior tree of the virtual object in the target game environment.

[0103] In some alternative implementations, the first optimization submodule includes: The third generation unit is used to generate update instructions for the initial knowledge base based on the response results of the decision model to the game data description and the initial experience pool. The update unit is used to update the initial knowledge base using update instructions to obtain the target knowledge base; The optimization unit is used to optimize the first behavior tree based on the target knowledge base, the initial experience pool, and the game data description to obtain the target behavior tree of the virtual object in the target game environment.

[0104] The behavior tree generation apparatus provided in this application can execute the behavior tree generation method provided in any embodiment of this application, and has the corresponding functional modules and beneficial effects of the method. Further functional descriptions of the various modules and units described above are the same as in the corresponding embodiments described above, and will not be repeated here.

[0105] Figure 6This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application.

[0106] The following is a detailed reference. Figure 6 This diagram illustrates a suitable structural schematic for implementing the electronic device described in the embodiments of this application. The electronic device may include a processor (e.g., a central processing unit, graphics processor, etc.) 601, which can perform various appropriate actions and processes according to a program stored in read-only memory (ROM) 602 or a program loaded from memory 608 into random access memory (RAM) 603. The RAM 603 also stores various programs and data required for the operation of the electronic device. The processor 601, ROM 602, and RAM 603 are interconnected via a bus 604. An input / output (I / O) interface 605 is also connected to the bus 604.

[0107] Typically, the following devices can be connected to I / O interface 605: input devices 606 including, for example, touchscreens, touchpads, keyboards, mice, cameras, microphones, accelerometers, gyroscopes, etc.; output devices 607 including, for example, liquid crystal displays (LCDs), speakers, vibrators, etc.; memory devices 608 including, for example, magnetic tapes, hard disks, etc.; and communication devices 609. Communication device 609 allows electronic devices to communicate wirelessly or wiredly with other devices to exchange data. Although Figure 6 Electronic devices with various devices are shown, but it should be understood that it is not required to implement or have all of the devices shown, and more or fewer devices may be implemented or have instead.

[0108] Specifically, according to embodiments of this application, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of this application include a computer program product comprising a computer program carried on a non-transitory computer-readable medium, the computer program containing program code for performing the methods shown in the flowcharts. In such embodiments, the computer program can be downloaded and installed from a network via a communication device 609, or installed from a memory 608, or installed from a ROM 602. When the computer program is executed by the processor 601, it performs the functions defined in the behavior tree generation method of embodiments of this application.

[0109] Figure 6 The electronic device shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of this application.

[0110] This application also provides a computer-readable storage medium. The methods described in this application can be implemented in hardware or firmware, or implemented as recordable on a storage medium, or implemented as computer code downloaded over a network and originally stored on a remote storage medium or a non-transitory machine-readable storage medium and then stored on a local storage medium. Thus, the methods described herein can be processed by software stored on a storage medium using a general-purpose computer, a dedicated processor, or programmable or dedicated hardware. The storage medium can be a magnetic disk, optical disk, read-only memory, random access memory, flash memory, hard disk, or solid-state drive, etc.; further, the storage medium can also include combinations of the above types of memory. It is understood that computers, processors, microprocessor controllers, or programmable hardware include storage components capable of storing or receiving software or computer code. When the software or computer code is accessed and executed by the computer, processor, or hardware, the behavior tree generation method shown in the above embodiments is implemented.

[0111] A portion of this application can be applied as a computer program product, such as computer program instructions, which, when executed by a computer, can invoke or provide the methods and / or technical solutions according to this application through the operation of the computer. Those skilled in the art will understand that the forms in which computer program instructions exist in a computer-readable medium include, but are not limited to, source files, executable files, installation package files, etc. Correspondingly, the ways in which computer program instructions are executed by a computer include, but are not limited to: the computer directly executing the instructions, or the computer compiling the instructions and then executing the corresponding compiled program, or the computer reading and executing the instructions, or the computer reading and installing the instructions and then executing the corresponding installed program. Here, the computer-readable medium can be any available computer-readable storage medium or communication medium accessible to a computer.

[0112] Although embodiments of this application have been described in conjunction with the accompanying drawings, those skilled in the art can make various modifications and variations without departing from the spirit and scope of this application, and all such modifications and variations fall within the scope defined by the appended claims.

Claims

1. A method for generating behavior trees, characterized in that, The method includes: Obtain the initial prompt word corresponding to the virtual object and the target game environment in which the virtual object is located; The initial prompt words are input into a pre-trained decision model to generate the first behavior tree corresponding to the virtual object; The first behavior tree is deployed to the target game environment to obtain game match data; The game data is input into a pre-trained cognitive model to generate data description information corresponding to the game data. The first behavior tree is optimized based on the data description information to obtain the target behavior tree of the virtual object in the target game environment.

2. The method according to claim 1, characterized in that, The step of inputting the initial prompt word into a pre-trained decision model to generate a first behavior tree corresponding to the virtual object includes: Obtain the initial knowledge base corresponding to the virtual object; Based on the strategy knowledge information in the initial knowledge base, the decision model is guided by the initial prompt words to generate the behavior tree, thereby obtaining the first behavior tree.

3. The method according to claim 2, characterized in that, The process of generating the first behavior tree by using the initial prompts to guide the decision model based on the strategy knowledge information in the initial knowledge base includes: Based on the strategy knowledge information in the initial knowledge base, the initial prompt words are used to guide the decision model in the process of generating the behavior tree, and a second behavior tree is generated. The second row tree is formatted based on a preset parsing method to obtain the conversion result; If the conversion result indicates that the second behavior tree conversion was successful, then the first behavior tree after the second behavior tree conversion is obtained.

4. The method according to claim 3, characterized in that, The method further includes: If the conversion result indicates that the second behavior tree conversion has failed, an error message is generated; Based on the error message, the second line tree is modified to obtain the modified second line tree.

5. The method according to claim 1, characterized in that, The method further includes: Based on the cognitive model, the data description information is analyzed to generate game experience information corresponding to the data description information.

6. The method according to claim 5, characterized in that, The step of optimizing the first behavior tree based on the data description information to obtain the target behavior tree of the virtual object in the target game environment includes: Obtain the current optimization round for the first behavior tree; If the current optimization round is the first round of optimization for the first behavior tree, then an initial experience pool corresponding to the virtual object is established based on the game experience information; The first behavior tree is optimized based on the initial experience pool and the game data description to obtain the target behavior tree of the virtual object in the target game environment.

7. The method according to claim 6, characterized in that, The method further includes: If the current optimization round is a non-first round optimization for the first behavior tree, then obtain the first experience pool corresponding to the previous optimization round; The game experience information is written into the first experience pool to obtain the target experience pool; The first behavior tree is optimized based on the target experience pool and the game data description to obtain the target behavior tree of the virtual object in the target game environment.

8. The method according to claim 6, characterized in that, The step of optimizing the first behavior tree based on the initial experience pool and the game data description to obtain the target behavior tree of the virtual object in the target game environment includes: Based on the decision model's response to the game data description and the initial experience pool, update instructions for the initial knowledge base are generated. The initial knowledge base is updated using the update instruction to obtain the target knowledge base; The first behavior tree is optimized based on the target knowledge base, the initial experience pool, and the game data description to obtain the target behavior tree of the virtual object in the target game environment.

9. A behavior tree generation device, characterized in that, The device includes: The acquisition module is used to acquire the initial prompt word corresponding to the virtual object and the target game environment in which the virtual object is located; The first generation module is used to input the initial prompt words into a pre-trained decision model to generate a first behavior tree corresponding to the virtual object; The deployment module is used to deploy the first behavior tree to the target game environment to obtain game match data; The second generation module is used to input the game data into a pre-trained cognitive model and generate data description information corresponding to the game data. An optimization module is used to optimize the first behavior tree based on the data description information to obtain the target behavior tree of the virtual object in the target game environment.

10. An electronic device, characterized in that, include: A memory and a processor are communicatively connected, the memory stores computer instructions, and the processor executes the behavior tree generation method according to any one of claims 1 to 8 by executing the computer instructions.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores computer instructions for causing a computer to perform the behavior tree generation method according to any one of claims 1 to 8.

12. A computer program product, characterized in that, Includes computer instructions for causing a computer to perform the behavior tree generation method according to any one of claims 1 to 8.