Control method, device, storage medium and electronic device for virtual game characters

Through the control method of the two-level behavior tree, it is difficult to implement the control logic of virtual game character collection, which solves the problem of difficult control logic of virtual game character collection in the existing technology, realizes flexibility and maintenance, and is compatible with independent AI behavior , improves the gaming experience.

CN113926196BActive Publication Date: 2024-12-20NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111130405.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-26
Publication Date
2024-12-20
Estimated Expiration
2041-09-26

AI Technical Summary

Technical Problem

In the prior art, the control logic of virtual game character collection is difficult to implement, and it is difficult to ensure the controllability of gameplay and logic difficulty, especially when game updates and data changes, the model needs to be retrained.

Method used

The control method of a two-level behavior tree is adopted, where the virtual game character collection has its own behavior tree for managing all characters, and each virtual game character keeps its own behavior tree open, and the game behavior is constructed through the node configuration of the behavior tree, and the game behavior is used to use Different nodes implement stylized AI tactics.

Benefits of technology

It reduces the difficulty of implementing the control logic of virtual game character collection, ensures the flexibility and maintenance of game behavior, is compatible with the independent AI behavior logic of each virtual game character, and improves the gaming experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113926196B_ABST
    Figure CN113926196B_ABST
Patent Text Reader

Abstract

The present invention discloses a control method, device, storage medium and electronic device for virtual game characters. The method comprises: calling a first behavior tree associated with a set of virtual game characters, and determining a target object associated with the set of virtual game characters through the first behavior tree, wherein the set of virtual game characters includes multiple virtual game characters, and at least part of the nodes of the first behavior tree include a second behavior tree associated with each virtual game character; determining a first game behavior corresponding to the target object through the first behavior tree, wherein the first game behavior is a behavior to be executed by the set of virtual game characters; calling a second behavior tree associated with each virtual game character through the first behavior tree, and controlling each corresponding virtual game character to execute the first game behavior through the second behavior tree. Through the present invention, the effect of reducing the difficulty of realizing the logic of controlling the set of virtual game characters is achieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computers, and in particular to a control method, device, storage medium and electronic device for a virtual game character. Background Art

[0002] At present, in the development of artificial intelligence (AI), game AI can control the actions and performances of virtual game characters. In order to make the combat methods of virtual game characters in the game more diverse and more expressive, sometimes a collection of virtual game characters is required to perform some game behaviors together.

[0003] In the related art, the behavior of activating team strategies is usually added to the finite state machine or hierarchical state machine of the game entity. However, this method requires detailed design of each state in the design, listing the hierarchical state structure, and strictly restricting state jumps for specific problems. The design and maintenance of the state machine structure also requires a lot of effort; and when the virtual game character set performs the game behavior together, it is difficult for each virtual game character to obtain the data information of other virtual game characters, which makes it difficult to implement the logic of controlling the virtual game character set.

[0004] In another related technology, complex neural networks can be built and trained through deep learning technology, which can achieve functions similar to a controller controlling each virtual game character in a collection of virtual game characters. In this case, the team strategy will be trained by a specific network layer and executed when the network is running. However, the decision-making of the neural network itself is actually a black box. Developers cannot know when the virtual game character will perform what game behavior, and cannot guarantee the controllability of gameplay and logical difficulty. In addition, the construction and training of the network requires a lot of R&D resources. The model needs to be retrained every time the game is updated and the data changes, which makes it difficult to implement the logic of controlling the collection of virtual game characters.

[0005] With respect to the problem in the prior art that it is difficult to realize the logic of controlling a collection of virtual game characters, no effective solution has been proposed yet. Summary of the invention

[0006] The main purpose of the present invention is to provide a method, device, storage medium and electronic device for controlling a virtual game character, so as to at least solve the problem that the logic for controlling a set of virtual game characters is difficult to implement.

[0007] In order to achieve the above-mentioned object, according to one aspect of the present invention, a method for controlling a virtual game character is provided. The method may include: calling a first behavior tree associated with a set of virtual game characters, and determining a target object associated with the set of virtual game characters through the first behavior tree, wherein the set of virtual game characters includes multiple virtual game characters, and at least some nodes of the first behavior tree include a second behavior tree associated with each virtual game character; determining a first game behavior corresponding to the target object through the first behavior tree, wherein the first game behavior is a behavior to be performed by the set of virtual game characters; calling a second behavior tree associated with each virtual game character through the first behavior tree, and controlling each corresponding virtual game character to perform the first game behavior through the second behavior tree.

[0008] Optionally, determining the target object associated with the set of virtual game characters through the first behavior tree includes: determining the target object through a first sequence node of the first behavior tree, wherein the first sequence node is a child node of a first selection node of the first behavior tree.

[0009] Optionally, determining the target object through the first sequence node of the first behavior tree includes: determining that the target object has not been determined yet through the first condition node in the first sequence node; determining the target object from multiple first target objects through the first execution node in the first sequence node, wherein the multiple first target objects are associated with at least one virtual game character among the multiple virtual game characters.

[0010] Optionally, the first execution node includes a first sub-execution node and a second sub-execution node, and the target object is determined from multiple first target objects through the first execution node of the first sequence node, including: through the first sub-execution node, obtaining the correlation between each virtual game character and each first target object associated with each virtual game character, obtaining multiple correlation degrees, and determining the highest correlation degree from the multiple correlation degrees; through the second sub-execution node, determining the first target object corresponding to the highest correlation degree as the target object.

[0011] Optionally, calling a first behavior tree associated with the set of virtual game characters includes: when at least one first target object associated with any one of the plurality of virtual game characters is determined, calling the first behavior tree.

[0012] Optionally, determining a first game behavior corresponding to the target object through the first behavior tree includes: determining the first game behavior through a second sequence node of the first behavior tree, wherein the second sequence node is a child node of a first selection node of the first behavior tree.

[0013] Optionally, determining the first game behavior through the second sequence node of the first behavior tree includes: determining the first game behavior through the second execution node of the second sequence node.

[0014] Optionally, calling the second behavior tree associated with each virtual game character through the first behavior tree, and controlling each corresponding virtual game character to perform the first game behavior through the second behavior tree, includes: after determining the first game behavior through the second execution node of the second sequence node, calling the second behavior tree associated with each virtual game character through the screening node of the second sequence node, and controlling each corresponding virtual game character to perform the first game behavior through the second behavior tree.

[0015] Optionally, the method further includes: prohibiting calling the first behavior tree through a third sequence node of the first behavior tree, wherein the third sequence node is a child node of the first selection node of the first behavior tree.

[0016] Optionally, prohibiting calling the first behavior tree through the third sequence node of the first behavior tree includes: determining that a prohibition instruction has been obtained through the second condition node of the third sequence node, wherein the prohibition instruction is used to prohibit calling the first behavior tree; and prohibiting calling the first behavior tree in response to the prohibition instruction through the third execution node of the third sequence node.

[0017] Optionally, controlling each corresponding virtual game character to perform the first game behavior through the second behavior tree includes: controlling each corresponding virtual game character to perform a sub-game behavior in the first game behavior through the fourth sequence node of the second behavior tree, wherein the fourth sequence node is a child node of the second selection node of the second behavior tree.

[0018] Optionally, through the fourth sequence node of the second behavior tree, each corresponding virtual game character is controlled to execute the sub-game behavior in the first game behavior, including: through the third condition node of the fourth sequence node, determining that the first behavior tree is allowed to be called; through the fourth execution node of the fourth sequence node, each corresponding virtual game character is controlled to execute the sub-game behavior.

[0019] Optionally, the method further includes: controlling each corresponding virtual game character to execute the second game behavior of each virtual game character through the fifth sequence node of the second behavior tree, wherein the fifth sequence node is a child node of the second selection node of the second behavior tree.

[0020] Optionally, through the fifth sequence node of the second behavior tree, each corresponding virtual game character is controlled to execute the independent behavior of each virtual game character, including: through the fourth condition node of the fifth sequence node, determining to prohibit calling the first behavior tree; through the fifth execution node of the fifth sequence node, controlling each corresponding virtual game character to execute the second game behavior.

[0021] Optionally, each virtual game character obtains team information through identification information of the virtual game character set, wherein the team information includes information of the virtual game character set and / or information of virtual game characters other than each virtual game character among the multiple virtual game characters.

[0022] In order to achieve the above-mentioned object, according to another aspect of the present invention, a control device for a virtual game character is also provided. The device may include: a first determination unit, used to call a first behavior tree associated with a set of virtual game characters, and determine a target object associated with the set of virtual game characters through the first behavior tree, wherein the set of virtual game characters includes multiple virtual game characters, and at least part of the nodes of the first behavior tree include a second behavior tree associated with each virtual game character; a second determination unit, used to determine a first game behavior corresponding to the target object through the first behavior tree, wherein the first game behavior is a behavior to be performed by the set of virtual game characters; a control unit, used to call a second behavior tree associated with each virtual game character through the first behavior tree, and control each corresponding virtual game character to perform the first game behavior through the second behavior tree.

[0023] In order to achieve the above object, according to another aspect of the present invention, a computer-readable storage medium is provided. The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the device where the computer-readable storage medium is located is controlled to execute the control method of the virtual game character of the embodiment of the present invention.

[0024] To achieve the above object, according to another aspect of the present invention, an electronic device is provided, including a memory and a processor. The memory stores a computer program, and the processor is configured to execute the computer program to execute the control method of the virtual game character of the embodiment of the present invention.

[0025] In an embodiment of the present invention, a first behavior tree associated with a set of virtual game characters is called, and a target object associated with the set of virtual game characters is determined through the first behavior tree, wherein the set of virtual game characters includes multiple virtual game characters, and at least some nodes of the first behavior tree include a second behavior tree associated with each virtual game character; a first game behavior corresponding to the target object is determined through the first behavior tree, wherein the first game behavior is a behavior to be executed by the set of virtual game characters; a second behavior tree associated with each virtual game character is called through the first behavior tree, and each corresponding virtual game character is controlled to execute the first game behavior through the second behavior tree. That is to say, the present application adopts a two-level behavior tree, the set of virtual game characters has its own first behavior tree for managing all virtual game characters, and the first game behavior can be constructed according to the node configuration of different behavior trees, and each virtual game character also keeps its own second behavior tree open, so that each virtual game character executes the first game behavior. Since the structure of the behavior tree is clear, flexible, easy to maintain, and has strong extensibility, different nodes can be used to implement stylized AI tactics, thereby solving the technical problem of the difficulty of implementing the control logic of the set of virtual game characters, and achieving the technical effect of reducing the difficulty of implementing the control logic of the set of virtual game characters. BRIEF DESCRIPTION OF THE DRAWINGS

[0026] The drawings constituting a part of this application are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:

[0027] Figure 1 It is a hardware structure block diagram of a mobile terminal of a method for controlling a virtual game character according to an embodiment of the present invention;

[0028] Figure 2 is a flow chart of a method for controlling a virtual game character according to an embodiment of the present invention;

[0029] Figure 3 is a schematic diagram of a hierarchical state machine according to the related art;

[0030] Figure 4 is a schematic diagram of a network structure of OpenAIFive according to an embodiment of the present invention;

[0031] Figure 5 is a schematic diagram of a relationship between a manager of an AI team entity, an AI team entity, and an AI member entity created in a battle space of a game according to an embodiment of the present invention;

[0032] Figure 6 is a schematic diagram of a behavior tree of an AI team entity according to an embodiment of the present invention;

[0033] Figure 7 is a schematic diagram of a behavior tree of an AI member entity according to an embodiment of the present invention;

[0034] Figure 8 is a schematic diagram of a control device for a virtual game character according to an embodiment of the present invention. DETAILED DESCRIPTION

[0035] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present invention will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.

[0036] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.

[0037] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.

[0038] The method embodiments provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure block diagram of a mobile terminal of a method for controlling a virtual game character according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data. Optionally, the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0039] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to a method for data processing in an embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, to implement the above method. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the mobile terminal via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.

[0040] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0041] In this embodiment, a control method for a virtual game character running on the above-mentioned mobile terminal is provided. Figure 2 FIG. 1 is a flow chart of a method for controlling a virtual game character according to an embodiment of the present invention. Figure 2 As shown, the method may include the following steps:

[0042] Step S202: calling a first behavior tree associated with the set of virtual game characters, and determining a target object associated with the set of virtual game characters through the first behavior tree.

[0043] In the technical solution provided in the above step S202 of the present invention, the virtual game character set includes multiple virtual game characters, and at least part of the nodes of the first behavior tree include a second behavior tree associated with each virtual game character.

[0044] In this embodiment, the virtual game character set can be a team controlled by AI, and can also be called team AI, AI team entity, which can include a group of virtual game characters, each virtual game character can be a team member controlled by AI, and can also be called independent AI, AI character, AI member, wherein each virtual game character can be a monster or a non-player character (Non-Player Character, referred to as NPC). This embodiment can call the first behavior tree associated with the virtual game character set, that is, open the first behavior tree, and determine the target object associated with the virtual game character set through the first behavior tree. The target object is an object associated with each virtual game character in the virtual game character set, which can be a target virtual game character that needs to be attacked together by multiple virtual games, such as a common hatred object, or a geographical location that needs to be reached together, or a skill or mode used to complete a task together, rather than fighting separately, or an enemy's building model, etc. Any object used for each virtual game character in the virtual game character set to start cooperation, which is not specifically limited here. Therefore, the above association can refer to the connection established between the virtual game character set and the target object when the virtual game character set performs a team task in a collaborative manner.

[0045] Optionally, the embodiment can establish a global manager in the game scene, wherein the game scene can be the battle space of the game, and the global manager can be a global team manager, which can be a class object, and the class object can include a dictionary for storing and managing all virtual game character sets in the game scene. Optionally, the embodiment creates an entity of a virtual game character set through the above-mentioned global manager, that is, creates an AI team entity, and each virtual game character set in the virtual game character set can be registered in the entity of the virtual game character set. Optionally, the open interface of the global manager of this embodiment is used to enable other modules to obtain the entity of any virtual game character set, and is used to clean up and destroy data. When the game scene is created or destroyed, the initialization and destruction interfaces of all virtual game character sets can be uniformly called, wherein the global manager can add a listening event for each virtual game character, and when a virtual game character is destroyed or dies, it will be removed from the virtual game character set. Optionally, the entity of the virtual game character set of this embodiment contains a list, which can be used to store the unique identification information (ID) of each virtual game character, so that the identification information can be used to uniformly manage the life cycle of each virtual game character.

[0046] In this embodiment, the behavior tree is the most flexible and extensible solution in the AI ​​operation scheme. The virtual game character set of this embodiment has a first behavior tree that runs by itself. The first behavior tree can also be called a team behavior tree or an AI behavior tree. It can be composed of customized team tactical nodes, general nodes, screening nodes and their subnodes, etc. The planner can configure the specific behaviors to be performed by each virtual game character set. Optionally, the above-mentioned tactical nodes are used to realize the combat of virtual game characters. For example, it can be a twin ship clamping tactical node. That is, in a naval battle, two AI ships can respectively sail from the left and right sides of the virtual game character to the left and right sides, and in the process, fire and attack the virtual game character sandwiched in the middle. After the attack, the twin ships quickly move to the front of the virtual game character and cross each other, facing the virtual game character and continuing to clamp, wherein the virtual game character can be a virtual ship controlled by the player. Optionally, the queue tactical node can also be, for example, 3 to 5 AI ships connected head to tail to form a queue, which will attack the virtual game character in a circle and maintain the queue in the case of attrition. Optionally, the general nodes of this embodiment may include performance nodes such as a user interface (UI) and sound effects that are played simultaneously by each virtual game character.

[0047] The entity of the virtual game character set of this embodiment can act as the brain of the team, performing a series of operations such as searching, locking and homing, and can also construct game tactics (team tactics) of different styles according to different node configurations of the first behavior tree.

[0048] Optionally, at least some nodes of the first behavior tree include a second behavior tree associated with each virtual game character. The second behavior tree may also be referred to as a member behavior tree. The second behavior tree is started simultaneously when the second behavior tree is created, and its structure may be the same as that of the first behavior tree.

[0049] The structures of the first behavior tree and the second behavior tree of this embodiment can be determined before the game is run, so that they are static. This staticity ensures the stability of AI operation. At the same time, the first behavior tree and the second behavior tree can be composed of execution nodes, conditional nodes, combination nodes and other nodes. Among them, the execution node is a leaf node of the behavior tree, and the execution node is used to execute a specific function; when the conditional node is run, the subsequent nodes will continue to be executed only when the condition is met; the combination node includes a selection node and a sequence node, wherein the selection node will execute its child nodes from top to bottom in sequence, and as long as the child node operation result returns failure, the subsequent child nodes can be continued to be executed until a child node operation result returns success, then the subsequent child nodes will be stopped from being executed, and the operation result will be returned to the parent node; the sequence node will execute its child nodes from top to bottom in sequence, and as long as the child node operation result returns success, the subsequent child nodes will be continued from being executed until a child node operation result returns failure, then the subsequent child nodes will be stopped from being executed, and the failure will be returned to the parent node; the filter node allows the addition of child nodes, which is used to define different special treatments for child nodes.

[0050] The organizational structure of the first behavior tree and the second behavior tree of this embodiment is intuitive and easy to maintain. In addition, the nodes constituting the first behavior tree and the second behavior tree are highly reusable, and AI with different functions can be obtained through different organizational methods.

[0051] Step S204: determining a first game behavior corresponding to the target object through the first behavior tree, wherein the first game behavior is a behavior to be executed by the set of virtual game characters.

[0052] In the technical solution provided in the above step S204 of the present invention, after determining the target object associated with the virtual game character set through the first behavior tree, the first game behavior corresponding to the target object can be determined through the first behavior tree, wherein the first game behavior is the behavior to be executed by the virtual game character set.

[0053] In this embodiment, since the first behavior tree can be a game behavior that the virtual game character set is to perform by planning and configuring, and the game behavior is generated for the target object associated with the virtual game character set when cooperating in order to complete the team task, therefore, this embodiment can determine the first game behavior corresponding to the above target object through the first behavior tree, and the first game behavior is the behavior to be performed by the virtual game character set. The first game behavior can be the team tactical logic determined for the team task, and can be a complex tactical logic, such as the behavior of performing continuous skills or the behavior of starting a cooperative offensive. Optionally, when the target object is different, the first game behavior can also be different. For example, when the target object is a target virtual game character that multiple virtual game characters need to attack together, the first game behavior is an attacking game behavior. When the target object is a geographical location that needs to be reached together, the first game behavior can be an advancing game behavior. No specific restrictions are made here.

[0054] Step S206: calling the second behavior tree associated with each virtual game character through the first behavior tree, and controlling each corresponding virtual game character to perform the first game behavior through the second behavior tree.

[0055] In the technical solution provided in the above step S206 of the present invention, after determining the first game behavior corresponding to the target object through the first behavior tree, the second behavior tree associated with each virtual game character can be called through the first behavior tree, and each corresponding virtual game character can be controlled to perform the first game behavior through the second behavior tree.

[0056] In this embodiment, when the first behavior tree is turned on, the second behavior tree associated with each virtual game character can be called through the first behavior tree, thereby forming a structure in which two levels of behavior trees run together, and the corresponding virtual game character is controlled to perform the first game behavior through the nodes of the second behavior tree. Optionally, the second behavior tree of each virtual game character can control the virtual game character to perform the same first game behavior. For example, the first game behavior is a shooting game behavior. Optionally, the first game behavior is a type of game behavior, which may include sub-game behaviors. The second behavior tree of each virtual game character can control the virtual game character to perform a corresponding sub-game behavior. The first game behavior is formed by each virtual game character performing a corresponding sub-game behavior. For example, if the first game behavior is an attacking game behavior, the sub-game behavior may be a firing behavior, a slashing behavior, etc., which is not specifically limited here.

[0057] Through the above steps S202 to S206 of the present application, the first behavior tree associated with the set of virtual game characters is called, and the target object associated with the set of virtual game characters is determined through the first behavior tree, wherein the set of virtual game characters includes multiple virtual game characters, and at least some nodes of the first behavior tree include a second behavior tree associated with each virtual game character; a first game behavior corresponding to the target object is determined through the first behavior tree, wherein the first game behavior is a behavior to be executed by the set of virtual game characters; the second behavior tree associated with each virtual game character is called through the first behavior tree, and each corresponding virtual game character is controlled through the second behavior tree to execute the first game behavior. That is to say, the present application adopts a two-level behavior tree, and the virtual game character set has its own first behavior tree for managing all virtual game characters. The first game behavior can be constructed according to the node configuration of different behavior trees, and each virtual game character also keeps its own second behavior tree open, so that each virtual game character performs the first game behavior. Since the structure of the behavior tree is clear, flexible, easy to maintain, and has strong expansibility, different nodes can be used to implement stylized AI tactics, thereby solving the technical problem of the difficulty in implementing the control logic of the virtual game character set, and achieving the technical effect of reducing the difficulty in implementing the control logic of the virtual game character set.

[0058] The above method of this embodiment is further introduced below.

[0059] As an optional implementation, step S202, determining the target object associated with the set of virtual game characters through the first behavior tree, includes: determining the target object through the first sequence node of the first behavior tree, wherein the first sequence node is a child node of the first selection node of the first behavior tree.

[0060] In this embodiment, the first behavior tree includes a root node, the root node has a first selection node, the first selection node has a first sequence node, and optionally, this embodiment determines the target object through the first sequence node. The process of determining the target object is also the process of determining the locked target, so that the target object can also be called a locked target.

[0061] As an optional implementation, determining the target object through the first sequence node of the first behavior tree includes: determining that the target object is not currently determined through the first condition node in the first sequence node; and determining the target object from multiple first target objects through the first execution node in the first sequence node, wherein the multiple first target objects are associated with at least one virtual game character among the multiple virtual game characters.

[0062] In this embodiment, the first sequence node may include a first conditional node and a first execution node. The first conditional node may be used to determine that the target object has not been determined currently, or it may be determined that a suitable locked target has not been selected currently. Then, the first execution node may be executed, thereby determining the target object from multiple first target objects. Optionally, the multiple first target objects are associated with at least one virtual game character among multiple virtual game characters. For example, the at least one first target object is the hatred object of the corresponding virtual game character. Each virtual game character may obtain a hatred list through its own hatred system, determine the at least one first target object in the hatred list, and then obtain the multiple first target objects. The target object is determined from the multiple first target objects, and the information of the target object may be transmitted to all virtual game characters.

[0063] As an optional implementation, the first execution node includes a first sub-execution node and a second sub-execution node, and the target object is determined from multiple first target objects through the first execution node of the first sequence node, including: through the first sub-execution node, obtaining the correlation between each virtual game character and each first target object associated with each virtual game character, obtaining multiple correlations, and determining the highest correlation from the multiple correlations; through the second sub-execution node, determining the first target object corresponding to the highest correlation as the target object.

[0064] In this embodiment, the first execution node may further include a first sub-execution node and a second sub-execution node. This embodiment may obtain the correlation between each virtual game character and each first target object associated with each virtual game character through the first sub-execution node, and obtain multiple correlations, which are used to represent the degree of association between each virtual game character and a corresponding first target object, such as a hatred value. This embodiment may sort the multiple correlations, select the highest correlation from the sorted multiple correlations, such as the highest hatred value, and determine the first target object corresponding to the highest correlation as the target object through the second sub-execution node, use it as the locked target, and transmit the information of the locked target to all virtual game characters.

[0065] Optionally, after the target object is determined, the second behavior tree may be called to control multiple virtual game characters to execute the first game behavior corresponding to the target object, so as to achieve the purpose of officially running the team tactical logic.

[0066] As an optional implementation, step S202, calling a first behavior tree associated with the set of virtual game characters, includes: when at least one first target object associated with any one of the multiple virtual game characters is determined, calling the first behavior tree.

[0067] In this embodiment, when any one of the multiple virtual game characters obtains at least one first target object associated with itself through the target condition, the first behavior tree can be called, that is, the team AI will be started, wherein the above-mentioned target condition can be a condition triggered by distance, camp, blood volume, etc., and at least one first target object can be a hatred object in the lock filter list.

[0068] As an optional implementation, the method further includes: prohibiting calling the first behavior tree through a third sequence node of the first behavior tree, wherein the third sequence node is a child node of the first selection node of the first behavior tree.

[0069] In this embodiment, the first selection node of the first behavior tree also includes a third sequence node, and the priority of the third sequence node is second only to the first sequence node. Therefore, this embodiment can prohibit calling the first behavior tree through the third sequence node to achieve the purpose of closing the first behavior tree in time.

[0070] As an optional implementation, prohibiting calling the first behavior tree through the third sequence node of the first behavior tree includes: determining that a prohibition instruction has been obtained through the second condition node of the third sequence node, wherein the prohibition instruction is used to prohibit calling the first behavior tree; and prohibiting calling the first behavior tree in response to the prohibition instruction through the third execution node of the third sequence node.

[0071] In this embodiment, the third sequence node includes a second conditional node, and it can be determined through the second conditional node that a prohibition instruction has been obtained. For example, when the number of multiple virtual game characters decreases and the first game behavior (team task) cannot be continued, or the corresponding target object of the virtual game character set dies or escapes from the battlefield, resulting in the virtual game character set no longer hating any target object when executing the first game behavior, the prohibition instruction will be triggered, and the third execution node of the third sequence node will respond to the prohibition instruction, prohibiting the calling of the first behavior tree, thereby achieving the purpose of closing the first behavior tree.

[0072] As an optional implementation, determining a first game behavior corresponding to a target object through a first behavior tree includes: determining the first game behavior through a second sequence node of the first behavior tree, which may be determining the first game behavior through a second execution node of the second sequence node, wherein the second sequence node is a child node of a first selection node of the first behavior tree.

[0073] In this embodiment, the first selection node of the first behavior tree may include a second sequence node, and this embodiment may determine the first game behavior through the second sequence node, for example, determine team tactics. Optionally, considering the game strategy, the priority of the second sequence node of this embodiment may be lower than the third sequence node, that is, this embodiment prioritizes whether it is determined that a prohibition instruction has been obtained, and if so, responds to the prohibition instruction and prohibits calling the first behavior tree, and if not, the first game behavior may be determined through the second sequence node of the first behavior tree. Optionally, the second sequence node also includes a second execution node, and this embodiment may be to determine the first game behavior through the second execution node.

[0074] As an optional implementation, calling the second behavior tree associated with each virtual game character through the first behavior tree, and controlling each corresponding virtual game character to perform the first game behavior through the second behavior tree, includes: after determining the first game behavior through the second execution node of the second sequence node, calling the second behavior tree associated with each virtual game character through the screening node of the second sequence node, and controlling each corresponding virtual game character to perform the first game behavior through the second behavior tree.

[0075] In this embodiment, in order to better reuse the execution nodes of the first behavior tree, this embodiment produces a filtering node, which is a node executed by all virtual game characters, and its child nodes can be execution nodes of independent virtual game characters. In this way, after the first game behavior is determined through the second execution node of the second sequence node, the second behavior tree associated with each virtual game character can be called through the filtering node of the second sequence node, and each corresponding virtual game character is controlled to execute the first game behavior through the second behavior tree. Therefore, this embodiment uses the filtering node to enable all virtual game characters to run the same execution node at the same time to execute the first game behavior.

[0076] Since each virtual game character's corresponding execution node will obtain its own return value, the above-mentioned filtering node can have three return modes when returning to the parent node. For example, if a virtual game character successfully executes the first game behavior, it returns success; if a virtual game character fails to execute the first game behavior, it returns failure; before all virtual game characters complete the execution of the first game behavior, they return to the continuous running state.

[0077] As an optional implementation, step S206, controlling each corresponding virtual game character to execute the first game behavior through the second behavior tree, includes: controlling each corresponding virtual game character to execute a sub-game behavior in the first game behavior through the fourth sequence node of the second behavior tree, wherein the fourth sequence node is a child node of the second selection node of the second behavior tree.

[0078] In this embodiment, the second behavior tree of each virtual game character includes a root node, which has a second selection node, and the second selection node includes a fourth sequence node. The first game behavior includes sub-game behaviors. For example, the first game behavior is an attacking game behavior, and the sub-game behavior can be a firing behavior, a slashing behavior, etc., and no specific limitation is made here. This embodiment can control each corresponding virtual game character through the fourth sequence node to execute the sub-game behavior in the first game behavior, so that multiple virtual game characters can jointly realize the first game behavior.

[0079] As an optional implementation, through the fourth sequence node of the second behavior tree, each corresponding virtual game character is controlled to execute the sub-game behavior in the first game behavior, including: through the third condition node of the fourth sequence node, determining that the first behavior tree is allowed to be called; through the fourth execution node of the fourth sequence node, each corresponding virtual game character is controlled to execute the sub-game behavior.

[0080] In this embodiment, the fourth sequence node includes a third condition node and a fourth execution node. The third condition node determines whether the first behavior tree is allowed to be called, that is, the team AI is turned on. When any virtual game character in the set of virtual game characters obtains its own lock filter list through conditions such as distance, camp, and blood volume, the team AI will be started, and then each corresponding virtual game character will be controlled through the fourth execution node to execute the corresponding sub-game behavior.

[0081] As an optional implementation, the method further includes: controlling each corresponding virtual game character to execute the second game behavior of each virtual game character through the fifth sequence node of the second behavior tree, wherein the fifth sequence node is a child node of the second selection node of the second behavior tree.

[0082] In this embodiment, each virtual game character has its own independently executed second game behavior, such as independent entity logic (unique combat logic). The second selection node of the second behavior tree also includes a fifth sequence node, through which each corresponding virtual game character is controlled to execute the above second game behavior. Optionally, the priority of the fifth sequence node is higher than the priority of the fourth sequence node.

[0083] As an optional implementation, each corresponding virtual game character is controlled to execute an independent behavior of each virtual game character through the fifth sequence node of the second behavior tree, including: determining to prohibit calling the first behavior tree through the fourth condition node of the fifth sequence node; and controlling each corresponding virtual game character to execute the second game behavior through the fifth execution node of the fifth sequence node.

[0084] In this embodiment, the fifth sequence node further includes a fourth condition node and a fifth execution node. The fourth condition node can be used to determine whether to prohibit calling the first behavior tree. For example, when the number of multiple virtual game characters decreases and the first game behavior cannot be continued, or the target object corresponding to the virtual game character set dies or escapes from the battlefield, resulting in the virtual game character set no longer hating any target object when executing the first game behavior, the first behavior tree is prohibited from being called, thereby closing the first behavior tree. At this time, the virtual game character set is in a silent state, and the fifth execution node can be used to control each corresponding virtual game character to execute its own second game behavior. That is, when the first behavior tree is closed, each virtual game character will execute its own independent activity branch of the second behavior tree, and the independent activity branch corresponds to the independent entity logic of the virtual game character.

[0085] Therefore, this embodiment manages all virtual game characters to execute the first game behavior through the first behavior tree, and at the same time, each virtual game character also keeps its own second behavior tree open to execute the second game behavior unique to each virtual game character. That is, by adopting the behavior tree as an AI operation solution, this embodiment can realize the function of the virtual game character collection executing the team AI while being compatible with each virtual game character independently executing the AI ​​behavior logic.

[0086] As an optional implementation, each virtual game character obtains team information through identification information of the virtual game character set, wherein the team information includes information of the virtual game character set and / or information of virtual game characters other than each virtual game character among multiple virtual game characters.

[0087] In this embodiment, the virtual game character set has identification information, such as a team ID, and each virtual game character can obtain team information through the above identification information, which can be information about the virtual game character set, such as information related to the team, or information about other virtual game characters among multiple virtual game characters except each virtual game character, such as information about other members.

[0088] This embodiment is a method for virtual game characters to collaboratively execute game behaviors based on a two-level behavior tree. The virtual game character set has its own first behavior tree for managing all virtual game characters to execute the first game behavior. Each virtual game character also keeps its own second behavior tree open to execute the second game behavior unique to each virtual game character, thereby ensuring that the virtual game character set can be compatible with each virtual game character independently executing the second game behavior while executing the first game behavior. Because the structure of the behavior tree is clear, flexible, easy to maintain, and has strong expansibility, different nodes can be used to implement stylized AI tactics, thereby solving the technical problem of the difficulty in implementing the control logic of the virtual game character set, and achieving the technical effect of reducing the difficulty in implementing the control logic of the virtual game character set.

[0089] The above method of the embodiment of the present invention is further illustrated below in conjunction with preferred implementation modes.

[0090] In the development of artificial intelligence, game AI has always been an important research direction and a key area of ​​application and implementation. Game AI controls the actions and performance of AI characters (monsters and NPCs). As part of the game world, excellent game AI greatly enhances the player's gaming experience.

[0091] In order to make the combat methods of AI characters in the game more diverse and more expressive, sometimes a group of AI characters are needed to jointly execute some complex tactics, with team AI behaviors such as performing continuous skills or starting cooperative offensives, rather than fighting alone. Among them, a group of AI characters is also an AI team entity, which can also be called team AI. It can be configured by non-developers like editing a single AI character, with controllable changes and easy-to-maintain structure. Among them, a single AI character can also be called an AI member entity or an independent entity AI.

[0092] The AI ​​team entity can be an extension based on the design of an independent AI member entity, or a team event triggering scheme based on an independent AI state machine. Each independent game entity has its own AI decision-making system, which can be a finite state machine or a hierarchical state machine. In the finite state machine or hierarchical state machine, additional behaviors for activating team strategies are added, such as obtaining information about teammates or designated targets, and initiating (activating) a team battle or cooperative attack after conditional judgment.

[0093] In the above scheme, the state machine divides the AI ​​behavior of the game into different separate states, and the transition between states is triggered by events. However, the state machine structure becomes difficult to maintain when the number of states increases, so the hierarchical state machine is derived. In the hierarchical state machine, the behavior of the game entity is first classified, several small states are merged into one state, and then the jump links between the high-level state and the internal small states in the high-level state are defined.

[0094] Figure 3 FIG. 1 is a schematic diagram of a hierarchical state machine according to the related art. Figure 3 As shown, the hierarchical state machine includes jumps between state A, state B, and state C. Its design naturally limits the jumps of some states. The jump relationship between states A, state B, and state C does not require external state concern. In this way, isolation between unrelated states is achieved, and each level only needs to focus on the state jumps within its own layer.

[0095] In the above hierarchical state machine, the transition between states also depends on the triggering of events. Therefore, in order to realize that each game entity can form a team behavior in some cases, it is necessary to preset the triggering events of the logic related to team tactics in the game. After receiving the team event, these entities running the state machine independently will enter the team tactics sub-state and execute the preset team logic.

[0096] For finite state machines and hierarchical state machines, each state needs to be designed in detail and the hierarchical state structure needs to be listed. At the same time, state jumps need to be strictly restricted for specific problems. The design and maintenance of the structure requires a lot of effort. When executing team state behaviors, it is difficult for entity members to obtain data information about other teammates, which makes it very difficult to implement complex team logic.

[0097] In another related technology, complex neural networks are constructed and trained through deep learning technology, which can achieve functions similar to a controller controlling all game entities in a team. In this case, the team strategy will be trained by a specific network layer and executed when the network is running. The above scheme can be to use a deep learning neural network to extract and train global information in the game. This global information includes the characteristic data of all friendly members. Therefore, when implementing neural network training, each individual AI member entity will make a better choice when it learns the status and skills of the friendly party to make the penalty function converge, which actually constitutes the emergence of team tactics. Figure 4 FIG. 1 is a schematic diagram of a network structure of OpenAI Five according to an embodiment of the present invention. Figure 4As shown in the figure, under OpenAI Five, the data to be processed is processed by the concat function and two-layer neural network (FC-relu) to obtain data Slice 0:512 and data Slice 512:2048, which can correspond to the feature information of the players in the team and the feature information of the current player. After processing it by the concat function, a feature vector with a length of 2048 can be obtained, which will represent all the knowledge that AI has learned from the game. Through the continuous training of the neural network, the information features of these teammates will be learned as important features, and in the final actual game, they will also become an important reference for AI behavior decision-making.

[0098] However, since the decision-making of the neural network itself is actually a black box, developers cannot know when the AI ​​character will execute which strategy, and cannot guarantee the controllability of gameplay and difficulty. In addition, the construction and training of the network requires a lot of R&D resources. Every game update and data change requires retraining, which makes this solution not the best choice in actual projects.

[0099] In response to the above problems, this embodiment implements a method for AI member entities to collaboratively handle team tasks, which will ensure that the game only uses the behavior tree as an AI operation scheme, so that it can be compatible with the independent entity logic of independent entity AI while realizing the functions of the team. Team AI manages the information of all members and can coordinate and realize complex team cooperation tasks. In addition, the structure of the behavior tree is clear and easy to maintain, and developers can use different action nodes to implement stylized AI tactics.

[0100] The above method of this embodiment is further introduced below.

[0101] The method of this embodiment may include the following steps:

[0102] S1. In the game's battle space, establish a global team manager to manage all teams in the battle. You can create a team entity and register the team members to the team entity.

[0103] In the game's battle space, create a global team manager object entity (actually create a class object), which can contain a dictionary for storing and managing all AI team entities in the battle space. The team manager will be used to uniformly call the initialization and destruction interfaces of all AI team entities when the battle space is created or destroyed.

[0104] Optionally, the AI ​​team entity (team AI) of this embodiment may include a list for storing the unique IDs of all team members, which may be used to uniformly manage the life cycles of team members.

[0105] S2, AI team entities, like game entities, have their own AI behavior trees. The behavior trees can be composed of customized team tactical nodes, general nodes, and filter nodes and their sub-nodes. The planner can configure the specific behaviors to be performed by each AI team entity.

[0106] Optionally, the above-mentioned tactical node can be a twin ship flanking tactical node, that is, in a naval battle, two AI ships sail from the left and right sides of the player ship to the left and right sides respectively, and in the process, they open fire on the player ship sandwiched in the middle. After the attack, the twin ships can quickly move to the front of the player ship and cross each other, continuing to flanke the player ship; a queue tactical node can be 3 to 5 AI ships connected head to tail to form a queue, which will surround the player ship and maintain the queue in the case of attrition; general nodes can include performance nodes such as team members playing shouting UI, sound effects, etc. at the same time.

[0107] S3, AI team entity can obtain and manage data information of all AI member entities, and has its own hatred and target locking system. After the target locking process is started and locked, the team AI entity is officially started.

[0108] Optionally, starting the target locking process and locking each AI member entity refers to obtaining a hatred list through its own hatred system. The AI ​​team entity will select an entity with the highest hatred value among all the AI ​​member entities' hatred objects as its own locked target, and pass the locked target information to all AI member entities.

[0109] S4, when the behavior tree of the AI ​​team entity is turned on, the behavior tree of the AI ​​member entity will run on the opened branch of the behavior tree of the AI ​​team entity, forming a structure where two levels of behavior trees run together; when the behavior tree of the AI ​​team entity is turned off, the AI ​​member entities will each execute an independent active branch of their own behavior tree.

[0110] Optionally, the AI ​​team entity of this embodiment can choose whether to close the behavior tree based on conditions such as attrition and hatred. For example, when the target of hatred of the team entity dies or escapes from the battlefield, causing the AI ​​team entity to no longer hate any target, the behavior tree of the AI ​​team entity will be closed.

[0111] The above method of this embodiment is further described in detail below.

[0112] S1, in the game's battle space, you can create a manager (Team AI Manager) that manages all AI team entities. Figure 5 FIG. 1 is a schematic diagram of the relationship between the manager of an AI team entity and the AI ​​team entity and the AI ​​member entity created in the battle space of a game according to an embodiment of the present invention. Figure 5As shown, the open interface of the manager can be used by other modules to obtain any one of the first AI team entity, the second AI team entity and the third AI team entity, and used to clean up and destroy data. The AI ​​team entity is used to manage the AI ​​member entities, for example, the first AI member entity 1, the second AI member entity and the third AI member entity. Optionally, the AI ​​team entity of this embodiment will add a listening event for each AI member entity, and the AI ​​member entity will be removed from the team when it is destroyed or dies.

[0113] In this embodiment, the AI ​​member entity will also record the unique ID of the AI ​​team entity to which it belongs in itself. Through this unique ID, the AI ​​member entity will be able to obtain the information owned by the AI ​​team entity and the information of other AI member entities.

[0114] S2, the behavior tree that the AI ​​team entity runs is structurally consistent with the behavior tree of the AI ​​member entity.

[0115] The leaf nodes of the behavior tree can be execution nodes, which are used to perform specific functions. When the condition node is reached, the subsequent nodes will be executed only when the condition is met. Commonly used combination nodes include selection nodes and sequence nodes. Among them: selection nodes will execute their child nodes from top to bottom in sequence. As long as the child node running result returns failure, the subsequent child nodes will continue to be executed until one of the child nodes returns success. Then the execution of subsequent child nodes will be stopped and the running result will be returned to the parent node. Sequential nodes will execute their child nodes from top to bottom in sequence. As long as the child node running result returns success, the subsequent child nodes will continue to be executed until one of the child nodes returns failure. Then the execution of subsequent child nodes will be stopped and failure will be returned to the parent node. Filter nodes allow the addition of child nodes, which are used to define different special processing for child nodes.

[0116] In order to better reuse the execution nodes of the behavior tree, this embodiment creates a filter node that is executed by all members. Here, the child nodes of the filter node are the execution nodes of the AI ​​member entities. By using the filter node, all AI member entities can run the same execution node at the same time.

[0117] Since each AI member entity will obtain its own return value when executing a node, the filter node executed by all members defines three return modes when returning to the parent node: (1) if an AI member entity executes successfully, it returns success; (2) if an AI member entity fails to execute, it returns failure; (3) all AI member entities return to continue running before execution is completed.

[0118] S3, each AI member entity's behavior tree will be started at the same time when it is created, and will run on the independent activity branch of the AI ​​team entity's behavior tree. When any AI member entity in the AI ​​team entity obtains its own lock filter list through conditions such as distance, camp, health, etc., the AI ​​team entity will be started.

[0119] When the AI ​​team entity does not select a suitable target, each AI member entity will obtain a hatred list through its own hatred system. The AI ​​team entity will select the hatred object with the highest hatred value among all AI member entities as its own lock target, and pass the lock target information to all AI members.

[0120] S4, when the AI ​​team entity has a suitable locked target, the AI ​​team entity will officially run the team tactical logic. At this time, the behavior tree of the AI ​​member entity runs on the branch of the behavior tree of the AI ​​team entity, executing their respective combat logic (team member logic).

[0121] During the game, if the team mission cannot be continued due to attrition, you can first execute the node of the behavior tree of the AI ​​team entity to make the team AI silent. At this time, the behavior tree of each AI member entity will return to the independent activity branch again and continue the independent entity logic.

[0122] Figure 6 is a schematic diagram of a behavior tree of an AI team entity according to an embodiment of the present invention. Figure 6 As shown, the behavior tree of the AI ​​team entity includes a node, which includes a selection node. The selection node may include a sequence node. On the sequence node, a conditional node may be used to determine that there is no currently locked target, and an execution node may be used to perform hatred filtering. That is, the AI ​​team entity selects the hatred object with the highest hatred value among the hatred objects of all AI member entities, and determines the hatred object with the highest hatred value as the locked target through another execution node.

[0123] The selection node of the behavior tree of the AI ​​team entity may further include another sequence node, which may determine through a condition node that there is a reduction in the number of members in the AI ​​team entity, and then execute another execution node to close the behavior tree of the AI ​​team entity.

[0124] The selection node of the behavior tree of the AI ​​team entity can also include another sequence node, which can determine the team tactics through an execution node. The screening node can be used to implement the execution of all members, so that all members can run the same execution node at the same time.

[0125] Figure 7 is a schematic diagram of a behavior tree of an AI member entity according to an embodiment of the present invention. Figure 7 As shown, the behavior tree of the AI ​​member entity includes a root node, the root node includes a selection node, the selection node has a sequence node, on which the behavior tree of the AI ​​member entity can be determined to be closed through a condition node, and then an execution node is used to make the AI ​​member entity execute independent entity logic on its own independent activity branch. Optionally, the selection node of the behavior tree of the AI ​​member entity can also include another sequence node, and the behavior tree of the AI ​​member entity can be determined to be opened through a condition node, and then another execution node is used to make the AI ​​member entity execute team member logic.

[0126] The behavior tree structure is the most flexible and extensible solution for AI operation. The behavior tree structure is determined before the game is run. This static nature ensures the stability of AI operation. At the same time, the behavior tree is only composed of combination nodes, modification nodes, conditional nodes and execution nodes. The organizational structure is intuitive and easy to maintain. The nodes that make up the behavior tree are highly reusable. Through different organizational methods, AI with different functions can be obtained.

[0127] The AI ​​team entity proposed in this embodiment is composed of independent AI member entities, which also have the function of running their own behavior trees. The AI ​​team entity can act as the brain of the team to perform a series of operations such as search, lock, and homing, and can also build team tactics of different styles according to different behavior tree node configurations. This method has a simple structure, strong scalability and maintainability, and the team can also be created, run, or disbanded at any time, and is flexible to use.

[0128] This embodiment is a method for AI characters to collaboratively process team tasks based on a two-level behavior tree. The AI ​​team entity has its own behavior tree, which is used to manage all AI member entities to execute team tactics. The AI ​​member entity also keeps its own behavior tree open and executes the independent entity logic unique to each AI member, thereby ensuring that the game can be compatible with the independent logic of the AI ​​member entity while realizing the functions of the AI ​​team entity. Since the structure of the behavior tree is clear and easy to maintain, developers can use different nodes to implement stylized AI tactics, solving the technical problem of the difficulty of implementing team logic in the game, and achieving the technical effect of reducing the difficulty of implementing team logic in the game.

[0129] The embodiment of the present invention further provides a control device for a virtual game character. It should be noted that the control device for a virtual game character of this embodiment can be used to execute the control method for a virtual game character of the embodiment of the present invention.

[0130] Figure 8 Schematic diagram of a control device for a virtual game character according to an embodiment of the present invention. Figure 8As shown, the control device 80 of the virtual game character may include: a first determination unit 81, a second determination unit 82 and a control unit 83.

[0131] The first determination unit 81 is used to call a first behavior tree associated with a set of virtual game characters, and determine a target object associated with the set of virtual game characters through the first behavior tree, wherein the set of virtual game characters includes a plurality of virtual game characters, and at least some nodes of the first behavior tree include a second behavior tree associated with each virtual game character.

[0132] The second determining unit 82 is used to determine a first game behavior corresponding to the target object through the first behavior tree, wherein the first game behavior is a behavior to be executed by the set of virtual game characters.

[0133] The control unit 83 is used to call the second behavior tree associated with each virtual game character through the first behavior tree, and control each corresponding virtual game character to perform the first game behavior through the second behavior tree.

[0134] In the control device for virtual game characters of this embodiment, the present application adopts a two-level behavior tree. The virtual game character set has its own first behavior tree for managing all virtual game characters. The first game behavior can be constructed according to the node configuration of different behavior trees. Each virtual game character also keeps its own second behavior tree open, so that each virtual game character performs the first game behavior. Since the structure of the behavior tree is clear, flexible, easy to maintain, and has strong expansibility, different nodes can be used to implement stylized AI tactics, thereby solving the technical problem of the difficulty in implementing the control logic of the virtual game character set, and achieving the technical effect of reducing the difficulty in implementing the control logic of the virtual game character set.

[0135] The embodiment of the present invention further provides a computer-readable storage medium. The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the device where the computer-readable storage medium is located is controlled to execute the control method of the virtual game character of the embodiment of the present invention.

[0136] Optionally, in this embodiment, the above-mentioned computer-readable storage medium may include but is not limited to: a USB flash drive, a read-only memory (ROM), a random access memory (RAM), a mobile hard disk, a magnetic disk or an optical disk, and other media that can store computer programs.

[0137] An embodiment of the present invention further provides an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0138] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor, and the input / output device is connected to the processor.

[0139] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, and optionally, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0140] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for controlling a virtual game character, characterized in that: include: Calling a first behavior tree associated with a set of virtual game characters, and determining a target object associated with the set of virtual game characters through the first behavior tree, wherein the set of virtual game characters includes a plurality of virtual game characters, and at least part of the nodes of the first behavior tree include a second behavior tree associated with each of the virtual game characters; Determining a first game behavior corresponding to the target object through the first behavior tree, wherein the first game behavior is a behavior to be performed by the set of virtual game characters; Calling the second behavior tree associated with each of the virtual game characters through the first behavior tree, and controlling each of the corresponding virtual game characters to perform the first game behavior through the second behavior tree; The determining of the target object associated with the set of virtual game characters through the first behavior tree comprises: determining that the target object is not currently determined through a first condition node in a first sequence node of the first behavior tree; determining the target object from a plurality of first target objects through a first execution node in the first sequence node, wherein the first sequence node is a child node of a first selection node of the first behavior tree, and the plurality of first target objects are associated with at least one virtual game character among the plurality of virtual game characters; Among them, the first execution node includes a first sub-execution node and a second sub-execution node, and the target object is determined from multiple first target objects through the first execution node in the first sequence node, including: through the first sub-execution node, obtaining the correlation between each of the virtual game characters and each of the first target objects associated with each of the virtual game characters, obtaining multiple correlations, and determining the highest correlation from the multiple correlations; through the second sub-execution node, determining the first target object corresponding to the highest correlation as the target object.

2. The method according to claim 1, characterized in that The first behavior tree associated with the virtual game character set is called, including: When at least one first target object associated with any one of the plurality of virtual game characters is determined, the first behavior tree is called.

3. The method according to claim 1, characterized in that Determining the first game behavior corresponding to the target object through the first behavior tree includes: The first game behavior is determined through a second sequence node of the first behavior tree, wherein the second sequence node is a child node of a first selection node of the first behavior tree.

4. The method according to claim 3, characterized in that Determining the first game behavior through the second sequence node of the first behavior tree includes: The first game behavior is determined through a second execution node of the second sequence node.

5. The method according to claim 4, characterized in that Calling the second behavior tree associated with each of the virtual game characters through the first behavior tree, and controlling each of the corresponding virtual game characters to perform the first game behavior through the second behavior tree, comprises: After the first game behavior is determined through the second execution node of the second sequence node, the second behavior tree associated with each of the virtual game characters is called through the screening node of the second sequence node, and each of the corresponding virtual game characters is controlled to perform the first game behavior through the second behavior tree.

6. The method according to claim 1, characterized in that The method further comprises: The calling of the first behavior tree is prohibited through a third sequence node of the first behavior tree, wherein the third sequence node is a child node of a first selection node of the first behavior tree.

7. The method according to claim 6, characterized in that Forbidding calling the first behavior tree through the third sequence node of the first behavior tree includes: Determining, through the second condition node of the third sequence node, that a prohibition instruction has been obtained, wherein the prohibition instruction is used to prohibit calling the first behavior tree; The third execution node of the third sequence node responds to the prohibition instruction and prohibits calling the first behavior tree.

8. The method according to claim 1, characterized in that Controlling each of the corresponding virtual game characters to perform the first game behavior through the second behavior tree includes: Each corresponding virtual game character is controlled to execute a sub-game behavior in the first game behavior through a fourth sequence node of the second behavior tree, wherein the fourth sequence node is a child node of a second selection node of the second behavior tree.

9. The method according to claim 8, characterized in that Controlling each corresponding virtual game character to execute a sub-game behavior in the first game behavior through the fourth sequence node of the second behavior tree includes: Determining, through the third condition node of the fourth sequence node, that calling the first behavior tree is allowed; Through the fourth execution node of the fourth sequence node, each corresponding virtual game character is controlled to execute the sub-game behavior.

10. The method according to claim 1, characterized in that The method further comprises: Through the fifth sequence node of the second behavior tree, each corresponding virtual game character is controlled to perform the second game behavior of each virtual game character, wherein the fifth sequence node is a child node of the second selection node of the second behavior tree.

11. The method according to claim 10, characterized in that Controlling each corresponding virtual game character to execute an independent behavior of each virtual game character through the fifth sequence node of the second behavior tree includes: Determining, through the fourth condition node of the fifth sequence node, that calling the first behavior tree is prohibited; Through the fifth execution node of the fifth sequence node, each corresponding virtual game character is controlled to execute the second game behavior.

12. The method according to any one of claims 1 to 11, characterized in that Each of the virtual game characters obtains team information through identification information of the virtual game character set, wherein the team information includes information of the virtual game character set and / or information of virtual game characters among the multiple virtual game characters except each of the virtual game characters.

13. A control device for a virtual game character, characterized in that: include: a first determining unit, configured to call a first behavior tree associated with a set of virtual game characters, and determine a target object associated with the set of virtual game characters through the first behavior tree, wherein the set of virtual game characters includes a plurality of virtual game characters, and at least part of the nodes of the first behavior tree include a second behavior tree associated with each of the virtual game characters; A second determining unit, configured to determine a first game behavior corresponding to the target object through the first behavior tree, wherein the first game behavior is a behavior to be executed by the set of virtual game characters; a control unit, configured to call the second behavior tree associated with each of the virtual game characters through the first behavior tree, and control each of the corresponding virtual game characters to perform the first game behavior through the second behavior tree; The first determination unit is further used to determine the target object associated with the set of virtual game characters through the first behavior tree by the following steps: determining that the target object is not currently determined through a first condition node in a first sequence node of the first behavior tree; determining the target object from a plurality of first target objects through a first execution node in the first sequence node, wherein the first sequence node is a child node of a first selection node of the first behavior tree, and the plurality of first target objects are associated with at least one virtual game character among the plurality of virtual game characters; Among them, the first execution node includes a first sub-execution node and a second sub-execution node, and the first determination unit is also used to determine the target object from multiple first target objects through the first execution node in the first sequence node through the following steps: through the first sub-execution node, obtain the correlation between each of the virtual game characters and each of the first target objects associated with each of the virtual game characters, obtain multiple correlations, and determine the highest correlation from the multiple correlations; through the second sub-execution node, determine the first target object corresponding to the highest correlation as the target object.

14. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein when the computer program is executed by a processor, the device where the computer-readable storage medium is located is controlled to execute the method described in any one of claims 1 to 12.

15. An electronic device comprising a memory and a processor, characterized in that: The memory stores a computer program, and the processor is configured to execute the computer program to perform the method according to any one of claims 1 to 12.

Citation Information

Patent Citations

  • Resource marshalling model construction method and system for sea-air joint combat mission

    CN113392521A