Game AI configuration method, device and equipment
By building and assembling the AI behavior tree of game AI and utilizing the behavioral logical inheritance of AI nodes, the problem of excessive number of game AI configuration files is solved and execution efficiency is improved.
Patent Information
- Application Number
- CN202311218506.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-09-20
- Publication Date
- 2025-01-10
AI Technical Summary
In the prior art, the configuration files of game AI cannot be reused, resulting in too many configuration files, which affects the execution efficiency of game AI.
By obtaining the AI objects of the game AI architecture, building an AI behavior tree, and determining the behavior configuration parameters of the AI nodes based on the preset AI parameter configuration table, realizing behavioral logic inheritance and assembly between AI nodes, reducing duplicate development.
It realizes the reusability of nodes in the AI behavior tree, reduces the number of configuration files of game AI, and improves the execution efficiency of game AI.
Smart Images

Figure CN119280813A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to a configuration method, device and equipment for game AI. Background Art
[0002] In the process of developing game AI (Artificial Intelligence), due to limitations such as file structure, some configuration files with the same functions cannot be reused. Currently, repeated development is the only option. This has resulted in a large number of configuration files for game AI, affecting the execution efficiency of game AI. Summary of the invention
[0003] In view of this, the present application provides a method and device for configuring a game AI, the main purpose of which is to solve the problem in the prior art that configuration files for the same functions that cannot be reused can only be repeatedly developed, which to a certain extent causes a large number of configuration files for the game AI, affecting the execution efficiency of the game AI.
[0004] According to a first aspect of the present application, a method for configuring a game AI is provided, comprising:
[0005] Obtain an AI object corresponding to the game AI architecture, and construct an AI behavior tree according to the configuration information of the AI object, wherein the AI behavior tree includes multiple AI nodes of different types;
[0006] For each AI node, determine the behavior configuration parameters of the AI node according to the AI parameters of different behaviors in the preset AI parameter configuration table;
[0007] According to the behavior configuration parameters of each AI node, determine the AI behavior logic of the same attribute configuration in different AI nodes;
[0008] The AI behavior logic configured with the same attributes is set in an AI behavior tree with behavior associations of the AI node.
[0009] Furthermore, before determining the behavior configuration parameters of the AI node according to the AI parameters of different behaviors in the preset AI parameter configuration table for each AI node, the method further includes:
[0010] Predefine the attribute type corresponding to the AI behavior tree according to the configuration attributes of the AI object;
[0011] According to the attribute type corresponding to the AI behavior tree, the inheritance relationship of different types of AI nodes in the AI behavior tree is configured so that AI nodes with the same function inherit the same AI behavior tree when executing logic.
[0012] Furthermore, when the AI object is a scene AI, the method further includes:
[0013] For the AI behavior nodes in the scene AI, the AI behavior logic to be executed after the event is triggered is assembled through the preset AI event-driven assembly rules to form the behavior assembly data of the scene AI;
[0014] In response to different events being triggered at fixed logic points, the AI behavior logic of the event is executed according to the AI behavior assembly data of the scenario.
[0015] Furthermore, for the AI behavior nodes in the scene AI, the AI behavior logic to be executed after the event is triggered is assembled through the preset AI event-driven assembly rules to form the behavior assembly data of the scene AI, including:
[0016] For the AI behavior nodes in the scene AI, use the AI behavior nodes to be executed after the event is triggered to build an AI behavior tree;
[0017] The AI behavior logic of the behavior node in the AI behavior tree is read, and the AI behavior logic of the behavior node is assembled through the AI event-driven assembly technology to form the behavior assembly data of the scene AI.
[0018] Furthermore, when the AI object is a unit AI, the method further includes:
[0019] Classify the same state of different unit AIs, and place the same state configuration classifications in the different unit AIs into the AI state configuration file;
[0020] Selecting the state configuration required by the unit AI from the AI state configuration file through the AI behavior state assembly rule for assembly to form the state assembly data of the unit AI;
[0021] In response to the state loading in the unit AI, the behavior logic of the unit AI in the corresponding state is executed according to the state assembly data of the unit AI.
[0022] Furthermore, the state configuration required by the unit AI is selected from the AI state configuration file through the AI behavior state assembly technology for assembly to form the state assembly data of the unit AI, including:
[0023] By reading the state configuration in the AI state configuration file, constructing AI behavior subtrees in different states;
[0024] Through AI behavior state assembly technology, the AI behavior subtrees in the required state of the AI unit are spliced to obtain the behavior tree of the unit AI;
[0025] A behavior tree of a differentiated unit AI is constructed according to the parameter configuration, and the state configuration required by the AI unit is assembled using the behavior tree of the differentiated unit AI to form state assembly data of the unit AI.
[0026] Furthermore, in the behavior tree of the unit AI obtained by splicing, the AI behavior subtrees in different states have a splicing configuration order. In the process of splicing the AI behavior subtrees in different states to obtain the behavior tree of the unit AI through the AI behavior state assembly technology, it is determined according to the splicing configuration order whether there are AI behavior subtrees in the same state in the AI behavior subtrees to be spliced. If so, the AI behavior subtree in the state to be spliced is used to replace the AI behavior subtree in the spliced state during the splicing process.
[0027] Furthermore, after obtaining the AI object corresponding to the game AI architecture and constructing the AI behavior tree according to the configuration information of the AI object, the method further includes:
[0028] Configure the AI action nodes in the AI behavior tree using a preset node type;
[0029] Add an AI behavior node with event detection mechanism in the AI behavior tree, and configure the AI behavior logic according to the event detection result of the AI node;
[0030] A recursive hierarchy is constructed for the AI behavior node to detect the configuration hierarchy depth of the AI behavior node. When the configuration hierarchy depth is greater than a preset value, the AI behavior logic is restricted using an AI configuration prompt.
[0031] Furthermore, after obtaining the AI object corresponding to the game AI architecture and constructing the AI behavior tree according to the configuration information of the AI object, the method further includes:
[0032] Obtaining the AI action node that triggers the event, and initializing the AI behavior logic to be executed after the triggering event into the AI action node;
[0033] After the AI action node is executed, if there is AI behavior logic to be executed, the AI behavior logic configured in the AI action node is executed.
[0034] Furthermore, before determining the behavior configuration parameters of the AI node according to the AI parameters of different behaviors in the preset AI parameter configuration table for each AI node, the method further includes:
[0035] Using parameterized configuration for the node AI, generating an AI parameter configuration table according to the parameterized configuration;
[0036] Using the configuration index in the AI parameter configuration table to query the behavior configuration corresponding to the AI parameters of different behaviors;
[0037] The parameterized configuration is used for the node AI, and generating the AI parameter configuration table according to the parameterized configuration includes: using a set variable as a parameter reference in the configuration data of the AI node, and associating AI parameters of different behaviors with the behavior configuration according to the parameter name of the parameter reference to generate the AI parameter configuration table;
[0038] Accordingly, for each AI node, determining the behavior configuration parameters of the AI node according to the AI parameters of different behaviors in the preset AI parameter configuration table includes:
[0039] Read each node AI to determine whether parameterized configuration is used in the node AI;
[0040] If yes, parse the parameter name referenced by the node AI to obtain the AI parameter of the preset behavior in the AI node;
[0041] The behavior configuration parameters of the AI node are determined from the AI parameter configuration table according to the AI parameters of the preset behavior.
[0042] According to a second aspect of the present application, a configuration device for a game AI is provided, comprising:
[0043] An acquisition unit, used to acquire an AI object corresponding to the game AI architecture, and construct an AI behavior tree according to configuration information of the AI object, wherein the AI behavior tree includes a plurality of AI nodes of different types;
[0044] A first determining unit, configured to determine, for each AI node, a behavior configuration parameter of the AI node according to AI parameters of different behaviors in a preset AI parameter configuration table;
[0045] A second determination unit is used to determine the AI behavior logic of the same attribute configuration in different AI nodes according to the behavior configuration parameters of each AI node;
[0046] The setting unit is used to set the AI behavior logic of the same attribute configuration in the AI behavior tree with behavior association of the AI node.
[0047] Furthermore, the device also includes:
[0048] a definition unit, configured to predefine an attribute type corresponding to the AI behavior tree according to the configuration attributes of the AI object before determining the behavior configuration parameters of the AI node according to the AI parameters of different behaviors in the preset AI parameter configuration table for each AI node;
[0049] The first configuration unit is used to configure the inheritance relationship of different types of AI nodes in the AI behavior tree according to the attribute type corresponding to the AI behavior tree, so that AI nodes with the same function inherit the same AI behavior tree when executing logic.
[0050] Furthermore, when the AI object is a scene AI, the device further includes: an assembly unit, for assembling the AI behavior logic to be executed after the event is triggered by a preset AI event-driven assembly rule for the AI behavior node in the scene AI, to form the behavior assembly data of the scene AI;
[0051] The first execution unit is used to trigger different events in response to fixed logic points, and assemble data to execute AI behavior logic of the event according to the behavior of the scenario AI.
[0052] Furthermore, the assembly unit is specifically used to construct an AI behavior tree for the AI behavior nodes in the scene AI using the AI behavior nodes to be executed after event triggering; read the AI behavior logic of the behavior nodes in the AI behavior tree, and assemble the AI behavior logic of the behavior nodes through AI event-driven assembly technology to form behavior assembly data of the scene AI.
[0053] Furthermore, when the AI object is a unit AI, the device further comprises: a classification unit, configured to classify the same state for different unit AIs, and place the same state configuration classifications in the different unit AIs into an AI state configuration file;
[0054] A selection unit is used to select a state configuration required by the unit AI from the AI state configuration file according to the AI behavior state assembly rule to assemble the state configuration to form the state assembly data of the unit AI;
[0055] The second execution unit is used to respond to the state loading in the unit AI and assemble data according to the state of the unit AI to execute the behavior logic of the unit AI in the corresponding state.
[0056] Furthermore, the selection unit is specifically used to construct AI behavior subtrees in different states by reading the state configuration in the AI state configuration file; splicing the AI behavior subtrees in the required state of the AI unit to obtain the behavior tree of the unit AI through the AI behavior state assembly technology; constructing the behavior tree of the differentiated unit AI according to the parameter configuration, and assembling the state configuration required by the AI unit using the differentiated unit AI behavior tree to form the state assembly data of the unit AI.
[0057] Furthermore, in the behavior tree of the unit AI obtained by splicing, the AI behavior subtrees in different states have a splicing configuration order. In the process of splicing the AI behavior subtrees in different states to obtain the behavior tree of the unit AI through the AI behavior state assembly technology, it is determined according to the splicing configuration order whether there are AI behavior subtrees in the same state in the AI behavior subtrees to be spliced. If so, the AI behavior subtree in the state to be spliced is used to replace the AI behavior subtree in the spliced state during the splicing process.
[0058] Furthermore, the device also includes:
[0059] A second configuration unit is configured to configure AI action nodes in the AI behavior tree using a preset node type after obtaining the AI object corresponding to the game AI architecture and building the AI behavior tree according to the configuration information of the AI object;
[0060] A third configuration unit is used to add an AI behavior node of an event detection mechanism in the AI behavior tree, and configure the AI behavior logic according to the event detection result of the AI node;
[0061] A detection unit is used to construct a recursive hierarchy for the AI behavior node to detect the configuration hierarchy depth of the AI behavior node, and when the configuration hierarchy depth is greater than a preset value, use AI configuration prompts to restrict the AI behavior logic.
[0062] Furthermore, the device also includes:
[0063] An initialization unit, configured to obtain an AI action node of a triggering event after obtaining an AI object corresponding to the game AI architecture and constructing an AI behavior tree according to configuration information of the AI object, and initialize the AI behavior logic to be executed after the triggering event into the AI action node;
[0064] The third execution unit is used to execute the AI behavior logic configured in the AI action node after executing the AI action node, if there is AI behavior logic to be executed.
[0065] Furthermore, the device also includes:
[0066] A generating unit, configured to use parameterized configuration for each AI node and generate an AI parameter configuration table according to the parameterized configuration before determining the behavior configuration parameters of the AI node according to the AI parameters of different behaviors in a preset AI parameter configuration table for each AI node;
[0067] A query unit, configured to use a configuration index in the AI parameter configuration table to query behavior configurations corresponding to AI parameters of different behaviors;
[0068] The generating unit is specifically used to use the set variable as a parameter reference in the configuration data of the AI node, associate the AI parameters of different behaviors with the behavior configuration according to the parameter name of the parameter reference, and generate an AI parameter configuration table;
[0069] Correspondingly, the first determination unit is specifically used to read each node AI to determine whether parameterized configuration is used in the node AI; if so, parse the parameter name referenced by the node AI to obtain the AI parameters of the preset behavior in the AI node; determine the behavior configuration parameters of the AI node from the AI parameter configuration table according to the AI parameters of the preset behavior.
[0070] According to a third aspect of the present application, a computer device is provided, comprising a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of the method described in the first aspect when executing the computer program.
[0071] According to a fourth aspect of the present application, a readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the steps of the method described in the first aspect are implemented.
[0072] By means of the above technical scheme, the present application provides a configuration method, device and equipment for game AI. Compared with the current prior art method of configuring game AI through tools, the present application obtains the AI object corresponding to the game AI architecture, and constructs an AI behavior tree according to the configuration information of the AI object. The AI behavior tree includes multiple different types of AI nodes. For each AI node, the behavior configuration parameters of the AI node are determined according to the AI parameters of different behaviors in the preset AI parameter configuration table. Then, according to the behavior configuration parameters of each AI node, the AI behavior logic of the same attribute configuration in different AI nodes is determined, and the AI behavior logic of the same attribute configuration is set in the AI behavior tree with behavior association of the AI node. The whole process achieves the effect of reusable nodes in the AI behavior tree by splicing the same functions in the AI configuration into different AI behavior trees, so that the same AI behavior logic does not need to be repeatedly developed, reducing the number of configuration files of the game AI, and reconstructing the assembly process of the AI behavior tree through the parameterized configuration of the AI node, which improves the execution efficiency of the game AI to a certain extent.
[0073] The above description is only an overview of the technical solution of the present application. In order to more clearly understand the technical means of the present application, it can be implemented in accordance with the contents of the specification. In order to make the above and other purposes, features and advantages of the present application more obvious and easy to understand, the specific implementation methods of the present application are listed below. BRIEF DESCRIPTION OF THE DRAWINGS
[0074] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0075] Figure 1 It is a flowchart of a method for configuring a game AI provided in an embodiment of the present application;
[0076] Figure 2 It is a flowchart of another method for configuring a game AI provided in an embodiment of the present application;
[0077] Figure 3 It is a flowchart of another method for configuring a game AI provided in an embodiment of the present application;
[0078] Figure 4 It is a flowchart of another method for configuring a game AI provided in an embodiment of the present application;
[0079] Figure 5 It is a flowchart of another method for configuring a game AI provided in an embodiment of the present application;
[0080] Figure 6 It is a flowchart of another method for configuring a game AI provided in an embodiment of the present application;
[0081] Figure 7 It is a flowchart of another method for configuring a game AI provided in an embodiment of the present application;
[0082] Figure 8 It is a structural diagram of a configuration device for a game AI provided in an embodiment of the present application;
[0083] Fig. 9 It is a schematic diagram of the device structure of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0084] Now the content of the present invention will be discussed with reference to several exemplary embodiments. It should be understood that these embodiments are discussed only to enable those skilled in the art to better understand and thus implement the content of the present invention, rather than implying any limitation on the scope of the present invention.
[0085] As used herein, the term "including" and variations thereof are to be interpreted as open-ended terms meaning "including but not limited to." The term "based on" is to be interpreted as "based, at least in part, on." The terms "one embodiment" and "an embodiment" are to be interpreted as "at least one embodiment." The term "another embodiment" is to be interpreted as "at least one other embodiment."
[0086] In the related technology, the architecture of game AI can be implemented by combining hierarchical finite state machines and behavior trees. In the architecture of game AI, the configuration of game AI can be split into scene AI and unit AI. Scene AI is an AI behavior tree constructed through document configuration in a specific format. Since the gameplay and process positioning of each scene in the game are different, the same process in scene AI cannot be spliced together to obtain an AI behavior tree by combination. The configuration of unit AI is adapted to scene AI with different requirements to meet the requirements of a certain type of unit AI. In other words, in the configuration process of game AI, the configuration of scene AI cannot be reused, while the configuration of unit AI can be reused. The non-reusable scene AI requires repeated development of the same functions in the configuration of game AI, which to a certain extent results in a large number of configuration files for game AI, affecting the execution efficiency of game AI.
[0087] In order to solve this problem, this embodiment provides a configuration method for game AI, such as Figure 1 As shown, the method comprises the following steps:
[0088] 101. Obtain an AI object corresponding to the game AI architecture, and construct an AI behavior tree according to configuration information of the AI object.
[0089] An important application scenario of game AI is to control non-player characters (NPCs) in the game, so that non-player characters can perceive a series of operations of real players and make interactive behaviors, such as attacking and escaping. The response made by the AI is not generated out of thin air, but by imitating the operations of real players to make its behavior "intelligent". The execution of specific game AI can be achieved through the game AI architecture, which is equivalent to a software framework for realizing artificial intelligence functions in the game. It provides a way to organize and manage game AI code, so that developers can more effectively design, implement and debug AI behaviors in the game.
[0090] Generally speaking, the AI architecture of a game corresponds to an AI object, where AI objects can be player characters, non-player characters, and game scenes, etc. Each AI object can include the following core components: Perception module, used to obtain information in the game world, such as player positions, enemy positions, obstacles, etc. The specific perception module can obtain information through sensors, collision detection, ray transmission, etc. Decision module, used to make decisions based on the information obtained by perception, using predefined rules, algorithms, or machine learning models, such as selecting the best action, formulating strategies, etc. Behavior module, used to execute actions generated by decisions, such as moving, attacking, dodging, etc. Specific behaviors can be achieved through predefined action sequences, state machines, behavior trees, etc. Planning module, used to generate a series of action sequences based on the current game state and goals to achieve specific goals, which can be achieved using search algorithms, paths, planning, and other technologies. Learning module, used to learn and improve AI behavior from game experience through machine learning algorithms, which can be based on supervised learning, reinforcement learning, and other methods. It should be noted that the components in the game AI architecture can be combined and expanded according to specific game requirements and AI functions to implement different types of game AI, such as enemy AI, teammate AI, non-player character AI, etc.
[0091] It should be noted that AI objects usually have many behaviors during the game. Considering the connection between different behavior states, the behavior control of AI objects becomes more complicated. The behavior tree provides a hierarchical method for organizing behaviors in a complex descending order, so that a complex behavior can be represented as a subtree in the behavior tree, and the multiple simple behaviors that constitute the complex behavior represent smaller subtrees under the subtree. The behavior tree uses this simple behavior to implement complex behaviors, which can more conveniently expand the behavior, and can also express the direction of decision logic through the hierarchical arrangement of nodes in the behavior tree.
[0092] Among them, the configuration information of AI objects usually includes the following: AI type, AI behavior rules, AI decision logic, and AI resources, etc. AI type is the type of the specified AI object, such as enemy, friendly, neutral, etc. AI behavior logic is the behavior rules of the specified AI object, including patrol, pursuit, escape, etc. AI decision logic package is the decision logic of the specified AI object, which is used to control its behavior selection in the game, and AI resources are the resources required by the specified AI object, such as models, textures, sounds, etc.
[0093] The specific AI behavior tree includes multiple different types of AI nodes, and the AI nodes form a tree structure. Starting from the root node, go down from top to bottom. Each time you pass an AI node, you execute the corresponding function of the AI node. Here, each AI node can provide its own execution function and return the result of execution failure / success. Further, according to the execution results of different AI nodes, the downward path changes accordingly, and eventually you will reach the AI node at the end and execute its corresponding behavior.
[0094] Specifically, in the process of building an AI behavior tree according to the configuration information of the AI object, the node type of the AI node in the required AI behavior tree can be determined according to the configuration information of the AI object, such as a selection node, a sequence node, a condition node, an action node, etc., and then the root node type of the AI behavior tree is determined according to the configuration information of the AI object, and the root node is created, and then according to the configuration information of the AI object, child nodes are added to the root node or other nodes one by one, where the root node and other nodes are all AI nodes, and as needed, combination nodes such as selection nodes and sequence nodes can be used to organize the execution order of child nodes, and further according to the configuration information of the AI object, corresponding parameters are set for each AI node, for example, a condition node may need to set a judgment condition, and an action node may need to set a specific action to be executed, and according to the configuration information of the AI object, the various AI nodes are connected to form a complete AI behavior tree structure, and the child node list of the parent node or other methods can be used to connect the nodes, and finally in each game loop, according to the configuration information of the AI object, the update of the AI behavior tree is called.
[0095] The execution subject of this embodiment can be a configuration device or equipment for the game AI, which can be configured on the game server. The game server builds an AI behavior tree according to the configuration information of the AI object, and uses the AI behavior tree to classify the behavior logic and state data of the AI object. Any AI node can be reused, and different AI behavior tree assembly processes can be implemented by reorganizing different AI nodes, thereby improving the execution efficiency of the game AI.
[0096] 102. For each AI node, determine the behavior configuration parameters of the AI node according to the AI parameters of different behaviors in a preset AI parameter configuration table.
[0097] It is understandable that the parameter configuration of each AI node may vary according to different AI frameworks or tools. In the process of configuring the parameters of each AI node, the type of AI node is first determined, and then the behavioral meaning and function of each AI node is understood based on the node type, and the parameter AI configuration index is determined. The behavioral parameters of the AI node are read from the preset AI parameter configuration table based on the parameter AI configuration index. Since the AI parameter configuration table records AI parameters with different behaviors, the behavioral parameters of the AI node are configured according to the behavioral meaning and function of each AI node to determine the behavioral configuration parameters of the AI node.
[0098] Considering that AI objects may be of different types, the constructed AI behavior trees are of different behavior tree types. If the AI object contains scene AI, scene AI requires simple logic and has the characteristics of relatively similar AI behaviors. Therefore, in the processing of scene AI, the AI nodes included in the AI behavior tree can be divided into event nodes, logic nodes, condition nodes, and action nodes for unified management.
[0099] Since the behavior configuration parameters of AI nodes can be parameterized, the same AI behavior configuration can achieve different effects. Take the AI object as a unit AI as an example. If the action selection skill type = C_selectskillType, skill = C_skill, the configuration starting with C_ is a parameter reference, which is mapped to the AI parameter configuration table. According to the parameter AI configuration index, the resource data corresponding to selectskillType and skill can be found, and then the real parameters required by the unit AI can be parsed.
[0100] 103. According to the behavior configuration parameters of each AI node, determine the AI behavior logic of the same attribute configuration in different AI nodes.
[0101] Among them, the behavior configuration parameters of the AI node can be attribute parameters for the behavior configuration. For example, the AI node has behavior configuration parameters such as attack and escape. The attack configuration has attributes such as attack target, attack condition, and moving speed. The escape behavior configuration has attributes such as escape duration, escape speed, and escape direction. Considering that the behavior configuration parameters of different nodes can be defined by game developers, different AI nodes may have AI behavior configurations with the same attributes. For example, AI node 1 has behavior configuration parameters such as attack and escape, and AI node 2 has behavior configuration parameters such as dodge and escape. At this time, both AI nodes have behavior configuration parameters for escape.
[0102] Specifically, the configuration parameters of each AI node can be analyzed to determine the target attributes to be found, and then the AI nodes can be traversed to check the attributes of the AI nodes one by one. For each AI node, check whether the attributes match the target attributes. If an AI node with a matching target attribute is found, the AI behavior logic of the corresponding attribute configuration can be extracted to determine the AI nodes with the same attributes, and further analyze the commonality of the parameters with the same attributes in the behavior logic. For example, all AI nodes whose configuration parameters contain "attack power" may need to adjust the attack range according to the attack power at each iteration. In this case, the AI behavior logic of these AI nodes is to adjust the attack range according to the attack power.
[0103] 104. Setting the AI behavior logic with the same attribute configuration in the AI behavior tree with behavior association of the AI node.
[0104] It is understandable that, considering the large number of AI objects in the game AI architecture, each AI object will be configured accordingly, and an AI behavior tree will be built for the AI object. Depending on the AI object, the type of AI behavior tree built will also be different.
[0105] In some games, the AI behavior trees constructed by different AI objects may be independent and have no connection with each other. Each AI object has its own AI behavior tree and makes decisions based on the current environment and status. In other games, the AI behavior trees constructed by different AI objects may have certain associations. For example, the hostile non-player characters in the game may have a main AI behavior tree to control their basic behaviors, such as patrolling, chasing players, etc., while the AI behavior trees of other enemies may add AI nodes based on the main AI behavior tree. The added AI nodes have inheritance or extension associations with the main AI behavior tree to achieve specific behaviors, such as special attacks, teamwork, etc.
[0106] The relationship between specific AI behavior trees can be realized through the combination, inheritance, conditional judgment and other mechanisms of AI behavior trees. By reasonably designing and organizing the relationship between different AI behavior trees, more complex and diverse game behaviors can be achieved.
[0107] Here, the AI behavior logic with the same attribute configuration can be a piece of code, a function, or an independent behavior module. The behavior logic with the same attribute configuration can be queried in the AI behavior tree according to the association relationship between the AI behavior trees. The associated AI nodes can be behavior logics with associations. Specifically, the AI behavior logic with the same attribute configuration can be bound to the AI node associated with the behavior logic, or the behavior module can be the child node of the AI node. The associated AI nodes can be conditional judgments with associations. Specifically, conditional judgments can be added in the AI behavior tree to determine the execution of the AI behavior logic with the same attribute configuration according to specific conditions. The associated AI nodes can also be connection structures with associations. Specifically, according to the logical structure of the AI behavior tree, the AI nodes with the connection structure with associations can be connected, and the parent-child relationship or brother relationship between the AI nodes can be set. The above can be used to set the AI behavior logic with the same attribute configuration to the AI behavior with behavior associations for the association between AI nodes in different AI behavior trees, thereby realizing complex AI behavior control.
[0108] Compared with the current prior art method of configuring game AI through tools, the configuration method of game AI provided in the embodiment of the present application obtains the AI object corresponding to the game AI architecture, and constructs an AI behavior tree according to the configuration information of the AI object. The AI behavior tree includes multiple different types of AI nodes. For each AI node, the behavior configuration parameters of the AI node are determined according to the AI parameters of different behaviors in the preset AI parameter configuration table. Then, according to the behavior configuration parameters of each AI node, the AI behavior logic of the same attribute configuration in different AI nodes is determined, and the AI behavior logic of the same attribute configuration is set in the AI behavior tree with behavior association of the AI node. The whole process achieves the effect of reusable nodes in the AI behavior tree by splicing the same functions in the AI configuration into different AI behavior trees, so that the same AI behavior logic does not need to be repeatedly developed, reducing the number of configuration files of the game AI, and reconstructing the assembly process of the AI behavior tree through the parameterized configuration of the AI node, which improves the execution efficiency of the game AI to a certain extent.
[0109] In actual application scenarios, considering the inheritance relationship of different types of AI nodes in the AI behavior tree, AI nodes with the same configuration function need to integrate the same AI behavior tree when executing logic. Before step 102, Figure 2 As shown, the method also includes the following steps:
[0110] 201. Predefine the attribute type corresponding to the AI behavior tree according to the configuration attribute of the AI object.
[0111] 202. According to the attribute type corresponding to the AI behavior tree, configure the inheritance relationship of different types of AI nodes in the AI behavior tree, so that AI nodes with the same function inherit the same AI behavior tree when executing logic.
[0112] Among them, the configuration attribute of the AI object is equivalent to the attribute type of the game object, which can be the game scene, game character, game NPC, etc. According to the attribute type of the game object, the attribute type of the AI behavior tree can be defined, for example, 1 = scene behavior tree, 2 = unit behavior tree, that is, when the AI behavior tree is built, it is already known whether the current AI behavior tree belongs to scene AI or unit AI. When executing logic when building the same function AI node later, different AI logic function calls can be made according to different behavior types.
[0113] Specifically, it can be implemented using the AI logic management class. By distinguishing whether the AI logic management class belongs to scene AI or unit AI, the AI behavior logic can be processed separately. Then, the condition nodes and action nodes of scene AI and unit AI are integrated with the same base class to reduce secondary development. By inheriting the same base class, the same functional classes of scene AI and unit AI are initialized with different logic processing according to different AI behavior attributes, so that AI nodes with the same function inherit the same AI behavior tree when executing logic, thereby reducing repeated development of the same function in the AI behavior tree.
[0114] In actual application scenarios, considering the different attribute configurations of AI objects, different types of AI behavior trees have different logical processing methods. Specifically, when the AI object is a scene AI, such as Figure 3 As shown, the method also includes the following steps:
[0115] 301. For the AI behavior nodes in the scene AI, the AI behavior logic to be executed after the event is triggered is assembled through the preset AI event-driven assembly rules to form the behavior assembly data of the scene AI.
[0116] 302. In response to different events being triggered by fixed logic points, the AI behavior logic of the event is executed according to the behavior assembly data of the scenario AI.
[0117] Among them, AI nodes are program components used only to implement intelligent behaviors. They are usually used to control the logical behaviors of characters in the game, so that they can show intelligence and autonomy in the game. AI behavior nodes can contain various behaviors and decision-making logic, such as moving, attacking, finding targets, avoiding obstacles, etc. By combining multiple AI nodes together, complex NPC behaviors can be created, enabling them to interact and confront with players. Each AI node is equivalent to the implementation of an AI behavior logic. For example, if a unit needs to move around, then the movement around is equivalent to a node developed by AI.
[0118] It is understandable that the existing implementation method is that each scene AI generates an AI configuration file according to the different gameplay required. As the number of game play increases, the number of scene AI configuration files also increases. However, in actual application, scene AI requires simple logic to make the behavior of AI nodes more similar. In scene processing, AI nodes can be divided into event nodes, logic nodes, conditional nodes and action nodes. For the AI behavior nodes in the scene AI, they are formed into a complete scene AI through the preset AI event-driven assembly rules. In this way, the AI behavior nodes in the scene AI can be reused, thereby achieving the effect of simplified planning, so that planners only need to configure the behavior assembly data of the scene AI, and can complete the configuration of the scene AI without.
[0119] The application process of specific scene AI can be achieved by reading the scene AI configuration, building the scene AI behavior tree according to the scene AI configuration, and building the scene AI through the scene AI parameter configuration differentiation. The built scene AI is loaded when the scene is created, and when the scene gameplay ends or the scene is destroyed, the scene AI is destroyed accordingly. It should be noted that the same scene supports loading multiple different scene AIs at the same time, and supports dynamic loading and removal of scene AI.
[0120] Specifically, for the AI behavior nodes in the scene AI, the AI behavior nodes to be executed after the event is triggered can be used to build an AI behavior tree, read the AI behavior logic of the behavior nodes in the AI behavior tree, and assemble the AI behavior logic of the behavior nodes through the AI event-driven assembly technology to form the behavior assembly data of the scene AI. Exemplarily, a small section of AI execution behavior logic can be added after each event configuration, and the AI behavior nodes to be executed after the event is triggered can be configured through the AI configuration to build an AI behavior tree. Different AI events are triggered through fixed logic points in the project engineering. After listening to the event logic that needs to be processed, the subsequent logic nodes of the scene AI configuration are executed after the trigger.
[0121] It is understandable that the AI behavior nodes in the scene AI here are not configured in a certain configuration file, but a group of AI behavior nodes are uniformly managed through event-driven configuration, so that AI behavior nodes can be constructed through a unified AI node configuration path, making the AI behavior nodes in the scene AI reusable.
[0122] Correspondingly, when the AI object is a unit AI, such as Figure 4 As shown, the method also includes the following steps:
[0123] 401. Classify the same state of different unit AIs, and place the same state configuration classification in the different unit AIs into an AI state configuration file.
[0124] 402. Select the state configuration required by the unit AI from the AI state configuration file according to the AI behavior state assembly rule and assemble it to form state assembly data of the unit AI.
[0125] 403. In response to the state loading in the unit AI, assemble data according to the state of the unit AI to execute the behavior logic of the unit AI in the corresponding state.
[0126] It is understandable that unit AI requires complex logic, and the AI state structure is relatively similar. The use of mind maps to configure unit AI behavior is retained here, but instead of configuring a complete unit AI behavior, the idea of components is used to classify and manage unit AI in the same state, and then the AI behavior state assembly rules are used to assemble the AI state required by the current unit AI into any module, so that it forms a complete unit AI with its own characteristics, so that planners do not need to configure a large amount of unit AI behavior logic, but only need to configure the behavior under different AI states, thereby achieving a large reduction in the configuration of unit AI files. The state here refers to the state of the unit AI. For example, the first unit AI has a pursuit state, and the second unit AI also has a pursuit state. The pursuit state can be extracted and put into the AI state configuration file for unified management, and different pursuit states can be loaded according to different AI splicing configurations in the future.
[0127] Specifically, the state configuration in the AI state configuration file can be read to construct the AI behavior subtrees in different states. The AI behavior state assembly technology can be used to splice the AI behavior subtrees in the required state of the AI unit to obtain the behavior tree of the unit AI. The behavior tree of the differentiated unit AI is constructed according to the parameter configuration. The state configuration required by the AI unit is assembled using the behavior tree of the differentiated unit AI to form the state assembly data of the unit AI. For example, both unit A AI and unit B AI have an escape state, and there is no difference in behavior. The escape state can be extracted to construct an AI behavior subtree of the escape state. If the escape state is used during the configuration process of the unit AI, the AI behavior subtree of the escape state is spliced into the substate of the unit AI. Here, the behavior of the escape state is the same, and the specific parameters such as running speed and direction can be realized by the differentiation of configuration parameters.
[0128] It should be noted that each unit AI state is a subtree relative to the complete unit AI behavior tree. In the process of splicing according to the unit AI state configuration, if the same AI state behavior tree is encountered, the latter AI state behavior tree will replace the former AI state behavior tree. Specifically, in the behavior tree of the spliced unit AI, the AI behavior subtrees in different states have a splicing configuration order. In the process of splicing the AI behavior subtrees in different states to obtain the behavior tree of the unit AI through the AI behavior state assembly technology, it is determined according to the splicing configuration order whether there are AI behavior subtrees in the same state in the AI behavior subtrees to be spliced. If so, the AI behavior subtree in the state to be spliced is used to replace the AI behavior subtree in the spliced state during the splicing process.
[0129] In actual application scenarios, considering the execution efficiency of the AI behavior tree, the AI behavior depth often needs to be detected during the construction of the AI behavior tree. After step 101, Figure 5 As shown, the method also includes the following steps:
[0130] 501. Use a preset node type to configure an AI action node in the AI behavior tree.
[0131] 502. Add an AI behavior node of an event detection mechanism in the AI behavior tree, and configure the AI behavior logic according to the event detection result of the AI node.
[0132] 503. Construct a recursive hierarchy for the AI behavior node to detect the configuration hierarchy depth of the AI behavior node. When the configuration hierarchy depth is greater than a preset value, use an AI configuration prompt to restrict the AI behavior logic.
[0133] Among them, the preset node type refers to the action node. Usually, in order to reduce the cost of learning AI configuration, the AI node types can be reduced by adjusting the node types. Specifically, AND nodes, OR nodes, NOT nodes, prefix nodes, parallel nodes, selection nodes, and sequential nodes can be adjusted to prefix AND nodes, prefix OR nodes, parallel nodes, and sequential nodes. Complex AI logic can also be configured using the adjusted AI nodes.
[0134] Normally, during the process startup, the AI configuration can be detected through the detection mechanism. If the depth of the AI behavior node configuration level is greater than a certain value, the AI configuration will be prompted to optimize, and the AI logic will not be restricted. Specifically, during the construction of the AI behavior tree, the AI behavior depth can be recursively detected for the AI node. While reducing the AI node types, the configuration and construction of some AI logic behavior depths are reduced to a certain extent.
[0135] In actual application scenarios, two new AI behavior nodes, [Event] condition detection success and [Event] condition detection failure, can be added. The two newly added AI behavior nodes can strictly control the condition behavior node depth of the AI logic configuration, so that the node depth of the AI logic behavior remains no more than 4. For example, when the [Precondition and Condition] or [Precondition or Condition] node executes successfully or fails, the [Event] condition detection success or [Event] condition detection failure is triggered, and different AI behaviors are configured according to different detection results. In this way, the planner only needs to understand that under certain state conditions, the if statement needs to be executed, avoiding writing code-like AI logic.
[0136] In actual application scenarios, considering the execution efficiency of AI logic behavior, the AI logic after the trigger event can be directly initialized in the action node class. Specifically, after step 101, Figure 6 As shown, the method also includes the following steps:
[0137] 601. Obtain an AI action node that triggers an event, and initialize the AI behavior logic to be executed after the triggering event into the AI action node.
[0138] 602. After the AI action node is executed, if there is AI behavior logic to be executed, the AI behavior logic configured in the AI action node is executed.
[0139] It is understandable that when constructing an AI behavior tree, when the [Action] node of the triggered [Event] node type is initialized, the AI logic behavior after the triggered event can be directly initialized in the action node class. After the current action node is executed, check whether there is other AI behavior logic that needs to be executed. If so, continue to execute it, instead of querying through the event management class of the AI behavior tree first. When the specified event behavior is queried, the corresponding AI logic behavior tree is executed, thereby reducing the number of AI behavior queries.
[0140] Taking into account that different types of AI objects have different processes for processing AI behavior logic, in order to avoid repeated development of the same AI behavior logic, in the process of processing AI behavior logic, the same AI behavior logic in different AI objects is processed differently. Specifically, an AI logic management class can be used to distinguish whether the AI object belongs to scene AI or unit AI based on the type of the AI logic management class. Further, according to the type of the AI object, the processed AI behavior logic is distinguished. Then, the condition nodes and action nodes of scene AI and unit AI are integrated with the same base class, so that the same functional class of scene AI and unit AI is initially processed differently according to different AI behavior attributes. In other words, when both scene AI and unit AI use the same AI behavior logic, the processing method of AI behavior logic can be judged by the AI behavior tree type. For example, scene AI can create timers, and unit Ai can also create timers. The AI behavior logic for creating timers is the same, but the AI objects to which the timers belong are different. When executing the AI behavior logic for creating timers, it can be determined whether the current AI behavior logic for creating timers belongs to scene AI or unit AI based on the different types of affiliation set for the current AI node. Further, based on the type of AI object, the created timers can be placed in different timer cache containers, thus realizing the reuse of AI, effectively reducing the amount of AI configuration, and reducing the number of instances of AI nodes.
[0141] In actual application scenarios, before step 102, Figure 7 As shown, the method also includes the following steps:
[0142] 701. Use parameterized configuration for the node AI, and generate an AI parameter configuration table according to the parameterized configuration.
[0143] 702. Use the configuration index in the AI parameter configuration table to query behavior configurations corresponding to AI parameters of different behaviors.
[0144] Specifically, when using parameterized configuration for node AI and generating an AI parameter configuration table based on the parameterized configuration, set variables can be used as parameter references in the configuration data of the AI node, and AI parameters of different behaviors can be associated with the behavior configurations based on the parameter names of the parameter references to generate an AI parameter configuration table.
[0145] Exemplarily, it can be stipulated that all variables using parameterized configuration need to start with C_, followed by the referenced parameter name, and the parameter configuration is configured in JSON format. When reading the constructed AI node, it is determined whether the parameterized configuration is used, that is, whether there is a configuration starting with C_. If so, the required parameter value is extracted from the configuration JSON string corresponding to the AI parameter based on the parameter name referenced after C_. Replacement logic processing is performed when constructing a specific AI behavior node. Parameter replacement can use regular expression technology or JSON merge replacement.
[0146] Correspondingly, step 102 specifically includes: reading each node AI, determining whether parameterized configuration is used in the node AI, and if so, parsing the parameter name referenced by the node AI to obtain the AI parameters of the preset behavior in the AI node, and determining the behavior configuration parameters of the AI node from the AI parameter configuration table according to the AI parameters of the preset behavior.
[0147] The embodiment of the present application redesigns the AI architecture to effectively reduce the difficulty of AI logic-related configuration, reduce learning costs, and improve AI configuration efficiency to a certain extent. By reconstructing the assembly process of the AI behavior tree, the search during the AI execution process is reduced, and there is no need to repeatedly develop and implement AI nodes with the same functions, thereby improving AI execution efficiency.
[0148] Further, as Figure 1-Figure 7 The specific implementation of the method, the embodiment of the present application provides a configuration device for game AI, such as Figure 8 As shown, the device includes: an acquisition unit 81, a first determination unit 82, a second determination unit 83, and a setting unit 84.
[0149] An acquisition unit 81 is used to acquire an AI object corresponding to the game AI architecture, and construct an AI behavior tree according to the configuration information of the AI object, wherein the AI behavior tree includes a plurality of AI nodes of different types;
[0150] A first determining unit 82 is used to determine, for each AI node, the behavior configuration parameters of the AI node according to the AI parameters of different behaviors in a preset AI parameter configuration table;
[0151] A second determining unit 83, configured to determine the AI behavior logic of the same attribute configuration in different AI nodes according to the behavior configuration parameters of each AI node;
[0152] The setting unit 84 is used to set the AI behavior logic with the same attribute configuration in the AI behavior tree with behavior association of the AI node.
[0153] Compared with the current prior art method of configuring game AI through tools, the configuration device of game AI provided by the embodiment of the present invention obtains the AI object corresponding to the game AI architecture, and constructs an AI behavior tree according to the configuration information of the AI object. The AI behavior tree includes multiple different types of AI nodes. For each AI node, the behavior configuration parameters of the AI node are determined according to the AI parameters of different behaviors in the preset AI parameter configuration table. Then, according to the behavior configuration parameters of each AI node, the AI behavior logic of the same attribute configuration in different AI nodes is determined, and the AI behavior logic of the same attribute configuration is set in the AI behavior tree with behavior association of the AI node. The whole process achieves the effect of reusable nodes in the AI behavior tree by splicing the same functions in the AI configuration into different AI behavior trees, so that the same AI behavior logic does not need to be repeatedly developed, reducing the number of configuration files of the game AI, and reconstructing the assembly process of the AI behavior tree through the parameterized configuration of the AI node, which improves the execution efficiency of the game AI to a certain extent.
[0154] In an actual application scenario, the device further includes:
[0155] a definition unit, configured to predefine an attribute type corresponding to the AI behavior tree according to the configuration attributes of the AI object before determining the behavior configuration parameters of the AI node according to the AI parameters of different behaviors in the preset AI parameter configuration table for each AI node;
[0156] The first configuration unit is used to configure the inheritance relationship of different types of AI nodes in the AI behavior tree according to the attribute type corresponding to the AI behavior tree, so that AI nodes with the same function inherit the same AI behavior tree when executing logic.
[0157] In an actual application scenario, when the AI object is a scene AI, the device further includes: an assembly unit, which is used to assemble the AI behavior logic to be executed after the event is triggered by the preset AI event-driven assembly rules for the AI behavior nodes in the scene AI to form the behavior assembly data of the scene AI;
[0158] The first execution unit is used to trigger different events in response to fixed logic points, and assemble data to execute AI behavior logic of the event according to the behavior of the scenario AI.
[0159] In actual application scenarios, the assembly unit is specifically used to build an AI behavior tree for the AI behavior nodes in the scene AI using the AI behavior nodes to be executed after event triggering; read the AI behavior logic of the behavior nodes in the AI behavior tree, and assemble the AI behavior logic of the behavior nodes through AI event-driven assembly technology to form behavior assembly data for the scene AI.
[0160] In an actual application scenario, when the AI object is a unit AI, the device further includes: a classification unit, configured to classify the same state for different unit AIs, and place the same state configuration classifications in the different unit AIs into an AI state configuration file;
[0161] A selection unit is used to select a state configuration required by the unit AI from the AI state configuration file according to the AI behavior state assembly rule to assemble the state configuration to form the state assembly data of the unit AI;
[0162] The second execution unit is used to respond to the state loading in the unit AI and assemble data according to the state of the unit AI to execute the behavior logic of the unit AI in the corresponding state.
[0163] In actual application scenarios, the selection unit is specifically used to construct AI behavior subtrees in different states by reading the state configuration in the AI state configuration file; splicing the AI behavior subtrees in the required state of the AI unit to obtain the behavior tree of the unit AI through the AI behavior state assembly technology; constructing the behavior tree of the differentiated unit AI according to the parameter configuration, and assembling the state configuration required by the AI unit using the differentiated unit AI behavior tree to form the state assembly data of the unit AI.
[0164] In actual application scenarios, in the behavior tree of the unit AI obtained by splicing, the AI behavior subtrees in different states have a splicing configuration order. In the process of splicing the AI behavior subtrees in different states to obtain the behavior tree of the unit AI through the AI behavior state assembly technology, it is determined according to the splicing configuration order whether there are AI behavior subtrees in the same state in the AI behavior subtrees to be spliced. If so, the AI behavior subtree in the state to be spliced is used to replace the AI behavior subtree in the spliced state during the splicing process.
[0165] In an actual application scenario, the device further includes:
[0166] A second configuration unit is configured to configure AI action nodes in the AI behavior tree using a preset node type after obtaining the AI object corresponding to the game AI architecture and building the AI behavior tree according to the configuration information of the AI object;
[0167] A third configuration unit is used to add an AI behavior node of an event detection mechanism in the AI behavior tree, and configure the AI behavior logic according to the event detection result of the AI node;
[0168] A detection unit is used to construct a recursive hierarchy for the AI behavior node to detect the configuration hierarchy depth of the AI behavior node, and when the configuration hierarchy depth is greater than a preset value, use AI configuration prompts to restrict the AI behavior logic.
[0169] In an actual application scenario, the device further includes:
[0170] An initialization unit, configured to obtain an AI action node of a triggering event after obtaining an AI object corresponding to the game AI architecture and constructing an AI behavior tree according to configuration information of the AI object, and initialize the AI behavior logic to be executed after the triggering event into the AI action node;
[0171] The third execution unit is used to execute the AI behavior logic configured in the AI action node after executing the AI action node, if there is AI behavior logic to be executed.
[0172] In an actual application scenario, the device further includes:
[0173] A generating unit, configured to use parameterized configuration for each AI node and generate an AI parameter configuration table according to the parameterized configuration before determining the behavior configuration parameters of the AI node according to the AI parameters of different behaviors in a preset AI parameter configuration table for each AI node;
[0174] A query unit, configured to use a configuration index in the AI parameter configuration table to query behavior configurations corresponding to AI parameters of different behaviors;
[0175] The generating unit is specifically used to use the set variable as a parameter reference in the configuration data of the AI node, associate the AI parameters of different behaviors with the behavior configuration according to the parameter name of the parameter reference, and generate an AI parameter configuration table;
[0176] Correspondingly, the first determination unit is specifically used to read each node AI to determine whether parameterized configuration is used in the node AI; if so, parse the parameter name referenced by the node AI to obtain the AI parameters of the preset behavior in the AI node; determine the behavior configuration parameters of the AI node from the AI parameter configuration table according to the AI parameters of the preset behavior.
[0177] It should be noted that for other corresponding descriptions of the functional units involved in the configuration device for game AI provided in this embodiment, please refer to Figure 1-Figure 7 The corresponding description in will not be repeated here.
[0178] Based on the above Figure 1-Figure 7 The method shown in the embodiment of the present application accordingly provides a storage medium on which a computer program is stored, and when the program is executed by a processor, the above-mentioned Figure 1-Figure 7 The configuration method of the game AI is shown.
[0179] Based on this understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.), and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each implementation scenario of the present application.
[0180] Based on the above Figure 1-Figure 7 The method shown, and Figure 8 In order to achieve the above-mentioned purpose, the embodiment of the present application also provides a physical device for configuring the game AI, which can be a computer, a smart phone, a tablet computer, a smart watch, a server, or a network device, etc. The physical device includes a storage medium and a processor; the storage medium is used to store a computer program; the processor is used to execute the computer program to achieve the above-mentioned Figure 1-Figure 7 The configuration method of the game AI is shown.
[0181] Optionally, the physical device may also include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, etc. The user interface may include a display, an input unit such as a keyboard, etc., and the optional user interface may also include a USB interface, a card reader interface, etc. The network interface may optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), etc.
[0182] In an exemplary embodiment, see Fig. 9 The physical device includes a communication bus, a processor, a memory and a communication interface, and may also include an input / output interface and a display device, wherein each functional unit can communicate with each other through the bus. The memory stores a computer program, and the processor is used to execute the program stored in the memory and execute the configuration method of the game AI in the above embodiment.
[0183] Those skilled in the art will appreciate that the physical device structure of a game AI configuration provided in this embodiment does not constitute a limitation on the physical device, and may include more or fewer components, or a combination of certain components, or different component arrangements.
[0184] The storage medium may also include an operating system and a network communication module. The operating system is a program that manages the hardware and software resources of the physical device for the configuration and processing of the game AI, and supports the operation of information processing programs and other software and / or programs. The network communication module is used to achieve communication between components within the storage medium, as well as communication with other hardware and software in the information processing physical device.
[0185] Through the description of the above implementation methods, those skilled in the art can clearly understand that the present application can be implemented by means of software plus the necessary general hardware platform, or by hardware. By applying the technical solution of the present application, compared with the current existing methods, the present application achieves the effect of reusable nodes in the AI behavior tree by splicing the same functions in the AI configuration into different AI behavior trees, so that the same AI behavior logic does not need to be repeatedly developed, reducing the number of configuration files for the game AI, and reconstructing the assembly process of the AI behavior tree through the parameterized configuration of the AI nodes, thereby improving the execution efficiency of the game AI to a certain extent.
[0186] Those skilled in the art will appreciate that the accompanying drawings are only schematic diagrams of a preferred implementation scenario, and the modules or processes in the accompanying drawings are not necessarily necessary for implementing the present application. Those skilled in the art will appreciate that the modules in the devices in the implementation scenario can be distributed in the devices of the implementation scenario according to the description of the implementation scenario, or can be changed accordingly and located in one or more devices different from the present implementation scenario. The modules of the above-mentioned implementation scenario can be combined into one module, or can be further split into multiple submodules.
[0187] The above serial numbers of this application are only for description and do not represent the advantages and disadvantages of the implementation scenarios. The above disclosure is only a few specific implementation scenarios of this application, but this application is not limited to them, and any changes that can be thought of by technicians in this field should fall within the scope of protection of this application.
Claims
1. A method for configuring a game AI, characterized in that: include: Obtain an AI object corresponding to the game AI architecture, and construct an AI behavior tree according to the configuration information of the AI object, wherein the AI behavior tree includes multiple AI nodes of different types; For each AI node, determine the behavior configuration parameters of the AI node according to the AI parameters of different behaviors in the preset AI parameter configuration table; According to the behavior configuration parameters of each AI node, determine the AI behavior logic of the same attribute configuration in different AI nodes; The AI behavior logic configured with the same attributes is set in an AI behavior tree with behavior associations of the AI node.
2. The method according to claim 1, characterized in that Before determining the behavior configuration parameters of the AI node according to the AI parameters of different behaviors in the preset AI parameter configuration table for each AI node, the method further includes: Predefine the attribute type corresponding to the AI behavior tree according to the configuration attributes of the AI object; According to the attribute type corresponding to the AI behavior tree, the inheritance relationship of different types of AI nodes in the AI behavior tree is configured so that AI nodes with the same function inherit the same AI behavior tree when executing logic.
3. The method according to claim 1, characterized in that: When the AI object is a scene AI, the method further includes: For the AI behavior nodes in the scene AI, the AI behavior logic to be executed after the event is triggered is assembled through the preset AI event-driven assembly rules to form the behavior assembly data of the scene AI; In response to different events being triggered at fixed logic points, the AI behavior logic of the event is executed according to the AI behavior assembly data of the scenario.
4. The method according to claim 3, characterized in that The AI behavior nodes in the scene AI are assembled by using preset AI event-driven assembly rules to assemble the AI behavior logic to be executed after the event is triggered, forming the behavior assembly data of the scene AI, including: For the AI behavior nodes in the scene AI, use the AI behavior nodes to be executed after the event is triggered to build an AI behavior tree; The AI behavior logic of the behavior node in the AI behavior tree is read, and the AI behavior logic of the behavior node is assembled through the AI event-driven assembly technology to form the behavior assembly data of the scene AI.
5. The method according to claim 1, characterized in that When the AI object is a unit AI, the method further includes: Classify the same state of different unit AIs, and place the same state configuration classifications in the different unit AIs into the AI state configuration file; Selecting the state configuration required by the unit AI from the AI state configuration file through the AI behavior state assembly rule for assembly to form the state assembly data of the unit AI; In response to the state loading in the unit AI, the behavior logic of the unit AI in the corresponding state is executed according to the state assembly data of the unit AI.
6. The method according to claim 5, characterized in that The AI behavior state assembly technology selects the state configuration required by the unit AI from the AI state configuration file for assembly to form the state assembly data of the unit AI, including: By reading the state configuration in the AI state configuration file, constructing AI behavior subtrees in different states; Through AI behavior state assembly technology, the AI behavior subtrees in the required state of the AI unit are spliced to obtain the behavior tree of the unit AI; A behavior tree of a differentiated unit AI is constructed according to the parameter configuration, and the state configuration required by the AI unit is assembled using the behavior tree of the differentiated unit AI to form state assembly data of the unit AI.
7. The method according to claim 6, characterized in that In the behavior tree of the unit AI obtained by splicing, the AI behavior subtrees in different states have a splicing configuration sequence. In the process of splicing the AI behavior subtrees in different states to obtain the behavior tree of the unit AI through the AI behavior state assembly technology, it is determined according to the splicing configuration sequence whether there are AI behavior subtrees in the same state in the AI behavior subtrees to be spliced. If so, the AI behavior subtree in the state to be spliced is used to replace the AI behavior subtree in the spliced state during the splicing process.
8. The method according to any one of claims 1 to 7, characterized in that After obtaining the AI object corresponding to the game AI architecture and constructing the AI behavior tree according to the configuration information of the AI object, the method further includes: Configure the AI action nodes in the AI behavior tree using a preset node type; Add an AI behavior node with event detection mechanism in the AI behavior tree, and configure the AI behavior logic according to the event detection result of the AI node; A recursive hierarchy is constructed for the AI behavior node to detect the configuration hierarchy depth of the AI behavior node. When the configuration hierarchy depth is greater than a preset value, the AI behavior logic is restricted using an AI configuration prompt.
9. The method according to any one of claims 1 to 7, characterized in that: After obtaining the AI object corresponding to the game AI architecture and constructing the AI behavior tree according to the configuration information of the AI object, the method further includes: Obtaining the AI action node that triggers the event, and initializing the AI behavior logic to be executed after the triggering event into the AI action node; After the AI action node is executed, if there is AI behavior logic to be executed, the AI behavior logic configured in the AI action node is executed.
10. The method according to any one of claims 1 to 7, characterized in that Before determining the behavior configuration parameters of the AI node according to the AI parameters of different behaviors in the preset AI parameter configuration table for each AI node, the method further includes: Using parameterized configuration for the node AI, generating an AI parameter configuration table according to the parameterized configuration; Using the configuration index in the AI parameter configuration table to query the behavior configuration corresponding to the AI parameters of different behaviors; The parameterized configuration is used for the node AI, and generating the AI parameter configuration table according to the parameterized configuration includes: using a set variable as a parameter reference in the configuration data of the AI node, and associating AI parameters of different behaviors with the behavior configuration according to the parameter name of the parameter reference to generate the AI parameter configuration table; Accordingly, for each AI node, determining the behavior configuration parameters of the AI node according to the AI parameters of different behaviors in the preset AI parameter configuration table includes: Read each node AI to determine whether parameterized configuration is used in the node AI; If yes, parse the parameter name referenced by the node AI to obtain the AI parameter of the preset behavior in the AI node; The behavior configuration parameters of the AI node are determined from the AI parameter configuration table according to the AI parameters of the preset behavior.
11. A configuration device for game AI, characterized in that: include: An acquisition unit, used to acquire an AI object corresponding to the game AI architecture, and construct an AI behavior tree according to configuration information of the AI object, wherein the AI behavior tree includes a plurality of AI nodes of different types; A first determining unit, configured to determine, for each AI node, a behavior configuration parameter of the AI node according to AI parameters of different behaviors in a preset AI parameter configuration table; A second determination unit is used to determine the AI behavior logic of the same attribute configuration in different AI nodes according to the behavior configuration parameters of each AI node; The setting unit is used to set the AI behavior logic of the same attribute configuration in the AI behavior tree with behavior association of the AI node.
12. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method for configuring the game AI according to any one of claims 1 to 10 are implemented.
13. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method for configuring the game AI according to any one of claims 1 to 10 are implemented.
Citation Information
Cited By
Industrial automation control system based on behavior tree and resource abstraction layer
CN121300172A