A target behavior determination method and device, and a storage medium
By constructing a behavior tree, firearm behavior is encapsulated into behavior nodes, which solves the complexity problem of finite state machines in the design of firearms in science fiction. It enables the rapid adjustment and parallel execution of target behavior without modifying the code, thereby improving the efficiency and flexibility of weapon design.
Patent Information
- Application Number
- CN202010462437.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-05-27
- Publication Date
- 2026-08-25
- Estimated Expiration
- 2040-05-27
AI Technical Summary
Existing finite state machines are difficult to adapt to the degree of freedom required in science fiction in firearm design. This results in complex state machine processes that are difficult to parallelize, especially when the aiming function is executed simultaneously with other states, leading to low efficiency. Furthermore, they are not suitable for visual programming, which affects the design efficiency and iteration speed of innovative weapon prototypes.
By employing a behavior tree construction method, the behavior of the target object is encapsulated into behavior nodes. The behavior tree is constructed based on the triggering conditions of the behavior, allowing the behavior to be adjusted without modifying the code, thus enabling rapid iteration of the behavior.
By quickly matching target behaviors using behavior trees, the iteration speed of target object behaviors is improved, multiple behaviors can be executed in parallel, the weapon design process is simplified, and the development efficiency of innovative weapon prototypes is improved.
Smart Images

Figure CN112764727B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a method, apparatus and storage medium for determining target behavior. Background Technology
[0002] In the game, the development of firearms is mainly carried out in the weapon base class, using finite state machines to manage the weapon's equipment, reloading, firing and other behavioral states. Different functions of weapons are extended through inheritance and overloading, and all changes to the logic need to be modified at the code level.
[0003] Existing state machine schemes abstract the main behaviors of a weapon (loading, unloading, idle, firing, reloading) into states, and define the transition directions (one-way, two-way) and conditions between states. For each state module, corresponding actions can be defined for entering or exiting, and logic to be executed in each frame can also be defined for the state. For example, for the firing state, a certain hand-raising delay is executed upon entering, and within the firing state, a firing check is performed each frame; if the firing interval is met, the specific firing logic is executed.
[0004] To extend to new weapons, it's necessary to inherit new subclasses from the weapon base class and overload certain state modules or state transition conditions to achieve different functionalities. For example, for lasers and shotguns, the functions inside the firing state need to be overloaded to achieve different firing logic.
[0005] The biggest drawback of finite state machines is that all states must be known in advance before code planning can begin. In traditional firearm design, because the firearm prototype is fixed, the overall flowchart of the state machine can be pre-arranged before development. However, for science fiction firearms, their states, expressions, and input patterns have greater freedom. Each new state requires consideration of its connections with other existing states. Therefore, if the base class contains many states, the state machine flow becomes extremely complex. Furthermore, finite state machines are difficult to parallelize, making it difficult to execute the logic of two states simultaneously. This limitation affects the design of many firearms, especially the "aiming" function, which particularly needs to be executed simultaneously with other states. For example, aiming can lock onto a target while simultaneously charging the weapon. Existing development methods can only handle aiming behavior separately, without incorporating it into the state machine.
[0006] Furthermore, the development of existing finite state machines is not suitable for visual programming, as the transition conditions between states are numerous and complex, and are best planned by programmers at the code level. Consequently, current technical solutions are inefficient for designing innovative weapon prototypes, resulting in slow iteration.
[0007] Therefore, it is necessary to provide a method, apparatus, and storage medium for determining target behavior, which can quickly adjust the behavior of the target object without modifying the code, thereby improving the iteration speed of the target object's behavior. Summary of the Invention
[0008] This application provides a method, apparatus, and storage medium for determining target behavior, which can quickly adjust the behavior of a target object without modifying the code, thereby improving the iteration speed of the target object's behavior.
[0009] On the one hand, this application provides a method for determining target behavior, the method comprising:
[0010] Determine the target triggering conditions for the target object;
[0011] Determine the behavior tree corresponding to the target object;
[0012] Based on the target triggering condition, find the target behavior node that matches the target triggering condition from the behavior tree;
[0013] Determine the target behavior corresponding to the target behavior node;
[0014] The method for constructing the behavior tree includes:
[0015] Determine the set of behaviors of the target object;
[0016] Each behavior in the set of behaviors of the target object is encapsulated into a behavior node, and the hierarchy and triggering conditions of each behavior node are determined.
[0017] The behavior tree is constructed based on the hierarchy and triggering conditions of each behavior node.
[0018] On the other hand, a target behavior determination apparatus is provided, the apparatus comprising:
[0019] The target triggering condition determination module is used to determine the target triggering conditions for the target object;
[0020] The behavior tree determination module is used to determine the behavior tree corresponding to the target object;
[0021] The target behavior node lookup module is used to find target behavior nodes that match the target triggering conditions from the behavior tree based on the target triggering conditions.
[0022] The target behavior determination module is used to determine the target behavior corresponding to the target behavior node;
[0023] Behavior tree construction module, the behavior tree construction module includes:
[0024] The behavior set determination submodule is used to determine the behavior set of the target object;
[0025] The behavior node encapsulation submodule is used to encapsulate each behavior in the behavior set of the target object into a behavior node, and to determine the hierarchy and triggering conditions of each behavior node.
[0026] The behavior tree construction submodule is used to construct the behavior tree based on the hierarchy and triggering conditions of each behavior node.
[0027] On the other hand, a computer storage medium is provided that stores at least one instruction or at least one program, which is loaded and executed by a processor to achieve the target behavior determination method as described above.
[0028] The target behavior determination method, apparatus, and storage medium provided in this application have the following technical advantages:
[0029] This application encapsulates the behavior of the target object into behavior nodes, and constructs a behavior tree through the triggering conditions of the behavior and the behavior nodes. This makes it easy to modify the behavior of the weapon by adjusting the behavior nodes. Without modifying the code, the behavior of the target object can be quickly adjusted, thereby improving the iteration speed of the target object's behavior. When the target triggering condition is triggered, the corresponding target behavior can be quickly matched through the behavior tree. Attached Figure Description
[0030] To more clearly illustrate the technical solutions and advantages in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0031] Figure 1 This is a schematic diagram of a target behavior determination system provided in an embodiment of this application;
[0032] Figure 2 This is a flowchart illustrating a method for determining target behavior provided in an embodiment of this application;
[0033] Figure 3 This is a flowchart illustrating a method for determining the target behavior corresponding to the target behavior node provided in an embodiment of this application;
[0034] Figure 4 This is a flowchart illustrating a method for determining the hierarchy and triggering conditions of each behavior node according to an embodiment of this application.
[0035] Figure 5This is a flowchart illustrating the interaction method between the client and the server provided in an embodiment of this application;
[0036] Figure 6 This is a schematic diagram of a behavior tree structure provided in an embodiment of this application;
[0037] Figure 7 This is a schematic diagram of a dynamic hot-swappable replacement logic provided in an embodiment of this application;
[0038] Figure 8 This is a diagram illustrating a tree structure built using blueprint nodes, as provided in an embodiment of this application.
[0039] Figure 9 This is a schematic diagram of the parameters of a behavior node configured using blueprint variables, provided in an embodiment of this application.
[0040] Figure 10 This is a schematic diagram of the structure of a target behavior determination device provided in an embodiment of this application;
[0041] Figure 11 This is a schematic diagram of the structure of a server provided in an embodiment of this application. Detailed Implementation
[0042] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the scope of protection of this application.
[0043] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or server that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0044] Please see Figure 1 , Figure 1 This is a schematic diagram of a target behavior determination system provided in an embodiment of this application, such as... Figure 1 As shown, the target behavior determination system may include at least server 01 and client 02.
[0045] Specifically, in the embodiments of this specification, server 01 may include a standalone server, a distributed server, or a server cluster consisting of multiple servers. Server 01 may include a network communication unit, a processor, and memory, etc. Specifically, server 01 can be used to verify the target behavior of the client.
[0046] Specifically, in this embodiment of the specification, the client 02 may include physical devices such as smartphones, desktop computers, tablets, laptops, digital assistants, and smart wearable devices, and may also include software running on the physical device, such as web pages provided to users by some service providers, or applications provided to users by these service providers. Specifically, the client 02 can be used to construct a behavior tree and determine the target behavior based on the behavior tree logic.
[0047] The following describes a method for determining the target behavior according to this application. Figure 2 This is a flowchart illustrating a method for determining target behavior according to an embodiment of this application. This specification provides the operational steps of the method described in the embodiments or flowchart, but based on conventional or non-inventive labor, more or fewer operational steps may be included. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only execution order. In actual system or server product execution, the method can be executed sequentially or in parallel (e.g., in a parallel processor or multi-threaded processing environment) as shown in the embodiments or accompanying drawings. Specifically, as... Figure 2 As shown, the method may include:
[0048] S201: Determine the target triggering conditions for the target object.
[0049] In the embodiments of this specification, the method can be applied to online games, and the same game may include multiple target objects; the target objects may be weapons used in the online game, such as guns, knives, etc. used in the game.
[0050] In the embodiments described in this specification, determining the target triggering condition for the target object may include:
[0051] In response to a user's trigger action, determine the target trigger conditions for the target object.
[0052] Specifically, in the embodiments of this specification, the user's triggering operation can be a key operation on the keyboard; for example, after the user selects the target object on the display screen, they operate the key on the keyboard; thus, the target triggering condition can be determined based on the user's triggering operation.
[0053] Specifically, in the embodiments of this specification, the user's triggering operation can also be a user's triggering operation on the display screen, such as a user's single-click, double-click, swipe, or drag operation on the display screen.
[0054] In the embodiments of this specification, the target triggering condition can be one or more. For example, when a user clicks the left key and the space key at the same time, two target triggering conditions corresponding to the two keys can be determined.
[0055] In the embodiments described in this specification, the method may further include:
[0056] The correspondence between operation keys and trigger conditions is stored in advance.
[0057] In the embodiments of this specification, when the user presses the left key, the corresponding trigger condition is left key activation; when the user presses the right key, the corresponding trigger condition is right key activation; thus, multiple sets of operation key correspondences with trigger conditions can be set.
[0058] In the embodiments of this specification, the target triggering condition can be quickly determined by setting the correspondence between the user's triggering operation and the triggering condition.
[0059] In the embodiments of this specification, each triggering condition corresponds to at least two sets of triggering logic. After the step of determining the target triggering condition for the target object, the method includes:
[0060] Determine the target triggering logic corresponding to the target triggering condition.
[0061] In the embodiments of this specification, each triggering condition corresponds to a behavior node, and each triggering condition may include two or more sets of triggering logic. The method may also include:
[0062] Store the correspondence between the triggering conditions and the triggering logic.
[0063] S203: Determine the behavior tree corresponding to the target object.
[0064] In this embodiment of the specification, a corresponding behavior tree can be constructed for each object. Before the step of determining the behavior tree corresponding to the target object, the method may further include:
[0065] Establish the correspondence between object identifiers and behavior tree identifiers;
[0066] The correspondence between the object identifier and the behavior tree identifier is stored in a preset database.
[0067] Accordingly, determining the behavior tree corresponding to the target object may include:
[0068] Determine the identification information of the target object;
[0069] Based on the identification information of the target object, retrieve the identification information of the behavior tree that matches the identification information of the target object from the preset database;
[0070] The behavior tree that matches the identification information of the behavior tree is determined as the behavior tree corresponding to the target object.
[0071] In the embodiments of this specification, the behavior tree corresponding to the target object can be quickly determined by storing the correspondence between the object identifier and the behavior tree identifier.
[0072] S205: Based on the target triggering condition, search for the target behavior node that matches the target triggering condition in the behavior tree.
[0073] In the embodiments of this specification, each behavior tree may include multiple behavior nodes, wherein the multiple behavior nodes may include parallel nodes; when the target triggering condition is one, a target behavior node matching the target triggering condition is searched from the behavior tree; when the target triggering condition is at least two, at least two target behavior nodes matching the target triggering condition are searched from the behavior tree, wherein the at least two target behavior nodes may be parallel nodes.
[0074] In the embodiments described in this specification, at least two behaviors of the target object can be executed simultaneously through parallel nodes.
[0075] In this embodiment of the specification, after the step of determining the target triggering logic corresponding to the target triggering condition, the method further includes:
[0076] Determine whether the current behavior tree includes the target trigger logic;
[0077] Accordingly, the step of searching for a target behavior node that matches the target triggering condition from the behavior tree includes:
[0078] If the current behavior tree includes target triggering logic, the target behavior node that matches the target triggering condition is searched in the behavior tree according to the target triggering condition.
[0079] Specifically, in the embodiments of this specification, for example, when the target object (e.g., a weapon or firearm) needs to be changed to a new "firing" mode after deformation, the firing module can be dynamically hot-swapped. During operation, the original module is turned off and exited, and then a new module is connected and reactivated.
[0080] S207: Determine the target behavior corresponding to the target behavior node.
[0081] In the embodiments described in this specification, such as Figure 3 As shown, before the step of determining the target behavior corresponding to the target behavior node, the method further includes:
[0082] S2061: Determine a set of higher-level behavior nodes that are at a higher level than the target behavior node;
[0083] S2063: Determine whether the behavior corresponding to each behavior node in the high-level behavior node set has been executed;
[0084] Accordingly, determining the target behavior corresponding to the target behavior node includes:
[0085] If the behavior corresponding to each behavior node in the high-level behavior node set has been executed, the target behavior corresponding to the target behavior node is determined.
[0086] In the embodiments of this specification, the execution logic of behavior nodes in the behavior tree is to execute sequentially downwards from the root node. The target behavior node can only be executed after the behaviors corresponding to the parent node and the nodes above the parent node have been executed.
[0087] In the embodiments of this specification, when there is one target behavior node, one target behavior is determined; when there are at least two target behavior nodes, two target behaviors are determined.
[0088] In this embodiment of the specification, after the step of determining the target behavior corresponding to the target behavior node, the method further includes:
[0089] Execute the target behavior to obtain the execution result;
[0090] Determine whether the target behavior is an action performed on the target subject;
[0091] If so, a network call request is sent to the server, the network call request carrying the identification information of the target behavior and the execution result, so that the server can verify the execution result based on the identification information of the target behavior.
[0092] In the embodiments of this specification, the server can be the backend server corresponding to the client, the target subject can be a character or object in a game application, the action acting on the target subject can be the "fire" action in the game, and the corresponding execution result is the damage value to the target subject. To prevent cheating by client users, when the server receives a network call request and calculates the damage value, it will simulate the client user's operation to determine the actual damage value; if the actual damage value is consistent with the damage value sent by the client, it means that the client user has not cheated; if the actual damage value is inconsistent with the damage value sent by the client, it means that the client user has not cheated; the server calculates the damage based on the actual damage value.
[0093] In the embodiments of this specification, the interaction method between the client and the server is as follows: Figure 5 As shown, users execute behavior tree logic sequentially from the root node through input operations on the client. When the firing action is executed, the firing action module initiates a corresponding network call request, causing the server to also fire and calculate damage. This avoids the complex validation and error correction functions of the behavior tree itself, decoupling the behavior tree from network synchronization, while subordinate nodes perform network call actions according to local conditions. However, to prevent players from skipping the pre-processing logic switches on the local client to cheat, key steps can be validated on the server to ensure the accuracy of behavior calculation results on the server.
[0094] In the embodiments of this specification, the method for constructing the behavior tree may include:
[0095] S301: Determine the set of behaviors of the target object.
[0096] In the embodiments of this specification, after determining the target object, the set of behaviors for the target object can be determined. For example, when the target object is a firearm, the corresponding set of behaviors may include: charging, aiming, reloading, generating a laser sight, firing, etc. When there are multiple target objects in a game application, the set of behaviors corresponding to each target object can be determined, thereby facilitating the construction of a behavior tree for each target object.
[0097] S303: Encapsulate each behavior in the set of behaviors of the target object into a behavior node, and determine the level and triggering conditions of each behavior node.
[0098] In the embodiments of this specification, after encapsulating each behavior in the set of behaviors of the target object into a behavior node, a tree structure can be used to organize the relationships between the behavior nodes. Adding, deleting, or modifying behavior nodes only requires adjusting the position of the tree structure. Furthermore, placing child nodes under parallel control nodes within the tree structure enables the parallel execution of behavior nodes.
[0099] In the embodiments of this specification, the method for constructing the behavior tree further includes:
[0100] Determine the execution order and triggering conditions of each behavior in the set of behaviors of the target object.
[0101] In the embodiments of this specification, the actions corresponding to the target object have a sequential execution order. For example, when the target object is a firearm, the corresponding action set includes actions such as: charging, aiming, reloading, generating a laser aiming line, and firing. The first action executed may include charging, aiming, reloading, and generating a laser aiming line, and the second action executed may be firing. Each action is set with a corresponding trigger condition, such as... Figure 6 As shown, the trigger condition for charging is activation with the left key on the keyboard, the trigger condition for aiming is activation with the right key, and the trigger condition for reloading is meeting the reloading condition. The reloading trigger condition can be triggered by user input or by firing. For example, reloading is automatically executed when the user triggers the firing action; the trigger condition for generating the laser aiming line is a Boolean value of true, meaning the gun generates a laser aiming line at all times; the trigger condition for firing is a charge value greater than or equal to 1.
[0102] In the embodiments described in this specification, such as Figure 4 As shown, the step of encapsulating each behavior in the set of behaviors of the target object into a behavior node, and determining the hierarchy and triggering conditions of each behavior node includes:
[0103] S3031: Encapsulate each behavior in the set of behaviors of the target object into a behavior node, and construct the correspondence between each behavior node and the triggering condition according to the triggering condition of each behavior;
[0104] S3033: Determine the hierarchy of each behavior node based on the execution order of each behavior;
[0105] In the embodiments of this specification, the step of encapsulating each behavior in the set of behaviors of the target object into a behavior node, and determining the hierarchy and triggering conditions of each behavior node, includes:
[0106] Each behavior in the set of behaviors of the target object is encapsulated into a behavior node, and the correspondence between each behavior node and the triggering condition is constructed.
[0107] Determine the hierarchy of each behavior node based on the execution order of each behavior;
[0108] Accordingly, constructing the behavior tree based on the hierarchy and triggering conditions of each behavior node includes:
[0109] The behavior tree is constructed based on the hierarchy of each behavior node and the correspondence between each behavior node and the triggering condition.
[0110] S305: Construct the behavior tree based on the hierarchy and triggering conditions of each behavior node.
[0111] In this embodiment of the specification, constructing the behavior tree based on the hierarchy and triggering conditions of each behavior node includes:
[0112] The behavior tree is constructed based on the hierarchy of each behavior node and the correspondence between each behavior node and the triggering condition.
[0113] Specifically, in the embodiments of this specification, constructing the behavior tree based on the hierarchy and triggering conditions of each behavior node includes:
[0114] Each behavior node group is obtained by using the triggering condition of each behavior node as the parent node of each behavior node.
[0115] The hierarchy of each behavior node group is determined based on the hierarchy of the behavior nodes in each behavior node group;
[0116] The behavior tree is constructed based on the hierarchy of each behavior node group.
[0117] In the embodiments of this specification, each behavior node group includes a trigger condition and a corresponding behavior node. Determining the hierarchy of behavior node groups is equivalent to determining the parent-child relationship between two behavior node groups. The trigger condition serves as the parent node of the corresponding behavior node, and the trigger conditions corresponding to parallel behavior nodes are also parallel nodes; thus facilitating the execution of parallel behaviors based on parallel trigger conditions.
[0118] In the embodiments of this specification, when the target object is a firearm, its corresponding behavior tree is as follows: Figure 6 As shown, when the target triggering condition is left-click activation and right-click activation, the corresponding target behavior nodes are charging and aiming; when the parallel nodes charging, aiming, reloading, and generating laser aiming lines are all completed, if the charging value is greater than or equal to 1, the firing behavior is executed.
[0119] In the embodiments of this specification, when constructing a behavior tree, if a behavior corresponds to multiple triggering logics, the correspondence between the behavior and the multiple triggering logics is stored; and a triggering logic is selected according to a preset rule to construct the behavior tree.
[0120] Specifically, in the embodiments of this specification, the tree structure can be adjusted; such as... Figure 7As shown, when a weapon changes to a new firing mode after transformation, the firing module is dynamically hot-swapped. During operation, the original module is turned off and exited, then the new module is connected and reactivated. The corresponding pre-switching logic can also be replaced if necessary. Before weapon transformation, the firing behavior is triggered when the charge value meets a preset condition. After transformation, the firing behavior is triggered when the number of locked targets meets a preset condition. This allows the firing logic to be replaced during game operation.
[0121] In the embodiments described in this specification, the game application can be developed using the UE4 engine. Within the engine editor, game designers can flexibly build a new weapon using blueprint nodes. For example... Figure 8 As shown, game designers can freely combine the weapon behavior nodes (firing, charging, aiming, etc.) encapsulated by programmers to quickly build weapon functional prototypes. The charging module, aiming module, laser aiming line generation module, and instant bullet firing module all have corresponding parameter settings. The parameter type and number for each module can be set according to actual needs.
[0122] For each behavior node, game designers can configure the corresponding parameters using blueprint variables. For example... Figure 9 As shown, the firing module (fire instant bullet module) corresponding to a weapon can be configured with a series of corresponding firing parameters or resources (recoil, damage, muzzle flash effects, etc.), and can be quickly adjusted and tested in the editor.
[0123] In the embodiments described in this specification, the nodes of the behavior tree can be adjusted according to changes in the behavior of the target object, such as adding, deleting, or modifying behavior nodes, greatly improving weapon development efficiency. Programmers only need to focus on developing the core behavior modules and encapsulating them into visual nodes, while game designers can quickly build a weapon with entirely new functions in the engine editor using the Blueprint tool. At the same time, designers can also flexibly adjust the behaviors and parameters in the weapon to quickly iterate the weapon prototype, which is of great value in the early prototype exploration stage of the game, allowing for significant functional changes without relying on programmer support.
[0124] In the embodiments of this specification, the behavior tree before and after the change can be visualized, realizing the visualization of the difference information of the behavior tree before and after the change. This is beneficial to intuitively display the difference information of the behavior tree, and to help testers accurately and quickly identify and determine the difference information of the behavior tree. Furthermore, it is beneficial to ensure the quality and efficiency of game management and game testing.
[0125] As can be seen from the technical solutions provided in the embodiments of this specification above, the embodiments of this specification encapsulate the behavior of the target object into behavior nodes, and construct a behavior tree through the triggering conditions of the behavior and the behavior nodes, thereby facilitating the modification of the weapon's behavior by adjusting the behavior nodes. Without modifying the code, the behavior of the target object can be quickly adjusted, thereby improving the iteration speed of the target object's behavior; when the target triggering condition is triggered, the corresponding target behavior can be quickly matched through the behavior tree.
[0126] This application also provides a target behavior determination device, such as... Figure 10 As shown, the device includes:
[0127] The target triggering condition determination module 1010 is used to determine the target triggering conditions for the target object.
[0128] The behavior tree determination module 1020 is used to determine the behavior tree corresponding to the target object;
[0129] The target behavior node lookup module 1030 is used to look up target behavior nodes that match the target triggering conditions from the behavior tree according to the target triggering conditions.
[0130] The target behavior determination module 1040 is used to determine the target behavior corresponding to the target behavior node;
[0131] It also includes a behavior tree construction module 1050, which includes:
[0132] The behavior set determination submodule 10510 is used to determine the behavior set of the target object;
[0133] The behavior node encapsulation submodule 10520 is used to encapsulate each behavior in the behavior set of the target object into a behavior node, and to determine the level and triggering conditions of each behavior node.
[0134] The behavior tree construction submodule 10530 is used to construct the behavior tree based on the hierarchy and triggering conditions of each behavior node.
[0135] In some embodiments, the behavior tree building module further includes:
[0136] The trigger condition determination submodule is used to determine the execution order and trigger condition of each behavior in the behavior set of the target object.
[0137] In some embodiments, the behavior node encapsulation submodule includes:
[0138] The relationship building unit is used to encapsulate each behavior in the set of behaviors of the target object into a behavior node, and to build a correspondence between each behavior node and the triggering condition based on the triggering condition of each behavior.
[0139] The first-level determination unit is used to determine the level of each behavior node based on the execution order of each behavior.
[0140] In some embodiments, the behavior tree construction submodule includes:
[0141] The first behavior tree construction unit is used to construct the behavior tree according to the hierarchy of each behavior node and the correspondence between each behavior node and the triggering condition.
[0142] In some embodiments, the behavior tree construction submodule includes:
[0143] A behavior node group determination unit is used to determine each behavior node group by taking the triggering condition of each behavior node as the parent node of each behavior node.
[0144] The second-level determination unit is used to determine the level of each behavior node group based on the level of the behavior nodes in each behavior node group.
[0145] The second behavior tree construction unit is used to construct the behavior tree according to the hierarchy of each behavior node group.
[0146] In some embodiments, each trigger condition corresponds to at least two sets of trigger logic, and the apparatus may further include:
[0147] The target triggering logic determination module is used to determine the target triggering logic corresponding to the target triggering condition.
[0148] In some embodiments, the apparatus may further include:
[0149] The target trigger logic judgment module is used to determine whether the current behavior tree includes target trigger logic.
[0150] In some embodiments, the target behavior node lookup module includes:
[0151] The first execution submodule is used to, if the current behavior tree includes target triggering logic, execute the search for a target behavior node in the behavior tree that matches the target triggering condition, based on the target triggering condition.
[0152] In some embodiments, the target triggering conditions are at least two, and the target behavior node search module includes:
[0153] The lookup submodule is used to find the target behavior node that matches each target trigger condition from the behavior tree based on at least two target trigger conditions.
[0154] In some embodiments, the apparatus may further include:
[0155] The behavior node set determination module is used to determine a higher-level behavior node set that is at a higher level than the target behavior node;
[0156] The behavior determination module is used to determine whether the behavior corresponding to each behavior node in the high-level behavior node set has been executed.
[0157] In some embodiments, the target behavior determination module includes:
[0158] The second execution submodule is used to execute the target behavior corresponding to the target behavior node if the behavior corresponding to each behavior node in the high-level behavior node set has been executed.
[0159] In some embodiments, the apparatus may further include:
[0160] The execution result determination module is used to execute the target behavior and obtain the execution result.
[0161] The target behavior determination module is used to determine whether the target behavior is an action that acts on the target subject;
[0162] The request sending module is used to send a network call request to the server if the target behavior is an action acting on a target subject. The network call request carries the identification information of the target behavior and the execution result, so that the server can verify the execution result based on the identification information of the target behavior.
[0163] The apparatus and method embodiments described herein are based on the same inventive concept.
[0164] This application provides a target behavior determination device, which includes a processor and a memory. The memory stores at least one instruction or at least one program, which is loaded and executed by the processor to implement the target behavior determination method provided in the above method embodiments.
[0165] Embodiments of this application also provide a computer storage medium, which can be disposed in a terminal to store at least one instruction or at least one program related to implementing a target behavior determination method in the method embodiments. The at least one instruction or at least one program is loaded and executed by the processor to implement the target behavior determination method provided in the above method embodiments.
[0166] Optionally, in the embodiments of this specification, the storage medium may be located at at least one of the multiple network servers in a computer network. Optionally, in this embodiment, the storage medium may include, but is not limited to, various media capable of storing program code, such as USB flash drives, read-only memory (ROM), random access memory (RAM), portable hard drives, magnetic disks, or optical disks.
[0167] The memory described in the embodiments of this specification can be used to store software programs and modules. The processor executes various functional applications and data processing by running the software programs and modules stored in the memory. The memory may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for the functions, etc.; the data storage area may store data created according to the use of the device, etc. In addition, the memory may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory may also include a memory controller to provide the processor with access to the memory.
[0168] The target behavior determination method provided in this application can be executed on a mobile terminal, computer terminal, server, or similar computing device. Taking running on a server as an example... Figure 11 This is a hardware structure block diagram of a server for a target behavior determination method provided in an embodiment of this application. For example... Figure 11As shown, the server 1100 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 1110 (CPUs 1110 may include, but are not limited to, microprocessors such as MCUs or programmable logic devices such as FPGAs), a memory 1130 for storing data, and one or more storage media 1120 (e.g., one or more mass storage devices) for storing application programs 1123 or data 1122. The memory 1130 and storage media 1120 may be temporary or persistent storage. The program stored in the storage media 1120 may include one or more modules, each module may include a series of instruction operations on the server. Furthermore, the CPU 1110 may be configured to communicate with the storage media 1120 and execute the series of instruction operations stored in the storage media 1120 on the server 1100. Server 1100 may also include one or more power supplies 1160, one or more wired or wireless network interfaces 1150, one or more input / output interfaces 1140, and / or one or more operating systems 1121, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™, etc.
[0169] The input / output interface 1140 can be used to receive or send data via a network. Specific examples of the network described above may include a wireless network provided by the communication provider of server 1100. In one example, the input / output interface 1140 includes a network interface controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the input / output interface 1140 may be a radio frequency (RF) module for wireless communication with the Internet.
[0170] Those skilled in the art will understand that Figure 11 The structure shown is for illustrative purposes only and does not limit the structure of the aforementioned electronic device. For example, server 1100 may also include... Figure 11 The more or fewer components shown, or having the same Figure 11 The different configurations shown.
[0171] As can be seen from the embodiments of the target behavior determination method, apparatus, server or storage medium provided in this application, this application encapsulates the behavior of the target object into behavior nodes, constructs a behavior tree through the triggering conditions of the behavior and the behavior nodes, thereby facilitating the modification of the weapon's behavior by adjusting the behavior nodes. Without modifying the code, the behavior of the target object can be quickly adjusted, thereby improving the iteration speed of the target object's behavior; when the target triggering condition is triggered, the corresponding target behavior can be quickly matched through the behavior tree.
[0172] It should be noted that the order of the embodiments described above is merely for descriptive purposes and does not represent the superiority or inferiority of the embodiments. Furthermore, specific embodiments have been described above. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps described in the claims can be performed in a different order than that shown in the embodiments and still achieve the desired result. Additionally, the processes depicted in the drawings do not necessarily require a specific or sequential order to achieve the desired result. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0173] The various embodiments in this specification are described in a progressive manner. Similar or identical parts between embodiments can be referred to mutually. Each embodiment focuses on describing the differences from other embodiments. In particular, the embodiments of apparatus, devices, and storage media are basically similar to the method embodiments, so the descriptions are relatively simple; relevant parts can be referred to the descriptions of the method embodiments.
[0174] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer storage medium, such as a read-only memory, a disk, or an optical disk.
[0175] The above description is only a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A method for determining target behavior, characterized in that, The method includes: In response to a key press by the user on the keyboard, a target trigger condition is determined for the target object based on a pre-stored correspondence between the key press and the trigger condition; the target object is an item used in an online game, and each trigger condition corresponds to at least two sets of trigger logic. Determine the behavior tree corresponding to the target object; and determine the target triggering logic corresponding to the target triggering condition; If the behavior tree includes the target triggering logic, execute the search for the target behavior node that matches the target triggering condition from the behavior tree according to the target triggering condition; Determine the target behavior corresponding to the target behavior node; The method for constructing the behavior tree includes: Determine the set of behaviors of the target object; Determine the execution order and triggering conditions of each behavior in the set of behaviors of the target object; Each behavior in the set of behaviors of the target object is encapsulated into a behavior node, and the correspondence between each behavior node and the triggering condition is constructed according to the triggering condition of each behavior. Determine the hierarchy of each behavior node based on the execution order of each behavior; The behavior tree is constructed based on the hierarchy of each behavior node and the correspondence between each behavior node and the triggering condition.
2. The method according to claim 1, characterized in that, The step of constructing the behavior tree based on the hierarchy and triggering conditions of each behavior node includes: Each behavior node group is obtained by using the triggering condition of each behavior node as the parent node of each behavior node. The hierarchy of each behavior node group is determined based on the hierarchy of the behavior nodes in each behavior node group. The behavior tree is constructed based on the hierarchy of each behavior node group.
3. The method according to claim 1, characterized in that, After the step of determining the target triggering logic corresponding to the target triggering condition, the method further includes: Determine whether the current behavior tree includes the target trigger logic.
4. The method according to claim 1, characterized in that, The target triggering conditions are at least two, and the step of searching for target behavior nodes that match the target triggering conditions from the behavior tree includes: Based on at least two target trigger conditions, find the target behavior node that matches each target trigger condition from the behavior tree.
5. The method according to claim 1, characterized in that, Before the step of determining the target behavior corresponding to the target behavior node, the method further includes: Determine the set of higher-level behavior nodes that are at a higher level than the target behavior node; Determine whether the behavior corresponding to each behavior node in the high-level behavior node set has been executed; Accordingly, determining the target behavior corresponding to the target behavior node includes: If the behavior corresponding to each behavior node in the high-level behavior node set has been executed, the target behavior corresponding to the target behavior node is determined.
6. The method according to claim 1, characterized in that, After the step of determining the target behavior corresponding to the target behavior node, the method further includes: Execute the target behavior to obtain the execution result; Determine whether the target behavior is an action performed on the target subject; If so, a network call request is sent to the server, the network call request carrying the identification information of the target behavior and the execution result, so that the server can verify the execution result based on the identification information of the target behavior.
7. A target behavior determination device, characterized in that, The device includes: The target trigger condition determination module is used to respond to key operations triggered by the user on the keyboard and determine the target trigger condition for the target object based on the pre-stored correspondence between key operations and trigger conditions; the target object is an item used in the online game, and each trigger condition corresponds to at least two sets of trigger logic. The behavior tree determination module is used to determine the behavior tree corresponding to the target object; The target behavior node lookup module is used to determine the target triggering logic corresponding to the target triggering condition; if the behavior tree includes the target triggering logic, it performs the search for the target behavior node that matches the target triggering condition from the behavior tree according to the target triggering condition; The target behavior determination module is used to determine the target behavior corresponding to the target behavior node; Behavior tree construction module, the behavior tree construction module includes: The behavior set determination submodule is used to determine the behavior set of the target object; The trigger condition determination submodule is used to determine the execution order and trigger condition of each behavior in the behavior set of the target object; The behavior node encapsulation submodule is used to encapsulate each behavior in the behavior set of the target object into a behavior node, construct the correspondence between each behavior node and the triggering condition according to the triggering condition of each behavior, and determine the hierarchy of each behavior node according to the execution order of each behavior. The behavior tree construction submodule is used to construct the behavior tree based on the hierarchy of each behavior node and the correspondence between each behavior node and the triggering condition.
8. The apparatus according to claim 7, characterized in that, The behavior tree construction submodule includes: A behavior node group determination unit is used to determine each behavior node group by taking the triggering condition of each behavior node as the parent node of each behavior node. The second-level determination unit is used to determine the level of each behavior node group based on the level of the behavior nodes in each behavior node group. The second behavior tree construction unit is used to construct the behavior tree according to the hierarchy of each behavior node group.
9. The apparatus according to claim 7, characterized in that, The device further includes: The target trigger logic judgment module is used to determine whether the current behavior tree includes target trigger logic.
10. The apparatus according to claim 7, characterized in that, The target triggering conditions are at least two, and the target behavior node search module includes: The lookup submodule is used to find the target behavior node that matches each target trigger condition from the behavior tree based on at least two target trigger conditions.
11. The apparatus according to claim 7, characterized in that, The device further includes: The behavior node set determination module is used to determine a higher-level behavior node set that is at a higher level than the target behavior node; The behavior determination module is used to determine whether the behavior corresponding to each behavior node in the high-level behavior node set has been executed. The target behavior determination module includes a second execution submodule, which is used to determine the target behavior corresponding to the target behavior node if the behavior corresponding to each behavior node in the high-level behavior node set has been executed.
12. The apparatus according to claim 7, characterized in that, The device further includes: The execution result determination module is used to execute the target behavior and obtain the execution result. The target behavior determination module is used to determine whether the target behavior is an action that acts on the target subject; The request sending module is used to send a network call request to the server if the target behavior is an action acting on a target subject. The network call request carries the identification information of the target behavior and the execution result, so that the server can verify the execution result based on the identification information of the target behavior.
13. A target behavior determination device, characterized in that, The device includes a processor and a memory, the memory storing at least one instruction or at least one program, the at least one instruction or at least one program being loaded and executed by the processor to implement the target behavior determination method as described in any one of claims 1-6.
14. A computer storage medium, characterized in that, The computer storage medium stores at least one instruction or at least one program, which is loaded and executed by a processor to implement the target behavior determination method as described in any one of claims 1-6.
Citation Information
Patent Citations
A behavior execution method, a behavior tree generation method and device and a computer device
CN109189504A