Data processing method and apparatus, computer, and readable storage medium

By obtaining the initial collision cache area of ​​the virtual object and the boundary information in the obstacle space binary tree, predicting the movement speed to control the movement of the virtual object, it solves the problem of low efficiency of virtual object pathfinding in the existing technology, and realizes the problem of inefficiency when the scene terrain changes. Efficient movement and pathfinding.

WO2024156218A9PCT designated stage expired Publication Date: 2024-08-29TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2023/133377
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2023-01-28
Filing Date
2023-11-22
Publication Date
2024-08-29

AI Technical Summary

Technical Problem

Existing technology requires frequent regeneration of terrain division area data when moving virtual objects in open world games, resulting in low pathfinding efficiency. Especially when the scene terrain layout changes, the scene map needs to be rebuilt and connected polygon paths need to be calculated.

Method used

By obtaining the candidate objects in the initial collision cache area of ​​the virtual object, traversing the obstacle space binary tree to determine the collision area boundary, and predicting and updating the movement speed based on these boundaries to control the movement of the virtual object, reducing the dependence on changes in the terrain layout and improving the virtual Object pathfinding efficiency.

Benefits of technology

It is possible to improve the moving speed and pathfinding efficiency of virtual objects without regenerating terrain data when the scene terrain layout changes, reducing the consumption of computing resources and improving the performance and scalability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2023133377_29082024_PF_FP_ABST
    Figure CN2023133377_29082024_PF_FP_ABST
Patent Text Reader

Abstract

Disclosed in the embodiments of the present application are a data processing method and apparatus, a computer, and a readable storage medium. The method comprises: acquiring candidate virtual objects in an initial collision cache area of a first virtual object, and acquiring from amongst the candidate virtual objects a second virtual object having a distance from the first virtual object smaller than or equal to a collision distance; traversing an obstacle space binary tree of a target scene, and determining as a collision area boundary a target obstacle area boundary having a distance from the first virtual object smaller than or equal to the collision distance, the difference value between the number of obstacle area boundaries included in a first direction subtree of a node in the obstacle space binary tree and the number of obstacle area boundaries included in a second direction subtree thereof being smaller than or equal to a boundary splitting threshold value; and predicting a updated movement speed on the basis of the second virtual object and the collision area boundary, and controlling the first virtual object to move on the basis of the updated movement speed. Using the present application may improve the path finding efficiency of the virtual objects.
Need to check novelty before this filing date? Find Prior Art

Description

Data processing method, device, computer and readable storage medium

[0001] This application claims priority to the Chinese patent application filed with the China Patent Office on January 28, 2023, with application number 202310042502.X and application name “Data processing method, device, computer and readable storage medium”, the entire contents of which are incorporated by reference into this application. Technical Field

[0002] The present application relates to the field of computer technology, and in particular to a data processing method, device, computer, and readable storage medium. Background Art

[0003] The current development trend of games is to build open worlds. The interaction of players in open worlds will affect the terrain of the scene. In order to better control the movement of virtual objects, it is necessary to collide with virtual objects to avoid pathfinding. At present, generally, the overall space of the target scene is divided into multiple convex polygons by the terrain layout of the target scene. Adjacent convex polygons are connected by shared edges. The multiple convex polygons include passable areas and impassable areas, which are equivalent to the scene map of the target scene. Further, based on the terrain division area (that is, each convex polygon), the connected polygon path between the polygon where the starting point is located and the polygon where the end point is located is calculated, and the connected polygon path is optimized to obtain the final polygon path. According to the final polygon path, the virtual object is updated frame by frame to achieve the movement of the virtual object. However, this method requires the generation of relevant data of the terrain division area in advance. When the terrain layout in the target scene changes, it is necessary to re-construct the scene map of the target scene based on the new terrain layout, and then perform the connected polygon path calculation, which makes the pathfinding efficiency low.

[0004] Summary of the Invention

[0005] The embodiments of the present application provide a data processing method, device, computer, and readable storage medium, which can improve the efficiency of virtual object pathfinding.

[0006] On the one hand, an embodiment of the present application provides a data processing method, the method comprising:

[0007] Obtain a candidate virtual object located in an initial collision buffer area of ​​the first virtual object, and obtain a second virtual object associated with the first virtual object from the candidate virtual object; the distance between the second virtual object and the first virtual object is less than or equal to the collision distance of the first virtual object; the initial collision buffer area refers to the to-be-detected grid index corresponding to the first virtual object in the object management array; the object management array is used to represent the grid index corresponding to the virtual object included in the target scene, the grid index is used to represent the position of the virtual object in the unit grid divided into the target scene, and the target scene includes the first virtual object; the candidate virtual object is the virtual object in the array element indicated by the to-be-detected grid index in the object management array;

[0008] Obtain an obstacle space binary tree of a target scene where the first virtual object is located, traverse the nodes in the obstacle space binary tree, and determine the target obstacle region boundary corresponding to the node whose distance to the first virtual object is less than or equal to the collision distance as the collision region boundary of the first virtual object; the nodes in the obstacle space binary tree correspond to the obstacle region boundary in the target scene; the difference between the number of obstacle region boundaries included in the first direction subtree and the number of obstacle region boundaries included in the second direction subtree of any node in the obstacle space binary tree is less than or equal to the boundary splitting threshold; the obstacle region boundary refers to the boundary line of the obstacle region existing in the target scene;

[0009] Based on the second virtual object and the collision area boundary, an updated movement speed of the first virtual object is predicted, and the first virtual object is controlled to move based on the updated movement speed.

[0010] In one aspect, an embodiment of the present application provides a data processing device, the device comprising:

[0011] an object acquisition module, configured to acquire a candidate virtual object located in an initial collision buffer area of ​​the first virtual object;

[0012] An object determination module is configured to obtain, from candidate virtual objects, a second virtual object associated with the first virtual object; the distance between the second virtual object and the first virtual object is less than or equal to the collision distance of the first virtual object; the initial collision buffer area refers to the to-be-detected grid index corresponding to the first virtual object in the object management array; the object management array is used to represent the grid index corresponding to the virtual object included in the target scene, the grid index is used to represent the position of the virtual object in a unit grid divided into the target scene, and the target scene includes the first virtual object; the candidate virtual object refers to the virtual object in the array element indicated by the to-be-detected grid index in the object management array;

[0013] A tree acquisition module, configured to acquire an obstacle space binary tree of a target scene where the first virtual object is located;

[0014] A boundary determination module is configured to traverse the nodes in the obstacle space binary tree and determine the target obstacle region boundary corresponding to the node whose distance to the first virtual object is less than or equal to the collision distance as the collision region boundary of the first virtual object; the nodes in the obstacle space binary tree correspond to the obstacle region boundary in the target scene; the difference between the number of obstacle region boundaries included in the first direction subtree corresponding to any node in the obstacle space binary tree and the number of obstacle region boundaries included in the second direction subtree is less than or equal to the boundary splitting threshold; the obstacle region boundary refers to the boundary line of the obstacle region existing in the target scene;

[0015] a speed prediction module, configured to predict an updated movement speed of the first virtual object based on the second virtual object and the collision area boundary;

[0016] The movement control module is configured to control the movement of the first virtual object based on the updated movement speed.

[0017] The object acquisition module includes:

[0018] a detection and determination unit, configured to obtain first position information of the first virtual object and a collision distance of the first virtual object, and fuse the first position information and the collision distance to obtain a collision detection range of the first virtual object;

[0019] A grid conversion unit is used to obtain the unit length of the unit grid of the target scene, and perform grid conversion on the collision detection range based on the unit length to obtain the grid detection range;

[0020] The candidate acquisition unit is configured to perform hash conversion on the grid detection range to obtain an initial collision buffer area of ​​the first virtual object, and determine the virtual object corresponding to the initial collision buffer area in the object management array as a candidate virtual object.

[0021] The device further comprises:

[0022] A grid construction module, used to construct the target scene into M unit grids based on the unit length of the unit grid;

[0023] The grid initialization module is used to initialize the grid position information corresponding to M unit grids; M is a positive integer;

[0024] The array creation module is used to create an N-dimensional initial object management array, perform hash conversion on the grid position information corresponding to each of the M unit grids, and obtain the grid index corresponding to each of the M unit grids; N is a positive integer;

[0025] The array generation module is used to obtain the unit grid where the virtual object included in the target scene is located, and add the virtual object to the initial object management array based on the grid index of the unit grid where the virtual object is located to obtain the object management array; the initial collision buffer area refers to the grid index obtained based on the grid detection range conversion; the virtual object includes the candidate virtual object.

[0026] The grid initialization module is specifically used to:

[0027] The second position information of the grid identification points respectively corresponding to the M unit grids is obtained, and the second position information respectively corresponding to the M unit grids is converted into a position grid based on the unit length to obtain the grid position information respectively corresponding to the M unit grids.

[0028] The device further comprises:

[0029] a position acquisition module, configured to acquire third position information of the third virtual object in the target scene when the third virtual object enters the target scene;

[0030] An index acquisition module, configured to perform grid conversion on the third position information based on a unit length to obtain an object grid position of the third virtual object, and perform hash conversion on the object grid position to obtain a grid index to be added corresponding to the third virtual object;

[0031] The object cache module is used to add the third virtual object to the object management array based on the grid index to be added.

[0032] The object acquisition module includes:

[0033] The cache search unit is used to obtain a candidate virtual object from a collision object cache associated with the first virtual object; the collision object cache is used to store virtual objects located in an initial collision cache area of ​​the first virtual object.

[0034] The device further comprises:

[0035] A movement acquisition module, configured to acquire a standard movement speed and a collision distance of the first virtual object when the first virtual object joins the target scene;

[0036] a buffer area determination module, configured to determine an initial collision buffer area of ​​the first virtual object according to a standard moving speed and a collision distance;

[0037] a candidate determination module, configured to determine the virtual objects included in the initial collision cache area as candidate virtual objects associated with the first virtual object, and add the candidate virtual objects to the collision object cache associated with the first virtual object;

[0038] The object synchronization module is configured to add the first virtual object to a collision object cache of candidate virtual objects.

[0039] The device further comprises:

[0040] The cache update module is configured to clear the collision object cache of the first virtual object if the cache duration of the collision object cache of the first virtual object reaches the cache update period, or the first virtual object undergoes a position jump, obtain the current collision cache area of ​​the first virtual object, and add the virtual objects included in the current collision cache area to the collision object cache of the first virtual object; a position jump refers to the first virtual object changing from a first position to a second position at a speed greater than a teleportation speed threshold.

[0041] The object determination module includes:

[0042] a position acquisition unit, configured to acquire candidate position information of a candidate virtual object and first position information of a first virtual object;

[0043] A distance screening unit is configured to calculate an object position distance between the candidate position information and the first position information, and if the object position distance is less than or equal to the collision distance, determine the candidate virtual object as a second virtual object associated with the first virtual object; the second virtual object does not include the first virtual object.

[0044] The device further comprises:

[0045] A boundary acquisition module is configured to acquire an obstacle region included in a target scene, acquire an original obstacle region boundary of the obstacle region, and acquire a first obstacle region boundary from the original obstacle region boundary; the difference between the number of obstacle region boundaries located on a first direction side of the first obstacle region boundary and the number of obstacle region boundaries located on a second direction side of the first obstacle region boundary is less than or equal to a boundary splitting threshold; any obstacle region boundary refers to an original obstacle region boundary located on one direction side of the first obstacle region boundary, or refers to an obstacle region boundary obtained by segmenting the original obstacle region boundaries located on two directions side of the first obstacle region boundary;

[0046] a root determination module, configured to use the first obstacle area boundary as a root node;

[0047] A boundary division module, configured to divide the original obstacle area boundary into a first boundary set and a second boundary set based on the first obstacle area boundary;

[0048] A tree construction module is used to construct a first directional subtree of the root node based on a first boundary set, and to construct a second directional subtree of the root node based on a second boundary set; the first boundary set includes the obstacle area boundaries located on the first directional side of the first obstacle area boundary, and the second boundary set includes the obstacle area boundaries located on the second directional side of the first obstacle area boundary.

[0049] The boundary division module includes:

[0050] a boundary segmentation unit configured to segment the original obstacle region boundary C into an obstacle region boundary C1 and an obstacle region boundary C2 using a straight line on which the first obstacle region boundary lies; the obstacle region boundary C1 being the portion of the original obstacle region boundary C located on a first direction side of the first obstacle region boundary, and the obstacle region boundary C2 being the portion of the original obstacle region boundary C located on a second direction side of the first obstacle region boundary;

[0051] The boundary division unit is configured to determine the obstacle area boundary A and the obstacle area boundary C1 as a first boundary set, and determine the obstacle area boundary B and the obstacle area boundary C2 as a second boundary set; the obstacle area boundary A refers to the original obstacle area boundary located on the first direction side of the first obstacle area boundary, the obstacle area boundary B refers to the original obstacle area boundary located on the second direction side of the first obstacle area boundary, and the original obstacle area boundary C refers to the original obstacle area boundary located on both directions side of the first obstacle area boundary.

[0052] The tree building module includes:

[0053] A first node construction unit is configured to, if the number of the obstacle area boundary A and the obstacle area boundary C1 is less than or equal to the tree construction threshold, use the obstacle area boundary A and the obstacle area boundary C1 as the first directional child nodes of the root node, and determine the first directional child nodes of the root node as the first directional subtree of the root node;

[0054] The second node construction unit is configured to, if the number of the obstacle area boundaries A and the obstacle area boundaries C1 is greater than the tree construction threshold, obtain a second obstacle area boundary from the obstacle area boundary A and the obstacle area boundary C1, determine the second obstacle area boundary as a first direction subnode of the root node, divide the obstacle area boundary A and the obstacle area boundary C1 into a third boundary set and a fourth boundary set based on the first direction subnode, construct a first direction subtree of the first direction subnode based on the third boundary set, and construct a second direction subtree of the first direction subnode based on the fourth boundary set.

[0055] The device further comprises:

[0056] a boundary screening module, configured to, if the number of obstacle region boundaries of the obstacle region included in the target scene is less than or equal to a tree construction threshold, obtain a distance between the obstacle region boundary and the first virtual object, and determine an obstacle region boundary among the obstacle region boundaries whose distance with the first virtual object is less than or equal to the collision distance as a collision region boundary of the first virtual object;

[0057] The tree triggering module is used to notify the tree acquisition module to execute the acquisition of the obstacle space binary tree of the target scene where the first virtual object is located if the number of obstacle area boundaries of the obstacle area included in the target scene is greater than the tree construction threshold.

[0058] The device further comprises:

[0059] a dynamic acquisition module, configured to, if the dynamic boundary set is not empty, acquire a dynamic area boundary from the dynamic boundary set, and determine a dynamic area boundary in the dynamic area boundary whose distance to the first virtual object is less than or equal to the collision distance as a dynamic collision boundary of the first virtual object;

[0060] The speed prediction module is further configured to predict an updated movement speed of the first virtual object based on the second virtual object, the collision area boundary of the first virtual object, and the dynamic collision boundary of the first virtual object;

[0061] The dynamic acquisition module is further used to notify the speed prediction module to predict the updated movement speed of the first virtual object based on the second virtual object and the boundary of the collision area.

[0062] The device further comprises:

[0063] a tree reconstruction module, configured to reconstruct the obstacle space binary tree based on the nodes and dynamic area boundaries in the obstacle space binary tree if the number of dynamic area boundaries included in the dynamic boundary set is greater than or equal to the dynamic support threshold, or the fixed time length of the obstacle space binary tree is greater than or equal to the tree update period;

[0064] The collection clearing module is used to clear the dynamic boundary collection.

[0065] The speed prediction module includes:

[0066] an information acquiring unit, configured to acquire first moving speed and first position information of a first virtual object;

[0067] a first offset unit, configured to obtain a second moving speed and object position information of a second virtual object, construct a first speed region according to the first position information and the object position information, and determine first offset data based on the first moving speed and the second moving speed;

[0068] a first determining unit, configured to construct a second speed region according to the first offset data and the first speed region, and determine a first candidate speed range based on the second speed region;

[0069] a second offset unit, configured to obtain boundary movement speed and boundary position information of a collision area boundary of the first virtual object, construct a third speed area according to the first position information and the boundary position information, and determine second offset data based on the first movement speed and the boundary movement speed;

[0070] a second determining unit, configured to construct a fourth speed region according to the second offset data and the third speed region, and determine a second candidate speed range based on the fourth speed region;

[0071] The speed determining unit is configured to determine the intersection of the first candidate speed range and the second candidate speed range as a target candidate speed range of the first virtual object, and select an updated moving speed of the first virtual object in the target candidate speed range.

[0072] On the one hand, an embodiment of the present application provides a computer device, including a processor, a memory, and an input and output interface;

[0073] The processor is connected to the memory and the input and output interface respectively, wherein the input and output interface is used to receive and output data, the memory is used to store the computer program, and the processor is used to call the computer program so that the computer device including the processor executes the data processing method in one aspect of the embodiment of the present application.

[0074] On one hand, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program. The computer program is suitable for being loaded and executed by a processor so that a computer device having the processor executes the data processing method in one aspect of the embodiment of the present application.

[0075] In one aspect, an embodiment of the present application provides a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in various optional embodiments of the present application. In other words, when the computer instructions are executed by the processor, the methods provided in various optional embodiments of the present application are implemented.

[0076] Implementing the embodiments of this application will have the following beneficial effects:

[0077] In an embodiment of the present application, a candidate virtual object located in an initial collision cache area of ​​a first virtual object can be obtained, and a second virtual object associated with the first virtual object can be obtained from the candidate virtual object. The candidate virtual objects of the first virtual object are widely stored in the cache, which is equivalent to a preliminary screening of virtual objects. The initial collision cache area refers to the index of the to-be-detected grid corresponding to the first virtual object in the object management array. The object management array is used to represent the position of the virtual objects included in the target scene in the unit grid divided by the target scene, so that the computer device can easily and quickly index the candidate virtual object in the object management array, thereby reducing the search time required to obtain the second virtual object and improving the efficiency of virtual object screening. Moreover, the unit grid is divided only based on the position in the target scene and is not affected by the terrain layout of the target scene. This makes it unnecessary to change the generation of the unit grid multiple times and can even be applied to different scenes, which can improve the efficiency and convenience of unit grid construction. Furthermore, an obstacle space binary tree of the target scene where the first virtual object is located can be obtained, and the nodes in the obstacle space binary tree can be traversed. The target obstacle region boundary corresponding to the node whose distance from the first virtual object is less than or equal to the collision distance is determined as the collision region boundary of the first virtual object. The nodes in the obstacle space binary tree correspond to the obstacle region boundary in the target scene, and the difference between the number of child nodes in the first direction and the number of child nodes in the second direction corresponding to any node in the obstacle space binary tree is less than or equal to the boundary splitting threshold. In other words, any node in the obstacle region binary tree has similar numbers of child nodes in both directions. This makes traversal of the obstacle space binary tree similar to a binary search, improving the efficiency of obstacle region screening. Furthermore, based on the obtained second virtual object and the aforementioned collision region boundary, the updated movement speed of the first virtual object can be predicted, and the movement of the first virtual object can be controlled based on the updated movement speed. Through the above process, the efficiency of each step of obtaining the updated movement speed is improved, thereby improving pathfinding efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0078] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.

[0079] FIG1 is a diagram of a network interaction architecture for data processing provided by an embodiment of the present application;

[0080] FIG2 is a schematic diagram of a data processing scenario provided by an embodiment of the present application;

[0081] FIG3 is a flow chart of a data processing method provided in an embodiment of the present application;

[0082] FIG4 is a schematic diagram of an object management array generation scenario provided by an embodiment of the present application;

[0083] FIG5 is a schematic diagram of another object management array generation scenario provided in an embodiment of the present application;

[0084] FIG6 is a schematic diagram of an obstacle space binary tree provided in an embodiment of the present application;

[0085] FIG7 is a schematic diagram of a scenario provided by an embodiment of the present application;

[0086] FIG8 is a schematic diagram of a speed update scenario provided by an embodiment of the present application;

[0087] FIG9 is a schematic diagram of a speed region construction scenario provided by an embodiment of the present application;

[0088] FIG10 is a schematic diagram of an iteration time provided in an embodiment of the present application;

[0089] FIG11 is a schematic diagram of a tree construction test result provided in an embodiment of the present application;

[0090] FIG12 is a schematic diagram of a data processing device provided in an embodiment of the present application;

[0091] FIG13 is a schematic structural diagram of a computer device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0092] The following will be combined with the drawings in the embodiments of this application to clearly and completely describe the technical solutions in the embodiments of this application. Obviously, the embodiments described are only part of the embodiments of this application, not all of the embodiments. Based on the embodiments in this application, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of this application.

[0093] Among them, if it is necessary to collect object (such as user, etc.) data in this application, a prompt interface or pop-up window will be displayed before or during the collection. The prompt interface or pop-up window is used to remind the user that data is currently being collected. Only after the user confirms the prompt interface or pop-up window, the relevant steps for data acquisition will be started, otherwise the process will end. Moreover, the acquired user data will be used in reasonable and legal scenarios or purposes. Optionally, in some scenarios where user data needs to be used but has not been authorized by the user, authorization can be requested from the user, and the user data can be used when the authorization is passed.

[0094] Among them, pathfinding refers to the process of calculating the connected path between two locations in space. Navigation mesh refers to the data description of the pathfindable surface of space (such as the target scene) (that is, the passable area in the target scene) in the form of convex polygons. Collision avoidance refers to the avoidance of other virtual objects and obstacle areas during the movement of virtual objects, so as to prevent virtual objects from overlapping with other virtual objects or obstacle areas. Obstacle areas refer to inaccessible areas, such as the areas where obstacles are located in the target scene. Dynamic obstacle areas refer to inaccessible areas that can be added or deleted at any time in the target scene, such as the areas where obstacles are located that can be added or deleted at any time in the target scene. Among them, passable areas refer to areas that can be passed by virtual objects and pathfinding can be performed; inaccessible areas refer to areas that virtual objects cannot pass through and pathfinding cannot be performed. Among them, virtual objects can be considered as game characters controlled by players through computer devices.

[0095] In an embodiment of the present application, please refer to FIG. 1 , which is a diagram of a network interaction architecture for data processing provided by an embodiment of the present application. As shown in FIG. 1 , a user can enter a target scene through a computer device, and the computer device can control the movement of a virtual object within the target scene. The virtual object can be considered the user's character in the computer device. Any computer device can exchange data with other computer devices, or can exchange data with other computer devices through server 101, such as computer device 102a, computer device 102b, or computer device 102c. The computer device where a first virtual object resides can obtain a second virtual object and a collision zone boundary near the first virtual object. The second virtual object refers to a virtual object whose distance from the first virtual object is less than or equal to the collision distance of the first virtual object, i.e., a virtual object that may collide with the first virtual object; the collision zone boundary of the first virtual object refers to the boundary of an obstacle zone whose distance from the first virtual object is less than or equal to the collision distance, i.e., the boundary of an obstacle zone that may collide with the first virtual object. Furthermore, the computer device can predict the updated movement speed of the first virtual object based on the second virtual object and the collision zone boundary, and control the movement of the first virtual object based on the updated movement speed.

[0096] Specifically, please refer to Figure 2, which is a schematic diagram of a data processing scenario provided by an embodiment of the present application. As shown in Figure 2, the target scene 201 contains a first virtual object 2011, an obstacle area 2012, and virtual objects other than the first virtual object 2011, such as virtual object 2013. Specifically, the computer device can obtain a candidate virtual object 203 located in the initial collision buffer area 202 of the first virtual object 2011, wherein the initial collision buffer area 202 refers to an area used for performing a rough collision screening of the first virtual object 2011. A second virtual object 204 can be obtained from the candidate virtual object 203, and the distance between the second virtual object 204 and the first virtual object 2011 is less than or equal to the collision distance of the first virtual object. Through the above-mentioned rough collision screening, the number of virtual objects that need to be compared with the first virtual object is reduced, saving the time for obtaining virtual objects that may collide. Then, based on the collision distance, the second virtual object that may collide with the first virtual object is determined, thereby improving the accuracy of obtaining virtual objects and thereby improving the efficiency of obtaining virtual objects.

[0097] Among them, the computer device can obtain the obstacle space binary tree 205 of the target scene 201 where the first virtual object 2011 is located, traverse the nodes in the obstacle space binary tree 205, and obtain the target obstacle area boundary whose distance from the first virtual object 2011 is less than or equal to the collision distance in the obstacle area boundary corresponding to the node, and determine the target obstacle area boundary as the collision area boundary 206 of the first virtual object 2011, wherein the difference between the number of obstacle area boundaries included in the first direction subtree of any node in the obstacle space binary tree 205 and the number of obstacle area boundaries included in the second direction subtree is less than or equal to the boundary splitting threshold, that is, it can be considered that the obstacle space binary tree 205 is a tree in which the number of obstacle area boundaries in the left and right subtrees of any node is relatively balanced, and any main node The relative position of the child nodes in the subtree of a point (also referred to as a parent node) and the main node (this relative position can be understood as the child node being in the subtree to the right of the parent node, or in the subtree to the left), and the relative position of the obstacle area boundary corresponding to the main node and the obstacle area boundary corresponding to the child nodes in the subtree of the main node are the same; for example, node A has child node 1 and child node 2, and child node 1 is located in the first direction subtree of node A, and child node 2 is located in the second direction subtree of node A. Then, it can be considered that the obstacle area boundary corresponding to child node 1 is located on the first direction side of the obstacle area boundary corresponding to node A (the same direction as the first direction subtree, such as both are on the left), and the obstacle area boundary corresponding to child node 2 is located on the second direction side of the obstacle area boundary corresponding to node A (the same direction as the second direction subtree, such as both are on the right). Any node in the obstacle space binary tree can be called a master node, and nodes in the master node's subtree can be considered child nodes of the master node. That is, when a leaf node in the obstacle space binary tree serves as a master node, the child nodes are empty. When the root node in the obstacle space binary tree serves as the master node, all nodes except the root node in the obstacle space binary tree can be considered child nodes. This obstacle space binary tree can improve the efficiency of obtaining the boundaries of obstacle areas that may collide with the first virtual object.

[0098] The computer device can construct an obstacle space binary tree based on the obstacle area boundaries in the target scene. Specifically, the computer device can obtain the obstacle area boundaries of the obstacle area included in the target scene, traverse the obstacle area boundaries, and when the first obstacle area boundary is found, construct a first root node based on the first obstacle area boundary; the difference in the number of obstacle area boundaries located on each directional side of the first obstacle area boundary is less than or equal to a boundary splitting threshold. Based on the N directional sides of the first obstacle area boundary, the obstacle area boundary is divided into N boundary sets; N is a positive integer, and the obstacle area boundaries included in each boundary set are located on the same directional side of the first obstacle area boundary. If the number of obstacle area boundaries included in the i-th boundary set is greater than the tree construction threshold, the i-th boundary set is traversed to find the second obstacle area boundary in the i-th boundary set. Based on the second obstacle area boundary in the i-th boundary set, the i-th child node of the first root node is constructed, until the i-th subtree of the first root node is obtained; i is a positive integer less than or equal to N. If the number of obstacle area boundaries included in the i-th boundary set is less than or equal to the tree construction threshold, the i-th child node of the first root node is constructed based on the i-th boundary set, and the i-th child node of the first root node is determined as the i-th subtree of the first root node. When N subtrees of the first root node are obtained, the first root node and its N subtrees are constructed into an obstacle space binary tree; the obstacle space binary tree is used for collision detection of virtual objects.

[0099] Furthermore, the updated movement speed of the first virtual object can be predicted based on the second virtual object's collision zone boundary, and the first virtual object's movement can be controlled based on the updated movement speed. By optimizing the steps in the process of obtaining the updated movement speed, the efficiency of pathfinding for the first virtual object can be improved.

[0100] It is understood that the computer devices mentioned in the embodiments of the present application include but are not limited to terminal devices or servers. In other words, the computer device can be a server or a terminal device, or it can be a system composed of a server and a terminal device. Among them, the terminal device mentioned above can be an electronic device, including but not limited to a mobile phone, a tablet computer, a desktop computer, a laptop computer, a PDA, a vehicle-mounted device, an augmented reality / virtual reality (AR / VR) device, a helmet display, a smart TV, a wearable device, a smart speaker, a digital camera, a camera and other mobile internet devices (mobile internet device, MID) with network access capability, or terminal devices in scenarios such as trains, ships, and flights. As shown in Figure 1, the terminal device can be a laptop computer (as shown in computer device 102b), a mobile phone (as shown in computer device 102c) or a vehicle-mounted device (as shown in computer device 102a), etc. Figure 1 only lists some of the devices. Optionally, the computer device 102a refers to a device located in a vehicle 103. The computer device 102a can be used to enter a target scene, such as participating in a target game. The target scene refers to any scene in the target game, and the target game can be any game that can perform pathfinding. Among them, the server mentioned above can be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, vehicle-road collaboration, content delivery networks (CDNs), and big data and artificial intelligence platforms.

[0101] Optionally, the data involved in the embodiments of the present application can be stored in a computer device, or the data can be stored based on cloud storage technology or a blockchain network, which is not limited here.

[0102] Further, please refer to Figure 3, which is a flow chart of a data processing method provided in an embodiment of the present application. As shown in Figure 3, the data processing process includes the following steps:

[0103] Step S301 : Acquire candidate virtual objects located in an initial collision buffer area of ​​a first virtual object, and acquire a second virtual object associated with the first virtual object from the candidate virtual objects.

[0104] In an embodiment of the present application, a computer device can obtain a candidate virtual object located in an initial collision cache area of ​​a first virtual object, wherein the initial collision cache area refers to an area for performing rough collision screening on the first virtual object, and the initial collision cache area refers to the grid index to be detected corresponding to the first virtual object in the object management array, or an area for constructing a collision object cache of the first virtual object. Wherein, the distance between the second virtual object and the first virtual object is less than or equal to the collision distance of the first virtual object. Optionally, the object management array can also be stored in the collision object cache, and therefore, the virtual objects contained in the object management array can also be understood as virtual objects stored in the collision object cache. Wherein, the object management array is used to represent the grid index corresponding to the virtual object included in the target scene, and the grid index is used to represent the position of the virtual object in the unit grid divided into the target scene, and the target scene includes the first virtual object; the candidate virtual object can refer to the virtual object in the array element indicated by the grid index to be detected in the object management array.

[0105] Specifically, in one embodiment, the computer device can obtain the first position information of the first virtual object and the collision distance of the first virtual object, and fuse the first position information and the collision distance to obtain the collision detection range of the first virtual object. For example, the first virtual object is denoted as agent_A, and the first position information of the first virtual object is obtained. The first position information can be a dim-dimensional position, where dim is a positive integer and is the spatial dimension of the target scene. If the target scene is a two-dimensional space, then dim is 2, and the first position information can be considered to be (x1, z1); if the target scene is a three-dimensional space, then dim is 3, and the first position information can be considered to be (x1, y1, z1), etc. The computer device can obtain the collision distance radius of the first virtual object. The collision distance refers to the distance at which there is a possibility of collision with the first virtual object. That is, a virtual object whose distance to the first virtual object is less than or equal to the collision distance has the possibility of collision with the first virtual object.

[0106] Furthermore, the computer device may fuse the first position information and the collision distance to obtain a collision detection range of the first virtual object, that is, the collision detection range may be constructed with the first position information as the center and the collision distance of the first virtual object as the radius, wherein the dimension of the collision detection range may be determined according to the spatial dimension of the target scene. For example, if the target scene is a two-dimensional space, that is, the spatial dimension dim is 2, the dimension of the collision detection range may be 2; if the target scene is a three-dimensional space, that is, the spatial dimension dim may be 2 or 3, the dimension of the collision detection range may be 2 or 3. Alternatively, the computer device may obtain the dimensional position of the first position information in h dimensions to be detected, determine the range of the h dimensional positions according to the collision distance, obtain the dimensional ranges corresponding to the h dimensions to be detected, and construct a collision detection range based on the dimensional ranges corresponding to the h dimensions to be detected, where h is a positive integer less than or equal to dim. For example, taking h as 2, the computer device can determine the first dimensional range in the first dimension based on the first dimensional position and collision distance in the first dimension in the first position information, and can determine the second dimensional range in the second dimension based on the second dimensional position and collision distance in the second dimension in the first position information, and construct the collision detection range through the first dimensional range and the second dimensional range. For example, the first dimensional range is [x1-radius, x1+radius], and the second dimensional range is [z1-radius, z1+radius]. Alternatively, it can be considered that a first position conversion is performed on the first position information based on the collision distance to obtain a first range boundary. For example, the first position conversion is a subtraction process, h is 2, then the first range boundary can be recorded as [x_low, z_low], where x_low = x1-radius, z_low = z1-radius; a second position conversion is performed on the first position information based on the collision distance to obtain a second range boundary. For example, the second position conversion is an addition process, h is 2, then the second range boundary can be recorded as [x_up, z_up], where x_up = x1+radius, z_up = z1+radius.

[0107] Furthermore, the computer device can obtain the unit length of the unit grid of the target scene, which can be recorded as (x_uint, z_uint), and perform grid conversion on the collision detection range based on the unit length to obtain the grid detection range. For example, the grid detection range is determined based on the first range boundary and the second range boundary mentioned above. At this time, the grid detection range includes the first detection boundary and the second detection boundary, wherein the acquisition process of the first detection boundary can be shown in formula ①: (grid_x_low, grid_z_low) = ((x1-radius) / x_uint, (z1-radius) / z_uint)①

[0108] As shown in formula ①, the first detection boundary is (grid_x_low, grid_z_low).

[0109] The process of obtaining the second detection boundary can be shown in formula ②: (grid_x_up, grid_z_up) = ((x1+radius) / x_uint, (z1+radius) / z_uint)②

[0110] As shown in formula ②, the second detection boundary is (grid_x_up, grid_z_up).

[0111] Furthermore, the computer device may perform a hash conversion on the grid detection range to obtain an initial collision buffer area for the first virtual object. Specifically, a unit grid located in the grid detection range may be obtained, and the unit grid located in the grid detection range may be recorded as a unit grid to be detected. For example, taking h as 2, the grid position information of the unit grid to be detected may be recorded as (grid_x, grid_z), wherein the unit grid to be detected satisfies (grid_x_low≤grid_x≤grid_x_up, grid_z_low≤grid_z≤grid_z_up). The grid position information of the unit grid to be detected is hashed to obtain an initial collision buffer area for the first virtual object. In this case, the initial collision buffer area refers to the index of the grid to be detected corresponding to the first virtual object in the object management array. Here, the grid position information of the unit grid to be detected can be hashed based on a hash function to obtain an initial collision buffer area for the first virtual object. The hash function can be recorded as grid_hash_func(parameters corresponding to h dimensions to be detected, N). If h is 2, the hash function is grid_hash_func(parameter 1, parameter 2, N), where N is a positive integer and is the array dimension of the object management array. In other words, the hash conversion can be recorded as grid_hash_func(grid_x, grid_z, N). The grid position information of the unit grid to be detected can be hashed based on a hash function to obtain the grid index k to be detected corresponding to the first virtual object. The grid index k to be detected is determined as the initial collision buffer area for the first virtual object. Furthermore, the virtual object corresponding to the initial collision buffer area in the object management array can be determined as a candidate virtual object. In other words, the virtual object in the array element indicated by the grid index to be detected in the object management array is determined as a candidate virtual object.

[0112] For example, assuming that the hash function grid_hash_func (parameter 1, parameter 2, N) = (2*parameter 1 + parameter 2)% N, N is 8, where it is assumed that N is 8, which is an assumed value. The value of N can also be changed according to the number of unit grids or user needs. There are [unit grid (0, 0), unit grid (0, 1), unit grid (0, 2), unit grid (0, 3), unit grid (1, 0), unit grid (1, 1), unit grid (1, 2), unit grid The grid indices corresponding to the unit grids are 0, 1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, ..., respectively. In this way, the unit grids can be mapped and associated with the grid indices of the object management array, so that the virtual objects included in any unit grid can be associated and cached to the grid index mapped to the unit grid, as shown in Figure 4. Assuming that the first virtual object is located in the unit grid (1, 2), the unit grids to be detected include [unit grid (1, 1), unit grid (1, 2), unit grid (2, 1), unit grid (2, 2)]. Based on the hash function, the grid position information of the unit grid to be detected is hashed to obtain the grid index k to be detected, k including [3, 4, 5, 6]. The virtual object in the array element corresponding to the grid index k to be detected is obtained from the object management array as the candidate virtual object. For example, the object management array is recorded as grid (8), that is, an eight-dimensional array, then the candidate virtual objects are the values ​​of grid [3], grid [4], grid [5] and grid [6]. Among them, the subscript (8) is used to represent the array dimension of the object management array, and the subscript [] is used to represent the grid index in the object management array, such as [3] represents the grid index "3" in the object management array.

[0113] Alternatively, the computer device can obtain a unit grid located in the grid detection range, record the unit grid located in the grid detection range as the unit grid to be detected, record the grid index of the grid position information corresponding to the unit grid to be detected in the object management array as the grid index to be detected, that is, the initial collision cache area of ​​the first virtual object, and determine the virtual object corresponding to the initial collision cache area in the object management array as the candidate virtual object. In other words, the computer device can cache the grid position information of the unit grid included in the target scene, and the association relationship between the grid index in the object management array. Any set of association relationships can be recorded as (grid position information, grid index). The computer device can determine the grid position information corresponding to the unit grid to be detected based on the association relationship, so that the grid index associated with the grid position information can be determined in the object management array. For example, see Figure 4, which is a schematic diagram of an object management array generation scene provided in an embodiment of the present application. As shown in FIG4 , taking the object management array 40a shown in FIG4 as an example, assuming that the first virtual object is virtual object A, the object management array 40a is recorded as grid(8), that is, taking N as 8 as an example, the object management array 40a includes the association relationship between the grid index 402 and the unit grid 403. Assuming that the unit grids to be detected include [unit grid (1, 1), unit grid (1, 2), unit grid (2, 1), unit grid (2, 2)], based on the association relationship between the grid index 402 and the unit grid 403, the grid index k to be detected corresponding to the unit grid to be detected is obtained. At this time, k includes [2, 3, 4, 5]. The virtual object corresponding to the grid index k to be detected is obtained from the object management array 40a as a candidate virtual object. The candidate virtual objects include (virtual object G, virtual object A, virtual object B, virtual object C, virtual object J, virtual object E, virtual object H, virtual object I).

[0114] The initial collision buffer area refers to the index of the to-be-detected grid corresponding to the first virtual object in the object management array. The object management array is used to represent the position of the virtual objects included in the target scene within the unit grid divided by the target scene. This allows the computer device to easily and quickly index the candidate virtual objects in the object management array, thereby reducing the search time required to obtain the second virtual object and improving the efficiency of virtual object screening. Moreover, the unit grid is divided only based on the position in the target scene and is not affected by the terrain layout of the target scene. This eliminates the need for multiple changes to the unit grid generation and can even be applied to different scenes, improving the efficiency and convenience of unit grid construction.

[0115] Among them, because the unit grid is obtained by dividing the scene map of the target scene, that is, the area included in each unit grid has a certain range of space, when each virtual object moves, the unit grid where each virtual object is located will not change in real time. Instead, it may move from one unit grid to another after a certain period of time. This also means that the object management array will not change for a certain period of time, and there is no need to update the object management array in real time, which can save time and improve the efficiency and convenience of virtual object collision detection. Through the object management array, virtual objects that need to be accurately detected are deleted, thereby reducing the amount of data for virtual object collision detection and improving pathfinding efficiency to a certain extent.

[0116] Furthermore, the computer device can create an object management array. The object management array is an array used to manage the virtual objects included in the target scene, that is, to represent the positions of the virtual objects included in the target scene in the unit grids divided by the target scene. Specifically, based on the unit length of the unit grids, the target scene can be constructed into M unit grids, and the grid position information corresponding to the M unit grids can be initialized; M is a positive integer. Taking h as 2 as an example, the unit length of the unit grid can be recorded as (x_uint, z_uint), that is, the x-axis unit length is x_uint, and the z-axis unit length is z_uint. Furthermore, an N-dimensional initial object management array can be created, and the grid position information corresponding to the M unit grids can be hashed to obtain the grid indexes corresponding to the M unit grids; N is a positive integer. Optionally, the array dimension N can be determined based on the number of unit grids M, or the default array dimension can be determined as the array dimension N, or the array dimension N can be obtained from integer powers of 2, without limitation. The computer device obtains the unit grid where the virtual object included in the target scene is located, and based on the grid index of the unit grid where the virtual object is located, adds the virtual object to the initial object management array to obtain the object management array; or, the computer device can obtain the position information of the virtual object included in the target scene, perform grid conversion on the position information of the virtual object based on the unit length, determine the first grid position corresponding to the virtual object, perform hash conversion on the first grid position, determine the grid index of the virtual object, and add the virtual object to the initial object management array based on the grid index of the virtual object to obtain the object management array. In this way, the virtual objects in the target scene are mapped to the constructed unit grid, so that the object management array can represent the position of each virtual object relative to the unit grid. Since the unit grid divides the target scene, the number of coordinates of the target scene is reduced (i.e., the coordinates of each position point in the target scene are reduced to the coordinates of each unit grid), thereby reducing the amount of data required to process when mapping the coordinates in the target scene to the object management array, thereby also reducing the time required for preliminary screening of virtual objects based on the object management array to a certain extent, and improving the efficiency of object detection. The initial collision buffer area is used to indicate the grid index converted from the grid detection range, i.e., the aforementioned grid index to be detected; virtual objects include candidate virtual objects. In other words, the unit grids obtained by dividing the target scene are only related to the location within the target scene, and are independent of the terrain layout of the target scene. This ensures that even if the terrain layout of the target scene changes, the unit grid division of the target scene does not need to be changed, thereby improving the efficiency and convenience of unit grid construction.

[0117] When initializing the grid position information corresponding to each of the M unit grids, the second position information of the grid identification points corresponding to each of the M unit grids can be obtained, and the second position information corresponding to each of the M unit grids can be converted to a grid based on the unit length to obtain the grid position information corresponding to each of the M unit grids. The grid identification point can be the center point of the unit grid, etc. Taking a unit grid as an example, the grid identification point corresponding to the unit grid can be denoted as center. Taking h as 2 as an example, the second position information of the grid identification point can be (center_x, center_z). The second position information of the unit grid is converted to a grid to obtain the grid position information of the unit grid (center_x / x_uint, center_z / z_uint).

[0118] For example, referring to FIG4 , M unit grids 401 are constructed, including unit grids (0, 1), ..., and unit grid (3, 3), and the grid position information corresponding to each of the M unit grids 401 is hashed to obtain grid indexes corresponding to each of the M unit grids 401, such as the association between grid index 402 and unit grid 403. The computer device can add a virtual object in the target scene to the array element at the grid index of the unit grid where the virtual object is located, thereby generating an object management array 40a. The object management array 40a may include a grid index 402 and an array element 404 indicated by the grid index, each array element being used to store a virtual object located in the array element, and the virtual object in the array element is also located in a unit grid corresponding to the grid index associated with the array element; or, the object management array 40a may include a grid index 402, an array element 404 indicated by the grid index 402, and a unit grid 403 corresponding to the grid index 402, that is, the object management array 40a may include a grid index, and grid position information of the array element and unit grid corresponding to any grid index.

[0119] When a new virtual object enters the target scene, the newly added virtual object can be added to the object management array. Specifically, when a third virtual object (i.e., a new virtual object) enters the target scene, the third position information of the third virtual object in the target scene is obtained; the third position information is grid-converted based on the unit length to obtain the object grid position of the third virtual object, the object grid position is hash-converted to obtain the grid index to be added corresponding to the third virtual object; based on the grid index to be added, the third virtual object is added to the object management array. In this application, the same hash conversion method is used for hash conversion, and the hash conversion method is not limited here. Optionally, the computer device can generate the object management array based on the array update cycle, that is, for example, the object management array is generated at the current moment, and after the array update cycle passes after the object management array is generated, the object management array is regenerated, so that the virtual objects stored in the object management array can correspond to the actual positions of the virtual objects in the target scene, that is, the virtual objects that may collide with the first virtual object can be more accurately obtained, thereby improving the accuracy of virtual object collision detection to a certain extent.

[0120] In one approach, a computer device can retrieve candidate virtual objects from a collision object cache associated with a first virtual object. The collision object cache is used to store virtual objects located in an initial collision cache region of the first virtual object. Specifically, the collision object cache can be composed of virtual objects corresponding to a to-be-detected grid index k in an object management array, where the to-be-detected grid index k represents the initial collision cache region of the first virtual object. In other words, a collision object cache can be maintained for any virtual object in a target scene. When a candidate virtual object for a particular virtual object is desired, the collision object cache for that virtual object can be retrieved, and the virtual objects included in the collision object cache can be determined as candidate virtual objects for that virtual object.

[0121] When a first virtual object is added to a target scene, the computer device may obtain the first virtual object's standard movement speed V and collision distance R (i.e., radius); and determine an initial collision cache area for the first virtual object based on the standard movement speed and collision distance. The standard movement speed can be considered to be the first virtual object's maximum movement speed within a cache update period. For example, the sum of an integer multiple of the standard movement speed and the collision distance can be determined as the area radius, such as (2V + R), and the initial collision cache area can be determined based on the area radius. Alternatively, the sum of the standard movement speed, collision distance, and range expansion length can be determined as the area radius, and the initial collision cache area can be determined based on the area radius, without limitation. The range expansion length is used to expand the range to be cached, thereby improving the fault tolerance of virtual object collision detection. Furthermore, the virtual objects included in the initial collision cache area are determined as candidate virtual objects associated with the first virtual object, and the candidate virtual objects are added to the collision object cache associated with the first virtual object. Simultaneously, the first virtual object can be added to the collision object cache of the candidate virtual objects. That is, when there is a possibility that the candidate virtual object will collide with the first virtual object, the collision object cache of the first virtual object may be synchronized. For example, if the collision object cache of the first virtual object includes virtual object 1 and virtual object 2, the first virtual object is added to the collision object cache of virtual object 1 and the collision object cache of virtual object 2.

[0122] For example, referring to FIG5 , FIG5 is a schematic diagram of another object management array generation scenario provided by an embodiment of the present application. As shown in FIG5 , when a first virtual object 5011 is added to a target scene 501, a standard movement speed 5021 (which may be referred to as V) and a collision distance 5022 (which may be referred to as R) of the first virtual object 5011 are obtained. Based on the standard movement speed 5021 and the collision distance 5022, an initial collision buffer area 503 of the first virtual object 5011 is determined. For example, using (2V+R) as the area radius 502, the initial collision buffer area 503 of the first virtual object 5011 is determined based on the area radius 502 and the first position information of the first virtual object 5011. The virtual objects included in the initial collision buffer area 503 are determined as candidate virtual objects associated with the first virtual object 5011, and the candidate virtual objects are added to the collision object cache 504 associated with the first virtual object 5011.

[0123] Optionally, if the cache duration of the collision object cache of the first virtual object reaches the cache update period, or the first virtual object undergoes a position jump, the collision object cache of the first virtual object is cleared, the current collision cache area of ​​the first virtual object is obtained, and the virtual objects included in the current collision cache area are added to the collision object cache of the first virtual object; position jump refers to the first virtual object changing from a first position to a second position at a speed greater than a teleportation speed threshold, which is equivalent to position teleportation. During normal movement, the first virtual object's movement distance within one second is limited to its maximum movement speed. Therefore, the initial collision buffer area, determined by the standard movement speed and collision distance, ensures that the first virtual object remains within the initial collision buffer area after movement during a cache update cycle. For example, when the area radius is (2V + R), the movement of other virtual objects can be considered. Specifically, the candidate virtual objects in the initial collision buffer area can include virtual objects that may collide with the first virtual object at various points during the first virtual object's movement within the cache update cycle. This eliminates the need for real-time updates of the collision object cache, reduces the frequency of full collision object cache calculations, and thus saves resources and improves cache management efficiency. If the first virtual object experiences a position jump (i.e., a sudden change in its position, resulting in a significant change in its position information and, consequently, a significant change in its initial collision buffer area), the collision object cache for the first virtual object can be updated to ensure cache accuracy.

[0124] When obtaining a second virtual object associated with a first virtual object from candidate virtual objects, candidate position information of the candidate virtual object and first position information of the first virtual object can be obtained; an object position distance between the candidate position information and the first position information is calculated; if the object position distance is less than or equal to the collision distance, the candidate virtual object is determined to be the second virtual object associated with the first virtual object; the second virtual object does not include the first virtual object. Both the candidate position information and the first position information can be considered as dim-dimensional vectors.

[0125] Step S302: Obtain an obstacle space binary tree of the target scene where the first virtual object is located, traverse the nodes in the obstacle space binary tree, and determine the target obstacle area boundary corresponding to the node whose distance to the first virtual object is less than or equal to the collision distance as the collision area boundary of the first virtual object.

[0126] In an embodiment of the present application, the nodes in the obstacle space binary tree correspond to the obstacle area boundaries in the target scene; the difference between the number of obstacle area boundaries included in the first direction subtree corresponding to any node in the obstacle space binary tree and the number of obstacle area boundaries included in the second direction subtree is less than or equal to the boundary splitting threshold. Wherein, there is an obstacle area in the target scene, and the boundary line of the obstacle area can be considered as the obstacle area boundary. The obstacle area refers to the area where obstacles (such as the main body of a building or scene furnishings, etc.) are located, as well as other impassable areas (such as oceans or swamps, etc.), that is, the impassable area in the target scene. The main body of a building refers to the impassable part of a building, such as a building wall. Taking an obstacle area boundary as an example, if the obstacle area boundary is not split, the obstacle area boundary can be considered as the original obstacle area boundary. If the obstacle area boundary is split, the obstacle area boundary is split to obtain a new obstacle area boundary. For example, if the obstacle area boundary A is split into two parts, the obstacle area boundary A can be considered to be split into obstacle area boundary A1 and obstacle area boundary A2, etc., where the obstacle area boundary A is the original obstacle area boundary. Among them, the relative position of the nodes (which can be recorded as child nodes) in the subtree of any node (which can be recorded as the main node) in the obstacle space binary tree and the main node is the same as the relative position of the obstacle area boundary corresponding to the main node and the obstacle area boundary corresponding to the nodes in the subtree of the main node. For details, please refer to the relevant description in Figure 2.

[0127] Specifically, the computer device may obtain an obstacle distance (referred to as a first obstacle distance, also referred to as a vertical distance) between the first virtual object and the straight line containing the obstacle region boundary corresponding to the root node in the obstacle space binary tree. If the first obstacle distance is less than or equal to the collision distance, the obstacle region boundary corresponding to the root node is determined as the collision region boundary of the first virtual object. The first and second direction subtrees of the root node are traversed to obtain target obstacle region boundaries for nodes included in the first and second direction subtrees, each of which has a second obstacle distance from the first virtual object less than or equal to the collision distance. The target obstacle region boundary is determined as the collision obstacle boundary of the first virtual object, or the original obstacle region boundary where the target obstacle region boundary is located is determined as the collision obstacle boundary of the first virtual object. In other words, the collision obstacle boundary of the first virtual object includes the obstacle region boundary corresponding to the root node and the obstacle region boundaries found by searching the first and second direction subtrees of the root node. The second obstacle distance corresponding to a particular obstacle region boundary may refer to the shortest distance between the line segment of the obstacle region boundary and the first virtual object (the second obstacle distance may be a vertical distance or a non-vertical distance).

[0128] If the first obstacle distance is greater than the collision distance, the relative positional relationship between the first virtual object and the obstacle region boundary corresponding to the root node is obtained. If the relative positional relationship indicates that the first virtual object is located on the first direction side of the obstacle region boundary corresponding to the root node, the nodes in the first direction subtree of the root node are recursively processed until a first target node is obtained. The first target node is a node in the first direction subtree where the first obstacle distance from the first virtual object to the corresponding obstacle region boundary is less than or equal to the collision distance. In other words, the first obstacle distance from the obstacle region boundary corresponding to the first target node to the first virtual object is less than or equal to the collision distance. An obstacle region is composed of multiple boundaries. Each obstacle region boundary can be represented as a line segment, such as obstacle region boundary 701a shown in FIG7 . The line containing any obstacle region boundary is the line obtained by extending the obstacle region boundary on both sides. The first and second direction subtrees of the first target node are continuously traversed to obtain a target obstacle region boundary whose second obstacle distance from the first virtual object is less than or equal to the collision distance. The target obstacle region boundary is then determined as the collision obstacle boundary for the first virtual object. Similarly, if the relative position relationship means that the first virtual object is located on the second direction side of the obstacle area boundary corresponding to the root node, then the nodes in the second direction subtree in the root node are recursively processed until the second target node is obtained. The second target node refers to the straight line where the corresponding obstacle area boundary is located in the second direction subtree, and the first obstacle distance between it and the first virtual object is less than or equal to the collision distance, that is, the straight line where the obstacle area boundary corresponding to the second target node is located, and the first obstacle distance between it and the first virtual object is less than or equal to the collision distance; continue to traverse the first direction subtree and the second direction subtree of the second target node to obtain the target obstacle area boundary whose second obstacle distance with the first virtual object is less than or equal to the collision distance, and determine the target obstacle area boundary as the collision obstacle boundary of the first virtual object.

[0129] In the process of traversing the nodes of the obstacle space binary tree, subtrees will be continuously acquired and detected from the obstacle space binary tree, such as the first direction subtree and the second direction subtree. The above-mentioned first obstacle distance refers to the first virtual object and the distance between the straight line where the obstacle area boundary corresponding to the root node in the currently detected subtree is located.

[0130] Among them, the first direction subtree of a main node refers to the tree structure composed of nodes located on the first direction side of the main node, which is equivalent to the left subtree, and the second direction subtree of the main node refers to the tree structure composed of nodes located on the second direction side of the main node, which is equivalent to the right subtree. For example, referring to Figure 6, Figure 6 is a schematic diagram of an obstacle space binary tree provided by an embodiment of the present application. As shown in Figure 6, assuming that the root node of the obstacle space binary tree is node 60a, the node 60a corresponds to the first direction subtree 601 and the second direction subtree 602; taking node 60b as an example, the first direction subtree of the node 60b refers to the tree structure composed of nodes 60c, 60d and 60e, and the second direction subtree of the node 60b refers to the tree structure composed of nodes 60f and 60g, etc. Similarly, the first direction subtree and the second direction subtree of any node in the obstacle space binary tree can be obtained.

[0131] Furthermore, the above-mentioned obstacle space binary tree is generated based on the obstacle area boundaries of the obstacle area included in the target scene. Specifically, the computer device can obtain the obstacle area included in the target scene and obtain the original obstacle area boundaries of the obstacle area. For example, referring to Figure 7, Figure 7 is a scene schematic diagram provided in an embodiment of the present application. As shown in Figure 7, it is assumed that there are obstacle areas 701, obstacle areas 702, and obstacle areas 703 in the target scene, wherein the obstacle area 701 includes the original obstacle area boundaries 701a, the original obstacle area boundaries 701b, the original obstacle area boundaries 701c, and the original obstacle area boundaries 701d, the obstacle area 702 includes the original obstacle area boundaries 702a, the original obstacle area boundaries 702b, the original obstacle area boundaries 702c, and the original obstacle area boundaries 702d, and the obstacle area 703 includes the original obstacle area boundaries 703a, the original obstacle area boundaries 703b, the original obstacle area boundaries 703c, ... and the original obstacle area boundaries 703h, etc. The shape (i.e., outline information) of the obstacle area in the target scene may be a polygon or an arc (such as a circle, ellipse, or irregular surface). When the obstacle area is polygonal, the original obstacle area boundary of the obstacle area can be clearly obtained, such as obstacle area 701 and obstacle area 702. When the obstacle area is arc-shaped, the original obstacle area boundary of the obstacle area cannot be directly obtained. The obstacle area can be converted into a polygon to obtain an obstacle conversion area. The boundary of the obstacle conversion area is determined as the original obstacle area boundary of the obstacle area, such as obstacle area 703. Similarly, the original obstacle area boundary included in the target scene can be obtained.

[0132] Furthermore, a first obstacle area boundary can be obtained from the original obstacle area boundary. The difference between the number of obstacle area boundaries located on a first direction side of the first obstacle area boundary and the number of obstacle area boundaries located on a second direction side of the first obstacle area boundary is less than or equal to a boundary splitting threshold. Any obstacle area boundary refers to the original obstacle area boundary located on one direction side of the first obstacle area boundary, or refers to an obstacle area boundary obtained by segmenting the original obstacle area boundaries located on both directions side of the first obstacle area boundary. Specifically, segmentation can be performed based on the first obstacle area boundary. Here, "located on one directional side of the first obstacle area boundary" means that all parts of an original obstacle area boundary are on the same side of the first obstacle area boundary. For example, taking original obstacle area boundary 701a as an example, original obstacle area boundary 701b, original obstacle area boundary 701c, original obstacle area boundary 701d, original obstacle area boundary 702c, ..., and original obstacle area boundary 703h can be considered as original obstacle area boundaries located on one directional side of original obstacle area boundary 701a, and original obstacle area boundary 702d and original obstacle area boundary 702b can be considered as original obstacle area boundaries located on both directional sides of original obstacle area boundary 701a. Furthermore, the first obstacle area boundary can be used as the root node, and the original obstacle area boundary can be divided into a first boundary set and a second boundary set based on the first obstacle area boundary. A first directional subtree of the root node is constructed based on the first boundary set, and a second directional subtree of the root node is constructed based on the second boundary set. The first boundary set includes the obstacle area boundaries located on the first directional side of the first obstacle area boundary, and the second boundary set includes the obstacle area boundaries located on the second directional side of the first obstacle area boundary. Optionally, the boundary splitting threshold may be a pre-set value, or the boundary splitting threshold may be determined based on the sum of the number of obstacle area boundaries located on the first direction side of the first obstacle area boundary and the number of obstacle area boundaries located on the second direction side of the first obstacle area boundary (such as referred to as the number of sets). For example, the boundary splitting threshold may be 1 / 10 of the number of sets, etc., which is not limited here. By selecting the segmentation line segment (i.e., the first obstacle area boundary) through the boundary splitting threshold, it is not necessary to traverse all the original obstacle area boundaries to find the original obstacle area boundary used as the root node, thereby reducing the construction time of the tree structure and reducing the time complexity of a single split of the first boundary set and the second boundary set to N*log(N), thereby improving the construction efficiency of the tree structure. Wherein. The N in the time complexity refers to a quantitative representation of complexity, which is different from other Ns, that is, the N in the time complexity in this application is a quantitative representation, and the N other than the N in the time complexity refers to the array dimension of the object management array.

[0133] When dividing the obstacle area boundary into a first boundary set and a second boundary set based on the first obstacle area boundary, the computer device can segment the original obstacle area boundary C into obstacle area boundary C1 and obstacle area boundary C2 based on the straight line along which the first obstacle area boundary lies. Obstacle area boundary C1 is the portion of the original obstacle area boundary C located on the first direction side of the first obstacle area boundary, and obstacle area boundary C2 is the portion of the original obstacle area boundary C located on the second direction side of the first obstacle area boundary. As shown in Figure 7 , original obstacle area boundary 702d can be segmented into obstacle area boundary 7021 and obstacle area boundary 7022 based on the straight line along which original obstacle area boundary 701a lies. The segmentation method for original obstacle area boundary C based on the straight line along which the first obstacle area boundary lies can be found in the segmentation method for original obstacle area boundary 702d in Figure 7 . Furthermore, obstacle area boundary A and obstacle area boundary C1 can be defined as a first boundary set, and obstacle area boundary B and obstacle area boundary C2 can be defined as a second boundary set. Obstacle area boundary A refers to the original obstacle area boundary located on the first direction side of the first obstacle area boundary, obstacle area boundary B refers to the original obstacle area boundary located on the second direction side of the first obstacle area boundary, and original obstacle area boundary C refers to the original obstacle area boundary located on both directions of the first obstacle area boundary. When constructing a first directional subtree with a root node based on the first boundary set, the above process of determining the first obstacle area boundary based on the original obstacle area boundary can be repeated until the first boundary set is traversed, the node distribution corresponding to each obstacle area boundary in the first boundary set is determined, and then the first directional subtree with the root node is determined based on the node distribution corresponding to each obstacle area boundary in the first boundary set. Similarly, a second directional subtree with a root node can be constructed based on the second boundary set. The original obstacle area boundary refers to the boundary that constitutes the obstacle area; one node corresponds to one or more obstacle area boundaries, and each obstacle area boundary can be the original obstacle area boundary that constitutes the obstacle area, or a portion of the original obstacle area boundary obtained by segmenting the original obstacle area boundary.

[0134] Optionally, each node in the obstacle space binary tree may correspond to one obstacle area boundary. Alternatively, a node in the obstacle space binary tree may correspond to multiple obstacle area boundaries. Specifically, if the number of obstacle area boundaries A and obstacle area boundaries C1 is less than or equal to a tree construction threshold, obstacle area boundaries A and obstacle area boundaries C1 are used as first directional child nodes of the root node, and the first directional child node of the root node is determined as the first directional subtree of the root node. If the number of obstacle area boundaries A and obstacle area boundaries C1 is greater than the tree construction threshold, a second obstacle area boundary is obtained from obstacle area boundaries A and obstacle area boundaries C1, and the second obstacle area boundary is determined as the first directional child node of the root node. Based on the first directional child node, obstacle area boundaries A and obstacle area boundaries C1 are divided into a third boundary set and a fourth boundary set. A first directional subtree of the first directional child node is constructed based on the third boundary set, and a second directional subtree of the first directional child node is constructed based on the fourth boundary set. Similarly, if the number of obstacle area boundaries B and obstacle area boundaries C2 is less than or equal to the tree construction threshold, the obstacle area boundaries B and obstacle area boundaries C2 are used as the second direction child nodes of the root node, and the second direction child nodes of the root node are determined as the second direction subtree of the root node; if the number of obstacle area boundaries B and obstacle area boundaries C2 is greater than the tree construction threshold, a third obstacle area boundary is obtained from the obstacle area boundaries B and obstacle area boundaries C2, and the third obstacle area boundary is determined as the second direction child node of the root node. Based on the second direction child nodes, the obstacle area boundaries B and obstacle area boundaries C2 are divided into a fifth boundary set and a sixth boundary set. The first direction subtree of the second direction child node is constructed based on the fifth boundary set, and the second direction subtree of the second direction child node is constructed based on the sixth boundary set. That is to say, when further dividing the above-mentioned boundary sets (such as the first boundary set, the second boundary set, ... and the sixth boundary set, etc.), when the number of obstacle area boundaries included in the boundary set is less than or equal to the tree construction threshold, the boundary set will no longer be divided, and the obstacle area boundaries included in the boundary set will be directly used as a node, thereby further reducing the number of divisions of the boundary set, and thus improving the efficiency of tree structure construction to a certain extent.

[0135] Optionally, a dynamic boundary set can also be searched, and based on the dynamic boundary set, the obstacle area boundary that may collide with the first virtual object is further searched. Specifically, if the dynamic boundary set is not empty, the dynamic area boundary is obtained from the dynamic boundary set, and the dynamic area boundary in the dynamic area boundary whose distance with the first virtual object is less than or equal to the collision distance is determined as the dynamic collision boundary of the first virtual object. Wherein, when the dynamic boundary set includes a dynamic obstacle area, the dynamic obstacle area can be obtained from the dynamic boundary set to obtain the dynamic area boundary of the dynamic obstacle area. Wherein, the dynamic collision boundary and the collision area boundary can be collectively referred to as a collision obstacle boundary, that is, the dynamic collision boundary and the collision area boundary are determined as the collision obstacle boundary. Wherein, the collision obstacle boundary refers to the boundary line where a collision may occur during the movement of the first virtual object.

[0136] Among them, if the number of dynamic area boundaries included in the dynamic boundary set is greater than or equal to the dynamic support threshold, or the fixed time length of the obstacle space binary tree is greater than or equal to the tree update period, then the obstacle space binary tree is reconstructed based on the nodes and dynamic area boundaries in the obstacle space binary tree; or, if the number of dynamic obstacle areas included in the dynamic boundary set is greater than or equal to the dynamic support threshold, or the fixed time length of the obstacle space binary tree is greater than or equal to the tree update period (that is, the obstacle space binary tree can be periodically updated), then the obstacle space binary tree is reconstructed based on the nodes and dynamic area boundaries in the obstacle space binary tree. Among them, the fixed time length refers to the time length during which the obstacle space binary tree does not change, that is, the continuous time length during which the obstacle space binary tree remains unchanged, which is equivalent to periodically updating the obstacle space binary tree based on the tree update period. Further, the dynamic boundary set is cleared or deleted. Optionally, the total number of obstacles in the obstacle area included in the target scene can be obtained, and the dynamic support threshold can be determined based on the total number of obstacles. For example, when the dynamic obstacle area is greater than or equal to a specific percentage of the obstacle area, the obstacle space binary tree is reconstructed. That is, the product of the total number of obstacles and the specific percentage can be determined as the dynamic support threshold.

[0137] Dynamic region boundaries can be considered as obstacle regions that dynamically increase or decrease in the target scene. If the obstacle space binary tree is rebuilt each time a dynamic region boundary is added to the target scene, the tree construction efficiency will be low due to the long time required to rebuild the obstacle space binary tree. Therefore, dynamic region boundaries can be maintained using a dynamic boundary set. Specifically, the computer device can maintain a dynamic boundary set AS and a global boundary set TS. Each node in the obstacle space binary tree can be associated with the region information of the obstacle region to which the obstacle region boundary corresponding to the node belongs. The dynamic boundary set AS is used to maintain the dynamically increasing or decreasing obstacle regions in the target scene, and the global boundary set TS is used to maintain all obstacle regions in the target scene. When a first obstacle region is added to the target scene, it can be added to the dynamic boundary set AS and the global boundary set TS. The first obstacle region in the dynamic boundary set AS can be referred to as a dynamic obstacle region, and the first obstacle region in the global boundary set TS can be referred to as an obstacle region. Obstacle regions include dynamic obstacle regions. Furthermore, when a second obstacle region is deleted from the target scene, the second obstacle region in the dynamic boundary set AS and the second obstacle region in the global boundary set TS can be deleted. At this point, when obtaining the collision region boundary and the dynamic collision boundary, the boundaries within the collision region boundary and the dynamic collision boundary that do not belong to the overall boundary set can be deleted to obtain the collision obstacle boundary. Optionally, the second obstacle region can be added to the deleted region set. When obtaining the collision region boundary and the dynamic collision boundary, the boundaries within the collision region boundary and the dynamic collision boundary that belong to the deleted region set can be deleted to obtain the collision obstacle boundary. Optionally, after reconstructing the obstacle space binary tree, the deleted region set can be deleted.

[0138] When the obstacle space binary tree is reconstructed based on the nodes in the obstacle space binary tree and the dynamic area boundaries, it can be considered that the obstacle space binary tree is reconstructed based on the area information of the obstacle area included in the overall boundary set.

[0139] Optionally, when dim is 3, when performing distance detection on the obstacle area boundary and the dynamic area boundary, the area boundary whose height range of the obstacle area does not intersect with the object height of the first virtual object can be directly deleted to obtain the boundary to be detected. For example, if the height range of obstacle area boundary 1 does not intersect with the object height of the first virtual object, obstacle area boundary 1 can be deleted. That is, the area boundary refers to the obstacle area boundary or the dynamic area boundary, or both. The collision obstacle boundary whose distance from the first virtual object is less than or equal to the collision distance is obtained from the boundary to be detected.

[0140] Step S303 : predicting an updated moving speed of the first virtual object based on the second virtual object and the collision area boundary.

[0141] In an embodiment of the present application, when there is a dynamic collision boundary, the updated movement speed of the first virtual object can be predicted based on the second virtual object, the collision area boundary of the first virtual object and the dynamic collision boundary of the first virtual object, that is, the updated movement speed of the first virtual object can be predicted based on the second virtual object and the collision obstacle boundary.

[0142] Specifically, the computer device obtains the first moving speed and first position information of the first virtual object. The computer device obtains the second moving speed and object position information of the second virtual object, constructs a first speed area based on the first position information and the object position information, and determines the first offset data based on the first moving speed and the second moving speed; constructs a second speed area based on the first offset data and the first speed area, and determines the first candidate speed range based on the second speed area. For example, refer to Figure 8, which is a schematic diagram of a speed update scenario provided by an embodiment of the present application. As shown in Figure 8, assuming that the first moving speed of the first virtual object 801 is V A , the second moving speed of the second virtual object 802 is V B Based on the first position information, the first virtual object 801 is reduced to a point, namely the first virtual object 801b, and based on the object position information, the second virtual object 802 is expanded to a radius of The object expansion area 802b, wherein Among them, R A Refers to the radius of the space occupied by the first virtual object 801, R B Refers to the radius of the space occupied by the second virtual object 802. A first speed region 803 is constructed based on the first position information and the object position information. The first speed region 803 can be considered as a set of relative speeds where a collision may occur between the first virtual object 801b and the object expansion region 802b. At this time, the relative speeds included in the first speed region 803 can be recorded as CC AB , see formula ③:

[0143] As shown in formula ③, is used to represent the relative speed of the first virtual object 801b relative to the second virtual object 802, A refers to Rays in the same direction, B N refers to the object expansion area 802b, Refers to the empty set.

[0144] Furthermore, first offset data is determined based on the first moving speed and the second moving speed. The first offset data may include first offset data A and first offset data B. A second speed region is constructed based on the first offset data and the first speed region. The second speed region includes second speed region A and second speed region B. The first candidate speed range is determined based on the second speed region. Specifically, the second moving speed may be determined as the first offset data A. The second speed region A is constructed based on the first offset data A and the first speed region, i.e., second speed region 804 shown in FIG8 . That is, the first offset data A is a vector indicated by the second moving speed. The first speed region 803 is moved along the first offset data A to obtain the second speed region 804. The second speed region 804 can be shown in formula 4:

[0145] As shown in formula ④, Φ VO Refers to the second speed area A, It refers to vector translation. By translating the first offset data A in the first speed area 803, it is equivalent to converting the relative speed into an absolute speed. That is to say, when the moving speed of the first virtual object belongs to the second speed area A, a collision may occur with the second virtual object.

[0146] Furthermore, the first offset data B can be determined based on the first moving speed and the second moving speed. For example, the first offset data B can be determined based on half of the vector sum of the first moving speed and the second moving speed; or, the first offset data B can be determined based on the first moving speed and the second speed region A, etc. The first offset data B is used to move the endpoint of the second speed region A to half of the vector sum of the first moving speed and the second moving speed. The second speed region B (i.e., the second speed region 805) is constructed based on the first offset data B and the second speed region A. The first offset data B is used to constrain the speed at the next moment to be half of the sum of the first moving speed and any speed that does not belong to the second speed region A, so as to adapt to the movement at the next moment. Since the speed selection at the next moment is arbitrary, the speed direction may change continuously, resulting in jitter, thereby affecting the authenticity of the simulation. By constraining the change in speed direction through the first offset data B, the authenticity of the simulation is improved, that is, the accuracy and authenticity of the speed prediction are improved. The second speed region B can be shown in formula ⑤:

[0147] As shown in formula ⑤, Φ RVO Refers to the second speed region B, where It refers to the speed included in the second speed region B. Further, according to the second speed region B, a first candidate speed range is determined. The first candidate speed range refers to a speed range indicated by a region that does not belong to the second speed region B.

[0148] Alternatively, when determining the first offset data based on the first and second moving speeds and constructing the second speed region based on the first offset data and the first speed region, half of the vector sum of the first and second moving speeds can be directly determined as the first offset data, and the first speed region can be translated based on the first offset data to obtain the second speed region. Furthermore, a first candidate speed range is determined based on the second speed region. This first candidate speed range is a speed range indicated by an area that does not belong to the second speed region.

[0149] Furthermore, the boundary movement speed and boundary position information of the collision area boundary of the first virtual object are obtained, a third speed area is constructed based on the first position information and the boundary position information, and second offset data is determined based on the first movement speed and the boundary movement speed; a fourth speed area is constructed based on the second offset data and the third speed area, and a second candidate speed range is determined based on the fourth speed area. Alternatively, when a dynamic collision boundary exists, the boundary movement speed and boundary position information of the collision obstacle boundary are obtained, a third speed area is constructed based on the first position information and the boundary position information, and second offset data is determined based on the first movement speed and the boundary movement speed; a fourth speed area is constructed based on the second offset data and the third speed area, and a second candidate speed range is determined based on the fourth speed area. The construction method of the third speed area can refer to the construction method of the first speed area described above, and the construction method of the fourth speed area can refer to the construction method of the second speed area described above, and will not be repeated here. The second movement speed in the construction process of the first speed area is replaced by the boundary movement speed to obtain the construction process of the third speed area; the second movement speed in the construction process of the second speed area is replaced by the boundary movement speed to obtain the construction process of the fourth speed area. The boundary movement speed can be considered to be 0.

[0150] Optionally, when constructing the third speed region based on the first position information and the boundary position information, the first position information can be used as the center of the circle, and the tangent line from the center of the circle to the outline information of the obstacle region indicated by the boundary position information can be used to construct the third speed region. See FIG9 , which is a schematic diagram of a speed region construction scenario provided by an embodiment of the present application. As shown in FIG9 , the first position information 901 is used as the center of the circle, and the tangent line from the center of the circle to the outline information of the obstacle region 903 indicated by the boundary position information of the collision obstacle boundary 902 can be used to construct the third speed region 904. The offset of the third speed region is the same as above. In this method, since it is implemented based on the obstacle region, the collision obstacle boundary can be regionally integrated to obtain the collision obstacle region corresponding to the collision obstacle boundary, and the fourth speed region can be constructed directly for the first virtual object and the collision obstacle region, thereby reducing the amount of data required for speed prediction and improving speed prediction efficiency.

[0151] Furthermore, the intersection of the first candidate speed range and the second candidate speed range is determined as the target candidate speed range for the first virtual object; alternatively, the union of the second speed region and the fourth speed region is determined as the total speed region, and the region excluding the total speed region is determined as the target candidate speed range for the first virtual object. The number of second virtual objects can be p, and the number of collision obstacle boundaries can be q, where p is a positive integer and q is a positive integer. The intersection of the first candidate speed ranges corresponding to the p second virtual objects and the second candidate speed ranges corresponding to the q collision obstacle boundaries can be determined as the target candidate speed range for the first virtual object; alternatively, the union of the second speed regions corresponding to the p second virtual objects and the fourth speed regions corresponding to the q collision obstacle boundaries can be determined as the total speed region, and the region excluding the total speed region is determined as the target candidate speed range for the first virtual object. Since the candidate speed range is a relatively wide range, speed determination efficiency can be improved by first integrating the speed regions and then determining the target candidate speed range. Furthermore, the updated movement speed of the first virtual object can be selected from the target candidate speed range. Optionally, the adjacent passable area of ​​the first position information (i.e., the passable area adjacent to the first position information) can be obtained, and the speed update direction can be determined based on the adjacent passable area and the moving direction in the first moving speed; the speed change range of the first virtual object can be determined based on the first moving speed and maximum acceleration of the first virtual object; and the updated moving speed of the first virtual object can be determined based on the speed update direction and the speed change range, wherein the direction of the updated moving speed belongs to the speed update direction, and the magnitude of the updated moving speed belongs to the speed change range. Through this process, the movement of the first virtual object at the next moment remains in the passable area of ​​the target scene, and there will be no sudden change in speed, thereby improving the accuracy, rationality and authenticity of the speed prediction. Alternatively, the updated moving speed of the first virtual object can be directly selected from the target candidate speed range.

[0152] Step S304: Control the first virtual object to move based on the updated movement speed.

[0153] In an embodiment of the present application, the movement of the first virtual object is controlled based on the updated movement speed. Optionally, in step S303, when the updated movement speed vel is directly obtained, an initial path plan can be determined based on the updated movement speed vel. The initial path plan can be recorded as vel*Δt. The initial path plan can be offset based on the adjacent passable area of ​​the first position information to obtain an offset path plan. The first virtual object is controlled to move based on the offset path plan so as to maintain the first virtual object in the passable area of ​​the target scene.

[0154] Optionally, if the number of obstacle region boundaries within the target scene is less than or equal to a tree construction threshold, the distance between the obstacle region boundaries and the first virtual object is obtained, and the obstacle region boundaries within the obstacle region boundaries whose distance with the first virtual object is less than or equal to the collision distance are determined as the collision region boundaries of the first virtual object. If the number of obstacle region boundaries within the target scene is greater than the tree construction threshold, a process of obtaining an obstacle space binary tree for the target scene where the first virtual object is located is executed. In other words, when the number of obstacle region boundaries within the target scene is small, there is no need to construct an obstacle space binary tree, thereby saving resources and improving binary tree management efficiency.

[0155] In an embodiment of the present application, a candidate virtual object located in an initial collision cache area of ​​the first virtual object can be obtained, and a second virtual object associated with the first virtual object can be obtained from the candidate virtual object. The candidate virtual objects of the first virtual object are widely stored through the cache, which is equivalent to preliminary screening of virtual objects. Since the cache of this initial collision cache area is widely stored, that is, pre-set, it will reduce the time required for searching when obtaining the second virtual object, thereby improving the efficiency of virtual object screening. Furthermore, an obstacle space binary tree of the target scene where the first virtual object is located can be obtained. Nodes in the obstacle space binary tree are traversed, and the target obstacle region boundaries corresponding to nodes whose distance from the first virtual object is less than or equal to the collision distance are determined as the collision region boundaries of the first virtual object. The nodes in the obstacle space binary tree correspond to obstacle region boundaries in the target scene, and the difference between the number of obstacle region boundaries included in the first direction subtree corresponding to any node in the obstacle space binary tree and the number of obstacle region boundaries included in the second direction subtree is less than or equal to a boundary splitting threshold. In other words, the number of child nodes in two directions for any node in the obstacle region binary tree is similar. This allows for directional filtering when traversing the obstacle space binary tree, improving obstacle region filtering efficiency. Furthermore, an updated movement speed of the first virtual object can be predicted based on the obtained second virtual object and the aforementioned collision region boundary, and the movement of the first virtual object is controlled based on the updated movement speed. Through the above process, the efficiency of each step of obtaining the updated movement speed is improved, thereby improving pathfinding efficiency.

[0156] Among them, taking the experimental scene as an example, the experimental scene is a circular ring with a radius of 1000, and U virtual objects with a radius of 1 are evenly distributed on the circular ring. The collision distance of each virtual object is 10, the standard moving speed is 5, and each virtual object needs to move to a position with an angle offset of 150 degrees from this circle. During the movement, the latest position information and the initial collision cache area are calculated every 0.1 seconds. After all virtual objects reach the specified position, the calculation of the initial collision cache area is stopped. Statistics are made under different U, and the complete iteration time of the existing algorithm and the complete iteration time of the present application are used to obtain the test results shown in Figure 10. Figure 10 is an iteration time diagram provided by an embodiment of the present application. As shown in Figure 10, test result 1001 is the complete iteration time of the present application, and test result 1002 is the complete iteration time of the existing algorithm. It can be seen that the complete iteration time is greatly reduced, and the construction efficiency of the initial collision cache area is improved by about four times, which also makes the number of virtual objects that can be carried by the same computing resources also increase by about four times.

[0157] Furthermore, a plurality of rotated squares (i.e., dynamic obstacle areas) are randomly generated in the experimental scenario. See Figure 11, which is a schematic diagram of a tree construction test result provided by an embodiment of the present application. As shown in Figure 11, the horizontal axis is the number of squares, and the vertical axis is the construction time of the obstacle space binary tree. The vertical axis adopts a logarithmic coordinate axis. For example, test result 1101 is the construction time of the obstacle space binary tree in the present application, and test result 1102 is the construction time of the obstacle space binary tree in the existing algorithm. It can be seen that the present application is a non-strictly balanced partition, and the existing algorithm is a strictly balanced partition. It can be seen that the time complexity of the strictly balanced partition is a constant term of the number of squares U more than the time complexity of the non-strictly balanced partition. That is, the present application reduces the construction time complexity of the obstacle space binary tree and improves the efficiency of tree construction. Among them, the time complexity of constructing the initial collision buffer area in this application is a constant multiple of the number of virtual objects, and the time complexity of constructing the obstacle space binary tree is also a constant multiple of the obstacle area. Therefore, under non-crowded conditions, the time required for the overall system to run is simply positively correlated with the number of virtual objects and obstacle areas in the target scene (including the experimental scene), and the performance scalability is very good.

[0158] Further, please refer to Figure 12, which is a schematic diagram of a data processing device provided in an embodiment of the present application. The data processing device can be a computer program (including program code, etc.) running in a computer device. For example, the data processing device can be an application software; the device can be used to execute the corresponding steps in the method provided in an embodiment of the present application. As shown in Figure 12, the data processing device 1200 can be used for the computer device in the embodiment corresponding to Figure 3. Specifically, the device may include: an object acquisition module 11, an object determination module 12, a tree acquisition module 13, a boundary determination module 14, a speed prediction module 15 and a movement control module 16.

[0159] An object acquisition module 11 is configured to acquire a candidate virtual object located in an initial collision buffer area of ​​the first virtual object;

[0160] An object determination module 12 is configured to obtain, from candidate virtual objects, a second virtual object associated with the first virtual object; the distance between the second virtual object and the first virtual object is less than or equal to the collision distance of the first virtual object; the initial collision buffer area refers to the to-be-detected grid index corresponding to the first virtual object in the object management array; the object management array is used to represent the grid index corresponding to the virtual object included in the target scene, the grid index is used to represent the position of the virtual object in the unit grid divided into the target scene, and the target scene includes the first virtual object; the candidate virtual object is the virtual object in the array element indicated by the to-be-detected grid index in the object management array;

[0161] A tree acquisition module 13 is used to obtain an obstacle space binary tree of the target scene where the first virtual object is located;

[0162] The boundary determination module 14 is configured to traverse the nodes in the obstacle space binary tree and determine the target obstacle region boundary corresponding to the node whose distance to the first virtual object is less than or equal to the collision distance as the collision region boundary of the first virtual object; the nodes in the obstacle space binary tree correspond to the obstacle region boundary in the target scene; the difference between the number of obstacle region boundaries included in the first direction subtree and the number of obstacle region boundaries included in the second direction subtree of any node in the obstacle space binary tree is less than or equal to the boundary splitting threshold; the obstacle region boundary refers to the boundary line of the obstacle region existing in the target scene;

[0163] A speed prediction module 15 is configured to predict an updated moving speed of the first virtual object based on the second virtual object and the collision area boundary.

[0164] The movement control module 16 is configured to control the movement of the first virtual object based on the updated movement speed.

[0165] The object acquisition module 11 includes:

[0166] a detection and determination unit 111 configured to obtain first position information of a first virtual object and a collision distance of the first virtual object, and fuse the first position information and the collision distance to obtain a collision detection range of the first virtual object;

[0167] A grid conversion unit 112 is used to obtain a unit length of a unit grid of a target scene, and perform grid conversion on the collision detection range based on the unit length to obtain a grid detection range;

[0168] The candidate acquisition unit 113 is configured to perform hash conversion on the grid detection range to obtain an initial collision buffer area of ​​the first virtual object, and determine the virtual object corresponding to the initial collision buffer area in the object management array as a candidate virtual object.

[0169] The device 1200 further includes:

[0170] A grid construction module 17 is configured to construct the target scene into M unit grids based on the unit length of the unit grid;

[0171] The grid initialization module 18 is used to initialize the grid position information corresponding to M unit grids respectively; M is a positive integer;

[0172] The array creation module 19 is used to create an N-dimensional initial object management array, perform hash conversion on the grid position information corresponding to the M unit grids, and obtain the grid index corresponding to the M unit grids; N is a positive integer;

[0173] The array generation module 20 is used to obtain the unit grid where the virtual object included in the target scene is located, and add the virtual object to the initial object management array based on the grid index of the unit grid where the virtual object is located to obtain the object management array; the initial collision buffer area refers to the grid index obtained based on the grid detection range conversion; the virtual object includes the candidate virtual object.

[0174] The grid initialization module 18 is specifically used for:

[0175] The second position information of the grid identification points respectively corresponding to the M unit grids is obtained, and the second position information respectively corresponding to the M unit grids is converted into a position grid based on the unit length to obtain the grid position information respectively corresponding to the M unit grids.

[0176] The device 1200 further includes:

[0177] a position acquisition module 21, configured to acquire third position information of the third virtual object in the target scene when the third virtual object enters the target scene;

[0178] An index acquisition module 22 is configured to perform grid conversion on the third position information based on a unit length to obtain an object grid position of the third virtual object, and perform hash conversion on the object grid position to obtain a grid index to be added corresponding to the third virtual object;

[0179] The object cache module 23 is configured to add the third virtual object to the object management array based on the grid index to be added.

[0180] The object acquisition module 11 includes:

[0181] The cache search unit 114 is configured to obtain a candidate virtual object from a collision object cache associated with the first virtual object; the collision object cache is configured to store virtual objects located in an initial collision cache area of ​​the first virtual object.

[0182] The device 1200 further includes:

[0183] A movement acquisition module 24 is configured to acquire a standard movement speed and a collision distance of the first virtual object when the first virtual object joins the target scene;

[0184] a buffer area determination module 25 for determining an initial collision buffer area of ​​the first virtual object according to a standard moving speed and a collision distance;

[0185] a candidate determination module 26 for determining virtual objects included in the initial collision cache area as candidate virtual objects associated with the first virtual object, and adding the candidate virtual objects to a collision object cache associated with the first virtual object;

[0186] The object synchronization module 27 is configured to add the first virtual object to the collision object cache of the candidate virtual objects.

[0187] The device 1200 further includes:

[0188] The cache update module 28 is configured to clear the collision object cache of the first virtual object if the cache duration of the collision object cache of the first virtual object reaches the cache update period, or if the first virtual object undergoes a position jump, obtain the current collision cache area of ​​the first virtual object, and add the virtual objects included in the current collision cache area to the collision object cache of the first virtual object; a position jump refers to the first virtual object changing from a first position to a second position at a speed greater than a teleportation speed threshold.

[0189] The object determination module 12 includes:

[0190] A position acquisition unit 121 is configured to acquire candidate position information of a candidate virtual object and first position information of a first virtual object;

[0191] The distance screening unit 122 is configured to calculate the object position distance between the candidate position information and the first position information. If the object position distance is less than or equal to the collision distance, the candidate virtual object is determined to be the second virtual object associated with the first virtual object; the second virtual object does not include the first virtual object.

[0192] The device 1200 further includes:

[0193] Boundary acquisition module 29 is configured to acquire an obstacle area included in a target scene, acquire an original obstacle area boundary of the obstacle area, and acquire a first obstacle area boundary from the original obstacle area boundary; the difference between the number of obstacle area boundaries located on a first direction side of the first obstacle area boundary and the number of obstacle area boundaries located on a second direction side of the first obstacle area boundary is less than or equal to a boundary splitting threshold; any obstacle area boundary refers to an original obstacle area boundary located on one direction side of the first obstacle area boundary, or refers to an obstacle area boundary obtained by segmenting the original obstacle area boundaries located on two directions side of the first obstacle area boundary;

[0194] a root determination module 30, configured to use the first obstacle area boundary as a root node;

[0195] The boundary division module 31 is configured to divide the original obstacle area boundary into a first boundary set and a second boundary set based on the first obstacle area boundary;

[0196] The tree construction module 32 is used to construct a first directional subtree of the root node based on the first boundary set, and to construct a second directional subtree of the root node based on the second boundary set; the first boundary set includes the obstacle area boundaries located on the first directional side of the first obstacle area boundary, and the second boundary set includes the obstacle area boundaries located on the second directional side of the first obstacle area boundary.

[0197] The boundary division module 31 includes:

[0198] The boundary segmentation unit 311 is configured to segment the original obstacle area boundary C into an obstacle area boundary C1 and an obstacle area boundary C2 using the straight line on which the first obstacle area boundary lies; the obstacle area boundary C1 is the portion of the original obstacle area boundary C located on the first direction side of the first obstacle area boundary, and the obstacle area boundary C2 is the portion of the original obstacle area boundary C located on the second direction side of the first obstacle area boundary;

[0199] The boundary division unit 312 is configured to determine the obstacle area boundary A and the obstacle area boundary C1 as a first boundary set, and determine the obstacle area boundary B and the obstacle area boundary C2 as a second boundary set; the obstacle area boundary A refers to the original obstacle area boundary located on the first direction side of the first obstacle area boundary, the obstacle area boundary B refers to the original obstacle area boundary located on the second direction side of the first obstacle area boundary, and the original obstacle area boundary C refers to the original obstacle area boundary located on both directions side of the first obstacle area boundary.

[0200] The tree construction module 32 includes:

[0201] A first node construction unit 321 is configured to, if the number of the obstacle area boundary A and the obstacle area boundary C1 is less than or equal to the tree construction threshold, use the obstacle area boundary A and the obstacle area boundary C1 as the first directional child nodes of the root node, and determine the first directional child nodes of the root node as the first directional subtree of the root node;

[0202] The second node construction unit 322 is configured to obtain a second obstacle area boundary from the obstacle area boundary A and the obstacle area boundary C1 if the number of the obstacle area boundary A and the obstacle area boundary C1 is greater than the tree construction threshold, determine the second obstacle area boundary as the first direction subnode of the root node, divide the obstacle area boundary A and the obstacle area boundary C1 into a third boundary set and a fourth boundary set based on the first direction subnode, construct a first direction subtree of the first direction subnode based on the third boundary set, and construct a second direction subtree of the first direction subnode based on the fourth boundary set.

[0203] The device 1200 further includes:

[0204] a boundary screening module 33 configured to, if the number of obstacle region boundaries within the target scene is less than or equal to a tree construction threshold, obtain a distance between the obstacle region boundary and the first virtual object, and determine an obstacle region boundary whose distance with the first virtual object is less than or equal to the collision distance as a collision region boundary for the first virtual object;

[0205] The tree triggering module 34 is configured to notify the tree acquiring module 13 to execute a process of acquiring an obstacle space binary tree of the target scene where the first virtual object is located if the number of obstacle area boundaries of the obstacle area included in the target scene is greater than a tree construction threshold.

[0206] The device 1200 further includes:

[0207] a dynamic acquisition module 35 configured to acquire a dynamic region boundary from the dynamic region boundary if the dynamic region boundary set is not empty, and determine a dynamic region boundary whose distance from the first virtual object is less than or equal to the collision distance as a dynamic collision boundary of the first virtual object;

[0208] The speed prediction module 15 is further configured to predict an updated movement speed of the first virtual object based on the second virtual object, the collision area boundary of the first virtual object, and the dynamic collision boundary of the first virtual object;

[0209] The dynamic acquisition module 35 is further configured to notify the speed prediction module 15 to predict the updated moving speed of the first virtual object based on the second virtual object and the boundary of the collision area.

[0210] The device 1200 further includes:

[0211] a tree reconstruction module 36 configured to reconstruct the obstacle space binary tree based on the nodes and dynamic area boundaries in the obstacle space binary tree if the number of dynamic area boundaries included in the dynamic boundary set is greater than or equal to the dynamic support threshold, or the fixed time length of the obstacle space binary tree is greater than or equal to the tree update period;

[0212] The set clearing module 37 is used to clear the dynamic boundary set.

[0213] The speed prediction module 15 includes:

[0214] The information acquisition unit 151 is configured to acquire first moving speed and first position information of a first virtual object;

[0215] A first offset unit 152 is configured to obtain a second moving speed and object position information of a second virtual object, construct a first speed region according to the first position information and the object position information, and determine first offset data based on the first moving speed and the second moving speed;

[0216] a first determining unit 153, configured to construct a second speed region according to the first offset data and the first speed region, and determine a first candidate speed range based on the second speed region;

[0217] The second offset unit 154 is configured to obtain boundary movement speed and boundary position information of the collision area boundary of the first virtual object, construct a third speed area according to the first position information and the boundary position information, and determine second offset data based on the first movement speed and the boundary movement speed;

[0218] a second determining unit 155 for constructing a fourth speed region according to the second offset data and the third speed region, and determining a second candidate speed range based on the fourth speed region;

[0219] The speed determination unit 156 is configured to determine the intersection of the first candidate speed range and the second candidate speed range as a target candidate speed range for the first virtual object, and select an updated moving speed for the first virtual object from the target candidate speed range.

[0220] In an embodiment of the present application, a candidate virtual object located in an initial collision cache area of ​​a first virtual object can be obtained, and a second virtual object associated with the first virtual object can be obtained from the candidate virtual object. The candidate virtual objects of the first virtual object are widely stored in the cache, which is equivalent to a preliminary screening of virtual objects. The initial collision cache area refers to the index of the to-be-detected grid corresponding to the first virtual object in the object management array. The object management array is used to represent the position of the virtual objects included in the target scene in the unit grid divided by the target scene, so that the computer device can easily and quickly index the candidate virtual object in the object management array, thereby reducing the search time required to obtain the second virtual object and improving the efficiency of virtual object screening. Moreover, the unit grid is divided only based on the position in the target scene and is not affected by the terrain layout of the target scene. This makes it unnecessary to change the generation of the unit grid multiple times and can even be applied to different scenes, which can improve the efficiency and convenience of unit grid construction. Furthermore, an obstacle space binary tree of the target scene where the first virtual object is located can be obtained, and the nodes in the obstacle space binary tree can be traversed. The target obstacle region boundary corresponding to the node whose distance from the first virtual object is less than or equal to the collision distance is determined as the collision region boundary of the first virtual object. The nodes in the obstacle space binary tree correspond to the obstacle region boundary in the target scene, and the difference between the number of child nodes in the first direction and the number of child nodes in the second direction corresponding to any node in the obstacle space binary tree is less than or equal to the boundary splitting threshold. In other words, any node in the obstacle region binary tree has similar numbers of child nodes in both directions. This makes traversal of the obstacle space binary tree similar to a binary search, improving the efficiency of obstacle region screening. Furthermore, based on the obtained second virtual object and the aforementioned collision region boundary, the updated movement speed of the first virtual object can be predicted, and the movement of the first virtual object can be controlled based on the updated movement speed. Through the above process, the efficiency of each step of obtaining the updated movement speed is improved, thereby improving pathfinding efficiency.

[0221] Referring to Figure 13, Figure 13 is a schematic diagram of the structure of a computer device provided in an embodiment of the present application. As shown in Figure 13, the computer device in an embodiment of the present application may include: one or more processors 1301, a memory 1302, and an input / output interface 1303. The processor 1301, the memory 1302, and the input / output interface 1303 are connected via a bus 1304. The memory 1302 is used to store a computer program, which includes program instructions. The input / output interface 1303 is used to receive and output data, such as for data exchange between computer devices. The processor 1301 is used to execute the program instructions stored in the memory 1302.

[0222] The processor 1301 may perform the following operations:

[0223] Obtain a candidate virtual object located in an initial collision buffer area of ​​the first virtual object, and obtain a second virtual object associated with the first virtual object from the candidate virtual object; the distance between the second virtual object and the first virtual object is less than or equal to the collision distance of the first virtual object; the initial collision buffer area refers to the to-be-detected grid index corresponding to the first virtual object in the object management array; the object management array is used to represent the grid index corresponding to the virtual object included in the target scene, the grid index is used to represent the position of the virtual object in the unit grid divided into the target scene, and the target scene includes the first virtual object; the candidate virtual object is the virtual object in the array element indicated by the to-be-detected grid index in the object management array;

[0224] Obtain an obstacle space binary tree of a target scene where the first virtual object is located, traverse the nodes in the obstacle space binary tree, and determine the target obstacle region boundary corresponding to the node whose distance to the first virtual object is less than or equal to the collision distance as the collision region boundary of the first virtual object; the nodes in the obstacle space binary tree correspond to the obstacle region boundary in the target scene; the difference between the number of obstacle region boundaries included in the first direction subtree and the number of obstacle region boundaries included in the second direction subtree of any node in the obstacle space binary tree is less than or equal to the boundary splitting threshold; the obstacle region boundary refers to the boundary line of the obstacle region existing in the target scene;

[0225] Based on the second virtual object and the collision area boundary, an updated movement speed of the first virtual object is predicted, and the first virtual object is controlled to move based on the updated movement speed.

[0226] In some feasible implementations, the processor 1301 may be a central processing unit (CPU), or may be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor, or the processor may be any conventional processor, etc.

[0227] The memory 1302 may include a read-only memory and a random access memory, and provides instructions and data to the processor 1301 and the input / output interface 1303. A portion of the memory 1302 may also include a non-volatile random access memory. For example, the memory 1302 may also store device type information.

[0228] In a specific implementation, the computer device can execute the implementation methods provided by the various steps in Figure 3 through its built-in functional modules. For details, please refer to the implementation methods provided by the various steps in Figure 3, which will not be repeated here.

[0229] The present invention provides a computer device comprising a processor, an input / output interface, and a memory. The processor retrieves a computer program stored in the memory and executes the steps of the method shown in FIG3 to perform data processing operations. In this embodiment, candidate virtual objects located in an initial collision buffer area of ​​a first virtual object are retrieved. A second virtual object associated with the first virtual object is retrieved from the candidate virtual objects. The candidate virtual objects of the first virtual object are broadly stored in the cache, which is equivalent to preliminary virtual object screening. The initial collision buffer area refers to the index of the to-be-detected grid corresponding to the first virtual object in an object management array. The object management array is used to represent the position of the virtual objects included in the target scene within the unit grid divided by the target scene. This allows the computer device to easily and quickly index the candidate virtual object in the object management array, thereby reducing the search time required to obtain the second virtual object and improving the efficiency of virtual object screening. Furthermore, the unit grid is divided only based on the position in the target scene and is not affected by the terrain layout of the target scene. This eliminates the need for multiple changes to the unit grid generation and can even be applied to different scenes, thereby improving the efficiency and convenience of unit grid construction. Furthermore, an obstacle space binary tree of the target scene where the first virtual object is located can be obtained, and the nodes in the obstacle space binary tree can be traversed. The target obstacle region boundary corresponding to the node whose distance from the first virtual object is less than or equal to the collision distance is determined as the collision region boundary of the first virtual object. The nodes in the obstacle space binary tree correspond to the obstacle region boundary in the target scene, and the difference between the number of child nodes in the first direction and the number of child nodes in the second direction corresponding to any node in the obstacle space binary tree is less than or equal to the boundary splitting threshold. In other words, any node in the obstacle region binary tree has similar numbers of child nodes in both directions. This makes traversal of the obstacle space binary tree similar to a binary search, improving the efficiency of obstacle region screening. Furthermore, based on the obtained second virtual object and the aforementioned collision region boundary, the updated movement speed of the first virtual object can be predicted, and the movement of the first virtual object can be controlled based on the updated movement speed. Through the above process, the efficiency of each step of obtaining the updated movement speed is improved, thereby improving pathfinding efficiency.

[0230] The embodiment of the present application also provides a computer-readable storage medium, which stores a computer program, and the computer program is suitable for being loaded by the processor and executing the data processing method provided by each step in Figure 3. For details, please refer to the implementation method provided by each step in Figure 3, which will not be repeated here. In addition, the description of the beneficial effects of adopting the same method will not be repeated. For technical details not disclosed in the computer-readable storage medium embodiment involved in this application, please refer to the description of the method embodiment of this application. As an example, the computer program can be deployed to be executed on a computer device, or on multiple computer devices located in one place, or on multiple computer devices distributed in multiple places and interconnected by a communication network.

[0231] The computer-readable storage medium may be the data processing device provided in any of the aforementioned embodiments or the internal storage unit of the computer device, such as the hard disk or memory of the computer device. The computer-readable storage medium may also be an external storage device of the computer device, such as a plug-in hard disk, a smart memory card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device. Furthermore, the computer-readable storage medium may also include both the internal storage unit of the computer device and an external storage device. The computer-readable storage medium is used to store the computer program and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.

[0232] The present application also provides a computer program product or computer program, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in various optional embodiments of FIG. 3 , thereby obtaining candidate virtual objects located in an initial collision cache area of ​​a first virtual object, obtaining a second virtual object associated with the first virtual object from the candidate virtual objects, and broadly storing the candidate virtual objects of the first virtual object in a cache, which is equivalent to preliminary virtual object screening. The initial collision cache area refers to the index of the to-be-detected grid corresponding to the first virtual object in an object management array. The object management array is used to represent the position of virtual objects included in the target scene within the unit grids divided by the target scene. This allows the computer device to conveniently and quickly index the candidate virtual objects in the object management array, thereby reducing the search time required to obtain the second virtual object and improving virtual object screening efficiency. Moreover, the unit grid is divided based solely on the location in the target scene and is not affected by the terrain layout of the target scene. This eliminates the need for multiple changes to the unit grid generation and allows it to be applied to different scenes, thereby improving the efficiency and convenience of unit grid construction. Furthermore, an obstacle space binary tree of the target scene where the first virtual object is located can be obtained, and the nodes in the obstacle space binary tree can be traversed. The target obstacle region boundary corresponding to the node whose distance from the first virtual object is less than or equal to the collision distance is determined as the collision region boundary of the first virtual object. The nodes in the obstacle space binary tree correspond to the obstacle region boundary in the target scene, and the difference between the number of child nodes in the first direction and the number of child nodes in the second direction corresponding to any node in the obstacle space binary tree is less than or equal to the boundary splitting threshold. In other words, any node in the obstacle region binary tree has similar numbers of child nodes in both directions. Traversing the obstacle space binary tree is similar to a binary search, thereby improving the efficiency of obstacle region screening. Furthermore, based on the acquired second virtual object and the above-mentioned collision area boundary, the updated movement speed of the first virtual object can be predicted, and the movement of the first virtual object can be controlled based on the updated movement speed. Through the above process, the efficiency of each step of obtaining the updated movement speed is improved, thereby improving the pathfinding efficiency.

[0233] The terms "first", "second", etc. in the description, claims, and drawings of the embodiments of the present application are used to distinguish different objects, rather than to describe a specific order. In addition, the terms "comprising" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, apparatus, product, or device comprising a series of steps or units is not limited to the listed steps or modules, but may optionally include steps or modules not listed, or may optionally include other step units inherent to these processes, methods, apparatuses, products, or devices.

[0234] Those skilled in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in this description according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.

[0235] The method and related apparatus provided in the embodiment of the present application are described with reference to the method flow chart and / or structural diagram provided in the embodiment of the present application, and specifically can be implemented by computer program instructions for each process and / or box of the method flow chart and / or structural diagram, and the combination of the process and / or box in the flow chart and / or block diagram. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device produce a device for implementing the function specified in one process or multiple processes of the flow chart and / or one box or multiple boxes of the structural diagram. These computer program instructions can also be stored in a computer-readable memory that can guide a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce a product including an instruction device, and the instruction device implements the function specified in one process or multiple processes of the flow chart and / or one box or multiple boxes of the structural diagram. These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, whereby the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one or more processes in the flowchart and / or one or more boxes in the structural diagram.

[0236] The steps in the method of the embodiment of the present application can be adjusted in order, combined and deleted according to actual needs.

[0237] The modules in the device of the embodiment of the present application can be merged, divided and deleted according to actual needs.

[0238] The above disclosure is only a preferred embodiment of the present application, and certainly cannot be used to limit the scope of rights of the present application. Therefore, equivalent changes made according to the claims of the present application are still within the scope covered by the present application.

Claims

1. A data processing method, characterized in that: The method comprises: A candidate virtual object located in an initial collision cache area of ​​a first virtual object is obtained, and a second virtual object associated with the first virtual object is obtained from the candidate virtual object; the distance between the second virtual object and the first virtual object is less than or equal to the collision distance of the first virtual object; the initial collision cache area refers to a to-be-detected grid index corresponding to the first virtual object in an object management array; the object management array is used to represent a grid index corresponding to a virtual object included in a target scene, and the grid index is used to represent a position of the virtual object in a unit grid divided into the target scene, and the target scene includes the first virtual object; the candidate virtual object refers to a virtual object in an array element indicated by the to-be-detected grid index in the object management array; Obtain an obstacle space binary tree of a target scene where the first virtual object is located, traverse the nodes in the obstacle space binary tree, and determine the target obstacle area boundary corresponding to the node whose distance to the first virtual object is less than or equal to the collision distance as the collision area boundary of the first virtual object; the nodes in the obstacle space binary tree correspond to the obstacle area boundary in the target scene; the difference between the number of obstacle area boundaries included in the first direction subtree of any node in the obstacle space binary tree and the number of obstacle area boundaries included in the second direction subtree is less than or equal to the boundary splitting threshold; the obstacle area boundary refers to the boundary line of the obstacle area existing in the target scene; Based on the second virtual object and the collision area boundary, an updated movement speed of the first virtual object is predicted, and the first virtual object is controlled to move based on the updated movement speed.

2. The method according to claim 1, characterized in that The step of acquiring the candidate virtual object located in the initial collision buffer area of ​​the first virtual object comprises: Acquire first position information of a first virtual object and a collision distance of the first virtual object, and fuse the first position information and the collision distance to obtain a collision detection range of the first virtual object; Acquire a unit length of a unit grid of the target scene, and perform grid conversion on the collision detection range based on the unit length to obtain a grid detection range; A hash conversion is performed on the grid detection range to obtain an initial collision buffer area of ​​the first virtual object, and a virtual object corresponding to the initial collision buffer area in the object management array is determined as a candidate virtual object.

3. The method according to claim 2, characterized in that The method further comprises: Based on the unit length of the unit grid, the target scene is constructed into M unit grids, and grid position information corresponding to the M unit grids is initialized; M is a positive integer; Create an N-dimensional initial object management array, perform hash conversion on the grid position information corresponding to the M unit grids, and obtain the grid indexes corresponding to the M unit grids; N is a positive integer; A unit grid where a virtual object included in the target scene is located is obtained, and based on a grid index of the unit grid where the virtual object is located, the virtual object is added to the initial object management array to obtain the object management array; the initial collision cache area refers to a grid index obtained based on the conversion of the grid detection range; the virtual object includes the candidate virtual object.

4. The method according to claim 3, characterized in that The initializing the grid position information corresponding to the M unit grids respectively includes: The second position information of the grid identification points respectively corresponding to the M unit grids is obtained, and the second position information respectively corresponding to the M unit grids is converted into a position grid based on the unit length to obtain the grid position information respectively corresponding to the M unit grids.

5. The method according to claim 3, characterized in that The method further comprises: When the third virtual object enters the target scene, obtaining third position information of the third virtual object in the target scene; Performing a grid conversion on the third position information based on the unit length to obtain an object grid position of the third virtual object, and performing a hash conversion on the object grid position to obtain a grid index to be added corresponding to the third virtual object; Based on the to-be-added grid index, the third virtual object is added to the object management array.

6. The method according to claim 1, characterized in that The step of acquiring the candidate virtual object located in the initial collision buffer area of ​​the first virtual object comprises: A candidate virtual object is obtained from a collision object cache associated with the first virtual object; the collision object cache is used to store virtual objects located in an initial collision cache area of ​​the first virtual object.

7. The method according to claim 6, characterized in that The method further comprises: When the first virtual object joins the target scene, obtaining a standard moving speed and the collision distance of the first virtual object; Determine the initial collision buffer of the first virtual object according to the standard moving speed and the collision distance domain; Determine the virtual objects included in the initial collision cache area as candidate virtual objects associated with the first virtual object, and add the candidate virtual objects to the collision object cache associated with the first virtual object; The first virtual object is added to a collision object cache of the candidate virtual object.

8. The method according to claim 6, characterized in that The method further comprises: If the cache duration of the collision object cache of the first virtual object reaches the cache update period, or the first virtual object undergoes a position jump, the collision object cache of the first virtual object is cleared, the current collision cache area of ​​the first virtual object is obtained, and the virtual objects included in the current collision cache area are added to the collision object cache of the first virtual object; the position jump refers to the first virtual object changing from a first position to a second position at a speed greater than a teleportation speed threshold.

9. The method according to claim 1, characterized in that The acquiring, from the candidate virtual objects, the second virtual object associated with the first virtual object comprises: Acquire candidate position information of the candidate virtual object, and acquire first position information of the first virtual object; An object position distance between the candidate position information and the first position information is calculated, and if the object position distance is less than or equal to the collision distance, the candidate virtual object is determined to be a second virtual object associated with the first virtual object; the second virtual object does not include the first virtual object.

10. The method according to claim 1, characterized in that The method further comprises: Obtaining an obstacle area included in the target scene, obtaining an original obstacle area boundary of the obstacle area, and obtaining a first obstacle area boundary from the original obstacle area boundary; a difference between the number of obstacle area boundaries located on a first direction side of the first obstacle area boundary and the number of obstacle area boundaries located on a second direction side of the first obstacle area boundary is less than or equal to the boundary splitting threshold; any one obstacle area boundary refers to an original obstacle area boundary located on one direction side of the first obstacle area boundary, or refers to an obstacle area boundary obtained by segmenting the original obstacle area boundaries located on two directions sides of the first obstacle area boundary; The first obstacle area boundary is used as a root node, and the original obstacle area boundary is divided into a first boundary set and a second boundary set based on the first obstacle area boundary. A first direction subtree of the root node is constructed based on the first boundary set, and a second direction subtree of the root node is constructed based on the second boundary set; the first boundary set includes obstacle area boundaries located on the first direction side of the first obstacle area boundary, and the second boundary set includes obstacle area boundaries located on the second direction side of the first obstacle area boundary. An obstacle area boundary on the second direction side of an obstacle area boundary.

11. The method according to claim 10, characterized in that The dividing the original obstacle area boundary into a first boundary set and a second boundary set based on the first obstacle area boundary includes: The original obstacle area boundary C is divided into an obstacle area boundary C1 and an obstacle area boundary C2 by a straight line where the first obstacle area boundary is located; the obstacle area boundary C1 is a portion of the original obstacle area boundary C located on a first direction side of the first obstacle area boundary, and the obstacle area boundary C2 is a portion of the original obstacle area boundary C located on a second direction side of the first obstacle area boundary; The obstacle area boundary A and the obstacle area boundary C1 are determined as a first boundary set, and the obstacle area boundary B and the obstacle area boundary C2 are determined as a second boundary set; the obstacle area boundary A refers to an original obstacle area boundary located on a first direction side of the first obstacle area boundary, and the obstacle area boundary B refers to an original obstacle area boundary located on a second direction side of the first obstacle area boundary; and the original obstacle area boundary C refers to an original obstacle area boundary located on both direction sides of the first obstacle area boundary.

12. The method according to claim 11, characterized in that The step of constructing a first direction subtree of the root node based on the first boundary set includes: If the number of the obstacle area boundary A and the obstacle area boundary C1 is less than or equal to the tree construction threshold, the obstacle area boundary A and the obstacle area boundary C1 are used as the first direction child nodes of the root node, and the first direction child nodes of the root node are determined as the first direction subtree of the root node; If the number of the obstacle area boundaries A and the obstacle area boundaries C1 is greater than the tree construction threshold, a second obstacle area boundary is obtained from the obstacle area boundary A and the obstacle area boundary C1, and the second obstacle area boundary is determined as the first direction subnode of the root node, and the obstacle area boundary A and the obstacle area boundary C1 are divided into a third boundary set and a fourth boundary set based on the first direction subnode, a first direction subtree of the first direction subnode is constructed based on the third boundary set, and a second direction subtree of the first direction subnode is constructed based on the fourth boundary set.

13. The method according to claim 1, characterized in that The method further comprises: If the number of obstacle region boundaries of the obstacle region included in the target scene is less than or equal to the tree construction threshold, the distance between the obstacle region boundary and the first virtual object is obtained, and the obstacle region boundary whose distance to the first virtual object is less than or equal to the collision distance in the obstacle region boundary is determined as the obstacle region boundary of the first virtual object. Collision area boundaries; If the number of obstacle area boundaries of the obstacle area included in the target scene is greater than the tree construction threshold, the step of obtaining the obstacle space binary tree of the target scene where the first virtual object is located is performed.

14. The method according to claim 1, wherein: The method further comprises: If the dynamic boundary set is not empty, obtaining a dynamic area boundary from the dynamic boundary set, and determining a dynamic area boundary in the dynamic area boundary whose distance with the first virtual object is less than or equal to the collision distance as a dynamic collision boundary of the first virtual object; predicting an update movement speed of the first virtual object based on the second virtual object, a collision area boundary of the first virtual object, and a dynamic collision boundary of the first virtual object; If the dynamic boundary set is empty, the step of predicting the update movement speed of the first virtual object based on the second virtual object and the collision area boundary is performed.

15. The method according to claim 14, characterized in that The method further comprises: If the number of the dynamic area boundaries included in the dynamic boundary set is greater than or equal to a dynamic support threshold, or the fixed time length of the obstacle space binary tree is greater than or equal to a tree update period, reconstructing the obstacle space binary tree based on the nodes in the obstacle space binary tree and the dynamic area boundaries; Clear the dynamic boundary set.

16. The method according to claim 1, wherein: The predicting, based on the second virtual object and the collision area boundary, the update movement speed of the first virtual object includes: Acquire a first moving speed and a first position information of the first virtual object; Acquire a second moving speed and object position information of the second virtual object, construct a first speed area according to the first position information and the object position information, and determine first offset data based on the first moving speed and the second moving speed; constructing a second speed region according to the first offset data and the first speed region, and determining a first candidate speed range based on the second speed region; Acquire a boundary movement speed and boundary position information of a collision area boundary of the first virtual object, construct a third speed area according to the first position information and the boundary position information, and determine second offset data based on the first movement speed and the boundary movement speed; constructing a fourth speed region according to the second offset data and the third speed region, and determining a second candidate speed range based on the fourth speed region; The intersection of the first candidate speed range and the second candidate speed range is determined as a target candidate speed range for the first virtual object, and an updated moving speed of the first virtual object is selected from the target candidate speed range.

17. A data processing device, characterized in that: The device comprises: An object acquisition module, used to acquire a candidate virtual object located in an initial collision buffer area of ​​the first virtual object; An object determination module, used to obtain a second virtual object associated with the first virtual object from the candidate virtual objects; the distance between the second virtual object and the first virtual object is less than or equal to the collision distance of the first virtual object; the initial collision buffer area refers to the to-be-detected grid index corresponding to the first virtual object in the object management array; the object management array is used to represent the grid index corresponding to the virtual object included in the target scene, and the grid index is used to represent the position of the virtual object in the unit grid divided into the target scene, and the target scene includes the first virtual object; the candidate virtual object refers to the virtual object in the array element indicated by the to-be-detected grid index in the object management array; A tree acquisition module, used to acquire an obstacle space binary tree of the target scene where the first virtual object is located; A boundary determination module, used to traverse the nodes in the obstacle space binary tree, and determine the target obstacle area boundary corresponding to the node whose distance to the first virtual object is less than or equal to the collision distance as the collision area boundary of the first virtual object; the nodes in the obstacle space binary tree correspond to the obstacle area boundary in the target scene; the difference between the number of obstacle area boundaries included in the first direction subtree corresponding to any node in the obstacle space binary tree and the number of obstacle area boundaries included in the second direction subtree is less than or equal to the boundary splitting threshold; the obstacle area boundary refers to the boundary line of the obstacle area existing in the target scene; a speed prediction module, configured to predict an update movement speed of the first virtual object based on the second virtual object and the collision area boundary; A movement control module is used to control the movement of the first virtual object based on the updated movement speed.

18. A computer device, characterized in that: Includes processor, memory, input and output interfaces; The processor is connected to the memory and the input / output interface respectively, wherein the input / output interface is used to receive and output data, the memory is used to store a computer program, and the processor is used to call the computer program so that the computer device executes the method described in any one of claims 1-16.

19. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is suitable for being loaded and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 16.

20. A computer program product, characterized in that The computer program product comprises a computer program, which is stored in a computer-readable storage medium and is suitable for being read and executed by a processor, so that a computer device having the processor executes the method according to any one of claims 1 to 16.