Data processing method, device, computer equipment and computer program
The method uses an obstacle space binary tree and collision buffer areas to optimize pathfinding in open-world games, addressing inefficiencies in current methods by predicting and controlling virtual object movement, thus improving efficiency and accuracy.
Patent Information
- Application Number
- JP2025524368
- Authority / Receiving Office
- JP · JP
- Patent Type
- Applications
- Current Assignee / Owner
- Priority Date
- 2023-01-28
- Filing Date
- 2023-11-22
- Publication Date
- 2025-10-30
- Estimated Expiration
- 2043-11-22
AI Technical Summary
Current methods for pathfinding in open-world games require reconstructing scene maps when terrain layouts change, reducing efficiency due to the need for pre-generated terrain division data.
A data processing method involving an obstacle space binary tree and collision buffer areas to predict and control the movement of virtual objects, optimizing pathfinding by scanning nodes and determining collision boundaries based on distance thresholds.
Improves pathfinding efficiency by reducing the need for scene map reconstruction and optimizing movement speed prediction, enhancing the accuracy and speed of virtual object movement in dynamic environments.
Smart Images

Figure 2025535951000001_ABST
Abstract
Description
[Technical Field]
[0001] This application claims priority from a Chinese patent application filed on January 28, 2023, bearing application number 202310042502.X and entitled "Data Processing Method, Apparatus, Computer Equipment, and Storage Medium," the entire contents of which are incorporated herein by reference.
[0002] FIELD OF THE INVENTION Embodiments of the present invention relate to the field of computer technology, and in particular to data processing methods, devices, computer equipment and storage media. [Background technology]
[0003] Currently, the development trend of games is to build open worlds. In open worlds, player interactions affect the terrain of the scene. To better control the movement of virtual objects, virtual objects need to be searched for collision avoidance. Currently, the entire space of a target scene is generally divided into multiple convex polygons according to the terrain layout of the target scene. Adjacent convex polygons are connected by common edges, and the multiple convex polygons constitute a scene map of the target scene, including passable and impassable areas. Then, the terrain is divided into regions (i.e., each convex polygon), and a connected polygonal path between the polygon where the start point is located and the polygon where the end point is located is calculated. An optimization process is performed on the connected polygonal path to obtain a final polygonal path. The position of the virtual object is updated frame by frame according to the final polygonal path, thereby realizing the movement of the virtual object. However, this method requires that data regarding terrain division areas be generated in advance, so if the terrain layout in the target scene is changed, a scene map of the target scene must be reconstructed based on the new terrain layout and a connected polygon path must be calculated, which reduces the efficiency of route search. Summary of the Invention
[0004] The embodiments of the present invention provide a data processing method, an apparatus, a computer device, and a storage medium that can improve the efficiency of pathfinding for a virtual object.
[0005] In one aspect of an embodiment of the present invention, there is provided a data processing method, comprising steps of acquiring a candidate virtual object located in an initial collision buffer area of a first virtual object, and acquiring a second virtual object related to the first virtual object from the candidate virtual object, wherein a distance between the second virtual object and the first virtual object is equal to or less than a collision distance of the first virtual object, the initial collision buffer area representing a detection target grid index corresponding to the first virtual object in an object management array, the object management array being used to represent grid indexes corresponding to virtual objects included in a target scene, the grid index representing a position of the virtual object in a unit grid obtained by dividing the target scene, the target scene including the first virtual object, and the candidate virtual object being indicated by the detection target grid index in the object management array. acquiring an obstacle space binary tree of a target scene in which the first virtual object exists, scanning nodes in the obstacle space binary tree, and determining a target obstacle area boundary corresponding to a node whose distance to the first virtual object is equal to or less than the collision distance as a collision area boundary of the first virtual object, wherein the nodes in the obstacle space binary tree correspond to obstacle area boundaries in the target scene, a difference between the number of obstacle area boundaries included in a child tree in a first direction of an arbitrary node in the obstacle space binary tree and the number of obstacle area boundaries included in a child tree in a second direction is equal to or less than a boundary division threshold, and the obstacle area boundary refers to a boundary line of an obstacle area existing in the target scene; and predicting an updated movement speed of the first virtual object based on the second virtual object and the collision area boundary, and controlling the movement of the first virtual object based on the updated movement speed.
[0006] In one aspect of the present invention, a data processing device includes an object acquisition module that acquires a candidate virtual object located in an initial collision buffer area of a first virtual object, and an object determination module that acquires a second virtual object related to the first virtual object from the candidate virtual object, wherein a distance between the second virtual object and the first virtual object is equal to or less than a collision distance of the first virtual object, the initial collision buffer area represents a detection target 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, the grid index represents a position of the virtual object in a unit grid obtained by dividing the target scene, the target scene includes the first virtual object, and the candidate virtual object is a virtual object in an array element indicated by the detection target grid index in the object management array. a tree acquisition module that acquires an obstacle space binary tree of a target scene in which the first virtual object exists; a boundary determination module that scans nodes in the obstacle space binary tree and determines, as a collision area boundary of the first virtual object, a target obstacle area boundary corresponding to a node whose distance to the first virtual object is equal to or less than the collision distance, wherein the node in the obstacle space binary tree corresponds to an obstacle area boundary in the target scene, and a difference between the number of obstacle area boundaries included in a child tree in a first direction of any node in the obstacle space binary tree and the number of obstacle area boundaries included in a child tree in a second direction is equal to or less than a boundary division threshold, and the obstacle area boundary refers to a boundary of an obstacle area existing in the target scene; a speed prediction module that predicts an updated movement speed of the first virtual object based on the second virtual object and the collision area boundary; and a movement control module that controls the movement of the first virtual object based on the updated movement speed.
[0007] Here, the object acquisition module includes: a detection determination unit that acquires first position information of the first virtual object and a collision distance of the first virtual object, and combines the first position information with the collision distance to acquire a collision detection range of the first virtual object; a grid conversion unit that acquires a unit length of a unit grid of the target scene, and performs grid conversion on the collision detection range based on the unit length to acquire a grid detection range; and a candidate acquisition unit that performs hash conversion on the grid detection range to acquire an initial collision buffer area of the first virtual object, and determines a virtual object corresponding to the initial collision buffer area in an object management array as a candidate virtual object.
[0008] Here, the device further includes: a grid construction module that constructs the target scene as M unit grids based on the unit length of the unit grids; a grid initialization module that initializes grid position information corresponding to each of the M unit grids, where M is a positive integer; an array creation module that creates an N-dimensional initial object management array and performs a hash transformation on the grid position information corresponding to each of the M unit grids to obtain a grid index corresponding to each of the M unit grids, where N is a positive integer; and an array generation module that acquires a unit grid in which a virtual object included in the target scene exists, and adds the virtual object to the initial object management array based on the grid index of the unit grid in which the virtual object exists, to obtain the object management array, where the initial collision buffer area means the grid index obtained by converting the grid detection range, and the virtual object includes the candidate virtual object.
[0009] Here, the grid initialization module obtains second position information of grid identification points corresponding to the M unit grids, respectively, and performs position grid transformation on the second position information corresponding to the M unit grids, respectively, based on the unit length, to obtain grid position information corresponding to the M unit grids, respectively.
[0010] Here, the device further includes: a position acquisition module that acquires third position information of the third virtual object in the target scene when a third virtual object enters the target scene; an index acquisition module that performs grid transformation on the third position information based on the unit length to acquire an object grid position of the third virtual object, and performs hash transformation on the object grid position to acquire an added target grid index corresponding to the third virtual object; and an object buffering module that adds the third virtual object to the object management array based on the added target grid index.
[0011] Here, the object acquisition module includes: a buffer lookup unit that acquires candidate virtual objects from a collision object buffer associated with the first virtual object, the collision object buffer being used to store virtual objects located in an initial collision buffer area of the first virtual object.
[0012] Here, the device further includes: a movement acquisition module that acquires a standard movement speed and the collision distance of the first virtual object when the first virtual object enters the target scene; a buffer area determination module that determines the initial collision buffer area of the first virtual object based on the standard movement speed and the collision distance; a candidate determination module that determines a virtual object included in the initial collision buffer area as a candidate virtual object associated with the first virtual object and adds the candidate virtual object to a collision object buffer associated with the first virtual object; and an object synchronization module that adds the first virtual object to the collision object buffer of the candidate virtual object.
[0013] Here, the device further includes a buffer update module that clears the collision object buffer of the first virtual object, obtains a current collision buffer area of the first virtual object, and adds a virtual object included in the current collision buffer area to the collision object buffer of the first virtual object when a buffer time length of the collision object buffer of the first virtual object reaches a buffer update period or when a position warp of the first virtual object occurs, where the position warp means that the first virtual object moves from a first position to a second position at a speed greater than an instantaneous movement speed threshold.
[0014] Here, the object determination module includes: a position acquisition unit that acquires candidate position information of the candidate virtual object and acquires first position information of the first virtual object; and a distance screening unit that calculates an object position distance between the candidate position information and the first position information, and if the object position distance is equal to or less than the collision distance, determines the candidate virtual object as a second virtual object related to the first virtual object, where the second virtual object does not include the first virtual object.
[0015] Here, the device includes a boundary acquisition module that acquires an obstacle area included in the target scene, acquires an original obstacle area boundary of the obstacle area, and acquires a first obstacle area boundary from the original obstacle area boundary, wherein 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 equal to or less than the boundary division threshold, and the obstacle area boundary means the original obstacle area boundary located on one direction side of the first obstacle area boundary, or means the obstacle area boundaries obtained by dividing the original obstacle area boundary located on both direction sides of the first obstacle area boundary. The tree construction module further includes a boundary acquisition module, a root determination module that sets the first fault area boundary as a root node, a boundary classification module that classifies the original fault area boundary into a first boundary set and a second boundary set using the first fault area boundary, and a tree construction module that constructs a child tree of the root node in a first direction based on the first boundary set and a child tree of the root node in a second direction based on the second boundary set, wherein the first boundary set includes fault area boundaries located on a first direction side of the first fault area boundary, and the second boundary set includes fault area boundaries located on a second direction side of the first fault area boundary.
[0016] Here, the boundary classification module includes: a boundary division unit that divides the original obstacle area boundary C into obstacle area boundaries C1 and C2 by a straight line on which the first obstacle area boundary exists, where the obstacle area boundary C1 is a portion of the original obstacle area boundary C that is 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 that is located on a second direction side of the first obstacle area boundary; and a boundary classification unit that determines obstacle area boundary A and the obstacle area boundary C1 as a first boundary set and determines obstacle area boundaries B and C2 as a second boundary set, where the obstacle area boundary A means the original obstacle area boundary that is located on the first direction side of the first obstacle area boundary, the obstacle area boundary B means the original obstacle area boundary that is located on the second direction side of the first obstacle area boundary, and the original obstacle area boundary C means the original obstacle area boundary that is located on both direction sides of the first obstacle area boundary simultaneously.
[0017] Here, the tree construction module includes: a first node construction unit that, when the number of the fault area boundaries A and the fault area boundaries C1 is equal to or less than a tree construction threshold, sets the fault area boundaries A and C1 as child nodes in a first direction of a root node, and determines the child nodes in the first direction of the root node as child trees in the first direction of the root node; and a second node construction unit that, when the number of the fault area boundaries A and C1 is greater than the tree construction threshold, acquires second fault area boundaries from the fault area boundaries A and C1, determines the second fault area boundaries as child nodes in the first direction of the root node, classifies the fault area boundaries A and C1 into a third boundary set and a fourth boundary set based on the child nodes in the first direction, constructs child trees in the first direction of the child nodes in the first direction based on the third boundary set, and constructs child trees in the second direction of the child nodes in the first direction based on the fourth boundary set.
[0018] Here, the device further includes: a boundary screening module that, when the number of obstacle area boundaries of obstacle areas included in the target scene is equal to or less than a tree construction threshold, acquires distances between the obstacle area boundaries and the first virtual object, and determines, among the obstacle area boundaries, an obstacle area boundary whose distance to the first virtual object is equal to or less than the collision distance as a collision area boundary of the first virtual object; and a tree trigger module that, when the number of obstacle area boundaries of obstacle areas included in the target scene is greater than the tree construction threshold, executes a step of acquiring an obstacle space binary tree of the target scene in which the first virtual object exists.
[0019] Here, the device further includes a dynamic acquisition module that, when a dynamic boundary set is not empty, acquires a dynamic area boundary from the dynamic boundary set and determines a dynamic area boundary among the dynamic area boundaries whose distance to the first virtual object is equal to or less than the collision distance as a dynamic collision boundary of the first virtual object, wherein the speed prediction module predicts 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, and the dynamic acquisition module notifies the speed prediction module to predict the updated movement speed of the first virtual object based on the second virtual object and the collision area boundary.
[0020] Here, the device further includes a tree reconstruction module that reconstructs a fault space binary tree based on the nodes in the fault space binary tree and the dynamic region boundaries when the number of dynamic region boundaries included in the dynamic boundary set is equal to or greater than a dynamic support threshold, or when the fixed time length of the fault space binary tree is equal to or greater than a tree update period, and a set clearing module that clears the dynamic boundary set.
[0021] Here, the speed prediction module includes an information acquisition unit that acquires a first moving speed and first position information of the first virtual object, a first offset unit that acquires a second moving speed and object position information of the second virtual object, constructs a first speed region based on the first position information and the object position information, and determines first offset data based on the first moving speed and the second moving speed, a first determination unit that constructs a second speed region based on the first offset data and the first speed region, and determines a first candidate speed range based on the second speed region, and a boundary moving speed and a boundary of a collision area boundary of the first virtual object. a second offset unit that acquires the first position information and boundary position information, constructs a third speed region based on the first position information and the boundary position information, and determines second offset data based on the first movement speed and the boundary movement speed; a second determination unit that constructs a fourth speed region based on the second offset data and the third speed region and determines a second candidate speed range based on the fourth speed region; and a speed determination unit that determines an 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 selects an updated movement speed of the first virtual object within the target candidate speed range.
[0022] One aspect of the present invention provides a computer device including a processor, a memory, and an input / output interface, wherein the processor is connected to the memory and the input / output interface, respectively, and the input / output interface is used to receive data 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 a data processing method according to one aspect of the present invention.
[0023] In one aspect of the present invention, there is provided a computer-readable storage medium having a computer program stored thereon, the computer program being loaded and executed by a processor so that a computing device having the processor executes a data processing method according to one aspect of the present invention.
[0024] According to one aspect of the present invention, there is provided a computer program or computer program product comprising computer instructions stored on a computer-readable storage medium. A processor of a computing device reads and executes the computer instructions from the computer-readable storage medium, such that the computing device performs a method according to one aspect of the present invention. In other words, the computer instructions, when executed by a processor, implement the method according to one aspect of the present invention.
[0025] The embodiment of the present invention has the following advantageous effects.
[0026] In an embodiment of the present invention, obtaining a candidate virtual object located in an initial collision buffer area of a first virtual object, obtaining a second virtual object related to the first virtual object from the candidate virtual object, and widely storing the candidate virtual object for the first virtual object through buffering corresponds to preliminary screening of virtual objects. This initial collision buffer area represents a detection target grid index corresponding to the first virtual object in an object management array, and the object management array is used to represent the position of the virtual object included in the target scene in a unit grid obtained by dividing the target scene. This allows a computer device to easily and quickly index the candidate virtual object in the object management array, thereby reducing the lookup time required to obtain the second virtual object and improving the efficiency of screening virtual objects. Furthermore, the unit grid is obtained by dividing the target scene based only on its position in the target scene, and is not affected by the terrain layout of the target scene. This eliminates the need to change the unit grid multiple times, and the unit grid can be applied to different scenes, improving the efficiency and convenience of building the unit grid. The system also acquires an obstacle space binary tree of the target scene in which the first virtual object is located, scans the nodes in the obstacle space binary tree, and determines, as the collision area boundary of the first virtual object, a target obstacle area boundary corresponding to a node whose distance from the first virtual object is equal to or less than the collision distance. Here, the nodes in the obstacle space binary tree correspond to obstacle area boundaries in the target scene, and the difference between the number of obstacle area boundaries included in the child tree in the first direction of any node in the obstacle space binary tree and the number of obstacle area boundaries included in the child tree in the second direction is equal to or less than the boundary division threshold. In other words, the number of child nodes in two directions of any node in the obstacle space binary tree is approximately the same, and a binary search is performed when scanning the obstacle space binary tree, thereby improving the efficiency of obstacle area screening.Furthermore, an updated movement speed of the first virtual object can be predicted based on the acquired second virtual object and collision area boundary, and the movement of the first virtual object can be controlled based on the updated movement speed, thereby improving the efficiency of each step of acquiring the updated movement speed and improving the efficiency of path search. [Brief explanation of the drawings]
[0027] In order to more clearly describe the technical solutions in the embodiments of the present invention or the prior art, the following briefly introduces the drawings used in the description of the embodiments or the prior art. It should be noted that the drawings in the following description are merely some embodiments of the present invention, and it is obvious that those skilled in the art can derive other drawings based on these drawings without creative work. [Figure 1] FIG. 1 is a schematic diagram of an example of a network interaction architecture for data processing according to an embodiment of the present invention. [Figure 2] FIG. 2 is a schematic diagram of an example of a data processing scenario according to an embodiment of the present invention; [Figure 3] 1 is a flowchart illustrating an example of a data processing method according to an embodiment of the present invention. [Figure 4] FIG. 2 is a schematic diagram of an example scenario for creating an object management array according to an embodiment of the present invention; [Figure 5] FIG. 10 is a schematic diagram of another example scenario of creating an object management array according to an embodiment of the present invention. [Figure 6] FIG. 2 is a schematic diagram of an example of a binary tree of an obstacle space according to an embodiment of the present invention. [Figure 7] FIG. 2 is a schematic diagram of an example scenario according to an embodiment of the present invention. [Figure 8] FIG. 2 is a schematic diagram of an example of a rate update scenario according to an embodiment of the present invention. [Figure 9] FIG. 2 is a schematic diagram of an example scenario of building speed regions according to an embodiment of the present invention; [Figure 10] FIG. 4 is a schematic diagram of an example of repetition time according to an embodiment of the present invention. [Figure 11]FIG. 10 is a schematic diagram of an example of tree construction test results according to an embodiment of the present invention. [Figure 12] 1 is a schematic diagram of an example of a data processing device according to an embodiment of the present invention; [Figure 13] FIG. 1 is a diagram illustrating an example of a configuration of a computer device according to an embodiment of the present invention. DETAILED DESCRIPTION OF THE INVENTION
[0028] The following clearly and completely describes the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. It should be noted that the described embodiments are only a part of the embodiments of the present invention, not all of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative work are within the protection scope of the present invention.
[0029] Here, in the present invention, when it is necessary to collect target (e.g., user) data, a display screen or pop-up window is displayed before and during collection to notify the user that data is currently being collected, and only if the user confirms the display screen or pop-up window, execution of the data acquisition steps is started; otherwise, the processing is terminated. Furthermore, the acquired user data is used in reasonable and lawful situations and applications. Preferably, in scenarios where the user data needs to be used but has not been approved by the user, approval may be requested from the user, and if approval is obtained, the user data may be used.
[0030] Here, path finding refers to the process of calculating a connecting path between two locations in space. A navigation grid refers to a data description of a path-finding surface (i.e., a traversable area of a target scene) of a space (e.g., a target scene) using convex polygons. Collision avoidance refers to avoiding other virtual objects and obstacle areas while a virtual object is moving, and avoiding overlapping of the virtual object with other virtual objects or obstacle areas. Here, an obstacle area refers to an impassable area, such as an area with an obstacle in the target scene. A dynamic obstacle area refers to an impassable area that has been added or removed from the target scene at some time, such as an area with an obstacle that has been added or removed from the target scene at some time. Here, a traversable area refers to an area through which a virtual object can pass and through which path finding is possible. An impassable area refers to an area through which a virtual object cannot pass and through which path finding is impossible. Here, the virtual object can be considered as a game character controlled by a player via a computer device.
[0031] An embodiment of the present invention will be described with reference to FIG. 1. FIG. 1 is a schematic diagram of an example of a network interaction architecture for data processing according to an embodiment of the present invention. 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 in the target scene. This virtual object can be considered as the user's character on the computer device. Any computer device can exchange data with other computer devices, or can exchange data with other computer devices, such as computer device 102a, computer device 102b, or computer device 102c, via server 101. A computer device where a first virtual object is located can obtain a second virtual object and a collision area boundary near the first virtual object. Here, the second virtual object refers to a virtual object whose distance from the first virtual object is equal to or less than the collision distance of the first virtual object, i.e., a virtual object that may collide with the first virtual object. The collision area boundary of the first virtual object refers to the boundary of an obstacle area whose distance from the first virtual object is equal to or less than the collision distance, i.e., the boundary of an obstacle area that may collide with the first virtual object. The computer device may also predict an updated movement speed of the first virtual object based on the second virtual object and the collision area boundary, and control the movement of the first virtual object based on the updated movement speed.
[0032] Specifically, the following description will be given with reference to FIG. 2. FIG. 2 is a schematic diagram of an example of a data processing scenario according to an embodiment of the present invention. As shown in FIG. 2, a target scene 201 includes a first virtual object 2011, an obstacle area 2012, and a virtual object other than the first virtual object 2011, such as a virtual object 2013. Specifically, the computer device may acquire a candidate virtual object 203 located in an initial collision buffer area 202 of the first virtual object 2011. Here, the initial collision buffer area 202 is an area for performing preliminary collision screening for the first virtual object 2011. From the candidate virtual object 203, a second virtual object 204 may be acquired whose distance to the first virtual object 2011 is equal to or less than the collision distance of the first virtual object. The above preliminary collision screening reduces the number of virtual objects that need to be compared with the first virtual object in terms of distance, thereby saving time for acquiring virtual objects with a potential collision. Furthermore, by determining a second virtual object that may collide with the first virtual object based on the collision distance, it is possible to improve the accuracy of acquiring the virtual object and improve the efficiency of acquiring the virtual object.
[0033] Here, the computer device may obtain an obstacle space binary tree 205 of the target scene 201 in which the first virtual object 2011 is located, scan the nodes in the obstacle space binary tree 205, obtain a target obstacle area boundary in an obstacle area boundary corresponding to the node whose distance to the first virtual object 2011 is equal to or less than the collision distance, and determine this target obstacle area boundary as the collision area boundary 206 of the first virtual object 2011. Here, the difference between the number of obstacle area boundaries included in the child tree in the first direction of any node in the obstacle space binary tree 205 and the number of obstacle area boundaries included in the child tree in the second direction is equal to or less than the boundary division threshold. In other words, the fault space binary tree 205 is a tree in which the number of fault region boundaries in the left and right child trees of any node is balanced, and the relative position of a child node in the child tree of any main node (also referred to as a parent node) and the main node (this relative position may be understood as the child node being located in the right child tree or the left child tree of the parent node) is the same as the relative position of the fault region boundary corresponding to the main node and the fault region boundary corresponding to the child node in the child tree of the main node. For example, if there are child nodes 1 and 2 for node A, and child node 1 is located in the child tree of node A in the first direction and child node 2 is located in the child tree of node A in the second direction, the fault area boundary corresponding to child node 1 can be considered to be located on the first direction side of the fault area boundary corresponding to node A (the same as the direction of the child tree in the first direction, e.g., both are on the left side), and the fault area boundary corresponding to child node 2 can be considered to be located on the second direction side of the fault area boundary corresponding to node A (the same as the direction of the child tree in the second direction, e.g., both are on the right side). Here, any node in this fault space binary tree may be referred to as a principal node, and nodes in the child tree of this principal node can be considered child nodes of this principal node. In other words, if a leaf node in the fault space binary tree is considered the principal node, the child node is empty. If the root node in the fault space binary tree is considered the principal node, all nodes in this fault space binary tree other than the root node can be considered child nodes. This obstacle space binary tree can improve the efficiency of acquiring the boundary of an obstacle area that may collide with the first virtual object.
[0034] Here, the computer device may construct a fault space binary tree based on fault area boundaries in the target scene. Specifically, the computer device may obtain fault area boundaries of the fault areas included in the target scene, scan the fault area boundaries, and if a first fault area boundary is found, construct a first root node based on the first fault area boundary. The difference in the number of fault area boundaries located on each directional side of the first fault area boundary is equal to or less than a boundary division threshold. Based on the N directional sides of the first fault area boundary, the fault area boundaries are classified into N boundary sets, where N is a positive integer, and the fault area boundaries included in each boundary set are located on the same directional side of the first fault area boundary. If the number of fault area boundaries included in the i-th boundary set is greater than the tree construction threshold, the i-th boundary set is scanned until an i-th child tree of the first root node is obtained, and a second fault area boundary in the i-th boundary set is found. The i-th child node of the first root node is constructed based on the second fault area boundary in the i-th boundary set. i is a positive integer equal to or less than N. If the number of obstacle area boundaries included in the i-th boundary set is less than or equal to a tree construction threshold, an 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 child tree of the first root node. When N child trees of the first root node are obtained, the first root node and the N child trees of the first root node are constructed as an obstacle space binary tree. The obstacle space binary tree is used to perform collision detection of virtual objects.
[0035] Furthermore, an updated movement speed of the first virtual object may be predicted based on the second virtual object and the collision area boundary, and the movement of the first virtual object may be controlled based on the updated movement speed. By optimizing the steps in the process of obtaining the updated movement speed, the efficiency of path search for the first virtual object can be improved.
[0036] Note that the computer device according to the embodiment of the present invention includes, but is not limited to, a terminal device or a server. In other words, the computer device may be a server or a terminal device, or a system including a server and a terminal device. Here, the terminal device may be an electronic device, including, but not limited to, a mobile phone, a tablet computer, a desktop computer, a laptop computer, a handheld computer, an in-vehicle device, an augmented reality / virtual reality (AR / VR) device, a head-mounted display, a smart TV, a wearable device, a smart speaker, a digital camera, a camera, and other mobile internet devices (MIDs) that can access a network, or a terminal device in a scenario such as a train, a ship, or an airplane. As shown in FIG. 1, the terminal device may be a laptop computer (designated as computer device 102b), a mobile phone (designated as computer device 102c), or an in-vehicle device (designated as computer device 102a), but FIG. 1 only shows some of the devices. Preferably, the computer device 102a refers to a device located in the vehicle 103, and the computer device 102a may be used to enter a target scene and participate in, for example, a target game. The target scene refers to any scene in a target game, and the target game may be any game capable of executing path planning. Here, the server may be an independent physical server, a server cluster or a distributed system consisting of multiple physical servers, or a cloud server providing 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 coordination, content delivery networks (CDNs), big data, and artificial intelligence platforms.
[0037] Preferably, data according to the embodiments of the present invention may be stored in a computer device, or may be stored by cloud storage technology or a blockchain network, but the present invention is not limited thereto.
[0038] The following description will be made with reference to Fig. 3. Fig. 3 is a flowchart of an example of a data processing method according to an embodiment of the present invention. As shown in Fig. 3, the data processing method includes the following steps:
[0039] Step S301: Obtain a candidate virtual object located in an initial collision buffer area of a first virtual object, and obtain a second virtual object related to the first virtual object from the candidate virtual objects.
[0040] In an embodiment of the present invention, a computer device may acquire candidate virtual objects located within an initial collision buffer area of a first virtual object. The initial collision buffer area refers to an area for performing preliminary collision screening for the first virtual object. The initial collision buffer area refers to a detection target grid index corresponding to the first virtual object in an object management array, or an area for constructing a collision object buffer for the first virtual object. Here, the distance between the second virtual object and the first virtual object is equal to or less than the collision distance of the first virtual object. Preferably, the object management array may also be stored in the collision object buffer, and therefore the virtual objects included in the object management array may be understood to be virtual objects stored in the collision object buffer. Here, the object management array is used to represent grid indices corresponding to virtual objects included in a target scene, and the grid indices are used to represent the positions of the virtual objects in a unit grid obtained by dividing the target scene, and the target scene includes the first virtual object. The candidate virtual objects may refer to virtual objects in array elements indicated by the detection target grid indices in the object management array.
[0041] Specifically, in one aspect, the computer device may acquire first position information of a first virtual object and a collision distance of the first virtual object, and may combine the first position information and the collision distance to acquire a collision detection range of the first virtual object. For example, the first virtual object may be agent_A, and first position information of the first virtual object may be acquired. The first position information is a dim-dimensional position, where dim is a positive integer and represents the spatial dimension of the target scene. If the target scene is two-dimensional, dim may be 2, and the first position information may be (x1, z1). If the target scene is three-dimensional, dim may be 3, and the first position information may be (x1, y1, z1). The computer device may acquire a collision distance radius of the first virtual object. The collision distance means a distance at which a collision with the first virtual object is possible. In other words, a virtual object whose distance to the first virtual object is equal to or less than the collision distance may collide with the first virtual object.
[0042] Next, the computer device may acquire a collision detection range for the first virtual object by combining the first position information and the collision distance. That is, the computer device may construct a collision detection range using the first position information as the center of a circle and the collision distance of the first virtual object as the radius. Here, the dimension of this collision detection range may be determined based on the spatial dimension of the target scene. For example, if the target scene is a two-dimensional space, i.e., if the spatial dimension dim is 2, the dimension of the collision detection range may be 2. For example, if the target scene is a three-dimensional space, i.e., if the spatial dimension dim is 2 or 3, the dimension of the collision detection range may be 2 or 3. Alternatively, the computer device may acquire dimensional positions in h detection target dimensions of the first position information, determine ranges for the h dimensional positions based on the collision distance, acquire dimensional ranges corresponding to the h detection target dimensions, and construct the collision detection range based on the dimensional ranges corresponding to the h detection target dimensions, where h is a positive integer less than or equal to dim. For example, assuming that h is 2, the computer device may determine a first dimension range in the first dimension based on a first dimension position in the first dimension of the first position information and the collision distance, determine a second dimension range in the second dimension based on a second dimension position in the second dimension of the first position information and the collision distance, and construct a collision detection range based on the first dimension range and the second dimension range. For example, the first dimension range is [x1-radius, x1+radius], and the second dimension range is [z1-radius, z1+radius]. Alternatively, for example, a first range boundary may be obtained by performing a first position transformation on the first position information based on the collision distance. For example, if the first position transformation is a subtraction process and h is 2, the first range boundary may be [x_low, z_low], where x_low=x1-radius and z_low=z1-radius. Also, a second position transformation may be performed on the first position information based on the collision distance to obtain a second range boundary.For example, if the second position transformation is an addition operation and h is 2, the second range bound may be [x_up, z_up], where x_up=x1+radius and z_up=z1+radius.
[0043] The computer device may also obtain a unit length of a unit grid of the target scene, for example, (x_uint, z_uint), and perform grid transformation on the collision detection range based on the unit length to obtain the grid detection range. For example, the grid detection range may be determined based on the above-mentioned first range boundary and second range boundary, where the grid detection range includes the first detection boundary and the second detection boundary, and the procedure for obtaining the first detection boundary may refer to Equation (1).
[0044] (grid_x_low,grid_z_low)=((x1-radius) / x_uint,(z1-radius) / z_uint) (1) As shown in equation (1), the first detection boundary is (grid_x_low, grid_z_low).
[0045] Here, the procedure for obtaining the second detection boundary may refer to equation (2).
[0046] (grid_x_up,grid_z_up)=((x1+radius) / x_uint,(z1+radius) / z_uint) (2) As shown in equation (2), the second detection boundary is (grid_x_up, grid_z_up).
[0047] The computer device may then perform a hash transform 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 used as a detection target unit grid. In the following, assuming that h is 2 as an example, the grid position information of the detection target unit grid may be (grid_x, grid_z), where the detection target unit grid satisfies (grid_x_low≦grid_x≦grid_x_up, grid_z_low≦grid_z≦grid_z_up). The grid position information of the detection target unit grid may be hash transformed to obtain an initial collision buffer area for the first virtual object. In this case, the initial collision buffer area refers to the detection target grid index corresponding to the first virtual object in the object management array. Here, the grid position information of the detection target unit grid may be hash transformed based on a hash function to obtain an initial collision buffer area for the first virtual object. The hash function is grid_hash_func(parameters corresponding to the h detection target dimensions, N). For example, when 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. That is, the hash conversion may be grid_hash_func(grid_x, grid_z, N). Grid position information of the detection target unit grid may be hash converted based on the hash function to obtain a detection target grid index k corresponding to a first virtual object, and this detection target grid index k may be determined as an initial collision buffer area for the first virtual object. Then, a virtual object corresponding to the initial collision buffer area in the object management array may be determined as a candidate virtual object. That is, a virtual object in an array element indicated by the detection target grid index in the object management array may be determined as a candidate virtual object.
[0048] For example, assume that the hash function is grid_hash_func(parameter 1, parameter 2, N) = (2 * parameter 1 + parameter 2) % N, and N is 8. Here, N is assumed to be 8, but this is only a hypothetical value, and the value of N may change depending on the number of unit grids and user requirements. 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 (1,3), unit grid (2,0), unit grid (2,1), unit grid (2,2), unit grid (2,3), ...], and the grid indices corresponding to each unit grid are 0, 1, 2, 3, 2, 3, 4, 5, 4, 5, 6, 7, .... 4, by mapping the unit grids and the grid indices of the object management array, virtual objects included in any unit grid can be buffered in association with the location of the grid index mapped to that unit grid. Assuming that a first virtual object is located at unit grid (1,2), the obtained detection target unit grid includes [unit grid (1,1), unit grid (1,2), unit grid (2,1), unit grid (2,2)]. The grid position information of the detection target unit grid is hash-converted based on a hash function to obtain a detection target grid index k, where k includes [3,4,5,6]. A virtual object at an array element corresponding to the detection target grid index k is obtained from the object management array as a candidate virtual object. For example, if the object management array is grid (8), i.e., an 8-dimensional array, the candidate virtual objects are the values of grid [3], grid [4], grid [5], and grid [6]. Here, the corner mark (8) is used to indicate the array dimension of the object management array, and the corner mark [] is used to indicate the grid index in the object management array, for example, [3] indicates the grid index "3" in the object management array.
[0049] Alternatively, the computer device may acquire a unit grid located within the grid detection range, determine the unit grid located within the grid detection range as a detection target unit grid, determine a grid index in the object management array of grid position information corresponding to the detection target unit grid as a detection target grid index, i.e., an initial collision buffer area of a first virtual object, and determine a virtual object corresponding to the initial collision buffer area in the object management array as a candidate virtual object. That is, the computer device may buffer a correlation between grid position information of a unit grid included in a target scene and a grid index in the object management array, and an arbitrary correlation pair may be (grid position information, grid index). Based on this correlation, the computer device may identify grid position information corresponding to the detection target unit grid and identify a grid index corresponding to the grid position information in the object management array. For example, a description will be given with reference to FIG. 4. FIG. 4 is a schematic diagram of an example scenario for generating an object management array according to an embodiment of the present invention. 4, taking the object management array 40a shown in FIG. 4 as an example, if the first virtual object is virtual object A and this object management array 40a is grid(8), that is, N is 8, this object management array 40a includes a correlation between grid index 402 and unit grid 403. Assuming that the detection target unit grid includes [unit grid (1,1), unit grid (1,2), unit grid (2,1), unit grid (2,2)], a detection target grid index k corresponding to the detection target unit grid is obtained based on the correlation between the grid index 402 and the unit grid 403. In this case, k includes [2,3,4,5], and a virtual object corresponding to the detection target grid index k is obtained from the object management array 40a as a candidate virtual object. The candidate virtual objects include (object G, object A, object B, object C, object J, object E, object H, object I).
[0050] Here, the initial collision buffer area refers to a detection target grid index corresponding to a first virtual object in the object management array, and the object management array is used to display the position of a virtual object included in a target scene in a unit grid divided in the target scene. This allows a computer device to conveniently and quickly index candidate virtual objects in the object management array, thereby reducing the search time required to acquire a second virtual object and improving the efficiency of virtual object selection. Furthermore, the unit grid is obtained by dividing only the position in the target scene, and is not affected by the topographical layout of the target scene. This eliminates the need to repeatedly change the unit grid generation, and allows it to be applied to different scenes, improving the efficiency and convenience of unit grid construction.
[0051] Here, the unit grids are obtained by dividing the scene map of the target scene, i.e., the area included in each unit grid has a certain range space. Therefore, when each virtual object moves, the unit grid on which each virtual object is located does not change in real time, and after a certain time has passed, the virtual object can move from one unit grid to another unit grid. Therefore, the object management array does not change within a certain time, and there is no need to update the object management array in real time. Therefore, time can be saved and the efficiency and convenience of collision detection for virtual objects can be improved. The object management array can reduce the number of virtual objects that need to be accurately detected, thereby reducing the amount of data required for virtual object collision detection and improving the efficiency of path search.
[0052] The computer device may then create an object management array. Here, this object management array is an array for managing virtual objects included in the target scene, i.e., an array for representing the positions of the virtual objects included in the target scene in the unit grids divided by the target scene. Specifically, the target scene may be constructed as M unit grids based on the unit lengths of the unit grids, and grid position information corresponding to each of the M unit grids may be initialized. M is a positive integer. Here, assuming that h is 2 as an example, the unit length of the unit grid may be expressed as (x_uint, z_uint), i.e., the unit length of the x-axis is x_uint and the unit length of the z-axis is z_uint. Then, an N-dimensional initial object management array may be created, and the grid position information corresponding to each of the M unit grids may be hash-transformed to obtain grid indices corresponding to each of the M unit grids. N is a positive integer. Preferably, the array dimension may be determined from the number M of unit grids, or a default array dimension N may be determined, or the array dimension may be obtained from an integer power of 2, but is not limited thereto. The computer device then acquires a unit grid in which a virtual object included in the target scene exists, and adds the virtual object to the initial object management array based on the grid index of the unit grid in which the virtual object exists, thereby acquiring the object management array. Alternatively, the computer device may acquire position information of a virtual object included in the target scene, grid-convert the position information of the virtual object based on the unit length, determine a first grid position corresponding to the virtual object, hash-convert the first grid position, determine a 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, thereby acquiring the object management array. By mapping virtual objects in the target scene to the constructed unit grid in this way, the object management array can represent the position of each virtual object with respect to the unit grid.Dividing the target scene by unit grids reduces the number of coordinates in the target scene (i.e., reduces the coordinates of each position point in the target scene to the coordinates of each unit grid). This reduces the amount of data that needs to be processed when mapping coordinates in the target scene to the object management array, reduces the time required for initial screening of virtual objects based on the object management array, and improves the efficiency of object detection. Here, the initial collision buffer area is used to indicate the grid index converted according to the grid detection range, i.e., the above-mentioned detection target grid index. The virtual objects include candidate virtual objects. That is, the unit grids obtained by dividing the target scene are unrelated to the terrain layout of the target scene and are related only to the position in the target scene. Therefore, even if the terrain layout of the target scene changes, there is no need to change the division of the unit grids in the target scene, thereby improving the efficiency and convenience of building the unit grids.
[0053] Here, when initializing the grid position information corresponding to each of the M unit grids, second position information of the grid identification point corresponding to each of the M unit grids may be obtained, and the second position information corresponding to each of the M unit grids may be subjected to position grid transformation based on the unit length to obtain the grid position information corresponding to each of the M unit grids. Here, the grid identification point may be the center point of the unit grid where it is located. Taking one unit grid as an example, the grid identification point corresponding to the unit grid may be denoted as "center." Taking h as 2 as an example, the second position information of the grid identification point may be denoted as (center_x, center_z). The second position information of the unit grid is subjected to grid transformation to obtain the grid position information (center_x / x_uint, center_z / z_uint) of the unit grid.
[0054] 4, M unit grids 401 including unit grid (0,1), ..., and unit grid (3,3) are constructed, and grid position information corresponding to each of the M unit grids 401 is hash-transformed to obtain grid indexes corresponding to each of the M unit grids 401, such as an association relationship between a grid index 402 and a unit grid 403. The computer device may generate an object management array 40a by adding a virtual object in the target scene to an array element at the grid index of the unit grid in which the virtual object exists. Here, the object management array 40a may include a grid index 402 and an array element 404 indicated by the grid index, where each array element is used to store a virtual object located at the array element, and the virtual object in the array element exists in the unit grid corresponding to the grid index associated with the array element. Alternatively, 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 an array element and unit grid corresponding to an arbitrary grid index.
[0055] Here, when a new virtual object enters the target scene, the newly added virtual object may be added to the object management array. Specifically, when a third virtual object (new virtual object) enters the target scene, third position information of the third virtual object in the target scene is obtained, grid transformation is performed on the third position information based on the unit length to obtain the object grid position of the third virtual object, hash transformation is performed on the object grid position to obtain an addition target grid index corresponding to the third virtual object, and the third virtual object is added to the object management array based on the addition target grid index. Here, the present invention performs hash transformation using the same hash transformation method, but is not limited to this hash transformation method. Preferably, the computer device may generate the object management array based on the array update period. That is, for example, the object management array may be generated at the current time point, and the object management array may be regenerated when the array update period has elapsed since the generation of the object management array, so that the virtual objects stored in the object management array correspond to the actual positions of the virtual objects in the target scene. That is, 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.
[0056] In one embodiment, the computer device may obtain candidate virtual objects from a collision object buffer associated with a first virtual object. The collision object buffer is for storing virtual objects located in an initial collision buffer area of the first virtual object. That is, the collision object buffer may be configured using a virtual object corresponding to a detection target grid index k in the object management array, where the detection target grid index k is the initial collision buffer area of the first virtual object. That is, when it is necessary to obtain candidate virtual objects for a virtual object, the computer device may maintain a collision object buffer for the virtual object, and may obtain the collision object buffer for the virtual object and determine the virtual objects included in the collision object buffer as candidate virtual objects for the virtual object.
[0057] When a first virtual object enters the target scene, the computer device may acquire a standard moving speed V and a collision distance R (i.e., a radius) of the first virtual object and determine an initial collision buffer area for the first virtual object based on the standard moving speed and the collision distance. Here, the standard moving speed may be the maximum moving speed of the first virtual object during a buffer update period. For example, the computer device may determine an area radius, e.g., (2V+R), as the sum of an integer multiple of the standard moving speed and the collision distance, and determine the initial collision buffer area based on the area radius. Alternatively, the computer device may determine an area radius as the sum of the standard moving speed, the collision distance, and a range expansion length, and determine the initial collision buffer area based on the area radius. The range expansion length is used to expand the range required for buffering and improve the tolerance for collision detection of the virtual object. Then, the computer device may determine virtual objects included in the initial collision buffer area as candidate virtual objects associated with the first virtual object and add the candidate virtual objects to a collision object buffer associated with the first virtual object. The computer device may also add the first virtual object to the collision object buffer of the candidate virtual object. That is, if a candidate virtual object has a possibility of colliding with a first virtual object, the collision object buffer of the first virtual object may be synchronized. For example, if the collision object buffer of the first virtual object includes virtual object 1 and virtual object 2, the first virtual object is added to the collision object buffer of virtual object 1 and the collision object buffer of virtual object 2.
[0058] For example, description will be given with reference to FIG. 5. FIG. 5 is a schematic diagram of another example scenario of generating an object management array according to an embodiment of the present invention. As shown in FIG. 5, when a first virtual object 5011 joins 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. An initial collision buffer area 503 of the first virtual object 5011 is determined based on the standard movement speed 5021 and the collision distance 5022. For example, (2V+R) is set 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 first position information of the first virtual object 5011. Virtual objects included in the initial collision buffer area 503 are determined as candidate virtual objects related to the first virtual object 5011, and the candidate virtual objects are added to a collision object buffer 504 related to the first virtual object 5011.
[0059] Preferably, when the buffer time length of the collision object buffer for the first virtual object reaches the buffer update period or when position warping of the first virtual object occurs, the collision object buffer for the first virtual object is cleared, a current collision buffer area for the first virtual object is obtained, and the virtual objects included in the current collision buffer area are added to the collision object buffer for the first virtual object. Position warping refers to the first virtual object moving from a first position to a second position at a speed greater than an instantaneous movement speed threshold, which corresponds to instantaneous position movement. Here, when the first virtual object moves normally, the movement distance within one second is limited to the maximum movement speed. Therefore, the initial collision buffer area is determined based on the standard movement speed and the collision distance, and the first virtual object remains in the initial collision buffer area after moving within the buffer update period. For example, if the area radius is (2V+R), movement of other virtual objects, i.e., movement of candidate virtual objects within the initial collision buffer area, may be considered. The movement of the first virtual object and the movement of other virtual objects may be taken into consideration, i.e., virtual objects that may collide with the first virtual object may be included at each point in time when the first virtual object moves within a buffer update period. This eliminates the need to update the collision object buffer in real time and reduces the frequency of full calculation of the collision object buffer, thereby saving resources and improving buffer management efficiency. On the other hand, when position warping of the first virtual object occurs, i.e., when a sudden change in the position of the first virtual object causes a relatively large change in the position information of the first virtual object and a relatively large change in the initial collision buffer area of the first virtual object, the collision object buffer of the first virtual object is updated to ensure buffer accuracy.
[0060] Here, when acquiring a second virtual object related to a first virtual object from a candidate virtual object, candidate position information of the candidate virtual object may be acquired, first position information of the first virtual object may be acquired, an object position distance between the candidate position information and the first position information may be calculated, and if the object position distance is equal to or less than the collision distance, the candidate virtual object may be determined as the second virtual object related to the first virtual object. The second virtual object does not include the first virtual object. Here, the candidate position information and the first position information may both be dim-dimensional vectors.
[0061] Step S302: Obtain an obstacle space binary tree of the target scene in which the first virtual object exists, scan 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.
[0062] In an embodiment of the present invention, a node in the obstacle space binary tree corresponds to an obstacle area boundary in the target scene. The difference between the number of obstacle area boundaries included in the child tree in the first direction corresponding to any node in the obstacle space binary tree and the number of obstacle area boundaries included in the child tree in the second direction is less than or equal to a boundary split threshold. Here, an obstacle area exists in the target scene, and the boundary of the obstacle area may be an obstacle area boundary. Here, the obstacle area refers to an area where an obstacle (e.g., the main body of a building or a scene decoration) exists, and other impassable areas (such as the sea or a swamp), i.e., an impassable area in the target scene, and here, the main body of a building refers to an impassable part within a building, such as a wall of a building. Taking a certain obstacle area boundary as an example, if the obstacle area boundary is not split, the obstacle area boundary may be the original obstacle area boundary. If the obstacle area boundary is split, the obstacle area boundary may be a new obstacle area boundary obtained by splitting the obstacle area boundary. For example, if an obstacle area boundary A is split into two parts, the obstacle area boundary A may be divided into an obstacle area boundary A1 and an obstacle area boundary A2. A2. Here, the fault area boundary A is the original fault area boundary. Here, the relative position of a node (which may be called a child node) in a child tree of any one node (which may be called a main node) in the fault space binary tree and the main node is the same as the relative position of the fault area boundary corresponding to the main node and the fault area boundary corresponding to a node in the child tree of the main node. Specifically, see the related description in FIG. 2.
[0063] Specifically, the computer device may obtain an obstacle distance (also referred to as a first obstacle distance or a perpendicular distance) between the first virtual object and a line on which an obstacle area boundary corresponding to a root node in the obstacle space binary tree exists. If the first obstacle distance is equal to or less than the collision distance, the computer device determines the obstacle area boundary corresponding to the root node as the collision area boundary of the first virtual object, scans the first-direction child trees and the second-direction child trees of the root node, obtains target obstacle area boundaries of nodes included in the first-direction child trees and the second-direction child trees whose second obstacle distance to the first virtual object is equal to or less than the collision distance, and determines the target obstacle area boundary as the collision obstacle boundary of the first virtual object. Alternatively, the computer device may determine the original obstacle area boundary where the target obstacle area boundary is located as the collision obstacle boundary of the first virtual object. That is, the collision obstacle boundary of the first virtual object includes the obstacle area boundary corresponding to the root node and the obstacle area boundaries obtained by searching the first-direction child trees and the second-direction child trees of the root node. Here, the second obstacle distance corresponding to the obstacle area boundary may be the shortest distance between the line segment of the obstacle area boundary and the first virtual object (the second obstacle distance may or may not be a perpendicular distance).
[0064] If the first obstacle distance is greater than the collision distance, the relative positional relationship between the first virtual object and the obstacle area boundary corresponding to the root node is acquired. If the relative positional relationship means that the first virtual object is located on the first direction side of the obstacle area boundary corresponding to the root node, the nodes in the child tree of the root node in the first direction are recursively processed until a first target node is acquired. The first target node refers to a node where the first obstacle distance between the line on which the obstacle area boundary corresponding to the child tree in the first direction exists and the first virtual object is less than or equal to the collision distance. In other words, the first obstacle distance between the line on which the obstacle area boundary corresponding to the first target node exists and the first virtual object is less than or equal to the collision distance. Here, one obstacle area is composed of multiple boundaries, and for purposes of expression, each obstacle area boundary may be regarded as a single line segment, such as obstacle area boundary 701a shown in FIG. 7. The line on which any obstacle area boundary exists refers to the line obtained by extending the obstacle area boundary on both sides. The first-direction child tree and the second-direction child tree of the first target node are continuously scanned to obtain a target obstacle area boundary whose second obstacle distance with the first virtual object is equal to or less than the collision distance, and the target obstacle area boundary is determined as the collision obstacle boundary of the first virtual object. Similarly, if the relative positional relationship indicates that the first virtual object is located on the second-direction side of the obstacle area boundary corresponding to the root node, the nodes in the second-direction child tree of the root node are recursively processed until a second target node is obtained. The second target node refers to a node whose first obstacle distance between the line on which the obstacle area boundary corresponding to the second-direction child tree exists and the first virtual object is equal to or less than the collision distance. That is, the first obstacle distance between the line on which the obstacle area boundary corresponding to the second target node exists and the first virtual object is equal to or less than the collision distance. Continue scanning the child trees in the first direction and the child trees in the second direction of the second target node, obtain a target fault area boundary whose second fault distance with the first virtual object is less than or equal to the collision distance, and determine the target fault area boundary as the collision fault boundary of the first virtual object.
[0065] Here, in the process of performing node traversal on the fault space binary tree, continue to obtain and detect child trees from the fault space binary tree, such as a child tree in a first direction and a child tree in a second direction, and the first fault distance means the distance between the first virtual object and the straight line on which the fault area boundary corresponding to the root node in the currently detected child tree exists.
[0066] Here, the first-direction child tree of a given main node refers to a tree structure formed by nodes located on the first-direction side of the main node and corresponds to a left child tree, while the second-direction child tree of the main node refers to a tree structure formed by nodes located on the second-direction side of the main node and corresponds to a right child tree. For example, a description will be given with reference to FIG. 6. FIG. 6 is a schematic diagram of an example of a binary tree in an obstacle space according to an embodiment of the present invention. As shown in FIG. 6, assume that the root node of this obstacle space binary tree is node 60a, and that node 60a corresponds to first-direction child tree 601 and second-direction child tree 602. Taking node 60b as an example, the first-direction child tree of node 60b refers to a tree structure formed by nodes 60c, 60d, and 60e, while the second-direction child tree of node 60b refers to a tree structure formed by nodes 60f and 60g. Similarly, the first-direction child tree and the second-direction child tree of any node in the obstacle space binary tree can be obtained.
[0067] The obstacle space binary tree is then generated from the obstacle area boundaries of the obstacle areas included in the target scene. Specifically, the computer device may acquire the obstacle areas included in the target scene and acquire the original obstacle area boundaries of the obstacle areas. For example, a description will be given with reference to FIG. 7. FIG. 7 is a schematic diagram of an example scenario according to an embodiment of the present invention. As shown in FIG. 7, assume that obstacle area 701, obstacle area 702, obstacle area 703, etc. exist in the target scene. Here, obstacle area 701 includes original obstacle area boundary 701a, original obstacle area boundary 701b, original obstacle area boundary 701c, and original obstacle area boundary 701d; obstacle area 702 includes original obstacle area boundary 702a, original obstacle area boundary 702b, original obstacle area boundary 702c, and original obstacle area boundary 702d; obstacle area 703 includes original obstacle area boundary 703a, original obstacle area boundary 703b, original obstacle area boundary 703c, ..., and original obstacle area boundary 703h, etc. Here, the shape of the obstacle area in the target scene (i.e., contour information) may be a polygon or an arc (e.g., a circle, an ellipse, an irregular curved surface, etc.). If the shape of the obstacle area is a polygon, the original obstacle area boundary of the obstacle area, such as obstacle area 701 or obstacle area 702, may be directly acquired. If the shape of the obstacle area is an arc, the original obstacle area boundary of the obstacle area cannot be directly acquired. However, as shown in obstacle area 703, for example, the obstacle area may be converted into a polygon to acquire an obstacle-converted area, and the boundary of the obstacle-converted area may be determined as the original obstacle area boundary of the obstacle area. Similarly, the original obstacle area boundary included in the target scene may be acquired.
[0068] Then, a first failure area boundary may be obtained from the original failure area boundary. Here, the difference between the number of failure area boundaries located on the first direction side of the first failure area boundary and the number of failure area boundaries located on the second direction side of the first failure area boundary is equal to or less than a boundary division threshold. Any one failure area boundary refers to an original failure area boundary located on one direction side of the first failure area boundary, or refers to a failure area boundary obtained by dividing the original failure area boundary located on both direction sides of the first failure area boundary. Here, specifically, division may be performed based on the first failure area boundary. Here, being located on one direction side of the first failure area boundary means that all parts of the original failure area boundary are on the same side of the first failure area boundary. For example, taking original failure area boundary 701a as an example, original failure area boundary 701b, original failure area boundary 701c, original failure area boundary 701d, original failure area boundary 702c, ..., original failure area boundary 703h, etc. are original failure area boundaries located on one direction side of original failure area boundary 701a, while original failure area boundary 702d and original failure area boundary 702b, etc. are original failure area boundaries located on both direction sides of original failure area boundary 701a. Then, the first failure area boundary is set as the root node, and the original failure area boundaries are classified into a first boundary set and a second boundary set by the first failure area boundary. A child tree of the root node in the first direction is constructed based on the first boundary set, and a child tree of the root node in the second direction is constructed based on the second boundary set. The first boundary set includes failure area boundaries located on the first direction side of the first failure area boundary, and the second boundary set includes failure area boundaries located on the second direction side of the first failure area boundary. Preferably, the boundary division threshold may be a preset value. Alternatively, the boundary division threshold may be determined based on the sum (e.g., referred to as the number of sets) 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. For example, the boundary division threshold may be, but is not limited to, 1 / 10 of the number of sets.By selecting a partitioning line segment (i.e., the first fault area boundary) based on the boundary partitioning threshold, it is no longer necessary to scan all original fault area boundaries to find the original fault area boundary to be used as the root node, thereby reducing the tree structure construction time and reducing the time complexity of a single partitioning of the first boundary set and the second boundary set to N*log(N), thereby improving the tree structure construction efficiency. Here, N in the time complexity is a kind of numerical expression of complexity and is different from other Ns. That is, N in the time complexity according to the present invention is a kind of numerical expression, and N other than N in the time complexity refers to the array dimension of the object management array.
[0069] Here, when classifying the original failure area boundary C into the first boundary set and the second boundary set by the first failure area boundary, the computer device may divide the original failure area boundary C into failure area boundary C1 and failure area boundary C2 by a line along which the first failure area boundary exists. The failure area boundary C1 is a portion of the original failure area boundary C located on a first direction side of the first failure area boundary, and the failure area boundary C2 is a portion of the original failure area boundary C located on a second direction side of the first failure area boundary. As shown in FIG. 7 , the original failure area boundary 702d may be divided into failure area boundary 7021 and failure area boundary 7022 by a line along which the original failure area boundary 701a exists. The division method of the original failure area boundary 702d in FIG. 7 may be referred to for the method for dividing the original failure area boundary C by the line along which the first failure area boundary exists. Then, the fault area boundary A and the fault area boundary C1 may be determined as a first boundary set, and the fault area boundary B and the fault area boundary C2 may be determined as a second boundary set. The fault area boundary A refers to the original fault area boundary located on the first direction side of the first fault area boundary, the fault area boundary B refers to the original fault area boundary located on the second direction side of the first fault area boundary, and the original fault area boundary C refers to the original fault area boundary located simultaneously on both direction sides of the first fault area boundary. When constructing a child tree of the root node in the first direction based on the first boundary set, the process of determining the first fault area boundary based on the original fault area boundary may be repeated until the first boundary set is traversed and the node distribution corresponding to each fault area boundary in the first boundary set is determined. Furthermore, the child tree of the root node in the first direction may be determined from the node distribution corresponding to each fault area boundary in the first boundary set. Similarly, a child tree of the root node in the second direction may be constructed based on the second boundary set. Here, the original fault area boundary refers to the boundary that constitutes the fault area. One node corresponds to one or more fault area boundaries, and each fault area boundary may be the original fault area boundary that constitutes the fault area, or may be a part of the original fault area boundary obtained by dividing the original fault area boundary.
[0070] Preferably, each node in the failure space binary tree may correspond to one failure area boundary. Alternatively, one node in the failure space binary tree may correspond to multiple failure area boundaries. Specifically, if the number of failure area boundaries A and C1 is equal to or less than a tree-building threshold, the failure area boundaries A and C1 are set as child nodes in the first direction of the root node, and the child nodes in the first direction of the root node are determined as child trees in the first direction of the root node. If the number of failure area boundaries A and C1 is greater than the tree-building threshold, second failure area boundaries are obtained from the failure area boundaries A and C1 and determined as child nodes in the first direction of the root node. Based on the child nodes in the first direction, the failure area boundaries A and C1 are classified into a third boundary set and a fourth boundary set. Based on the third boundary set, a first-direction child tree of the child nodes in the first direction is constructed, and based on the fourth boundary set, a second-direction child tree of the child nodes in the first direction is constructed. Similarly, if the number of fault area boundaries B and C2 is less than or equal to the tree construction threshold, the fault area boundaries B and C2 are set as child nodes in the second direction of the root node, and the child nodes in the second direction of the root node are determined as child trees in the first direction of the root node. If the number of fault area boundaries B and C2 is greater than the tree construction threshold, a third fault area boundary is obtained from the fault area boundaries B and C2 and determined as a child node in the second direction of the root node. Based on the child nodes in the second direction, the fault area boundaries B and C2 are classified into a fifth boundary set and a sixth boundary set. Based on the fifth boundary set, a child tree in the first direction of the child nodes in the second direction is constructed, and based on the sixth boundary set, a child tree in the second direction of the child nodes in the second direction is constructed. In other words, when further classifying each of the above boundary sets (for example, the first boundary set, the second boundary set, ..., and the sixth boundary set, etc.), if the number of fault area boundaries contained in a boundary set is less than or equal to the tree construction threshold, the boundary set is not classified, and each fault area boundary contained in the boundary set is treated as a single node, thereby further reducing the number of times the boundary set is classified and improving the efficiency of building the tree structure to some extent.
[0071] Preferably, a dynamic boundary set may be searched, and obstacle area boundaries that may collide with the first virtual object may be further searched for based on the dynamic boundary set. Specifically, if the dynamic boundary set is not empty, a dynamic area boundary is obtained from the dynamic boundary set, and a dynamic area boundary whose distance to the first virtual object is equal to or less than the collision distance is determined as a dynamic collision boundary of the first virtual object. Here, if the dynamic boundary set includes a dynamic obstacle area, the dynamic obstacle area may be obtained from the dynamic boundary set, and the dynamic area boundary of the dynamic obstacle area may be obtained. Here, the dynamic collision boundary and the collision area boundary may be collectively referred to as a collision obstacle boundary. In other words, the dynamic collision boundary and the collision area boundary may be determined as a collision obstacle boundary. Here, the collision obstacle boundary refers to a boundary line where a collision may occur during movement of the first virtual object.
[0072] Here, if the number of dynamic region boundaries included in the dynamic boundary set is equal to or greater than the dynamic support threshold, or if the fixed time length of the failure space binary tree is equal to or greater than the tree update period, the failure space binary tree is reconstructed based on the nodes and dynamic region boundaries in the failure space binary tree. Alternatively, if the number of dynamic failure regions included in the dynamic boundary set is equal to or greater than the dynamic support threshold, or if the fixed time length of the failure space binary tree is equal to or greater than the tree update period (i.e., the failure space binary tree can be periodically updated), the failure space binary tree is reconstructed based on the nodes and dynamic region boundaries in the failure space binary tree. Here, this fixed time length refers to the length of time during which the failure space binary tree does not change, i.e., the continuous length of time during which the failure space binary tree is unchanged, and corresponds to periodically updating the failure space binary tree based on the tree update period. Then, the dynamic boundary set is cleared or deleted. Preferably, the total number of failures in the failure regions included in the target scene may be obtained, and the dynamic support threshold may be determined based on the total number of failures. For example, if the dynamic fault area is equal to or greater than a predetermined percentage of the fault area, the fault space binary tree may be reconstructed, i.e., the product of the total number of faults and the predetermined percentage may be determined as the dynamic support threshold.
[0073] Here, the dynamic region boundary may be an obstacle region that dynamically increases or decreases in the target scene. Reconstructing the obstacle space binary tree each time a dynamic region boundary is added to the target scene would take time, reducing the efficiency of tree structure construction. Therefore, the dynamic region boundary may be maintained by a dynamic boundary set. Specifically, the computer device may maintain a dynamic boundary set AS and a global boundary set TS, and may associate, for each node in the target scene, region information of the obstacle region to which the obstacle region boundary corresponding to the node belongs. Here, the dynamic boundary set AS is used to maintain obstacle regions that dynamically increase or decrease 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, the first obstacle region may be added to the dynamic boundary set AS and the global boundary set TS. Here, the first obstacle region in the dynamic boundary set AS may be referred to as a dynamic obstacle region, and the first obstacle region in the global boundary set TS may be referred to as an obstacle region, and the obstacle regions include the dynamic obstacle region. Then, when the 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 total boundary set TS may be deleted. In this case, when the collision region boundary and the dynamic collision boundary are obtained, the collision region boundary and the dynamic collision boundary that do not belong to the total boundary set may be deleted to obtain the collision obstacle boundary. Preferably, the second obstacle region may be added to the deleted region set. When the collision region boundary and the dynamic collision boundary are obtained, the collision region boundary and the dynamic collision boundary that belong to the deleted region set may be deleted to obtain the collision obstacle boundary. Preferably, the deleted region set may be deleted after the obstacle space binary tree is reconstructed.
[0074] Here, when the failure space binary tree is reconstructed based on the nodes in the failure space binary tree and the dynamic region boundaries, the failure space binary tree may be reconstructed based on the region information of the failure regions included in the total boundary set.
[0075] Preferably, when dim is 3, when distance detection is performed on obstacle area boundaries and dynamic area boundaries, area boundaries that do not have an intersection between the height range of the obstacle area to which they belong and the object height of the first virtual object may be directly deleted to obtain a detection target boundary. For example, if an intersection between the height range to which obstacle area boundary 1 belongs and the object height of the first virtual object does not exist, obstacle area boundary 1 may be deleted. In other words, the area boundary means either an obstacle area boundary or a dynamic area boundary, or both. From the detection target boundary, a collision obstacle boundary whose distance to the first virtual object is less than the collision distance is obtained.
[0076] Step S303: Predict an updated moving speed of the first virtual object based on the second virtual object and the collision area boundary.
[0077] In an embodiment of the present invention, when a dynamic collision boundary exists, the updated movement speed of the first virtual object may 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, i.e., the updated movement speed of the first virtual object may be predicted based on the second virtual object and the collision obstacle boundary.
[0078] Specifically, the computer device acquires a first moving speed and first position information of a first virtual object; acquires a second moving speed and object position information of a second virtual object; constructs a first speed region based on the first position information and the object position information; and determines first offset data based on the first moving speed and the second moving speed; constructs a second speed region based on the first offset data and the first speed region; and determines a first candidate speed range based on the second speed region. For example, this will be described with reference to FIG. 8. FIG. 8 is a schematic diagram of an example of a speed update scenario according to an embodiment of the present invention. As shown in FIG. 8, when the first moving speed of a first virtual object 801 is V, the first moving speed of the first virtual object 801 is V. A and the second moving speed of the second virtual object 802 is V B, the first virtual object 801 is reduced to one point, i.e., the first virtual object 801b, based on the first position information, and the second virtual object 802 is reduced to a point with a radius of R B N The object is expanded to an object extension region 802b where R B N =R A +R B where R A represents the spatial radius occupied by the first virtual object 801, and R B represents the spatial radius 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, and the first speed region 803 may be a set of a series of relative speeds that may cause a collision between the first virtual object 801b and the object extension region 802b. In this case, the relative speeds included in this first speed region 803 are expressed as CC AB It may be written as: and refer to equation (3).
[0079] CC AB ={V A N |λ A ∩B N ≠φ} (3) As shown in equation (3), V A N represents the relative velocity of the first virtual object 801b with respect to the second virtual object 802, and λ A is V A N means a line in the same direction as B N represents the object extension region 802b, and φ represents the empty set.
[0080] Then, first offset data is determined based on the first moving speed and the second moving speed. The first shift data may include first shift data A and first shift data B. A second speed region is constructed based on the first shift data and the first speed region. The second speed region includes second speed region A and second speed region B. A first candidate speed range is determined based on the second speed region. Specifically, the second moving speed may be determined as first shift data A, and the second speed region A, i.e., the second speed region 804 shown in FIG. 8, may be constructed based on the first shift data A and the first speed region. That is, the first shift data A is a vector indicated by the second moving speed. The first speed region 803 is moved along the first shift data A to obtain the second speed region 804. The second speed region 804 may refer to equation (4).
[0081]
number
[0082] Then, the first shift data B may be determined based on the first movement speed and the second movement speed. For example, the first shift data B may be determined based on half the sum of the vectors of the first movement speed and the second movement speed. Alternatively, the first shift data B may be determined based on the first movement speed and the second speed region A. The first shift data B is used to move the end point of the second speed region A to half the sum of the vectors of the second movement speed and the second movement speed. The second speed region B (i.e., the second speed region 805) is constructed based on the first shift data B and the second speed region A. The first offset data B is used to constrain the speed at the next time point to be half the sum of the first movement speed and any speed that does not belong to the second speed region A, so as to adapt to the movement at the next time point. Because the selection of the speed at the next time point is arbitrary, the speed direction may constantly change, which may result in vibration phenomena, thereby affecting the veracity of the simulation. The first offset data B can improve the realism of the simulation by constraining the change in the velocity direction, i.e., improve the accuracy and realism of the velocity prediction. The second velocity region B may refer to Equation (5).
[0083] Φ RVO ={V A RVO |2V A RVO -V A ∈Φ VO} (5) As shown in equation (5), Φ RVO represents the second velocity region B, where V A RVO is a speed included in the second speed region B. Then, a first candidate speed range is determined based on the second speed region B, and the first candidate speed range is a speed range indicated by a region that does not belong to the second speed region B.
[0084] Alternatively, when determining first offset data based on the first movement speed and the second movement speed, and constructing the second speed region based on the first offset data and the first speed region, half the sum of the vectors of the first movement speed and the second movement speed may be determined as the first offset data, and a translation process may be performed on the first speed region based on the first offset data to obtain the second speed region. Then, a first candidate speed range may be determined based on the second speed region, and the first candidate speed range is a speed range indicated by a region not belonging to the second speed region.
[0085] Then, the boundary movement speed and boundary position information of the collision area boundary of the first virtual object are acquired, a third speed area is constructed based on the first position information and boundary position information, second offset data is determined based on the first movement speed and 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, if a dynamic collision boundary exists, the boundary movement speed and boundary position information of the collision obstacle boundary are acquired, a third speed area is constructed based on the first position information and boundary position information, and second offset data is determined based on the first movement speed and 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. Here, the construction form of this third speed area may refer to the construction form of the first speed area described above, and the construction form of the fourth speed area may refer to the construction form of the second speed area described above, and description thereof will be omitted here. Here, the second movement speed in the construction process of the first speed region is replaced with the boundary movement speed to obtain a construction process of a third speed region. The second movement speed in the construction process of the second speed region is replaced with the boundary movement speed to obtain a construction process of a fourth speed region. Here, the boundary movement speed may be set to 0.
[0086] Preferably, when constructing the third speed region from the first position information and boundary position information, the first position information may be used as the center of a circle, and the third speed region may be constructed as a tangent line from the center of the circle to the contour information of the obstacle region indicated by the boundary position information. This will be described with reference to FIG. 9. FIG. 9 is a schematic diagram of an example of a scenario for constructing a speed region according to an embodiment of the present invention. As shown in FIG. 9, the first position information 901 is used as the center of a circle, and the third speed region 904 is constructed as a tangent line from the center of the circle to the contour information of the obstacle region 903 indicated by the boundary position information of the collision obstacle boundary 902. The offset of the third speed region is the same as described above. Here, since this is realized based on the obstacle region in this way, region integration is performed on the collision obstacle boundary to obtain the collision obstacle region corresponding to the collision obstacle boundary, and the fourth speed region is directly constructed for the first virtual object and the collision obstacle region, thereby reducing the amount of processing data required for speed prediction and improving the efficiency of speed prediction.
[0087] Then, the intersection of the first candidate speed range and the second candidate speed range is determined as the target candidate speed range of the first virtual object. Alternatively, the union of the second speed range and the fourth speed range is determined as the total speed range, and the area other than the total speed range is determined as the target candidate speed range of the first virtual object. Here, the number of second virtual objects is p, the number of collision obstacle boundaries is q, and p and q are positive integers. 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 is determined as the target candidate speed range of the first virtual object. Alternatively, the union of the second speed ranges corresponding to the p second virtual objects and the fourth speed ranges corresponding to the q collision obstacle boundaries is determined as the total speed range, and the area other than the total speed range is determined as the target candidate speed range of the first virtual object. Because the candidate speed range is relatively wide, the speed range may be first integrated, and then a target candidate speed range may be determined. This improves the efficiency of speed determination. An updated movement speed of the first virtual object may then be selected within the target candidate speed range. Preferably, an adjacent travel area (i.e., a passable area adjacent to the first location information) of the first position information may be obtained, and the speed update direction may be determined based on the adjacent travel area and the movement direction of the first movement speed. A speed change range of the first virtual object may be determined based on the first movement speed and maximum acceleration of the first virtual object. An updated movement speed of the first virtual object may be determined based on the speed update direction and the speed change range. Here, the direction of the updated movement speed belongs to the speed update direction, and the magnitude of the updated movement speed belongs to the speed change range. In this way, the movement of the first virtual object at the next time point is maintained within the passable area of the target scene, and sudden speed changes are prevented, thereby improving the accuracy, rationality, and veracity of speed prediction. Alternatively, an updated movement speed of the first virtual object may be directly selected within the target candidate speed range.
[0088] Step S304: Control the movement of the first virtual object based on the updated movement speed.
[0089] In an embodiment of the present invention, the movement of the first virtual object is controlled based on the updated movement speed. Preferably, in step S303, if the updated movement speed vel is directly acquired, an initial path plan may be determined based on the updated movement speed vel, and the initial path plan may be expressed as vel*Δt. The initial path plan may be offset based on an adjacent travel area of the first position information to obtain an offset path plan, and the movement of the first virtual object may be controlled based on the offset path plan so as to maintain the first virtual object within the travel area of the target scene.
[0090] Preferably, when the number of obstacle area boundaries of obstacle areas included in the target scene is equal to or less than a tree-construction threshold, the distances between the obstacle area boundaries and the first virtual object are acquired, and obstacle area boundaries whose distances to the first virtual object are equal to or less than the collision distance are determined as collision area boundaries of the first virtual object. When the number of obstacle area boundaries of obstacle areas included in the target scene is greater than the tree-construction threshold, a process is executed to acquire an obstacle space binary tree of the target scene in which the first virtual object exists. That is, when the number of obstacle area boundaries of obstacle areas included in the target scene is small, there is no need to construct an obstacle space binary tree, which saves resources and improves binary tree management efficiency.
[0091] In an embodiment of the present invention, the method involves obtaining candidate virtual objects located in an initial collision buffer area of a first virtual object, obtaining a second virtual object related to the first virtual object from the candidate virtual objects, and extensively storing the candidate virtual objects of the first virtual object through buffering, which corresponds to preliminary screening of virtual objects. The extensive storage of the initial collision buffer area, i.e., pre-defined, reduces the search time required for obtaining the second virtual object and improves the efficiency of virtual object screening. The method also involves obtaining an obstacle space binary tree of a target scene in which the first virtual object is located, scanning nodes in the obstacle space binary tree, and determining, as the collision area boundary of the first virtual object, a target obstacle area boundary corresponding to a node whose distance from the first virtual object is less than or equal to the collision distance. Here, the nodes in the obstacle space binary tree correspond to obstacle area boundaries in the target scene, and the difference between the number of obstacle area boundaries in a child tree in a first direction of any node in the obstacle space binary tree and the number of obstacle area boundaries in a child tree in a second direction is less than or equal to a boundary division threshold. That is, since the number of child nodes in two directions of any node in the obstacle area binary tree is approximately the same and a binary search is performed when scanning the obstacle space binary tree, the efficiency of screening obstacle areas can be improved. Furthermore, the updated movement speed of the first virtual object can be predicted based on the acquired second virtual object and collision area boundary, and the movement of the first virtual object can be controlled based on the updated movement speed. This improves the efficiency of each step of acquiring the updated movement speed and improves the efficiency of path search.
[0092] Take the experimental scene as an example: the experimental scene is a circle with a radius of 1000. U virtual objects, each with a radius of 1, are evenly arranged on the circle. The collision distance of each virtual object is 10, the standard movement speed is 5, and each virtual object is required to move to a position offset by 150 degrees on the circle. During movement, the latest position information and initial collision buffer area are calculated every 0.1 seconds. When all virtual objects reach their designated positions, the calculation of the initial collision buffer area is stopped. For different U, statistics were taken of the complete iteration time using the conventional algorithm and the complete iteration time using the present invention, and the test results shown in FIG. 10 were obtained. FIG. 10 is a schematic diagram of an example of the iteration time according to an embodiment of the present invention. As shown in FIG. 10, test result 1001 is the complete iteration time of the present invention, and test result 1002 is the complete iteration time using the conventional algorithm. As can be seen from the results, the complete iteration time was significantly reduced, the efficiency of constructing the initial collision buffer area was improved by about four times, and the number of virtual objects that can be handled by the same computing resources was also improved by about four times.
[0093] Then, a plurality of rotating squares (i.e., dynamic obstacle regions) are randomly generated in the experimental scene. This will be described with reference to FIG. 11. FIG. 11 is a schematic diagram of an example of test results for tree construction according to an embodiment of the present invention. As shown in FIG. 11, the horizontal axis represents the number of squares, the vertical axis represents the construction time of the obstacle space binary tree, and the vertical axis is a logarithmic coordinate axis. Test result 1101 is the construction time of the obstacle space binary tree according to the present invention, and test result 1102 is the construction time of the obstacle space binary tree according to the conventional algorithm. That is, the present invention uses non-strict equalization partitioning, while the conventional algorithm uses strict equalization partitioning. It can be seen that the time complexity of the strict equalization partitioning is one constant term larger than the time complexity of the non-strict equalization partitioning, that is, the present invention reduces the construction time complexity of the obstacle space binary tree and improves the construction efficiency of the tree structure. Here, the time complexity of constructing the initial collision buffer area according to the present invention 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 areas. Therefore, when the entire system is not congested, the operation time shows a simple positive correlation with the number of virtual objects and obstacle areas in the target scene (including the experimental scene), and the system has excellent performance scalability.
[0094] Next, a description will be given with reference to FIG. 12. FIG. 12 is a schematic diagram of an example of a data processing device according to an embodiment of the present invention. The data processing device may be a computer program (including program code, etc.) executed on a computer device, for example, the data processing device may be application software. The device may be used to perform corresponding steps of a method according to an embodiment of the present invention. As shown in FIG. 12, a data processing device 1200 may be used in a computer device according to an embodiment corresponding to FIG. 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.
[0095] The object acquisition module 11 acquires a candidate virtual object located in an initial collision buffer area of a first virtual object.
[0096] The object determination module 12 acquires a second virtual object related to the first virtual object from the candidate virtual objects, the distance between the second virtual object and the first virtual object is equal to or less than the collision distance of the first virtual object, the initial collision buffer area represents a detection target grid index corresponding to the first virtual object in the object management array, the object management array is used to represent a grid index corresponding to a virtual object included in a target scene, the grid index represents a position of the virtual object in a unit grid obtained by dividing the target scene, the target scene includes the first virtual object, and the candidate virtual object represents a virtual object in an array element indicated by the detection target grid index in the object management array.
[0097] The tree acquisition module 13 acquires an obstacle space binary tree of the target scene in which the first virtual object exists.
[0098] The boundary determination module 14 scans the nodes in the obstacle space binary tree and determines a target obstacle area boundary corresponding to a node whose distance to the first virtual object is equal to or less than the collision distance as the collision area boundary of the first virtual object. The nodes in the obstacle space binary tree correspond to obstacle area boundaries in the target scene, and the difference between the number of obstacle area boundaries included in the child tree in the first direction of any node in the obstacle space binary tree and the number of obstacle area boundaries included in the child tree in the second direction is equal to or less than the boundary division threshold, and the obstacle area boundary refers to the boundary line of the obstacle area existing in the target scene.
[0099] The velocity prediction module 15 predicts an updated movement velocity of the first virtual object based on the second virtual object and the collision area boundary.
[0100] The movement control module 16 controls the movement of the first virtual object based on the updated movement speed.
[0101] Here, the object acquisition module 11 includes the following components:
[0102] The detection determination unit 111 acquires first position information of the first virtual object and a collision distance of the first virtual object, and combines the first position information with the collision distance to acquire a collision detection range of the first virtual object.
[0103] The grid conversion unit 112 obtains the unit length of the unit grid of the target scene, and performs grid conversion on the collision detection range based on the unit length to obtain the grid detection range.
[0104] The candidate acquisition unit 113 executes a hash conversion on the grid detection range to acquire an initial collision buffer area of the first virtual object, and determines a virtual object corresponding to the initial collision buffer area in the object management array as a candidate virtual object.
[0105] wherein the device further includes the following modules:
[0106] The grid construction module 17 constructs the target scene as M unit grids based on the unit length of the unit grids.
[0107] The grid initialization module 18 initializes grid position information corresponding to each of the M unit grids.
[0108] The array creation module 19 creates an N-dimensional initial object management array, and performs hash conversion on the grid position information corresponding to each of the M unit grids to obtain grid indexes corresponding to each of the M unit grids, where N is a positive integer.
[0109] The array generation module 20 acquires a unit grid in which a virtual object included in the target scene exists, and adds the virtual object to an initial object management array based on the grid index of the unit grid in which the virtual object exists to acquire an object management array. The initial collision buffer area refers to the grid index obtained by converting the grid detection range, and the virtual object includes the candidate virtual object.
[0110] Here, the grid initialization module 18 obtains second position information of the grid identification points corresponding to the M unit grids, respectively, and performs position grid transformation on the second position information corresponding to the M unit grids, respectively, based on the unit length, to obtain grid position information corresponding to the M unit grids, respectively.
[0111] Here, the apparatus 1200 further includes the following modules:
[0112] When the third virtual object enters the target scene, the position acquisition module 21 acquires third position information of the third virtual object in the target scene.
[0113] The index acquisition module 22 performs grid transformation on the third position information based on the unit length to obtain an object grid position of the third virtual object, and performs hash transformation on the object grid position to obtain an addition target grid index corresponding to the third virtual object.
[0114] The object buffering module 23 adds the third virtual object to the object management array based on the addition target grid index.
[0115] Here, the object acquisition module 11 includes the following components:
[0116] The buffer lookup unit 114 retrieves the candidate virtual object from a collision object buffer associated with the first virtual object. The collision object buffer is used to store virtual objects located in the initial collision buffer area of the first virtual object.
[0117] Here, the apparatus 1200 further includes the following modules:
[0118] The movement acquisition module 24 acquires the standard movement speed and collision distance of the first virtual object when the first virtual object enters the target scene.
[0119] The buffer area determination module 25 determines an initial collision buffer area for the first virtual object based on the standard movement speed and collision distance.
[0120] The candidate determination module 26 determines the virtual objects included in the initial collision buffer area as candidate virtual objects associated with the first virtual object, and adds the candidate virtual objects to a collision object buffer associated with the first virtual object.
[0121] The object synchronization module 27 adds the first virtual object to the collision object buffer of the candidate virtual object.
[0122] Here, the apparatus 1200 further includes the following modules:
[0123] When the buffer time length of the collision object buffer of the first virtual object reaches the buffer update period or when position warping of the first virtual object occurs, the buffer update module 28 clears the collision object buffer of the first virtual object, obtains the current collision buffer area of the first virtual object, and adds the virtual objects included in the current collision buffer area to the collision object buffer of the first virtual object. Position warping means that the first virtual object moves from a first position to a second position at a speed greater than the instantaneous movement speed threshold.
[0124] Here, the object determination module 12 includes the following components:
[0125] The position acquisition unit 121 acquires candidate position information of the candidate virtual object, and acquires first position information of the first virtual object.
[0126] The distance screening unit 122 calculates an object position distance between the candidate position information and the first position information, and if the object position distance is equal to or less than the collision distance, determines the candidate virtual object as a second virtual object related to the first virtual object. The second virtual object does not include the first virtual object.
[0127] Here, the apparatus 1200 further includes the following modules:
[0128] The boundary acquisition module 29 acquires an obstacle area included in the target scene, acquires an original obstacle area boundary of the obstacle area, and acquires a first obstacle area boundary from the original obstacle area boundary, where 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 equal to or less than a boundary division threshold, and the obstacle area boundary means the original obstacle area boundary located on one direction side of the first obstacle area boundary, or means the obstacle area boundaries obtained by dividing the original obstacle area boundary located on both direction sides of the first obstacle area boundary.
[0129] The root determination module 30 determines the first fault region boundary as the root node.
[0130] The boundary classification module 31 classifies the original obstacle region boundaries into a first boundary set and a second boundary set according to the first obstacle region boundary.
[0131] The tree construction module 32 constructs a child tree of the root node in a first direction based on a first boundary set, and constructs a child tree of the root node in a second direction based on a second boundary set, where the first boundary set includes fault region boundaries located on a first direction side of the first fault region boundary, and the second boundary set includes fault region boundaries located on a second direction side of the first fault region boundary.
[0132] Here, the boundary classification module 31 includes the following components:
[0133] The boundary dividing unit 311 divides the original obstacle area boundary C into an obstacle area boundary C1 and an obstacle area boundary C2 along a straight line on which the first obstacle area boundary exists. The obstacle area boundary C1 is the part of the original obstacle area boundary C that is located on the first direction side of the first obstacle area boundary, and the obstacle area boundary C2 is the part of the original obstacle area boundary C that is located on the second direction side of the first obstacle area boundary.
[0134] The boundary classification unit 312 determines the obstacle area boundary A and the obstacle area boundary C1 as a first boundary set, and determines the obstacle area boundary B and the obstacle area boundary C2 as a second boundary set. The obstacle area boundary A means the original obstacle area boundary located on the first direction side of the first obstacle area boundary, the obstacle area boundary B means the original obstacle area boundary located on the second direction side of the first obstacle area boundary, and the original obstacle area boundary C means the original obstacle area boundary located on both direction sides of the first obstacle area boundary at the same time.
[0135] Here, the tree construction module 32 includes the following components:
[0136] If the number of fault area boundaries A and fault area boundaries C1 is less than or equal to the tree construction threshold, the first node construction unit 321 determines that the fault area boundaries A and C1 are child nodes of the root node in the first direction, and that the child nodes of the root node in the first direction are child trees of the root node in the first direction.
[0137] If the number of failure area boundaries A and failure area boundaries C1 is greater than the tree construction threshold, the second node construction unit 322 obtains second failure area boundaries from the failure area boundaries A and C1, determines the second failure area boundaries as child nodes in the first direction of the root node, classifies the failure area boundaries A and C1 into a third boundary set and a fourth boundary set based on the child nodes in the first direction, constructs a first direction child tree of the first direction child node based on the third boundary set, and constructs a second direction child tree of the first direction child node based on the fourth boundary set.
[0138] Here, the apparatus 1200 further includes the following modules:
[0139] When the number of obstacle area boundaries of the obstacle area included in the target scene is equal to or less than a tree construction threshold, the boundary screening module 33 acquires the distances between the obstacle area boundaries and the first virtual object, and determines the obstacle area boundaries whose distances to the first virtual object are equal to or less than the collision distance as the collision area boundaries of the first virtual object.
[0140] The tree trigger module 34 notifies the tree acquisition module 13 to acquire an obstacle space binary tree of the target scene in which the first virtual object exists when the number of obstacle area boundaries of the obstacle area included in the target scene is greater than a tree construction threshold.
[0141] Here, the apparatus 1200 further includes the following modules:
[0142] If the dynamic boundary set is not empty, the dynamic acquisition module 35 acquires dynamic area boundaries from the dynamic boundary set, and determines a dynamic area boundary among the dynamic area boundaries 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.
[0143] The velocity prediction module 15 predicts an updated movement velocity 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.
[0144] The dynamic acquisition module 35 informs the velocity prediction module 15 to predict an updated movement velocity of the first virtual object based on the second virtual object and the collision area boundary.
[0145] Here, the apparatus 1200 further includes the following modules:
[0146] The tree reconstruction module 36 reconstructs the obstacle space binary tree based on the nodes and dynamic region boundaries in the obstacle space binary tree if the number of dynamic region boundaries included in the dynamic boundary set is equal to or greater than the dynamic support threshold, or if the fixed time length of the obstacle space binary tree is equal to or greater than the tree update period. The set clearing module 37 clears the dynamic boundary set.
[0147] Here, the speed prediction module 15 includes the following components:
[0148] The information acquisition unit 151 acquires a first moving speed and first position information of a first virtual object.
[0149] The first offset unit 152 acquires a second movement speed and object position information of the second virtual object, constructs a first speed region based on the first position information and the object position information, and determines first offset data based on the first movement speed and the second movement speed.
[0150] The first determination unit 153 constructs a second speed region based on the first offset data and the first speed region, and determines a first candidate speed range based on the second speed region.
[0151] The second offset unit 154 acquires boundary movement speed and boundary position information of the collision area boundary of the first virtual object, constructs a third speed area based on the first position information and the boundary position information, and determines second offset data based on the first movement speed and boundary movement speed.
[0152] The second determination unit 155 constructs a fourth speed region based on the second offset data and the third speed region, and determines a second candidate speed range based on the fourth speed region.
[0153] The speed determination unit 156 determines 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 selects an updated movement speed of the first virtual object within the target candidate speed range.
[0154] In an embodiment of the present invention, obtaining a candidate virtual object located in an initial collision buffer area of a first virtual object, obtaining a second virtual object related to the first virtual object from the candidate virtual object, and widely storing the candidate virtual object for the first virtual object through buffering corresponds to preliminary screening of virtual objects. This initial collision buffer area represents a detection target grid index corresponding to the first virtual object in an object management array, and the object management array is used to represent the position of the virtual object included in the target scene in a unit grid obtained by dividing the target scene. This allows a computer device to easily and quickly index the candidate virtual object in the object management array, thereby reducing the lookup time required to obtain the second virtual object and improving the efficiency of screening virtual objects. Furthermore, the unit grid is obtained by dividing the target scene based only on its position in the target scene, and is not affected by the terrain layout of the target scene. This eliminates the need to change the unit grid multiple times, and the unit grid can be applied to different scenes, improving the efficiency and convenience of building the unit grid. The system also acquires an obstacle space binary tree of the target scene in which the first virtual object is located, scans the nodes in the obstacle space binary tree, and determines, as the collision area boundary of the first virtual object, a target obstacle area boundary corresponding to a node whose distance from the first virtual object is equal to or less than the collision distance. Here, the nodes in the obstacle space binary tree correspond to obstacle area boundaries in the target scene, and the difference between the number of obstacle area boundaries included in the child tree in the first direction of any node in the obstacle space binary tree and the number of obstacle area boundaries included in the child tree in the second direction is equal to or less than the boundary division threshold. In other words, the number of child nodes in two directions of any node in the obstacle space binary tree is approximately the same, and a binary search is performed when scanning the obstacle space binary tree, thereby improving the efficiency of obstacle area screening.Furthermore, an updated movement speed of the first virtual object can be predicted based on the acquired second virtual object and collision area boundary, and the movement of the first virtual object can be controlled based on the updated movement speed, thereby improving the efficiency of each step of acquiring the updated movement speed and improving the efficiency of path search.
[0155] The following description will be made with reference to FIG. 13. FIG. 13 is a diagram illustrating an example of the configuration of a computer device according to an embodiment of the present invention. As shown in FIG. 13, the computer device according to an embodiment of the present invention 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 including program instructions, and the input / output interface 1303 is used to receive and transmit data for data interaction between the computer devices. The processor 1301 is used to execute the program instructions stored in the memory 1302.
[0156] Here, the processor 1301 can perform the following operations.
[0157] A candidate virtual object located in an initial collision buffer area of a first virtual object is acquired, and a second virtual object related to the first virtual object is acquired from the candidate virtual object, the distance between the second virtual object and the first virtual object is equal to or less than the collision distance of the first virtual object, the initial collision buffer area represents a detection target 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, the grid index represents a position of the virtual object in a unit grid obtained by dividing the target scene, the target scene includes the first virtual object, and the candidate virtual object represents a virtual object in an array element indicated by the detection target grid index in the object management array.
[0158] The method obtains an obstacle space binary tree of a target scene in which a first virtual object exists, scans the nodes in the obstacle space binary tree, and determines a target obstacle area boundary corresponding to a node whose distance to the first virtual object is equal to or less than a collision distance as a collision area boundary of the first virtual object. The nodes in the obstacle space binary tree correspond to obstacle area boundaries in the target scene, and the difference between the number of obstacle area boundaries included in a child tree in a first direction of any node in the obstacle space binary tree and the number of obstacle area boundaries included in a child tree in a second direction is equal to or less than a boundary division threshold, and the obstacle area boundary refers to a boundary line of an obstacle area existing in the target scene.
[0159] An updated movement speed of the first virtual object is predicted based on the second virtual object and the collision area boundary, and the movement of the first virtual object is controlled based on the updated movement speed.
[0160] In some possible embodiments, processor 1301 may be a central processing unit (CPU), other general-purpose processor, digital signal processor (DSP), application specific integrated circuit (ASIC), field-programmable gate array (FPGA) or other programmable logic device, discrete gate or transistor logic device, discrete hardware component, etc. In some possible embodiments, the general-purpose processor may be a microprocessor, or any conventional processor, etc.
[0161] The memory 1302 may include read-only memory and 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 non-volatile random access memory. The memory 1302 may also store, for example, device type information.
[0162] In a specific embodiment, the computer device can refer to the embodiments provided in each step of Figure 3 and execute the embodiments provided in each step of Figure 3 through each built-in functional module, and the description will be omitted here.
[0163] An embodiment of the present invention provides a computer device including 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 illustrated in FIG. 3 to perform data processing operations. In this embodiment of the present invention, obtaining candidate virtual objects located in an initial collision buffer area of a first virtual object, obtaining second virtual objects related to the first virtual object from the candidate virtual objects, and widely storing the candidate virtual objects of the first virtual object through buffering corresponds to preliminary screening of virtual objects. This initial collision buffer area represents a detection target grid index corresponding to the first virtual object in an object management array, and the object management array is used to represent the position of the virtual object included in the target scene in a unit grid obtained by dividing 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 lookup time required to obtain the second virtual object and improving the efficiency of virtual object screening. Furthermore, the unit grid is obtained by dividing the target scene based only on its position in the target scene, and is not affected by the terrain layout of the target scene. This eliminates the need to repeatedly change the unit grid generation and makes it applicable to different scenes, thereby improving the efficiency and convenience of unit grid construction. The method also obtains an obstacle space binary tree of the target scene in which the first virtual object is located, scans the nodes in the obstacle space binary tree, and determines a target obstacle area boundary corresponding to a node whose distance to the first virtual object is equal to or less than the collision distance as a collision area boundary of the first virtual object, where the node in the obstacle space binary tree corresponds to an obstacle area boundary in the target scene, and the difference between the number of obstacle area boundaries included in a child tree in a first direction of any node in the obstacle space binary tree and the number of obstacle area boundaries included in a child tree in a second direction is equal to or less than a boundary division threshold.That is, since the number of child nodes in two directions of any node in the obstacle area binary tree is approximately the same and a binary search is performed when scanning the obstacle space binary tree, the efficiency of screening obstacle areas can be improved. Furthermore, the updated movement speed of the first virtual object can be predicted based on the acquired second virtual object and collision area boundary, and the movement of the first virtual object can be controlled based on the updated movement speed. This improves the efficiency of each step of acquiring the updated movement speed and improves the efficiency of path search.
[0164] An embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon. The computer program is configured to be loaded by a processor and executed by the processor to perform the data processing method provided by each step in FIG. 3. For specific details, reference may be made to the embodiments of each step in FIG. 3, and a description thereof will be omitted here. Furthermore, although omitted in this specification, advantageous effects of employing a similar method will also be described. For technical details not disclosed in the embodiment of the computer-readable storage medium of the present invention, please refer to the description of the embodiment of the method of the present invention. For example, the computer program can be configured to be executed on one computer device, on multiple computer devices located in one location, or on multiple computer devices distributed across multiple locations and interconnected via a communication network.
[0165] The computer-readable storage medium may be an internal storage device of a computer device, such as the data processing device provided in any of the above embodiments, or 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 media card (SMC), a secure digital (SD) card, or a flash memory card, which is installed in the computer device. The computer-readable storage medium may further include both an internal storage unit and an external storage device of the computer device. The computer-readable storage medium is used to store computer programs and other programs and data required by the computer device. The computer-readable storage medium may also be used to temporarily store data that is output or to be output.
[0166] An embodiment of the present invention further provides a computer program product or computer program including computer instructions stored on a computer-readable storage medium. A processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the method provided in any of various manners in FIG. 3 . In this way, obtaining candidate virtual objects located in an initial collision buffer area of a first virtual object, obtaining second virtual objects related to the first virtual object from the candidate virtual objects, and widely storing the candidate virtual objects of the first virtual object through buffering corresponds to preliminary screening of virtual objects. This initial collision buffer area represents a detection target grid index corresponding to the first virtual object in the object management array, and the object management array is used to represent the positions of virtual objects included in the target scene in a unit grid obtained by dividing the target scene. This allows the computer device to easily and quickly index candidate virtual objects in the object management array, thereby reducing the lookup time required to obtain the second virtual object and improving the efficiency of virtual object screening. Furthermore, the unit grid is obtained by dividing only based on its position in the target scene, is not affected by the terrain layout of the target scene, does not need to be changed multiple times, and can be applied to different scenes, improving the efficiency and convenience of building the unit grid. Also, an obstacle space binary tree of the target scene in which the first virtual object is located is obtained, nodes in the obstacle space binary tree are scanned, and a target obstacle area boundary corresponding to a node whose distance to the first virtual object is less than or equal to the collision distance is determined as a collision area boundary of the first virtual object.Here, the nodes in the obstacle space binary tree correspond to obstacle area boundaries in the target scene, and the difference between the number of obstacle area boundaries included in the child tree in the first direction of any node in the obstacle space binary tree and the number of obstacle area boundaries included in the child tree in the second direction is equal to or less than the boundary division threshold. That is, the number of child nodes in the two directions of any node in the obstacle space binary tree is approximately the same, and a binary search is performed when scanning the obstacle space binary tree, thereby improving the efficiency of obstacle area screening. Furthermore, the updated movement speed of the first virtual object can be predicted based on the acquired second virtual object and collision area boundary, and the movement of the first virtual object can be controlled based on the updated movement speed. This improves the efficiency of each step of acquiring the updated movement speed and the efficiency of path search.
[0167] The terms "first," "second," etc. in the description, claims, and drawings of the embodiments of the present invention are intended to distinguish different objects, not to describe a particular order. Furthermore, the term "comprises" and any variations thereof are intended to cover a non-exclusive inclusion. Processes, methods, apparatuses, products, or devices comprising a series of steps or units disclosed herein are not limited to the recited steps or modules, but may instead further include unrecited steps or modules, or may instead further include other step units inherent to these processes, methods, devices, products, or devices.
[0168] Those skilled in the art will recognize that the various example units and algorithm steps described in connection with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. The various example units and algorithm steps described in connection with the embodiments disclosed herein are generally described functionally. Whether these functions are performed in hardware or software depends on the particular application and design constraints of the technical concept and should not be considered outside the scope of this specification.
[0169] Methods and related devices provided by embodiments of the present invention will be described with reference to method flowcharts and / or structural diagrams provided by embodiments of the present invention, and in particular may be implemented by computer program instructions that embody each flow and / or block of the method flowcharts and / or structural diagrams, as well as combinations of flows and / or blocks in the flowcharts and / or block diagrams. The methods and related devices provided by embodiments of the present invention may be provided to a general-purpose computer, a special-purpose computer, an embedded processor, or a processor of another programmable data processing device to produce a machine in which the instructions, executed by the processor of the computer or other programmable data processing device, produce means for implementing the functions specified in one or more flows of the flowcharts and / or one or more blocks of the structural diagrams. The instructions stored in embodiments of the present invention may be stored in a computer-readable memory that can cause a computer or other programmable data processing device to operate in a specific manner to produce an article of manufacture including an instruction device that implements the functions specified in one or more flows of the flowcharts and / or one or more blocks of the structural diagrams. These computer program instructions may be loaded onto a computer or other programmable data processing apparatus such that a series of operational steps are executed on the computer or other programmable apparatus to produce a computer-implemented process, where the instructions executed on the computer or other programmable apparatus provide steps for implementing the functions shown in one or more blocks of one or more flows and / or structures of the flowchart.
[0170] The steps in the method of the embodiment of the present invention may be sequentially adjusted, merged or deleted according to actual needs.
[0171] Modules in the apparatus of the embodiment of the present invention may be merged, divided or deleted according to actual needs.
[0172] Only the preferred embodiments of the present invention are disclosed, and do not limit the scope of the present invention, and equivalent modifications according to the claims of the present invention are within the protection scope of the present invention.
Claims
1. 1. A data processing method comprising: a step of acquiring a candidate virtual object located in an initial collision buffer area of a first virtual object, and acquiring a second virtual object related to the first virtual object from the candidate virtual object, wherein a distance between the second virtual object and the first virtual object is equal to or less than a collision distance of the first virtual object, the initial collision buffer area means a detection target 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, the grid index represents a position of the virtual object in a unit grid obtained by dividing the target scene, the target scene includes the first virtual object, and the candidate virtual object means a virtual object in an array element indicated by the detection target grid index in the object management array; a step of acquiring an obstacle space binary tree of a target scene in which the first virtual object exists, scanning nodes in the obstacle space binary tree, and determining a target obstacle area boundary corresponding to a node whose distance to the first virtual object is equal to or less than the collision distance as a collision area boundary of the first virtual object, wherein the node in the obstacle space binary tree corresponds to an obstacle area boundary in the target scene, a difference between the number of obstacle area boundaries included in a child tree in a first direction of any node in the obstacle space binary tree and the number of obstacle area boundaries included in a child tree in a second direction is equal to or less than a boundary division threshold, and the obstacle area boundary means a boundary line of an obstacle area existing in the target scene; predicting an updated movement velocity of the first virtual object based on the second virtual object and the collision area boundary, and controlling the movement of the first virtual object based on the updated movement velocity.
2. The step of obtaining a candidate virtual object located in an initial collision buffer area of the first virtual object includes: acquiring first position information of the first virtual object and a collision distance of the first virtual object, and fusing the first position information and the collision distance to acquire a collision detection range of the first virtual object; obtaining a unit length of a unit grid of the target scene, and performing a grid transformation on the collision detection range based on the unit length to obtain a grid detection range; and performing a hash transformation on the grid detection range to obtain an initial collision buffer area of the first virtual object, and determining a virtual object corresponding to the initial collision buffer area in an object management array as a candidate virtual object.
3. constructing the target scene as M unit grids based on a unit length of the unit grid, and initializing grid position information corresponding to each of the M unit grids, where M is a positive integer; creating an N-dimensional initial object management array, and performing a hash transformation on grid position information corresponding to each of the M unit grids to obtain grid indices corresponding to each of the M unit grids, where N is a positive integer; 3. The method of claim 2, further comprising: a step of acquiring a unit grid in which a virtual object included in the target scene exists, and adding the virtual object to the initial object management array based on a grid index of the unit grid in which the virtual object exists, to acquire the object management array, wherein the initial collision buffer area refers to a grid index obtained by converting the grid detection range, and the virtual object includes the candidate virtual object.
4. The step of initializing grid position information corresponding to each of the M unit grids includes:
4. The method of claim 3, further comprising: obtaining second position information of grid identification points corresponding to the M unit grids, respectively; and performing position grid transformation on the second position information corresponding to the M unit grids, respectively, based on the unit length, to obtain grid position information corresponding to the M unit grids, respectively.
5. When a third virtual object enters the target scene, acquiring third position information of the third virtual object in the target scene; performing a grid transformation 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 transformation on the object grid position to obtain an addition target grid index corresponding to the third virtual object; The method of claim 3 , further comprising: adding the third virtual object to the object management array based on the grid index to be added.
6. The step of acquiring a candidate virtual object located in an initial collision buffer area of the first virtual object includes:
2. The method of claim 1, comprising: obtaining candidate virtual objects from a collision object buffer associated with the first virtual object, the collision object buffer being used to store virtual objects located in an initial collision buffer area of the first virtual object.
7. When the first virtual object enters the target scene, acquiring a standard moving speed and the collision distance of the first virtual object; determining the initial collision buffer area of the first virtual object based on the standard movement speed and the collision distance; determining a virtual object included in the initial collision buffer area as a candidate virtual object associated with the first virtual object, and adding the candidate virtual object to a collision object buffer associated with the first virtual object; The method of claim 6 , further comprising: adding the first virtual object to a collision object buffer of the candidate virtual object.
8. 7. The method of claim 6, further comprising: clearing the collision object buffer of the first virtual object, obtaining a current collision buffer area of the first virtual object, and adding virtual objects included in the current collision buffer area to the collision object buffer of the first virtual object when a buffer time length of a collision object buffer of the first virtual object reaches a buffer update period or when a position warp of the first virtual object occurs, wherein the position warp means that the first virtual object moves from a first position to a second position at a speed greater than an instantaneous movement speed threshold.
9. The step of acquiring a second virtual object related to the first virtual object from the candidate virtual objects includes: acquiring candidate position information of the candidate virtual object and acquiring first position information of the first virtual object; 2. The method of claim 1 , further comprising: calculating an object position distance between the candidate position information and the first position information; and determining the candidate virtual object as a second virtual object related to the first virtual object if the object position distance is less than or equal to the collision distance, wherein the second virtual object does not include the first virtual object.
10. acquiring an obstacle area included in the target scene, acquiring an original obstacle area boundary of the obstacle area, and acquiring a first obstacle area boundary from the original obstacle area boundary, wherein 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 equal to or less than the boundary division threshold, and the obstacle area boundary means the original obstacle area boundary located on one direction side of the first obstacle area boundary, or means the obstacle area boundaries obtained by dividing the original obstacle area boundary located on both direction sides of the first obstacle area boundary; 2. The method of claim 1, further comprising the steps of: taking the first fault area boundary as a root node, classifying the original fault area boundary into a first boundary set and a second boundary set at the first fault area boundary, constructing a child tree of the root node in a first direction based on the first boundary set, and constructing a child tree of the root node in a second direction based on the second boundary set, wherein the first boundary set includes fault area boundaries located on a first direction side of the first fault area boundary, and the second boundary set includes fault area boundaries located on a second direction side of the first fault area boundary.
11. The step of classifying the original obstacle region boundary into a first boundary set and a second boundary set by the first obstacle region boundary includes: The original obstacle area boundary C is a straight line on which the first obstacle area boundary exists, and the obstacle area boundary C 1 and the obstacle area boundary C 2 and dividing the obstacle area boundary C 1 is a 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 C 2 is a portion of the original obstacle area boundary C located on the second direction side of the first obstacle area boundary; Obstacle area boundary A and the obstacle area boundary C 1 is determined as a first boundary set, and the obstacle area boundary B and the obstacle area boundary C 2 as a second boundary set, wherein the obstacle area boundary A means an original obstacle area boundary located on a first direction side of the first obstacle area boundary, the obstacle area boundary B means an original obstacle area boundary located on a second direction side of the first obstacle area boundary, and the original obstacle area boundary C means an original obstacle area boundary located simultaneously on both direction sides of the first obstacle area boundary.
12. constructing a first direction child tree of the root node based on the first boundary set, The obstacle area boundary A and the obstacle area boundary C 1 If the number of the faulty region boundaries A and C is less than or equal to the tree construction threshold, 1 as a child node in a first direction of a root node, and determining the child node in the first direction of the root node as a child tree in the first direction of the root node; the obstacle area boundary A and the obstacle area boundary C 1 If the number of the fault region boundaries A and C is greater than the tree construction threshold, 1 and determining the second fault area boundary as a child node of the root node in a first direction, and determining the fault area boundary A and the fault area boundary C based on the child node in the first direction. 1 into a third boundary set and a fourth boundary set, constructing a first direction child tree of the first direction child node based on the third boundary set, and constructing a second direction child tree of the first direction child node based on the fourth boundary set.
13. when the number of obstacle area boundaries of obstacle areas included in the target scene is equal to or less than a tree-construction threshold, acquiring distances between the obstacle area boundaries and the first virtual object, and determining, as a collision area boundary of the first virtual object, an obstacle area boundary whose distance to the first virtual object is equal to or less than the collision distance; 2. The method of claim 1, further comprising: if a number of obstacle region boundaries of obstacle regions included in the target scene is greater than a tree-building threshold, performing a step of obtaining an obstacle space binary tree of the target scene in which the first virtual object is present.
14. If the dynamic boundary set is not empty, acquiring a dynamic area boundary from the dynamic boundary set, and determining, among the dynamic area boundaries, a dynamic area boundary whose distance to the first virtual object is equal to or less than the collision distance as a dynamic collision boundary of the first virtual object; predicting an updated movement velocity 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; The method of claim 1 , further comprising: if the dynamic boundary set is empty, performing a step of predicting an updated movement speed of the first virtual object based on the second virtual object and the collision area boundary.
15. if the number of dynamic region boundaries included in the dynamic boundary set is equal to or greater than a dynamic support threshold, or if the fixed time length of the failure space binary tree is equal to or greater than a tree update period, reconstructing the failure space binary tree based on the nodes in the failure space binary tree and the dynamic region boundaries; The method of claim 14 , further comprising the step of: clearing the dynamic boundary set.
16. The step of predicting an updated movement speed of the first virtual object based on the second virtual object and the collision area boundary includes: acquiring a first moving speed and first position information of the first virtual object; acquiring a second moving speed and object position information of the second virtual object, constructing a first speed region based on the first position information and the object position information, and determining first offset data based on the first moving speed and the second moving speed; constructing a second speed region based on the first offset data and the first speed region, and determining a first candidate speed range based on the second speed region; acquiring boundary movement speed and boundary position information of a collision area boundary of the first virtual object, constructing a third speed area based on the first position information and the boundary position information, and determining second offset data based on the first movement speed and the boundary movement speed; constructing a fourth speed region based on the second offset data and the third speed region, and determining a second candidate speed range based on the fourth speed region; determining an 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 selecting an updated movement speed of the first virtual object in the target candidate speed range.
17. 1. A data processing device, comprising: an object acquisition module for acquiring candidate virtual objects located in an initial collision buffer area of the first virtual object; an object determination module that acquires a second virtual object related to the first virtual object from the candidate virtual object, wherein a distance between the second virtual object and the first virtual object is equal to or less than a collision distance of the first virtual object, the initial collision buffer area means a detection target 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, the grid index represents a position of the virtual object in a unit grid obtained by dividing the target scene, the target scene includes the first virtual object, and the candidate virtual object means a virtual object in an array element indicated by the detection target grid index in the object management array; a tree acquisition module that acquires an obstacle space binary tree of a target scene in which the first virtual object exists; a boundary determination module that scans nodes in the obstacle space binary tree and determines a target obstacle area boundary corresponding to a node whose distance to the first virtual object is equal to or less than the collision distance as a collision area boundary of the first virtual object, wherein the nodes in the obstacle space binary tree correspond to obstacle area boundaries in the target scene, a difference between the number of obstacle area boundaries included in a child tree in a first direction of any node in the obstacle space binary tree and the number of obstacle area boundaries included in a child tree in a second direction is equal to or less than a boundary division threshold, and the obstacle area boundary means a boundary line of an obstacle area existing in the target scene; a speed prediction module that predicts an updated movement speed of the first virtual object based on the second virtual object and the collision area boundary; a movement control module that controls movement of the first virtual object based on the updated movement speed.
18. A computer device including a processor, a memory, and an input / output interface, A computer device, wherein the processor is connected to the memory and the input / output interface, respectively, the input / output interface is used for receiving data and outputting data, the memory is used for storing a computer program, and the processor is used to call the computer program so that the computer device executes the method of any one of claims 1 to 16.
19. A computer program product causing a computer to carry out a method according to any one of claims 1 to 16.
Citation Information
Patent Citations
Control information, information storage medium and image generation device
JP2004178412A