Method, device, equipment and storage medium for processing object behavior data
By loading the memory structure data of the behavior tree into the system's shared memory and allocating processing memory for the behavior tree, the problem of data loss when the game process restarts is solved, and server resource consumption is reduced.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- TENCENT TECH SHANGHAI
- Filing Date
- 2020-06-05
- Publication Date
- 2026-07-03
AI Technical Summary
In existing technologies, when the game process restarts, object behavior data processing based on behavior trees is lost, resulting in excessive server resource consumption.
The memory structure data of the behavior tree is deserialized and loaded into the system's shared memory. Processing memory is allocated for the behavior tree, and the processing data is executed and saved in the shared memory.
When the game process restarts, data loss is avoided and server resource consumption is reduced.
Smart Images

Figure CN113760517B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of Internet technology, and in particular to a method, apparatus, device, and storage medium for processing object behavior data. Background Technology
[0002] A behavior tree is a tree-like structure composed of various types of behavior nodes, commonly used in games. It determines the actions to be taken based on in-game data. For example, when a player-controlled game character is a certain distance away from an NPC (Non-Player Character), the NPC can attack the player-controlled character. Typically, the behavior tree is set up on a server. After receiving object behavior data from the game terminal, the server can perform corresponding processing based on the behavior tree.
[0003] In existing technologies, processing object behavior data based on behavior trees requires allocating processing memory for the corresponding behavior nodes in the behavior tree. Currently, when allocating processing memory for behavior nodes in the behavior tree, it is dynamically allocated based on the heap memory of the game process in the server. That is, before executing the corresponding behavior node, processing memory is allocated for the corresponding behavior node in the heap memory of the game process.
[0004] In the process of developing this application, the inventors discovered that the prior art has at least the following problems:
[0005] Because the server may update game data, the game process will be restarted. The processing memory allocated by the game process to the behavior nodes in the behavior tree will be cleared, resulting in the loss of the processing data saved based on the behavior tree for object behavior data. When the game process restarts, the object behavior data needs to be processed again based on the behavior tree, which consumes a lot of server resources. Summary of the Invention
[0006] This application provides a method, apparatus, device, and storage medium for processing object behavior data. After a game process restarts, the behavior tree can continue execution based on execution data stored in shared memory, reducing server resource consumption. The technical solution is as follows:
[0007] On the one hand, a method for processing object behavior data is provided, the method comprising:
[0008] After the background program corresponding to the target application is started, the behavior tree file corresponding to the background program is deserialized to obtain the memory structure data of the behavior tree. The memory structure data includes node data of multiple nodes, and the node data includes behavior conditions or execution data.
[0009] Load the memory structure data of the behavior tree into the system's shared memory;
[0010] Based on the memory structure data, processing memory is allocated for the behavior tree in the system's shared memory;
[0011] When object behavior data is received, based on the processing memory, target execution data corresponding to the behavior conditions that match the object behavior data is obtained from the memory structure data, and the target execution data is executed.
[0012] Optionally, based on the memory structure data, processing memory is allocated for the behavior tree in the system shared memory, including:
[0013] Based on the node data of each node in the memory structure data, corresponding node processing memory is allocated to each node in the system shared memory.
[0014] Optionally, based on the node data of each node in the memory structure data, allocating corresponding node processing memory for each node in the system shared memory includes:
[0015] Determine the space for data processing corresponding to the node data of each node in the memory structure data;
[0016] Based on the space corresponding to the node data of each node, corresponding node processing memory is allocated to each node in the system's shared memory.
[0017] Optionally, based on the processing memory, obtaining target execution data corresponding to the behavior conditions matching the object behavior data from the memory structure data, and executing the target execution data, includes:
[0018] The root node of the behavior tree is determined as the current processing node;
[0019] Obtain the node data of the currently processed node;
[0020] For each current processing node, if the node data of the current processing node is a behavior condition, then based on the node processing memory corresponding to the current processing node, it is determined whether the object behavior data satisfies the behavior condition of the current processing node. If the object behavior data satisfies the behavior condition of the current processing node, then each child node of the current processing node is determined as a current processing node, and the process of obtaining the node data of the current processing node is executed. If the node data of the current processing node is execution data, then the execution data of the current processing node is determined to be the target execution data corresponding to the behavior condition that matches the object behavior data, and the target execution data is executed based on the node processing memory corresponding to the current processing node.
[0021] Optionally, after loading the memory structure data of the behavior tree of the background program into the system shared memory, the method further includes: allocating breakpoint recording memory in the system shared memory;
[0022] After determining the root node of the behavior tree as the current processing node, the method further includes: recording the node identifier of the root node in the breakpoint recording memory;
[0023] After determining each child node of the current processing node as the current processing node, the method further includes: recording the node identifier of each child node in the breakpoint record memory, and deleting the node identifier of the parent node of each child node recorded in the breakpoint record memory.
[0024] The method further includes: after each background program starts, if a node identifier is recorded in the breakpoint record memory, the node corresponding to the node identifier recorded in the breakpoint record memory is determined as the current processing node, and the process of obtaining the node data of the current processing node is executed.
[0025] Optionally, the background program startup includes: restarting the background program after receiving a restart command; or, restarting the background program after the device crashes.
[0026] On the other hand, an apparatus for processing object behavior data is provided, the apparatus comprising:
[0027] The processing module is configured to deserialize the behavior tree file corresponding to the background program after the background program corresponding to the target application starts, to obtain the memory structure data of the behavior tree, wherein the memory structure data includes node data of multiple nodes, and the node data includes behavior conditions or execution data.
[0028] The loading module is configured to load the memory structure data of the behavior tree into the system shared memory;
[0029] The allocation module is configured to allocate processing memory for the behavior tree in the system shared memory based on the memory structure data;
[0030] The execution module is configured to, upon receiving object behavior data, retrieve target execution data corresponding to the behavior conditions matching the object behavior data from the memory structure data based on the processing memory, and execute the target execution data.
[0031] Optionally, the allocation module is configured as follows:
[0032] Based on the node data of each node in the memory structure data, corresponding node processing memory is allocated to each node in the system shared memory.
[0033] Optionally, the allocation module is configured as follows:
[0034] Determine the space for data processing corresponding to the node data of each node in the memory structure data;
[0035] Based on the space corresponding to the node data of each node, corresponding node processing memory is allocated to each node in the system's shared memory.
[0036] Optionally, the execution module is configured as follows:
[0037] The root node of the behavior tree is determined as the current processing node;
[0038] Obtain the node data of the currently processed node;
[0039] For each current processing node, if the node data of the current processing node is a behavior condition, then based on the node processing memory corresponding to the current processing node, it is determined whether the object behavior data satisfies the behavior condition of the current processing node. If the object behavior data satisfies the behavior condition of the current processing node, then each child node of the current processing node is determined as a current processing node, and the process of obtaining the node data of the current processing node is executed. If the node data of the current processing node is execution data, then the execution data of the current processing node is determined to be the target execution data corresponding to the behavior condition that matches the object behavior data, and the target execution data is executed based on the node processing memory corresponding to the current processing node.
[0040] Optionally, the device further includes a memory allocation module configured to allocate breakpoint recording memory in the system shared memory;
[0041] The device further includes a recording module configured to record the node identifier of the root node in the breakpoint recording memory;
[0042] The recording module is further configured to: record the node identifier of each child node in the breakpoint recording memory, and delete the node identifier of the parent node of each child node recorded in the breakpoint recording memory;
[0043] The device further includes a processing module configured to: after each background program starts, if a node identifier is recorded in the breakpoint record memory, determine the node corresponding to the node identifier recorded in the breakpoint record memory as the current processing node, and proceed to execute the process of obtaining the node data of the current processing node.
[0044] In another aspect, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one instruction, the at least one instruction being loaded and executed by the processor to perform the operations performed by the method for processing object behavior data as described above.
[0045] In another aspect, a computer-readable storage medium is provided, wherein at least one instruction is stored therein, the at least one instruction being loaded and executed by a processor to perform the operations performed by the method for processing object behavior data as described above.
[0046] The beneficial effects of the technical solutions provided in this application are:
[0047] By storing the behavior tree's memory structure in the server's shared memory and pre-allocating corresponding memory for the behavior tree within that shared memory, the processing of object behavior data based on the behavior tree is executed within the shared memory, and the corresponding processed data is stored there. Since the shared memory is unaffected by the server's game process, the processed data from the behavior tree will not be lost when the game restarts. Therefore, this application can continue executing the behavior tree after the game restarts, based on the processed data from the behavior tree in the shared memory, thus reducing server resource consumption. Attached Figure Description
[0048] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying 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.
[0049] Figure 1This is a flowchart of a method for processing object behavior data provided in an embodiment of this application;
[0050] Figure 2 This is a schematic diagram illustrating a method for processing object behavior data provided in an embodiment of this application;
[0051] Figure 3 This is a schematic diagram illustrating a method for processing object behavior data provided in an embodiment of this application;
[0052] Figure 4 This is a schematic diagram of a device structure for processing object behavior data provided in an embodiment of this application;
[0053] Figure 5 This is a schematic diagram of the server structure provided in an embodiment of this application. Detailed Implementation
[0054] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.
[0055] This application embodiment can be implemented by a server. The server has a processor and memory, is capable of accessing the Internet, and communicates with terminals. The server can be a background server for any application, and it contains a background program that receives application data sent by the terminal running the corresponding application, processes the received application data, and sends the processing result back to the terminal. The background program can contain one or more behavior trees, and determines corresponding decision data based on the behavior trees and the received application data. The server can be a single server or a server group. If it is a single server, it can handle all the processing described below. If it is a server group, different servers in the server group can handle different processing in the described scheme. The specific processing allocation can be arbitrarily configured by technicians according to actual needs, and will not be elaborated here.
[0056] In this embodiment, a game application is used as an example to illustrate the solution in detail. Other cases are similar and will not be described again. The corresponding application data can be various object behavior data generated when the terminal runs the game application, such as the health of each player character in the game, the status information of various NPCs, etc. The background program corresponding to the game application on the server can set different behavior trees according to the various game characters, NPCs, etc. After receiving the game data sent by the terminal running the game application, the server can traverse the behavior tree to obtain the corresponding nodes (behavior nodes), then execute the corresponding nodes, and send the execution results to the terminal running the game application, so that the NPCs or game characters in the game perform the corresponding actions.
[0057] Figure 1 This is a flowchart illustrating a method for processing object behavior data provided in an embodiment of this application. See also... Figure 1 This embodiment includes:
[0058] Step 101: After the background program corresponding to the target application starts, deserialize the behavior tree file corresponding to the background program to obtain the memory structure data of the behavior tree.
[0059] The memory structure data includes node data from multiple nodes, and the node data includes behavioral conditions or execution data.
[0060] In implementation, a behavior tree can be a tree structure composed of multiple nodes. Each node can include behavioral conditions or execution data. Behavioral conditions determine whether the received game data meets the conditions set by the corresponding node. For example, if the target application is a game application, a behavioral condition might be whether the player-controlled character is within the attack range of a defensive tower. Execution data refers to the data on various actions that NPCs or characters in the game need to perform, such as firing a gun, opening a door, or defending. Technicians can store the behavior tree's memory structure in the server's shared memory. The editing process of the behavior tree can be as follows: Figure 2 As shown, the process first requires providing C language implementations for editing each node in the behavior tree. Then, the C-implemented nodes are converted into a format readable by the AI editor and loaded into Unity3D (a game development tool) as a plugin. In the AI editor, the behavior tree nodes are combined into a behavior tree with complete executable behaviors. The configured behavior tree is then exported as a JSON (JavaScript Object Notation, a lightweight data interchange format) behavior tree configuration file. Technical personnel can store this JSON behavior tree configuration file on a server. When the game application's background program starts, the JSON behavior tree configuration file can be deserialized to obtain the executable memory structure data of the behavior tree. This memory structure data includes node data for multiple nodes, and the node data includes behavioral conditions or execution data.
[0061] Step 102: Load the memory structure data of the behavior tree into the system shared memory.
[0062] System shared memory, also known as shared memory on a server, can be accessed by multiple processes within the server without being affected by individual processes. After deserializing the JSON-formatted behavior tree configuration file to obtain the executable memory structure data of the behavior tree, this memory structure data can be stored in the server's shared memory.
[0063] Step 103: Based on the memory structure data, allocate processing memory for the behavior tree in the system's shared memory.
[0064] In implementation, before executing the behavior tree—that is, before traversing and executing each node in the behavior tree—a memory pool can be pre-allocated in shared memory on the server for the behavior tree. This memory pool, large enough to execute the behavior tree, can be pre-allocated based on the node data of each node in the behavior tree. When executing the behavior tree, the corresponding behavior tree can be executed based on the pre-allocated memory pool.
[0065] Optionally, memory can be allocated to each node based on the node data of each node in the behavior tree. The corresponding processing is as follows: Based on the node data of each node in the memory structure data, memory for node processing is allocated to each node in the system's shared memory.
[0066] In implementation, the memory structure of the behavior tree includes individual nodes and their node data. When pre-allocating a memory pool for the behavior tree, corresponding node processing memory can be allocated based on the behavior data of each node in the behavior tree. Each node's processing memory can correspond one-to-one with each node. The node processing memory corresponding to each node can form the memory pool corresponding to the behavior tree.
[0067] Optionally, when allocating node processing memory for a node, the size of the corresponding node processing memory can be determined based on the node data of the node. The corresponding processing is as follows: determine the space for data processing corresponding to the node data of each node in the memory structure data; based on the space corresponding to the node data of each node, allocate the corresponding node processing memory for each node in the system shared memory.
[0068] In implementation, before allocating node processing memory for each node in the behavior tree, the memory space required to process the node data can be determined based on the node data itself. For example, the memory space needed can be determined based on information such as the length of the arrays included in the node data, the number and type of various parameters. Then, node processing memory can be allocated to the corresponding node based on the determined memory space. The allocated node processing memory can be larger than the determined memory space required to process the node data, ensuring that the size of the processing memory for each node is sufficient to handle the behavior data of the corresponding node.
[0069] Step 104: When object behavior data is received, based on the processing memory, retrieve the target execution data corresponding to the behavior conditions that match the object behavior data from the memory structure data, and execute the target execution data.
[0070] Among them, object behavior data refers to game data generated in the game, which can be data of game characters, NPCs, etc.
[0071] In implementation, after the server receives object behavior data sent by the terminal running the game application, it can determine the behavior tree corresponding to the object behavior data. Then, it can traverse the behavior tree stored in the server's shared memory. That is, starting from the root node of the behavior tree, according to the relationship between the nodes in the behavior tree, it determines the execution data corresponding to the behavior conditions satisfied by the object behavior data, and executes the corresponding execution data according to the memory allocated in the shared memory.
[0072] Optionally, the behavior tree can be executed starting from its root node, with the following processing: The root node of the behavior tree is determined as the current processing node; the node data of the current processing node is obtained; for each current processing node, if the node data is a behavior condition, then based on the node processing memory corresponding to the current processing node, it is determined whether the object behavior data satisfies the behavior condition of the current processing node; if the object behavior data satisfies the behavior condition of the current processing node, each child node of the current processing node is determined as a current processing node, and the process of obtaining the node data of the current processing node is executed; if the node data of the current processing node is execution data, then the execution data of the current processing node is determined to be the target execution data corresponding to the behavior condition matching the object behavior data, and the target execution data is executed based on the node processing memory corresponding to the current processing node.
[0073] In implementation, after determining the behavior tree corresponding to the object's behavior data, the root node of the behavior tree begins execution. The execution steps are as follows:
[0074] Step 1041: Take the root node of the behavior tree as the currently being processed node, and execute the node data of the root node in the node processing memory corresponding to the root node. The execution result may be to return an execution result or to continue execution. If the execution result is to continue execution, proceed to step 1042.
[0075] Step 1042: Determine the child nodes corresponding to the root node, then treat the child nodes as the currently being processed nodes, and execute the node data of the child nodes in the node processing memory corresponding to the child nodes. If the node data of the currently processed node contains behavioral conditions, that is, whether the object behavioral data meets the behavioral conditions set in the currently processed node, then execute the judgment program for the behavioral conditions according to the node processing memory corresponding to the currently processed node to obtain the result of whether the object behavioral data meets the behavioral conditions set by the currently processed node. If the object behavioral data meets the behavioral conditions set by the currently processed node, proceed to step 1043.
[0076] Step 1043: Determine each child node of the current processing node as the current processing node, and proceed to the process of obtaining the node data of the current processing node. If the node data of the current processing node is execution data, then the execution data is the target execution data corresponding to the behavior condition that matches the object behavior data. Then, in the node processing memory corresponding to the current processing node, execute the execution data of the node to obtain the corresponding execution result. For example, if the object behavior data is the position distance data between the game character and the defense tower, then the execution result can be that the defense tower attacks.
[0077] Optionally, during the execution of the behavior tree, the execution status of the behavior tree can be recorded in shared memory. The corresponding processing is as follows: allocate breakpoint recording memory in the system shared memory; record the node identifier of the root node in the breakpoint recording memory; record the node identifier of each child node in the breakpoint recording memory, and delete the node identifier of the parent node of each child node recorded in the breakpoint recording memory.
[0078] In implementation, a breakpoint can be set in the server's shared memory to record the memory. When executing the behavior tree, the node identifier of the first node currently being processed can be recorded, that is, the node identifier corresponding to the first node currently being executed can be recorded. After determining each child node of the first node to be processed as the current processing node, the node identifiers of each child node of the first node can be recorded in the breakpoint's recorded memory, and the node identifier of the first node can be deleted.
[0079] Optionally, when the server needs to restart the game process, or when the server crashes and restarts due to uncontrollable reasons, the execution of the behavior tree can be restored based on the behavior tree execution data stored in the shared memory of the server. The corresponding processing is as follows: After each background program starts, if a node identifier is recorded in the breakpoint record memory, the node corresponding to the node identifier recorded in the breakpoint record memory is determined as the current processing node, and the process of obtaining the node data of the current processing node is executed. The background program startup can include restarting the background program after receiving a restart command, or restarting the background program after the device crashes.
[0080] In implementation, after the server's background program starts—that is, after the game process that processes game data restarts—it's possible to check if the breakpoint records in shared memory contain node identifiers. If a node identifier is found, it indicates that before the restart, there was an executing node, and it corresponds to the node identifier stored in the breakpoint records. The game process can then resume the execution of the behavior tree based on the corresponding node. Figure 3As shown, the game process can retrieve the node corresponding to the node identifier stored in the breakpoint record memory, and then read the behavior tree from the shared memory again. In the corresponding behavior tree, it can locate the node corresponding to the node identifier stored in the breakpoint record memory and continue to execute the corresponding node.
[0081] In this embodiment, the behavior tree's memory structure is stored in the server's shared system memory, and corresponding memory is pre-allocated for the behavior tree within that shared memory. This allows the processing of object behavior data based on the behavior tree to be executed within the shared memory, and the corresponding processing data is stored there. Since the shared system memory is unaffected by the server's game process, the processing data based on the behavior tree is not lost when the game restarts. Therefore, this application can continue executing the behavior tree after the game restarts, based on the processing data stored in the shared system memory, thus reducing server resource consumption.
[0082] All of the above-mentioned optional technical solutions can be combined in any way to form optional embodiments of this disclosure, and will not be described in detail here.
[0083] Figure 4 This is a schematic diagram of a device structure for processing object behavior data provided in an embodiment of this application. This device can be a server as described in the above embodiments, such as... Figure 4 As shown, the device includes:
[0084] The processing module 410 is configured to deserialize the behavior tree file corresponding to the background program after the background program corresponding to the target application is started, to obtain the memory structure data of the behavior tree, wherein the memory structure data includes node data of multiple nodes, and the node data includes behavior conditions or execution data.
[0085] Loading module 420 is configured to load the memory structure data of the behavior tree into the system shared memory;
[0086] The allocation module 430 is configured to allocate processing memory for the behavior tree in the system shared memory based on the memory structure data;
[0087] The execution module 440 is configured to, when receiving object behavior data, obtain target execution data corresponding to the behavior conditions that match the object behavior data from the memory structure data based on the processing memory, and execute the target execution data.
[0088] Optionally, the allocation module 430 is configured to:
[0089] Based on the node data of each node in the memory structure data, corresponding node processing memory is allocated to each node in the system shared memory.
[0090] Optionally, the allocation module 430 is configured to:
[0091] Determine the space for data processing corresponding to the node data of each node in the memory structure data;
[0092] Based on the space corresponding to the node data of each node, corresponding node processing memory is allocated to each node in the system's shared memory.
[0093] Optionally, the execution module 440 is configured as follows:
[0094] The root node of the behavior tree is determined as the current processing node;
[0095] Obtain the node data of the currently processed node;
[0096] For each current processing node, if the node data of the current processing node is a behavior condition, then based on the node processing memory corresponding to the current processing node, it is determined whether the object behavior data satisfies the behavior condition of the current processing node. If the object behavior data satisfies the behavior condition of the current processing node, then each child node of the current processing node is determined as a current processing node, and the process of obtaining the node data of the current processing node is executed. If the node data of the current processing node is execution data, then the execution data of the current processing node is determined to be the target execution data corresponding to the behavior condition that matches the object behavior data, and the target execution data is executed based on the node processing memory corresponding to the current processing node.
[0097] Optionally, the device further includes a memory allocation module configured to allocate breakpoint recording memory in the system shared memory;
[0098] The device further includes a recording module configured to record the node identifier of the root node in the breakpoint recording memory;
[0099] The recording module is further configured to: record the node identifier of each child node in the breakpoint recording memory, and delete the node identifier of the parent node of each child node recorded in the breakpoint recording memory;
[0100] The device further includes a processing module configured to: after each background program starts, if a node identifier is recorded in the breakpoint record memory, determine the node corresponding to the node identifier recorded in the breakpoint record memory as the current processing node, and proceed to execute the process of obtaining the node data of the current processing node.
[0101] It should be noted that the apparatus for processing object behavior data provided in the above embodiments is only illustrated by the division of the above functional modules. In practical applications, the above functions can be assigned to different functional modules as needed, that is, the internal structure of the device can be divided into different functional modules to complete all or part of the functions described above. In addition, the apparatus for processing object behavior data and the method for processing object behavior data provided in the above embodiments belong to the same concept, and the specific implementation process can be found in the method embodiments, which will not be repeated here.
[0102] Figure 5 This is a schematic diagram of a server structure provided in an embodiment of this application. The server 500 can vary significantly due to different configurations or performance. It may include one or more central processing units (CPUs) 501 and one or more memories 502. The memories 502 store at least one instruction, which is loaded and executed by the processors 501 to implement the methods provided in the various method embodiments described above. Of course, the server may also have wired or wireless network interfaces, a keyboard, and input / output interfaces for input and output. The server may also include other components for implementing device functions, which will not be elaborated upon here.
[0103] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory including instructions that can be executed by a processor in a terminal to perform the method for processing object behavior data in the above embodiments. This computer-readable storage medium may be non-transitory. For example, the computer-readable storage medium may be ROM (Read-Only Memory), RAM (Random Access Memory), CD-ROM, magnetic tape, floppy disk, and optical data storage device, etc.
[0104] 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-readable storage medium, such as a read-only memory, a disk, or an optical disk.
[0105] 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 processing object behavior data, characterized in that, The method includes: After the background program corresponding to the target application is started, the behavior tree file corresponding to the background program is deserialized to obtain the memory structure data of the behavior tree. The memory structure data includes node data of multiple nodes, and the node data includes behavior conditions or execution data. Load the memory structure data of the behavior tree into the system's shared memory; Based on the node data of each node in the memory structure data, corresponding node processing memory is allocated to each node in the system shared memory; When object behavior data is received, the root node of the behavior tree is determined as the current processing node, and the node data of the current processing node is obtained. For each current processing node, determine whether the node data of the current processing node is a behavior condition or execution data, obtain a determination result, and based on the determination result and the node processing memory corresponding to the current processing node, obtain the target execution data corresponding to the behavior condition that matches the object behavior data from the memory structure data, and execute the target execution data.
2. The method according to claim 1, characterized in that, Based on the node data of each node in the memory structure data, the allocation of corresponding node processing memory for each node in the system shared memory includes: Determine the space for data processing corresponding to the node data of each node in the memory structure data; Based on the space corresponding to the node data of each node, corresponding node processing memory is allocated to each node in the system's shared memory.
3. The method according to claim 1, characterized in that, Based on the determined result and the node processing memory corresponding to the current processing node, the step of obtaining target execution data corresponding to the behavior conditions matching the object behavior data from the memory structure data, and executing the target execution data, includes: If the determination result indicates that the node data of the current processing node is a behavior condition, then based on the node processing memory corresponding to the current processing node, it is determined whether the object behavior data satisfies the behavior condition of the current processing node. If the object behavior data satisfies the behavior condition of the current processing node, then each child node of the current processing node is determined as the current processing node, and the process of obtaining the node data of the current processing node is executed. If the determination result indicates that the node data of the current processing node is execution data, then the execution data of the current processing node is determined to be the target execution data corresponding to the behavior condition that matches the object behavior data, and the target execution data is executed based on the node processing memory corresponding to the current processing node.
4. The method according to claim 3, characterized in that, After loading the memory structure data of the behavior tree into the system shared memory, the method further includes: allocating breakpoint recording memory in the system shared memory; After determining the root node of the behavior tree as the current processing node, the method further includes: recording the node identifier of the root node in the breakpoint recording memory; After determining each child node of the current processing node as the current processing node, the method further includes: recording the node identifier of each child node in the breakpoint record memory, and deleting the node identifier of the parent node of each child node recorded in the breakpoint record memory. The method further includes: after each background program starts, if a node identifier is recorded in the breakpoint record memory, the node corresponding to the node identifier recorded in the breakpoint record memory is determined as the current processing node, and the process of obtaining the node data of the current processing node is executed.
5. The method according to claim 4, characterized in that, The background program startup includes: The background program restarts upon receiving a restart command; or... The background program will restart after this device crashes.
6. An apparatus for processing object behavior data, characterized in that, The device includes: The processing module is configured to deserialize the behavior tree file corresponding to the background program after the background program corresponding to the target application starts, to obtain the memory structure data of the behavior tree, wherein the memory structure data includes node data of multiple nodes, and the node data includes behavior conditions or execution data. The loading module is configured to load the memory structure data of the behavior tree into the system shared memory; The allocation module is configured to allocate corresponding node processing memory for each node in the system shared memory based on the node data of each node in the memory structure data. The execution module is configured to, when receiving object behavior data, determine the root node of the behavior tree as the current processing node and obtain the node data of the current processing node; for each current processing node, determine whether the node data of the current processing node is a behavior condition or execution data, obtain a determination result, and based on the determination result and the node processing memory corresponding to the current processing node, obtain the target execution data corresponding to the behavior condition that matches the object behavior data from the memory structure data, and execute the target execution data.
7. The apparatus according to claim 6, characterized in that, The allocation module is configured to: determine the space for data processing corresponding to the node data of each node in the memory structure data; Based on the space corresponding to the node data of each node, corresponding node processing memory is allocated to each node in the system's shared memory.
8. The apparatus according to claim 6, characterized in that, The execution module is configured to: if the determination result indicates that the node data of the current processing node is a behavior condition, then based on the node processing memory corresponding to the current processing node, determine whether the object behavior data satisfies the behavior condition of the current processing node; if the object behavior data satisfies the behavior condition of the current processing node, then determine each child node of the current processing node as the current processing node, and proceed to execute the process of obtaining the node data of the current processing node; if the determination result indicates that the node data of the current processing node is execution data, then determine that the execution data of the current processing node is the target execution data corresponding to the behavior condition that matches the object behavior data, and execute the target execution data based on the node processing memory corresponding to the current processing node.
9. The apparatus according to claim 8, characterized in that, The device further includes a memory allocation module configured to allocate breakpoint recording memory in the system shared memory. The device further includes a recording module configured to record the node identifier of the root node in the breakpoint recording memory; The recording module is further configured to: record the node identifier of each child node in the breakpoint recording memory, and delete the node identifier of the parent node of each child node recorded in the breakpoint recording memory; The device further includes a processing module configured to: after each background program starts, if a node identifier is recorded in the breakpoint record memory, determine the node corresponding to the node identifier recorded in the breakpoint record memory as the current processing node, and proceed to execute the process of obtaining the node data of the current processing node.
10. The apparatus according to claim 9, characterized in that, The background program startup includes: restarting the background program after receiving a restart command; or restarting the background program after the device crashes.
11. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing at least one instruction, which is loaded and executed by the processor to perform the operation of the method for processing object behavior data as described in any one of claims 1 to 5.
12. A computer-readable storage medium, characterized in that, The storage medium stores at least one instruction, which is loaded and executed by a processor to perform the operation of the method for processing object behavior data as described in any one of claims 1 to 5.