Intelligent agent role control method and device in game, electronic equipment and readable storage medium
By introducing a three-layer strategy structure in the game, determining the behavior tree and control operations of the agent character, the problem of inflexible control of the agent character in the existing technology is solved, and more efficient dynamic adjustment and precise control are achieved.
Patent Information
- Application Number
- CN202411642581.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-15
- Publication Date
- 2025-04-08
- Estimated Expiration
- 2044-11-15
AI Technical Summary
The control methods of agent characters in the prior art are not flexible and accurate enough, resulting in a lack of dynamic adjustment ability when facing a rapidly changing gaming environment.
By introducing three-layer strategy structures into the game: the first macro strategy level, the second specific strategy level and the third strategy level implemented at the bottom, we determine the behavior tree and control operations to be executed by the agent character to be executed, and flexible control of the agent character is achieved.
The dynamic adjustment ability and control accuracy of the agent's character are improved, so that they can respond more flexibly to various situations when facing a rapidly changing game environment.
Smart Images

Figure CN119770970A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method for controlling an intelligent character in a game, an intelligent character control device in a game, an electronic device, and a computer-readable storage medium. Background Art
[0002] In games, the presence of intelligent characters (also often called robot characters or AI characters) can often improve the user experience. For example, you can add intelligent characters to allow humans to play against machines. For another example, when the number of users participating in the game is insufficient, you can use intelligent characters to fill in the gaps to ensure that the game starts normally.
[0003] However, the current control methods for intelligent characters are not flexible and accurate enough, which makes the intelligent characters lack the ability to dynamically adjust when facing a rapidly changing game environment. Summary of the invention
[0004] The present disclosure provides a method for controlling an intelligent character in a game, an intelligent character control device in a game, an electronic device and a computer-readable storage medium to solve or at least partially solve the above-mentioned problems, as follows.
[0005] In a first aspect, the present disclosure provides a method for controlling an intelligent character in a game, the method comprising:
[0006] Control the intelligent character to play against the virtual character controlled by the user;
[0007] In the preconfigured first strategy level, a first macro behavior to be implemented by the agent character and a first additional condition to be satisfied in the process of implementing the first macro behavior are determined based on game data through a pre-trained model or a pre-configured planning table; the first macro behavior is one of the macro behavior types preconfigured in the first strategy level, and the first additional condition is one of the additional conditions preconfigured in the first strategy level;
[0008] In a preconfigured second strategy level, based on the first macro behavior and the first additional condition, a first behavior tree to be executed by the agent role is determined; the second strategy level is a sublevel of the first strategy level, and the first behavior tree is one of the preconfigured behavior trees in the second strategy level;
[0009] Determining, in a preconfigured third policy level, a preconfigured control operation for a node of the first behavior tree; the third policy level being a sub-level of the second policy level;
[0010] The agent role is controlled based on the control operation, so that the agent role executes the nodes of the first behavior tree to implement the first macro behavior and satisfies the first additional condition in the process of implementing the first macro behavior.
[0011] In a second aspect, the present disclosure further provides an intelligent agent character control device in a game, the device comprising:
[0012] A first control module, used to control the intelligent character to play against the virtual character controlled by the user;
[0013] A first determination module is used to determine, in a preconfigured first strategy level, a first macro behavior to be implemented by the agent character and a first additional condition to be satisfied in the process of implementing the first macro behavior based on game data through a pre-trained model or a pre-configured planning table; the first macro behavior is one of the macro behavior types preconfigured in the first strategy level, and the first additional condition is one of the additional conditions preconfigured in the first strategy level;
[0014] A second determination module is used to determine a first behavior tree to be executed by the agent role based on the first macro behavior and the first additional condition in a preconfigured second strategy level; the second strategy level is a sublevel of the first strategy level, and the first behavior tree is one of the preconfigured behavior trees in the second strategy level;
[0015] a third determination module, configured to determine, in a preconfigured third policy level, a control operation preconfigured for a node of the first behavior tree; the third policy level being a sub-level of the second policy level;
[0016] A second control module is used to control the intelligent agent role based on the control operation, so that the intelligent agent role executes the nodes of the first behavior tree to implement the first macro behavior and satisfies the first additional condition in the process of implementing the first macro behavior.
[0017] In a third aspect, the present disclosure further provides an electronic device, comprising: a processor, a memory, and computer program instructions stored in the memory and executable on the processor;
[0018] When the processor executes the computer program instructions, the method for controlling an intelligent agent character in a game as described in the first aspect above is implemented.
[0019] In a fourth aspect, the present disclosure further provides a computer-readable storage medium, in which computer program instructions are stored. When the computer program instructions are executed by a processor, they are used to implement the intelligent character control method in the game as described in the first aspect above.
[0020] The exemplary embodiments of the present disclosure have the following beneficial effects:
[0021] The present disclosure provides a method for controlling an intelligent agent character in a game, which first controls the intelligent agent character to play against a virtual character controlled by a user; then, in a preconfigured first strategy level, a first macro behavior to be implemented by the intelligent agent character and a first additional condition to be satisfied in the process of implementing the first macro behavior are determined based on game data through a pretrained model or a preconfigured planning table; in a preconfigured second strategy level, a first behavior tree to be executed by the intelligent agent character is determined based on the first macro behavior, the first additional condition and the winning rate of the intelligent agent character, wherein the second strategy level is a sublevel of the first strategy level; then, in a preconfigured third strategy level, a control operation preconfigured for a node of the first behavior tree is determined, wherein the third strategy level is a sublevel of the second strategy level; then, based on the control operation, the intelligent agent character is controlled so that the intelligent agent character executes the node of the first behavior tree to implement the first macro behavior and satisfies the first additional condition in the process of implementing the first macro behavior. In the present disclosure, the control of the intelligent agent role can be achieved through a three-layer strategy structure consisting of a macro first strategy level, a specific second strategy level, and a bottom-level implemented third strategy level. Among them, the macro first strategy level can be divided into macro behaviors and additional conditions that need to be met in the process of implementing macro behaviors. The high-level strategies of the intelligent agent role can be flexibly adjusted through these two aspects of macro behaviors and additional conditions, so that the intelligent agent role has better dynamic adjustment capabilities when facing a rapidly changing game environment, and the control of the intelligent agent role is more flexible and precise. BRIEF DESCRIPTION OF THE DRAWINGS
[0022] Figure 1 is a flow chart of a method for controlling an intelligent character in a game provided by one of the embodiments of the present disclosure;
[0023] Figure 2 is a schematic diagram of a control strategy for an intelligent agent role provided by one of the embodiments of the present disclosure;
[0024] Figure 3 is a schematic diagram of a first strategy level in a control strategy of an intelligent agent role provided by one embodiment of the present disclosure;
[0025] Figure 4 is a schematic diagram of a model structure of a first supervised learning model provided by one of the embodiments of the present disclosure;
[0026] Figure 5 is a schematic diagram of a second strategy level provided by one of the embodiments of the present disclosure;
[0027] Figure 6is a schematic diagram of a model structure of a second supervised learning model provided by one of the embodiments of the present disclosure;
[0028] Figure 7 is a block diagram of an intelligent character control device in a game provided by one of the embodiments of the present disclosure;
[0029] Figure 8 It is a logical structure diagram of an electronic device for implementing control of an intelligent character in a game, provided in one of the embodiments of the present disclosure. DETAILED DESCRIPTION
[0030] In order to make the purpose, technical scheme and advantages of the embodiments of the present disclosure clearer, the technical scheme in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are only part of the embodiments of the present disclosure, rather than all of the embodiments. The components of the embodiments of the present disclosure generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present disclosure provided in the drawings is not intended to limit the scope of the present disclosure for protection, but merely represents the selected embodiments of the present disclosure. Based on the embodiments of the present disclosure, each other embodiment obtained by those skilled in the art without making creative work belongs to the scope of protection of the present disclosure.
[0031] The terms "a", "an", "the" and "said" are used in this specification to indicate the presence of one or more elements / components / etc.; the terms "including" and "having" are used to express an open-ended inclusion and mean that additional elements / components / etc. may exist in addition to the listed elements / components / etc.; the terms "first" and "second" etc. are used only as labels and are not intended to limit the quantity of their objects.
[0032] It should be understood that in the embodiments of the present disclosure, "at least one" means one or more, and "more than one" means two or more. "And / or" is merely a way to describe the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the previous and subsequent associated objects are in an "or" relationship. "Including A, B and / or C" means including any one, any two, or any three of A, B, and C.
[0033] It should be understood that in the embodiments of the present disclosure, "B corresponding to A", "B corresponding to A", "A corresponds to B", or "B corresponds to A" means that B is associated with A, and B can be determined according to A. Determining B according to A does not mean that B is determined only according to A, and B can also be determined according to A and / or other information.
[0034] The intelligent agent character control method in the game in one of the embodiments of the present disclosure can be run on a terminal device or a server, and the terminal device can be a desktop computer, a laptop computer, a tablet computer, a mobile phone, etc., or other electronic devices, which are not specifically limited in the present disclosure. The server is used to provide background services for the client of the application in the terminal device. For example, the server can be the background server of the above-mentioned application. The server can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms and other basic cloud computing services, which are not specifically limited in the present disclosure.
[0035] Before describing the embodiments of the present disclosure in detail, the related art is firstly further introduced.
[0036] In one prior art, the control method of the intelligent character in the game can adopt a multi-conditional behavior tree method, that is, if XX condition is met, behavior A is executed, and if YY condition is met, behavior B is executed.
[0037] In one prior art, an intelligent agent role is trained through a model, so that the behavior that the intelligent agent role needs to take can be determined according to the current game situation, and the intelligent agent role can be controlled to perform the behavior.
[0038] In one existing technology, a two-layer or three-layer control strategy can be used to perform hierarchical control on the intelligent agent role, such as a high-level strategy + a low-level strategy, a high-level strategy + a middle-level strategy + a low-level strategy.
[0039] However, the above prior art has the following problems:
[0040] 1. Regarding the first prior art mentioned above, firstly, for designers, when adding new functions, conflicts often occur, which leads to the need to reconstruct the entire behavior tree system; secondly, it is impossible to extract different functions into independent modules, the system robustness is poor, and the stable operation of the intelligent character under various circumstances cannot be guaranteed; thirdly, since the control structure of the behavior tree is relatively fixed, that is, a certain behavior can only be executed when certain conditions are met, etc., the control of the intelligent character is not flexible and the control precision is not high, which makes the intelligent character lack the ability to dynamically adjust when facing a rapidly changing game environment.
[0041] 2. Regarding the second existing technology mentioned above, due to the limitations of training data and generalization ability, the control of the intelligent character is not flexible and accurate enough, and it also makes the intelligent character unable to cope with the rapidly changing game environment.
[0042] 3. Regarding the third existing technology mentioned above, the high-level strategy (i.e., macro behavior) to be adopted is usually adjusted according to the winning rate of the intelligent agent role. The high-level strategy layer bears a large amount of calculation, and repeated adjustments of the high-level strategy will cause large changes in the macro behavior of the intelligent agent role, resulting in the basic ineffectiveness of the early calculations and a waste of computing resources.
[0043] Figure 1 A method for controlling an intelligent character in a game provided by one embodiment of the present disclosure is shown. Figure 1 As shown, the method includes the following steps S101 to S105.
[0044] Step S101: Control the intelligent character to play against the virtual character controlled by the user.
[0045] In one embodiment of the present disclosure, an intelligent character can be controlled to fight against a virtual character in a game, wherein the virtual character is controlled by a user and the intelligent character is controlled by a game system.
[0046] Step S102: In the preconfigured first strategy level, determine the first macro behavior to be implemented by the intelligent character and the first additional condition that needs to be met in the process of implementing the first macro behavior based on the game data through a pre-trained model or a pre-configured planning table; the first macro behavior is one of the macro behavior types preconfigured in the first strategy level, and the first additional condition is one of the additional conditions preconfigured in the first strategy level.
[0047] In this disclosure, reference is made to Figure 2 , the control strategy of the intelligent agent role can be divided into the first strategy level, the second strategy level, and the third strategy level according to the hierarchical relationship. Among them, the second strategy level is a sub-level of the first strategy level, and the third strategy level is a sub-level of the second strategy level. The first strategy level is pre-configured with a variety of macro behavior types and a variety of additional conditions. The macro behavior type is the most macro behavior that the intelligent agent role will perform, such as machine repair, rescue, treatment and other major behaviors. The additional condition is the additional condition that the intelligent agent role needs to meet when implementing a certain macro behavior type, such as the intelligent agent role needs to bypass a specific area in the virtual scene when going to repair the machine; the second strategy level is responsible for matching the first strategy level. Optionally, additional content that needs to be executed can also be added during the matching process; the third strategy level focuses more on the action implementation itself, that is, the interface call method, such as executing movement from point A to point B, executing window flipping, etc.
[0048] The first policy level is the high-level policy of the agent role, see Figure 3, high-level strategies can be divided into basic strategies and superimposed strategies. Basic strategies are the types of macro behaviors that the intelligent character needs to implement, which refers to the most macro behavior itself. Superimposed strategies are the additional conditions that need to be met in the process of the intelligent character implementing a certain type of macro behavior, that is, how to execute these macro behaviors. For example, when the intelligent character goes to repair the machine, should it go directly or use the RVO method (in an optional example, the RVO method can refer to avoiding passing through the area near a specific NPC during the movement); for example, when the intelligent character goes to rescue, should it go directly or send the corresponding quick message while going.
[0049] At the first strategy level, based on game data, the first macro behavior to be implemented by the intelligent character and the first additional condition that needs to be met in the process of implementing the first macro behavior can be determined through pre-trained models or pre-configured planning tables, that is, the basic strategy and superimposed strategy that the intelligent character needs to adopt can be determined.
[0050] In one of the embodiments of the present disclosure, the game data may include in-game data and out-of-game data.
[0051] 1. In-game data refers to the data generated during the game, which can include the following aspects:
[0052] 1. User game data: including user progress (e.g. game progress, task status, etc.), user attributes (e.g. health points, mana points, etc.), user items (e.g. equipment, props, gold coins, currency, resources, etc. obtained or equipped during the game), etc.
[0053] 2. Scene game data: including the current distribution of props in the virtual scene, the current distribution of NPCs, the current distribution of items, the current status of buildings, etc.
[0054] 2. Off-game data refers to game data that is not related to the game situation, including the following aspects:
[0055] 1. User data: user level information (such as user rank, user level, etc.), user customized information (appearance settings, button mapping, etc.), user account, user avatar, user nickname, etc.
[0056] 2. Scene data: including level structure (map, item layout, building layout, etc.), level conditions (level objectives, pass conditions, failure conditions, etc.), level configuration (dynamic element configuration, obstacle location, triggers, etc.), etc.
[0057] 3. Item and equipment data: including item attributes (name, description, rarity, icon, usage effect, etc.), equipment attributes (attack power, defense power, durability, additional effects, etc.), drop rules (item drop probability, drop conditions, drop source, etc.), etc.
[0058] In one embodiment of the present disclosure, this step can be implemented by the following steps S1021 to S1022.
[0059] Step S1021: According to the level information of the virtual character in the game data, select the target strategy for the intelligent agent character from the preconfigured first target strategy and the preconfigured second target strategy; the first target strategy is used to determine the macro behavior to be achieved by the intelligent agent character and the additional conditions that need to be met in the process of achieving the macro behavior through the pre-trained model, and the second target strategy is used to determine the macro behavior to be achieved by the intelligent agent character and the additional conditions that need to be met in the process of achieving the macro behavior through the preconfigured planning table.
[0060] Step S1022: According to the selected target strategy, determine the first macro behavior to be implemented by the intelligent agent role and the first additional condition to be met in the process of implementing the first macro behavior through a pre-trained model or a pre-configured planning table.
[0061] In this embodiment, based on the level of the virtual character participating in the game, a corresponding target strategy can be selected between the first target strategy and the second target strategy for the intelligent agent character participating in the game, thereby determining whether to use a pre-trained model or a pre-configured planning table for the intelligent agent character to determine the first macro behavior to be implemented and the first additional condition that needs to be met during the implementation process.
[0062] In one implementation of this embodiment, when the level information of the virtual character in the game data indicates that the level of the virtual character is within a first level range, the target strategy selected for the virtual character is the first target strategy; when the level information of the virtual character in the game data indicates that the level of the virtual character is within a second level range, the target strategy selected for the virtual character is the second target strategy.
[0063] Among them, the minimum value of the first level range is greater than the maximum value of the second level range, that is, when the level of the virtual character participating in the game is within the first level range, it means that the user participating in the game is a high-level user, and the target strategy for the virtual character can be selected as the first target strategy; when the level of the virtual character participating in the game is within the second level range, it means that the user participating in the game is a low-level user, and the target strategy for the virtual character can be selected as the second target strategy.
[0064] In an optional example, the pre-trained model may be a first supervised learning model.
[0065] Optionally, the training method of the first supervised learning model may include the following steps S01 to S02:
[0066] Step S01: Obtain a first game data training sample, and a macro behavior sample label and an additional condition sample label corresponding to the first game data training sample.
[0067] In this embodiment, the first game data training sample, as well as the macro behavior sample label and additional condition sample label corresponding to the first game data training sample can be obtained based on the game recording of the virtual character whose level is within the first level range.
[0068] Optionally, the first game data training sample, and the macro behavior sample label and additional condition sample label corresponding to the first game data training sample can be obtained in the following manner:
[0069] Step S01-1: if it is detected that the virtual character in the game video performs a first macro behavior type among the preconfigured macro behavior types during a time period from a first moment to a second moment in the game video, the game data corresponding to the first moment in the game video is determined as a first game data training sample;
[0070] Step S01-2: Determine the first macro behavior type (i.e., the basic strategy adopted by the virtual character in the game video) as the macro behavior sample label corresponding to the first game data training sample;
[0071] Step S01-3: determining, according to the confirmation strategy configured corresponding to each pre-configured additional condition, a second additional condition satisfied by the virtual character in the game video clip in the process of realizing the first macro behavior type, wherein the second additional condition is one of the pre-configured additional conditions;
[0072] Step S01-4: Determine that the second additional condition (ie, the superposition strategy adopted by the virtual character in the game recording) is the additional condition sample label corresponding to the first game data training sample.
[0073] In this embodiment, the character behavior in the high-level user game recording can be periodically detected. If in the time period t to t+T, if the character is detected to have machine repair behavior, it is considered that the basic strategy (macro behavior) adopted by the user at time t is machine repair; if the character is detected to have rescue behavior, it is considered that the basic strategy (macro behavior) adopted by the user at time t is rescue.
[0074] Exemplarily, in the high-level user game recording, the superposition strategy adopted by the user can be determined by the confirmation strategy in the following confirmation strategy configuration table.
[0075] Table 1 Confirmation strategy matching table
[0076]
[0077]
[0078] According to the above method, the basic strategies and superimposed strategies adopted by users in the high-level user game recordings can be determined, and then the first supervised learning model can be trained based on the game data at time t in the high-level user game recordings as features and the corresponding basic strategies and superimposed strategies as labels.
[0079] Step S02: Based on the first game data training sample, and the macro behavior sample labels and additional condition sample labels corresponding to the first game data training sample, the first supervised learning model is trained until the first supervised learning model converges.
[0080] Reference Figure 4 , exemplarily showing a model structure of a first supervised learning model, firstly, each game data at time t in the high-level user game video can be mapped to the latent space through the hidden layer, and the feature vectors of each game data at time t in the latent space can be obtained, and then each feature vector can be connected through the feature connection layer to obtain a connected feature vector, and then the information in the connected feature vector is analyzed through at least two hidden layers, and finally the basic strategy and superposition strategy adopted by the user at time t are output through two classifiers (such as softmax classifiers). Afterwards, the first supervised learning model can be adjusted through the loss function between the model output result and the label until the first supervised learning model converges, that is, the training is completed. Among them, the role of the hidden layer includes but is not limited to mapping, pooling, feature extraction, etc.
[0081] During reasoning, you only need to input the current game data into the trained first supervised learning model to obtain the basic strategy and superposition strategy that the intelligent character needs to adopt at the current moment, that is, the macro behavior that the intelligent character currently needs to achieve, and the additional conditions that need to be met in the process of the intelligent character achieving the macro behavior.
[0082] Supervised learning of basic strategies and superimposed strategies can control the intelligent agent role more flexibly and accurately.
[0083] The behavior of high-level users is more complex, and the strategy combinations they adopt are more diverse, while the behavior of low-level users is relatively more fixed. Therefore, in games involving high-level users, a pre-trained model can be used to determine the high-level strategies that the intelligent agent role in the game needs to adopt, and in games involving low-level users, a pre-configured planning table can be used to determine the high-level strategies that the intelligent agent role in the game needs to adopt. The model mode is highly flexible, and when applied to games involving high-level users, it can enable the intelligent agent role to have the game level that high-level users should have. The table mode is highly controllable, but the degree of anthropomorphism is low, and it is not easy to be detected when applied to games involving low-level users, saving computing resources.
[0084] Optionally, when the selected target strategy is the second target strategy, the first macro behavior (i.e., basic strategy) to be implemented by the intelligent character can be determined based on the game data and the priority set for the macro behavior type; then, the first additional condition (i.e., superposition strategy) that needs to be met in the process of the intelligent character implementing the first macro behavior is determined through a pre-configured planning table.
[0085] In this example, the basic strategy can be determined based on the current game situation and the basic strategy priority in the planning table. The current game situation can be determined based on the current game data. For example, if a certain type of character on the field is injured based on the current game data, the character can be treated. The basic strategy priority is the priority set for the pre-configured macro behavior type.
[0086] For example, the priority of the basic strategy can be set as treatment>rescue>repair>..., which means that if a specific type of character on the field is injured, this character will be treated first, and low-priority macro behaviors will be abandoned. If no specific type of character is injured on the field, but a specific type of character needs rescue, this character will be rescued first.
[0087] In an optional implementation, the planning matching table can be a fixed table, that is, what macro-behavior type needs to be matched with what additional conditions is fixed, that is, the mapping relationship between the macro-behavior type and the additional conditions is fixed. The fixed planning matching table can include additional conditions corresponding to the macro-behavior type.
[0088] Exemplarily, a fixed planning table is provided, see Table 2 below.
[0089] Table 2 Fixed planning table
[0090] Macro behavior type Additional conditions Rescue Tinnitus Repair RVO Go … … treat Go directly to
[0091] In this implementation, for a fixed planning schedule, it can be determined that the additional condition corresponding to the first macro behavior in the planning schedule is the first additional condition.
[0092] In an optional implementation, the planning matching table can be a conditional matching table, that is, what macro-behavior type needs to be matched with what additional conditions needs to be determined based on the conditions satisfied by the current game situation, that is, the mapping relationship between macro-behavior types and additional conditions is not fixed. The conditional planning matching table can include a set of matching conditions corresponding to different additional conditions corresponding to the macro-behavior type.
[0093] Exemplarily, a conditional planning table is provided, see Table 3 below.
[0094] Table 3 Conditional planning table
[0095]
[0096] In this embodiment, when the current game situation represented by the game data satisfies the first matching condition in the matching condition set corresponding to different additional conditions corresponding to the first macro behavior, the additional condition corresponding to the first macro behavior corresponding to the first matching condition is determined to be the first additional condition.
[0097] For example, based on the current game data, the current game situation is that there is a character A on the field who needs to be rescued, so it can be determined that the first macro behavior to be implemented by the intelligent character is the rescue behavior. Referring to the conditional planning table shown in Table 3, the matching condition set corresponding to the different additional conditions corresponding to the rescue behavior includes the first matching condition "user matching waiting time is greater than 20s" and the second matching condition "user matching waiting time is less than 20s", wherein the first matching condition is the matching condition for the rescue behavior corresponding to the additional condition "go directly", and the second matching condition is the matching condition for the rescue behavior corresponding to the additional condition "RVO go". Based on the current game data, it can be determined that the user matching waiting time is greater than 20s, so it can be determined that the additional condition that needs to be met in the process of the intelligent character in the game to implement the rescue behavior is "go directly", that is, the intelligent character needs to go directly to character A to rescue character A.
[0098] Step S103: In a preconfigured second strategy level, based on the first macro behavior and the first additional condition, determine a first behavior tree to be executed by the agent role; the second strategy level is a sublevel of the first strategy level, and the first behavior tree is one of the preconfigured behavior trees in the second strategy level.
[0099] In this step, based on the first macro behavior and the first additional condition, a first behavior tree to be executed by the agent role can be determined from the behavior trees preconfigured in the second strategy level.
[0100] In one of the embodiments of the present disclosure, any macro behavior type and any additional condition can be combined, and a behavior tree can be configured for each combination in the second strategy level, so that in the behavior tree preconfigured for each combination of different macro behavior types and different additional conditions, the behavior tree to be executed by the intelligent agent role can be determined as the first behavior tree preconfigured corresponding to the combination of the first macro behavior and the first additional condition.
[0101] In the present disclosure, the first macro behavior that meets the first additional condition may be split into a series of specific behaviors, and the specific behaviors may be constructed as nodes in a first behavior tree according to the relationships between the specific behaviors.
[0102] In an optional embodiment, a behavior tree matching identifier may be generated according to the first macro behavior and the first additional condition, and the behavior tree matching identifier is used to determine a preconfigured first behavior tree corresponding to the combination of the first macro behavior and the first additional condition; and then, according to the behavior tree matching identifier, a preconfigured first behavior tree corresponding to the combination of the first macro behavior and the first additional condition may be determined in the behavior trees preconfigured for each combination of different macro behavior types and different additional conditions.
[0103] In an optional implementation, referring to Table 4 below, the Chinese name of the macro behavior type can be mapped to English as the identifier of the macro behavior type, the Chinese name of the additional condition can be mapped to English as the identifier of the additional condition, and the identifier of the macro behavior type and the identifier of the additional condition can be combined, for example, by combining symbols such as underscore (_), plus sign (+), and asterisk (*), to obtain a behavior tree matching identifier. Then, according to the behavior tree matching identifier, the first behavior tree can be matched in the behavior tree preconfigured for each combination of different macro behavior types and different additional conditions.
[0104] Table 4
[0105] Macro behavior type English Mapping Rescue SAVE Repair FIX … … treat RESCUE Additional conditions English Mapping Go directly to DIRECTMOVE RVO Go RVOMOVE … … Quick Message QUICKSPEECH
[0106] For example, the first macro behavior to be implemented by the intelligent character is to repair the machine, and the first additional condition that needs to be satisfied in the process of implementing the first macro behavior is to go directly, that is, the high-level strategy that the intelligent character needs to adopt is "repair the machine + go directly". Then, through Table 4 above, it is determined that the English mappings corresponding to "repair the machine" and "go directly" are "FIX" and "DIRECTMOVE" respectively, and the behavior tree matching identifier obtained by the combination is "DIRECTMOVE_FIX", that is, the high-level strategy that the intelligent character needs to adopt can be expressed as "DIRECTMOVE_FIX".
[0107] Afterwards, according to the behavior tree matching identifier obtained by combining the first macro behavior and the first additional condition, a corresponding behavior tree can be matched in the second policy level. For example, as shown in Table 5, the behavior tree matched by the behavior tree matching identifier "DIRECTMOVE_FIX" in the second policy level is the "DIRECTMOVE_FIX" behavior tree.
[0108] Table 5
[0109] Behavior Tree Matching Flags Behavior Tree DIRECTMOVE_FIX Matches the "DIRECTMOVE_FIX" behavior tree QUICKSPEECH_FIX Matches the "QUICKSPEECH_FIX" behavior tree … … RVOMOVE_RESCUE Matches the "RVOMOVE_RESCUE" behavior tree
[0110] Reference Figure 5 , which exemplarily shows multiple behavior trees such as "DIRECTMOVE_FIX", "QUICKSPEECH_FIX" and so on pre-configured in the second strategy level, Figure 5 The tree structure of the "DIRECTMOVE_FIX" behavior tree is shown in more detail.
[0111] In one embodiment of the present disclosure, the first behavior tree may include preconfigured branches corresponding to different winning rate ranges, for example, Figure 5 As shown, the three branches of the behavior tree "DIRECTMOVE_FIX" are shown in more detail. Branch 1 corresponds to the winning rate range of winning rate < a, branch 2 corresponds to the winning rate range of a < winning rate < b, and branch 3 corresponds to the winning rate range of winning rate > b.
[0112] Optionally, the method provided by the present disclosure may further include the following steps: determining the winning rate of the intelligent agent character; if the winning rate of the intelligent agent character is within the first winning rate range among the different winning rate ranges, determining that the branch to be executed by the intelligent agent character in the first behavior tree is the first branch corresponding to the first winning rate range in the first behavior tree.
[0113] In this embodiment, executing branches corresponding to different winning rate ranges in the first behavior tree for the intelligent agent character can enable the intelligent agent character to achieve the first macro behavior that satisfies the first attachment condition, but the nodes under each branch will differ in behavior type and / or behavior parameters. This difference can adjust the winning rate of the intelligent agent character while the intelligent agent character achieves the first macro behavior that satisfies the first attachment condition, thereby guiding the winning rate of the intelligent agent character and the winning rate of the virtual character to be as close to 50-50 as possible (i.e., the winning rate of the intelligent agent character is gradually adjusted to about 50%) through the different branches of the first behavior tree, thereby enabling the intelligent agent character to adapt to the current game environment (i.e., while the intelligent agent character completes the first macro behavior that satisfies the first attachment condition), it can also ensure that the winning rate of the intelligent agent character is equivalent to that of the virtual character controlled by the user.
[0114] In an optional embodiment, the node structures of different branches of the same behavior tree are the same, and the behaviors represented by the nodes at the same position in different branches of the same behavior tree have the same behavior type and different pre-configured behavior parameters. Figure 5 As shown, the node structures of the three branches of the first behavior tree "DIRECTMOVE_FIX" are the same, and the behavior types represented by the behaviors at the same positions in the three branches are the same. For example, the behavior types represented by the behaviors of the first nodes in the three branches are all "setting the repair success rate", but the behaviors represented by the nodes at the same positions in the three branches correspond to different pre-configured behavior parameters. The first node in branch 1 needs to set the repair success rate to a1, the first node in branch 2 needs to set the repair success rate to a2, and the first node in branch 3 needs to set the repair success rate to a3.
[0115] In an optional embodiment, the node structures of different branches of the same behavior tree may be the same, but the behavior types represented by the behaviors of the same nodes in different branches of the same behavior tree may be different.
[0116] In an optional embodiment, the node structures of different branches of the same behavior tree may be different.
[0117] In one of the embodiments of the present disclosure, the winning rate of the intelligent agent role, that is, the winning probability of the intelligent agent role, can be determined by a pre-trained second supervised learning model.
[0118] Optionally, the training method of the second supervised learning model may include the following steps S03 to S04:
[0119] Step S03: Obtain a second game data training sample and a game result sample label corresponding to the second game data training sample.
[0120] In this embodiment, the second game data training sample and the game result sample label corresponding to the second game data training sample can be obtained based on the virtual character game video.
[0121] Optionally, the second game data training sample and the game result sample label corresponding to the second game data training sample can be obtained in the following way:
[0122] Step S03-1: determining the game data of the virtual character game in the video recording as the second game data training sample;
[0123] Step S03-2: Determine the winning or losing result of the target virtual character in the virtual character game video as the game result sample label corresponding to the second game data training sample; the target virtual character is one of the virtual characters participating in the game in the virtual character game video.
[0124] For example, if the target virtual character wins, the corresponding game result sample label can be 1, if the target virtual character and the opponent reach a tie, the corresponding game result sample label can be 0.5, and if the target virtual character loses, the corresponding game result sample label can be 0.
[0125] Step S04: Based on the second game data training samples and the battle result sample labels corresponding to the second game data training samples, the second supervised learning model is trained until the second supervised learning model converges.
[0126] Reference Figure 6 , exemplarily showing a model structure of a second supervised learning model, firstly, the game data of the game can be mapped to the latent space through the hidden layer to obtain the feature vectors of the game data of the game in the latent space, and then the feature vectors are connected through the feature connection layer to obtain the connected feature vector, and then the information in the connected feature vector is analyzed through at least two layers of hidden layers, and finally the output result is mapped to the interval [0,1] through the normalization layer (such as the sigmoid layer), so as to obtain the output user's winning rate at time t. Afterwards, the second supervised learning model can be adjusted through the loss function between the model output result and the label until the second supervised learning model converges, that is, the training is completed. Among them, the role of the hidden layer includes but is not limited to mapping, pooling, feature extraction, etc.
[0127] During reasoning, you only need to input the game data of the game into the trained second supervised learning model to predict the winning rate of the intelligent character at the current moment.
[0128] Among them, the training data of the first supervised learning model and the training data of the second supervised learning model can use the same type of game data or different types of game data, and the present disclosure is not intended to be limited to this.
[0129] In one of the embodiments of the present disclosure, the winning rate of the intelligent agent character may be determined periodically, for example, once every 15 seconds, 20 seconds, or 30 seconds.
[0130] Since all events in the game will affect the winning rate of the intelligent character, the winning rate of the intelligent character will change during the execution of the first branch, thus being in different winning rate ranges.
[0131] Accordingly, in this embodiment, when executing the first branch, if the winning rate of the intelligent character is changed from a first winning rate range among different winning rate ranges under the first behavior tree to a second winning rate range among different winning rate ranges under the first behavior tree, the branch to be executed by the intelligent character in the first behavior tree can be changed from the first branch to the second branch corresponding to the second winning rate range in the first behavior tree, and the second branch can be executed.
[0132] For example, refer to Figure 5 When executing branch 1 of the first behavior tree "DIRECTMOVE_FIX", if the winning rate of the intelligent character changes from the range of a and <b, you can switch from branch 1 corresponding to the winning rate <a to branch 2 corresponding to a < winning rate <b in the first behavior tree "DIRECTMOVE_FIX".
[0133] In an exemplary embodiment of the present disclosure, the winning rate of the intelligent agent role can be adjusted in the second strategy level according to the winning rate of the intelligent agent role to achieve a balance in the winning rate between the intelligent agent role and the user. When the macro behaviors that the intelligent agent needs to implement and the additional conditions that need to be met during the implementation process remain unchanged, the winning rate balance is performed through different branches of the behavior tree to be executed in the second strategy level, thereby reducing the amount of calculation at the first strategy level, eliminating the need to repeatedly adjust high-level strategies, and saving computing resources.
[0134] Step S104: determining a preconfigured control operation for a node of the first behavior tree in a preconfigured third policy level; the third policy level is a sub-level of the second policy level.
[0135] In the present disclosure, the behavior represented by each node in the first behavior tree can be implemented through one or more control operations. In this step, the control operations preconfigured for the nodes of the first behavior tree can be determined in the third strategy level. The control operations include, for example, a movement control operation from point A to point B, a window flipping control operation, a hemostasis control operation, a repair control operation, and the like.
[0136] In one of the embodiments of the present disclosure, if the branch to be executed by the intelligent character in the first behavior tree is the first branch corresponding to the first winning rate range in the first behavior tree, then in this step, the preconfigured control operation for the node of the first branch in the first behavior tree can be determined in the preconfigured third strategy level.
[0137] Step S105: Based on the control operation, the intelligent agent role is controlled so that the intelligent agent role executes the nodes of the first behavior tree to implement the first macro behavior and satisfies the first additional condition in the process of implementing the first macro behavior.
[0138] In this step, the functional interface corresponding to the control operation can be called for the intelligent agent role. The functional interface corresponding to the control operation is used to control the intelligent agent role to execute the virtual behavior corresponding to the control operation. Each call to the functional interface corresponding to the control operation preconfigured for a node of the first behavior tree can complete the execution of the node from the bottom layer, that is, control the intelligent agent role to execute the virtual behavior defined by the node. The execution of the node of the first behavior tree is completed, that is, the control of the intelligent agent role to execute the first macro behavior that meets the first additional condition is completed.
[0139] In one implementation, when executing a node of the first branch in the first behavior tree, a flag bit of the control operation corresponding to the executed node may be set. In the third strategy level, only the flag bit needs to be compared to determine which function interface corresponding to which control operation(s) needs to be called.
[0140] Table 6 below shows an exemplary correspondence between a control operation and a functional interface.
[0141] Table 6
[0142]
[0143] For example, in the second strategy level, the node "Move to Point A" is executed, and a flag can be set for the movement control operation from point A to point B. In the third strategy level, the move_interface interface can be called based on the flag "flag" of the movement control operation from point A to point B being True, and the position of point A is passed to the move_interface interface. In this way, the intelligent agent character can be controlled to move to point A through the move_interface interface.
[0144] In an exemplary embodiment of the present disclosure, the control of the intelligent agent role can be achieved through a three-layer strategy structure consisting of a macro first strategy level, a specific second strategy level, and a bottom-level third strategy level. Different control functions for the intelligent agent role are extracted into independent modules, thereby improving the robustness of the control system and ensuring the stable operation of the intelligent agent role under various circumstances. When adding new control functions, trunks or branches can be added independently at each layer without reconstructing the entire control system. Among them, the macro first strategy level can be divided into a basic strategy that characterizes macro behaviors and a superposition strategy that characterizes additional conditions that need to be met in the process of realizing macro behaviors. The high-level strategy of the intelligent agent role can be flexibly adjusted through the two aspects of macro behaviors and additional conditions, so that the intelligent agent role has better dynamic adjustment capabilities when facing a rapidly changing game environment, and the control of the intelligent agent role is more flexible and precise.
[0145] The present disclosure provides a method for controlling an intelligent agent character in a game, which first controls the intelligent agent character to play against a virtual character controlled by a user; then, in a preconfigured first strategy level, a first macro behavior to be implemented by the intelligent agent character and a first additional condition to be satisfied in the process of implementing the first macro behavior are determined based on game data through a pretrained model or a preconfigured planning table; in a preconfigured second strategy level, a first behavior tree to be executed by the intelligent agent character is determined based on the first macro behavior, the first additional condition and the winning rate of the intelligent agent character, wherein the second strategy level is a sublevel of the first strategy level; then, in a preconfigured third strategy level, a control operation preconfigured for a node of the first behavior tree is determined, wherein the third strategy level is a sublevel of the second strategy level; then, based on the control operation, the intelligent agent character is controlled so that the intelligent agent character executes the node of the first behavior tree to implement the first macro behavior and satisfies the first additional condition in the process of implementing the first macro behavior. In the present disclosure, the control of the intelligent agent role can be achieved through a three-layer strategy structure consisting of a macro first strategy level, a specific second strategy level, and a bottom-level implemented third strategy level. Among them, the macro first strategy level can be divided into macro behaviors and additional conditions that need to be met in the process of implementing macro behaviors. The high-level strategies of the intelligent agent role can be flexibly adjusted through these two aspects of macro behaviors and additional conditions, so that the intelligent agent role has better dynamic adjustment capabilities when facing a rapidly changing game environment, and the control of the intelligent agent role is more flexible and precise.
[0146] Corresponding to the method for controlling an intelligent agent character in a game provided by the embodiment of the present disclosure, the embodiment of the present disclosure also provides a device for controlling an intelligent agent character in a game. Figure 7 As shown, the device 700 includes:
[0147] The first control module 701 is used to control the intelligent character to play against the virtual character controlled by the user;
[0148] A first determination module 702 is used to determine, in a preconfigured first strategy level, a first macro behavior to be implemented by the agent character and a first additional condition to be satisfied in the process of implementing the first macro behavior based on game data through a pre-trained model or a pre-configured planning table; the first macro behavior is one of the macro behavior types preconfigured in the first strategy level, and the first additional condition is one of the additional conditions preconfigured in the first strategy level;
[0149] A second determination module 703 is used to determine a first behavior tree to be executed by the agent role based on the first macro behavior and the first additional condition in a preconfigured second strategy level; the second strategy level is a sublevel of the first strategy level, and the first behavior tree is one of the preconfigured behavior trees in the second strategy level;
[0150] A third determination module 704, configured to determine a preconfigured control operation for a node of the first behavior tree in a preconfigured third policy level; the third policy level is a sub-level of the second policy level;
[0151] The second control module 705 is used to control the intelligent agent role based on the control operation, so that the intelligent agent role executes the nodes of the first behavior tree to implement the first macro behavior and satisfies the first additional condition in the process of implementing the first macro behavior.
[0152] In an optional embodiment, the determining, based on the game data through a pre-trained model or a pre-configured planning table, the first macro behavior to be implemented by the agent character and the first additional condition to be satisfied in the process of implementing the first macro behavior includes:
[0153] According to the level information of the virtual character in the game data, a target strategy for the intelligent character is selected from a preconfigured first target strategy and a preconfigured second target strategy; the first target strategy is used to determine the macro behavior to be achieved by the intelligent character and the additional conditions that need to be met in the process of achieving the macro behavior through a pre-trained model, and the second target strategy is used to determine the macro behavior to be achieved by the intelligent character and the additional conditions that need to be met in the process of achieving the macro behavior through a pre-configured planning table;
[0154] According to the selected target strategy, the first macro behavior to be implemented by the intelligent agent role and the first additional condition to be satisfied in the process of implementing the first macro behavior are determined through a pre-trained model or a pre-configured planning table.
[0155] In an optional embodiment, selecting a target strategy for the agent character from a preconfigured first target strategy and a preconfigured second target strategy according to the level information of the virtual character in the game data comprises:
[0156] When the level information of the virtual character in the game data indicates that the level of the virtual character is within a first level range, selecting the target strategy for the intelligent character as the first target strategy;
[0157] When the level information of the virtual character in the game data indicates that the level of the virtual character is within a second level range, the target strategy for the intelligent character is selected as the second target strategy; the minimum value of the first level range is greater than the maximum value of the second level range.
[0158] In an optional embodiment, the pre-trained model is a first supervised learning model.
[0159] In an optional embodiment, the training method of the first supervised learning model includes:
[0160] Obtaining a first game data training sample, and a macro behavior sample label and an additional condition sample label corresponding to the first game data training sample;
[0161] Based on the first game data training samples, and the macro behavior sample labels and additional condition sample labels corresponding to the first game data training samples, the first supervised learning model is trained until the first supervised learning model converges.
[0162] In an optional embodiment, when the selected target strategy is the second target strategy, determining the first macro behavior to be implemented by the agent role and the first additional condition to be satisfied in the process of implementing the first macro behavior according to the second target strategy includes:
[0163] Determining a first macro behavior to be implemented by the agent character according to the game data and the priority set for the macro behavior type;
[0164] Through the preconfigured planning table, the first additional condition that needs to be met in the process of the intelligent agent role realizing the first macro behavior is determined.
[0165] In an optional embodiment, the planning matching table includes a set of matching conditions corresponding to different additional conditions corresponding to the macro behavior type;
[0166] The first additional condition to be satisfied in the process of the intelligent agent role realizing the first macro behavior is determined by the preconfigured planning table, including:
[0167] When the current game situation represented by the game data satisfies a first matching condition in a set of matching conditions corresponding to different additional conditions corresponding to the first macro behavior, the additional condition corresponding to the first macro behavior corresponding to the first matching condition is determined to be the first additional condition.
[0168] In an optional embodiment, the planning table includes additional conditions corresponding to the macro behavior type;
[0169] The first additional condition to be satisfied in the process of the intelligent agent role realizing the first macro behavior is determined by the preconfigured planning table, including:
[0170] Determine the additional condition corresponding to the first macro behavior in the planning table as the first additional condition.
[0171] In an optional embodiment, determining a first behavior tree to be executed by the agent role based on the first macro behavior and the first additional condition includes:
[0172] In the behavior trees preconfigured for each combination of different macro-behavior types and different additional conditions, it is determined that the behavior tree to be executed by the agent role is a first behavior tree preconfigured corresponding to the combination of the first macro-behavior and the first additional condition.
[0173] In an optional embodiment, the first behavior tree includes preconfigured branches corresponding to different winning rate ranges, and the method further includes:
[0174] Determining the winning rate of the intelligent agent role;
[0175] If the winning rate of the intelligent character is within a first winning rate range among the different winning rate ranges, determining that the branch to be executed by the intelligent character in the first behavior tree is a first branch corresponding to the first winning rate range in the first behavior tree;
[0176] The determining, in the preconfigured third strategy level, a preconfigured control operation for a node of the first behavior tree comprises:
[0177] In a preconfigured third strategy level, a control operation preconfigured for a node of the first branch in the first behavior tree is determined.
[0178] In an optional embodiment, the node structures of different branches of the same behavior tree are the same, and the behaviors represented by the nodes at the same position in different branches of the same behavior tree have the same behavior type and different preconfigured behavior parameters.
[0179] In an optional embodiment, the node structures of different branches of the same behavior tree are the same, and the behavior types represented by the nodes at the same position in different branches of the same behavior tree are different.
[0180] In an optional embodiment, different branches of the same behavior tree have different node structures.
[0181] In an optional embodiment, determining the winning rate of the intelligent agent role includes:
[0182] Periodically determining the winning rate of the agent role;
[0183] The method further comprises:
[0184] When executing the first branch, if the winning rate of the intelligent character changes from the first winning rate range to the second winning rate range in the different winning rate ranges, the branch to be executed by the intelligent character in the first behavior tree is changed from the first branch to the second branch corresponding to the second winning rate range in the first behavior tree, and the second branch is executed.
[0185] In an optional embodiment, determining the winning rate of the intelligent agent role includes:
[0186] The winning rate of the intelligent agent role is determined by a pre-trained second supervised learning model.
[0187] In an optional embodiment, the training method of the second supervised learning model includes:
[0188] Obtain a second game data training sample and a game result sample label corresponding to the second game data training sample;
[0189] Based on the second game data training samples and the battle result sample labels corresponding to the second game data training samples, the second supervised learning model is trained until the second supervised learning model converges.
[0190] In an optional embodiment, controlling the agent role based on the control operation includes:
[0191] The functional interface corresponding to the control operation is called for the intelligent agent role, and the functional interface corresponding to the control operation is used to control the intelligent agent role to execute the virtual behavior corresponding to the control operation.
[0192] In an optional embodiment, the game data includes in-game data and out-of-game data.
[0193] The intelligent agent character control device in the game provided by the present disclosure first controls the intelligent agent character to play against the virtual character controlled by the user; then, in a preconfigured first strategy level, based on the game data, a pre-trained model or a pre-configured planning table is used to determine the first macro behavior to be implemented by the intelligent agent character and the first additional condition to be satisfied in the process of implementing the first macro behavior; in a preconfigured second strategy level, based on the first macro behavior, the first additional condition and the winning rate of the intelligent agent character, a first behavior tree to be executed by the intelligent agent character is determined, wherein the second strategy level is a sub-level of the first strategy level; then, in a preconfigured third strategy level, a control operation preconfigured for a node of the first behavior tree is determined, wherein the third strategy level is a sub-level of the second strategy level; then, based on the control operation, the intelligent agent character is controlled so that the intelligent agent character executes the node of the first behavior tree to implement the first macro behavior and satisfies the first additional condition in the process of implementing the first macro behavior. In the present disclosure, the control of the intelligent agent role can be achieved through a three-layer strategy structure consisting of a macro first strategy level, a specific second strategy level, and a bottom-level implemented third strategy level. Among them, the macro first strategy level can be divided into macro behaviors and additional conditions that need to be met in the process of implementing macro behaviors. The high-level strategies of the intelligent agent role can be flexibly adjusted through these two aspects of macro behaviors and additional conditions, so that the intelligent agent role has better dynamic adjustment capabilities when facing a rapidly changing game environment, and the control of the intelligent agent role is more flexible and precise.
[0194] Next, an electronic device provided by an embodiment of the present disclosure is introduced. Figure 8 , Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present disclosure. The electronic device 800 may be equipped with an intelligent character control device in a game described in an embodiment of the present disclosure, so as to realize the functions in an embodiment of the present disclosure. Specifically, the electronic device 800 includes: a receiver 801, a transmitter 802, a processor 803, and a memory 804 (the number of processors 803 in the electronic device 800 may be one or more, Figure 8 In the example of FIG. 801 , a processor 803 may include an application processor 8031 and a communication processor 8032. In some embodiments of the present disclosure, the receiver 801, the transmitter 802, the processor 803 and the memory 804 may be connected via a bus or other means.
[0195] The memory 804 may include a read-only memory and a random access memory, and provides instructions and data to the processor 803. A portion of the memory 804 may also include a non-volatile random access memory (NVRAM). The memory 804 stores processor and operation instructions, executable modules or data structures, or subsets thereof, or extended sets thereof, wherein the operation instructions may include various operation instructions for implementing various operations.
[0196] The processor 803 controls the operation of the execution device. In a specific application, the various components of the execution device are coupled together through a bus system, wherein the bus system includes not only a data bus but also a power bus, a control bus, and a status signal bus, etc. However, for the sake of clarity, various buses are referred to as bus systems in the figure.
[0197] The method disclosed in the above embodiment of the present disclosure can be applied to the processor 803, or implemented by the processor 803. The processor 803 can be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 803. The above processor 803 can be a general processor, a digital signal processor (digital signal processing, DSP), a microprocessor or a microcontroller, and can further include an application specific integrated circuit (application specific integrated circuit, ASIC), a field programmable gate array (field-programmable gate array, FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The processor 803 can implement or execute the methods, steps and logic block diagrams disclosed in the embodiment of the present disclosure. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiment of the present disclosure can be directly embodied as a hardware decoding processor to be executed, or a combination of hardware and software modules in the decoding processor can be executed. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 804, and the processor 803 reads the information in the memory 804 and completes the steps of the above method in combination with its hardware.
[0198] The receiver 801 can be used to receive input digital or character information and generate signal input related to the relevant settings and function control of the execution device. The transmitter 802 can be used to output digital or character information through the first interface; the transmitter 802 can also be used to send instructions to the disk group through the first interface to modify the data in the disk group; the transmitter 802 can also include a display device such as a display screen.
[0199] In the embodiment of the present disclosure, the application processor 8031 in the processor 803 is used to execute the intelligent agent character control method in the game in the embodiment of the present disclosure. It should be noted that the specific manner in which the application processor 8031 executes each step is based on the same concept as the various method embodiments in the present disclosure, and the technical effects it brings are the same as the various method embodiments in the present disclosure. For specific contents, please refer to the description in the method embodiments shown in the above disclosure, and no further description will be given here.
[0200] The disclosed embodiment also provides a chip for running instructions, which is used to execute the technical solution of the intelligent character control method in the game in the above embodiment.
[0201] The embodiment of the present disclosure also provides a computer-readable storage medium, in which computer instructions are stored. When the computer instructions are executed on a processor, the processor executes the technical solution of the intelligent agent character control method in the game in the above embodiment.
[0202] The embodiments of the present disclosure also provide a computer program product, including a computer program, which, when executed by a processor, is used to execute the technical solution of the intelligent agent character control method in the game in the above embodiments.
[0203] The computer readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or dedicated server.
[0204] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
[0205] Although the present disclosure is disclosed as above in the form of a preferred embodiment, it is not intended to limit the present disclosure. Any person skilled in the art may make possible changes and modifications without departing from the spirit and scope of the present disclosure. Therefore, the scope of protection of the present disclosure shall be based on the scope defined by the claims of the present disclosure.
Claims
1. A method for controlling an intelligent character in a game, characterized in that: The method comprises: Control the intelligent character to play against the virtual character controlled by the user; In the preconfigured first strategy level, a first macro behavior to be implemented by the agent character and a first additional condition to be satisfied in the process of implementing the first macro behavior are determined based on game data through a pre-trained model or a pre-configured planning table; the first macro behavior is one of the macro behavior types preconfigured in the first strategy level, and the first additional condition is one of the additional conditions preconfigured in the first strategy level; In a preconfigured second strategy level, based on the first macro behavior and the first additional condition, a first behavior tree to be executed by the agent role is determined; the second strategy level is a sublevel of the first strategy level, and the first behavior tree is one of the preconfigured behavior trees in the second strategy level; Determining, in a preconfigured third policy level, a preconfigured control operation for a node of the first behavior tree; the third policy level being a sub-level of the second policy level; The agent role is controlled based on the control operation, so that the agent role executes the nodes of the first behavior tree to implement the first macro behavior and satisfies the first additional condition in the process of implementing the first macro behavior.
2. The method according to claim 1, characterized in that The determining, based on the game data through a pre-trained model or a pre-configured planning table, of the first macro behavior to be implemented by the agent character and the first additional condition to be satisfied in the process of implementing the first macro behavior includes: According to the level information of the virtual character in the game data, a target strategy for the intelligent character is selected from a preconfigured first target strategy and a preconfigured second target strategy; the first target strategy is used to determine the macro behavior to be achieved by the intelligent character and the additional conditions that need to be met in the process of achieving the macro behavior through a pre-trained model, and the second target strategy is used to determine the macro behavior to be achieved by the intelligent character and the additional conditions that need to be met in the process of achieving the macro behavior through a pre-configured planning table; According to the selected target strategy, the first macro behavior to be implemented by the intelligent agent role and the first additional condition to be satisfied in the process of implementing the first macro behavior are determined through a pre-trained model or a pre-configured planning table.
3. The method according to claim 2, characterized in that The step of selecting a target strategy for the agent character from a preconfigured first target strategy and a preconfigured second target strategy according to the level information of the virtual character in the game data comprises: When the level information of the virtual character in the game data indicates that the level of the virtual character is within a first level range, selecting the target strategy for the intelligent character as the first target strategy; When the level information of the virtual character in the game data indicates that the level of the virtual character is within a second level range, the target strategy for the intelligent character is selected as the second target strategy; the minimum value of the first level range is greater than the maximum value of the second level range.
4. The method according to claim 1, characterized in that: The pre-trained model is a first supervised learning model.
5. The method according to claim 4, characterized in that The training method of the first supervised learning model includes: Obtaining a first game data training sample, and a macro behavior sample label and an additional condition sample label corresponding to the first game data training sample; Based on the first game data training samples, and the macro behavior sample labels and additional condition sample labels corresponding to the first game data training samples, the first supervised learning model is trained until the first supervised learning model converges.
6. The method according to claim 2, characterized in that When the selected target strategy is the second target strategy, determining the first macro behavior to be implemented by the agent role and the first additional condition to be satisfied in the process of implementing the first macro behavior according to the second target strategy includes: Determining a first macro behavior to be implemented by the agent character according to the game data and the priority set for the macro behavior type; Through the preconfigured planning table, the first additional condition that needs to be met in the process of the intelligent agent role realizing the first macro behavior is determined.
7. The method according to claim 6, characterized in that The planning matching table includes a set of matching conditions corresponding to different additional conditions corresponding to the macro behavior type; The first additional condition to be satisfied in the process of the intelligent agent role realizing the first macro behavior is determined by the preconfigured planning table, including: When the current game situation represented by the game data satisfies a first matching condition in a set of matching conditions corresponding to different additional conditions corresponding to the first macro behavior, the additional condition corresponding to the first macro behavior corresponding to the first matching condition is determined to be the first additional condition.
8. The method according to claim 6, characterized in that The planning table includes additional conditions corresponding to the macro behavior type; The first additional condition to be satisfied in the process of the intelligent agent role realizing the first macro behavior is determined by the preconfigured planning table, including: Determine the additional condition corresponding to the first macro behavior in the planning table as the first additional condition.
9. The method according to claim 1, characterized in that: The step of determining a first behavior tree to be executed by the agent role based on the first macro behavior and the first additional condition includes: In the behavior trees preconfigured for each combination of different macro-behavior types and different additional conditions, it is determined that the behavior tree to be executed by the agent role is a first behavior tree preconfigured corresponding to the combination of the first macro-behavior and the first additional condition.
10. The method according to claim 9, characterized in that The first behavior tree includes preconfigured branches corresponding to different winning rate ranges, and the method further includes: Determining the winning rate of the agent character; If the winning rate of the intelligent character is within a first winning rate range among the different winning rate ranges, determining that the branch to be executed by the intelligent character in the first behavior tree is a first branch corresponding to the first winning rate range in the first behavior tree; The determining, in the preconfigured third strategy level, a preconfigured control operation for a node of the first behavior tree comprises: In a preconfigured third strategy level, a control operation preconfigured for a node of the first branch in the first behavior tree is determined.
11. The method according to claim 10, characterized in that The node structures of different branches of the same behavior tree are the same, and the behaviors represented by the nodes at the same position in different branches of the same behavior tree have the same behavior type and different pre-configured behavior parameters.
12. The method according to claim 10, characterized in that The node structures of different branches of the same behavior tree are the same, and the behavior types represented by the nodes at the same position in different branches of the same behavior tree are different.
13. The method according to claim 10, characterized in that Different branches of the same behavior tree have different node structures.
14. The method according to claim 10, characterized in that Determining the winning rate of the intelligent agent role includes: Periodically determining the winning rate of the agent role; The method further comprises: When executing the first branch, if the winning rate of the intelligent character changes from the first winning rate range to the second winning rate range in the different winning rate ranges, the branch to be executed by the intelligent character in the first behavior tree is changed from the first branch to the second branch corresponding to the second winning rate range in the first behavior tree, and the second branch is executed.
15. The method according to claim 10, characterized in that Determining the winning rate of the intelligent agent role includes: The winning rate of the intelligent agent role is determined by a pre-trained second supervised learning model.
16. The method according to claim 15, characterized in that The training method of the second supervised learning model includes: Obtain a second game data training sample and a game result sample label corresponding to the second game data training sample; Based on the second game data training samples and the battle result sample labels corresponding to the second game data training samples, the second supervised learning model is trained until the second supervised learning model converges.
17. The method according to claim 1, characterized in that The controlling the agent role based on the control operation comprises: The functional interface corresponding to the control operation is called for the intelligent agent role, and the functional interface corresponding to the control operation is used to control the intelligent agent role to execute the virtual behavior corresponding to the control operation.
18. The method according to claim 1, characterized in that The game data includes in-game data and out-of-game data.
19. A device for controlling an intelligent character in a game, characterized in that: The device comprises: A first control module, used to control the intelligent character to play against the virtual character controlled by the user; A first determination module is used to determine, in a preconfigured first strategy level, a first macro behavior to be implemented by the agent character and a first additional condition to be satisfied in the process of implementing the first macro behavior based on game data through a pre-trained model or a pre-configured planning table; the first macro behavior is one of the macro behavior types preconfigured in the first strategy level, and the first additional condition is one of the additional conditions preconfigured in the first strategy level; A second determination module is used to determine a first behavior tree to be executed by the agent role based on the first macro behavior and the first additional condition in a preconfigured second strategy level; the second strategy level is a sublevel of the first strategy level, and the first behavior tree is one of the preconfigured behavior trees in the second strategy level; a third determination module, configured to determine, in a preconfigured third policy level, a control operation preconfigured for a node of the first behavior tree; the third policy level being a sub-level of the second policy level; A second control module is used to control the intelligent agent role based on the control operation, so that the intelligent agent role executes the nodes of the first behavior tree to implement the first macro behavior and satisfies the first additional condition in the process of implementing the first macro behavior.
20. An electronic device, characterized in that: include: A processor, a memory, and computer program instructions stored on the memory and executable on the processor; When the processor executes the computer program instructions, the method for controlling an intelligent character in a game as described in any one of claims 1 to 18 is implemented.
21. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer program instructions, which, when executed by a processor, are used to implement the method for controlling an intelligent character in a game as described in any one of claims 1 to 18 above.
Citation Information
Patent Citations
Virtual object control method and device, equipment and storage medium
CN111228813A
Game interaction method and device, equipment and storage medium
CN112870721A
Method and device for generating battle fight type AI game model, equipment and medium
CN112870722A
Intelligent virtual character control method and device, equipment and storage medium
CN116459520A
Game role control method and device, electronic equipment and storage medium
CN117018618A