Three-dimensional map data updating method and device, equipment and storage medium

Through the method of real-time update of three-dimensional map data and the sparse octree structure, the problem of unreal-time update of three-dimensional map data in the existing technology is solved, and the accuracy of pathfinding and collision detection in the game is improved.

CN120204726APending Publication Date: 2025-06-27TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202311811528.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-12-25
Publication Date
2025-06-27

AI Technical Summary

Technical Problem

The prior art is difficult to realize real-time update of three-dimensional map data, especially when dynamic obstacle addition and deletion is uncontrollable, and the timed update method leads to excessive overhead.

Method used

Through the method executed by the server, a sparse octree is obtained for saving the three-dimensional map data, and responds to the client's obstacle update request to update the three-dimensional map data in real time.

Benefits of technology

Real-time update of three-dimensional map data is achieved, the accuracy of pathfinding and collision detection is improved, and the possibility of collision misjudgment is reduced.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120204726A_ABST
    Figure CN120204726A_ABST
Patent Text Reader

Abstract

The invention discloses a three-dimensional map data updating method and device, equipment and a storage medium, and belongs to the field of three-dimensional maps. The method comprises the following steps: acquiring a sparse octree for storing three-dimensional map data, wherein the three-dimensional map data is used for indicating connectivity information of a three-dimensional space; in response to a received obstacle updating request of the client, obstacle information to be updated is acquired, and the obstacle information is used for indicating an obstacle which blocks the virtual character from advancing in the three-dimensional space; and based on the obstacle information, updating the three-dimensional map data stored based on the sparse octree. According to the method and the device, the updating of the three-dimensional map data is set to be updating after the obstacle updating trigger request is received, so that the updating of the three-dimensional map data can be more timely.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of 3D maps, and particularly to a method, device, equipment, and storage medium for updating 3D map data. Background Art

[0002] Since the maps of 3D open worlds are often very large, game developers often provide a pathfinding function for players to plan 3D paths from the starting point to the ending point, such as planning flight routes for aircraft. In addition, currently, players can add dynamic obstacles in the 3D open world through interaction with the map. A dynamic obstacle refers to an obstacle that does not exist permanently in the map but is temporarily added and can block the progress of virtual characters or vehicles. For example, when a player controls a virtual character to release an earth wall skill, an earth wall will be added to the map, which can block the virtual character from directly passing through the position corresponding to the earth wall, and this earth wall will disappear after existing in the map for a certain period of time.

[0003] Since players can add dynamic obstacles in the 3D open world, this poses a challenge to the pathfinding function of 3D paths. Due to the temporariness of dynamic obstacles and the uncontrollability of the addition and deletion of dynamic obstacles, how to update map data is a major challenge currently faced. In related technologies, a sparse octree is used to store 3D map data, and the sparse octree is updated by means of regular updates. The regular update method means that the information of obstacles temporarily added by players is obtained regularly, and the sparse octree is updated.

[0004] The above method can only achieve an approximately real-time update effect of map data by reducing the time interval of regular updates. However, when the time interval of regular updates is small, it is easy to cause the problem of excessive overhead. Therefore, how to design a method for updating map data to achieve a real-time update effect is an urgent problem to be solved currently. Summary of the Invention

[0005] This application provides a method, device, equipment, and storage medium for updating 3D map data, and the technical solutions are as follows:

[0006] According to one aspect of this application, a method for updating 3D map data is provided. The method is executed by a server, and the method includes:

[0007] Obtain a sparse octree for storing the 3D map data, where the 3D map data is used to indicate the connectivity information of the 3D space;

[0008] In response to receiving an obstacle update request from a client, obtain the obstacle information to be updated, where the obstacle information is used to indicate the obstacles in the 3D space that block the progress of virtual characters;

[0009] Update the 3D map data stored based on the sparse octree based on the obstacle information.

[0010] According to one aspect of the present application, there is provided an apparatus for updating 3D map data, the apparatus comprising:

[0011] A first acquisition module, configured to acquire a sparse octree for storing the 3D map data, where the 3D map data is used to indicate connectivity information of a 3D space;

[0012] A second acquisition module, configured to acquire obstacle information to be updated in response to receiving an obstacle update request from a client, where the obstacle information is used to indicate an obstacle that blocks the advancement of a virtual character in the 3D space;

[0013] An update module, configured to update the 3D map data stored based on the sparse octree based on the obstacle information.

[0014] According to one aspect of the present application, there is provided a computer device, the computer device comprising: a processor and a memory, where at least one segment of program is stored in the memory; the processor is configured to execute the at least one segment of program in the memory to implement the above-mentioned method for updating 3D map data.

[0015] According to one aspect of the present application, there is provided a computer-readable storage medium, where executable instructions are stored in the computer-readable storage medium, and the executable instructions are loaded and executed by a processor to implement the above-mentioned method for updating 3D map data.

[0016] According to one aspect of the present application, there is provided a computer program product, the computer program product comprising computer instructions, the computer instructions being stored in a computer-readable storage medium, and the processor reads and executes the computer instructions from the computer-readable storage medium to implement the above-mentioned method for updating 3D map data.

[0017] The beneficial effects brought by the technical solution provided by the present application at least include:

[0018] In the above solution, whenever an update request for an obstacle is received, the 3D map data corresponding to the 3D space where the obstacle is located is updated, and real-time update of the 3D map data can be achieved. After a user adds a dynamic obstacle in the 3D space through interaction with the map, the corresponding 3D map data can be quickly updated, and the updated 3D map data can be used for pathfinding, collision detection and other determinations, and the operation results of different users' interaction operations can be synchronized in a timely manner, making pathfinding and collision detection and other determinations more accurate. Especially for some game programs with strong antagonism, quickly obtaining the updated 3D map data can reduce the possibility of collision misjudgment. Description of the Drawings

[0019] To more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the accompanying drawings required for the description of the embodiments. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, without creative efforts, other accompanying drawings can be obtained based on these drawings.

[0020] Figure 1 shows the structural diagram of a sparse octree in a related art of the present application;

[0021] Figure 2 shows the structural diagram of a sparse octree in a related art of the present application;

[0022] Figure 3 shows the architecture diagram of a computer system provided by an exemplary embodiment of the present application;

[0023] Figure 4 shows the flowchart of a method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0024] Figure 5 shows the schematic diagram of a method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0025] Figure 6 shows the schematic diagram of a method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0026] Figure 7 shows the schematic diagram of a method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0027] Figure 8 shows the schematic diagram of a method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0028] Figure 9 shows the schematic diagram of a method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0029] Figure 10 shows the schematic diagram of a method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0030] Figure 11 shows the flowchart of a method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0031] Figure 12 shows the schematic diagram of a method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0032] Figure 13 Schematic diagram showing the method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0033] Figure 14 Schematic diagram showing the method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0034] Figure 15 Schematic diagram showing the method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0035] Figure 16 Schematic diagram showing the method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0036] Figure 17 Schematic diagram showing the method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0037] Figure 18 Schematic diagram showing the method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0038] Figure 19 Schematic diagram showing the method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0039] Figure 20 Schematic diagram showing the method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0040] Figure 21 Schematic diagram showing the method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0041] Figure 22 Schematic diagram showing the method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0042] Figure 23 Flowchart showing the method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0043] Figure 24 Schematic diagram showing the method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0044] Figure 25 Schematic diagram showing the method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0045] Figure 26 Schematic diagram showing the method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0046] Figure 27 shows a schematic diagram of a method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0047] Figure 28 shows a schematic diagram of a method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0048] Figure 29 shows a schematic diagram of a method for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0049] Figure 30

[0049] shows a block diagram of the structure of an apparatus for updating three-dimensional map data provided by an exemplary embodiment of the present application;

[0050] Figure 31

[0049] shows a schematic diagram of the structure of a computer device provided by an exemplary embodiment of the present application. Detailed implementation manners

[0051] To make the objectives, technical solutions, and advantages of the present application clearer, the following will further describe the embodiments of the present application in detail with reference to the accompanying drawings.

[0052] Here, the exemplary embodiments will be described in detail, and the examples are shown in the accompanying drawings. When the following description refers to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. On the contrary, they are merely examples of apparatuses and methods consistent with some aspects of the present application as detailed in the appended claims.

[0053] The terms used in this disclosure are only for the purpose of describing specific embodiments and are not intended to limit the disclosure. The singular forms "a", "the", and "said" used in this disclosure and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" as used herein refers to and includes any or all possible combinations of one or more of the associated listed items.

[0054] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in the present application are all information and data authorized by the user or fully authorized by all parties, and the collection, use, and processing of the relevant data need to comply with the relevant laws, regulations, and standards of the relevant countries and regions. For example, the information such as setting operations involved in the present application is obtained under full authorization.

[0055] It should be understood that although the terms first, second, etc. may be used in this disclosure to describe various information, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from each other. For example, without departing from the scope of this disclosure, the first parameter may also be referred to as the second parameter, and similarly, the second parameter may also be referred to as the first parameter. Depending on the context, the word "if" as used herein may be interpreted as "when" or "while" or "in response to determining".

[0056] First, the relevant nouns involved in this application are introduced:

[0057] Sparse octree: A data structure used to represent objects or scenes in three-dimensional space. A sparse octree is a variant of an octree. Compared with an octree, when the splitting condition is not met, splitting is no longer performed, and the corresponding node has no child nodes. For different application scenarios of the sparse octree, the splitting conditions are also different. For example, when the three-dimensional space is represented by a voxel space, whether there are obstacles in the voxel space is a splitting condition when constructing map data for pathfinding. A voxel space refers to a space divided into voxels. A voxel is short for Volume Pixel and is the smallest unit of three-dimensional space segmentation. A voxel is actually similar to a pixel in two-dimensional space.

[0058] The structure of the sparse octree is as Figure 1 shown. The splitting condition is that there is an object in the three-dimensional space and the side length corresponding to the node is greater than 2. The side length 111 of the initial three-dimensional space 110 is 8. For the root node 0 in the three-dimensional space 110 that meets the splitting condition, it is split into eight child nodes, namely child nodes 0 - 7. Among the child nodes 0 - 7, the child nodes that meet the splitting condition are child node 2 and child node 6. Child node 2 and child node 6 are respectively split to obtain the secondary child nodes 0 - 7 corresponding to child node 2 and the secondary child nodes 8 - 15 corresponding to child node 6. Since the side lengths corresponding to the secondary child nodes 0 - 15 are 2 and do not meet the splitting condition, the splitting stops.

[0059] The sorting of the child node labels is from bottom to top, from left to right, and from back to front. Exemplarily, taking the child nodes 0 - 7 obtained by splitting the root node as an example, the child node at the bottom, leftmost, and backmost among the child nodes is child node 0. The right side of child node 0 is child node 1, the front of child node 0 is child node 2, the right side of child node 2 is child node 3, the upper side of child node 0 is child node 4, the right side of child node 4 is child node 5, the front of child node 4 is child node 6, and the right side of child node 6 is child node 7.

[0060] In some embodiments, the sorting of the sub-node labels can also be from top to bottom, from left to right, from front to back; or, from top to bottom, from left to right, from back to front; or, from top to bottom, from right to left, from front to back; or, from top to bottom, from right to left, from back to front; or, from bottom to top, from left to right, from front to back; or, from bottom to top, from right to left, from front to back; or, from bottom to top, from right to left, from back to front. It should be noted that this application takes from bottom to top, from left to right, and from back to front as an example for illustration, but is not limited thereto.

[0061] The sparse octree constructed for the map data used for pathfinding in this application has the following characteristics. The sparse octree is as Figure 2 shown.

[0062] (1) Logically, it is a tree structure. Each non-leaf node has eight sub-nodes, and each node has a grid field, that is, grid information. The grid field is used to store at least one of the position information, size information, and boundary information corresponding to the node. The position information is used to indicate the coordinates of the node in the spatial coordinate system corresponding to the three-dimensional space, usually represented in the form of a three-dimensional vector or coordinates; the size information is used to indicate the size of the node, usually represented in the form of side length, diameter, or other forms; the range information is used to indicate the boundary range of the node, that is, the spatial range covered by the node.

[0063] (2) Each node with the finest granularity includes voxel data. The voxel data is a variable of uint64 type and is used to store the data of 64 voxels in the 4*4*4 cube with the finest granularity. To save storage space, the minimum side length of the spatial cube corresponding to the node is set during node division. For example, when the side length of a voxel is 1, the minimum side length of the spatial cube corresponding to the node is 4, and this node will store the data of 4*4*4 voxels. This data is used to indicate whether the voxel has an obstacle. When the bit corresponding to the voxel is 1, it means that the voxel has an obstacle. The position index of each voxel in the voxel data can be represented as a voxel index (subnode_index). Exemplarily, as shown in the voxel data 112 in Figure 2 , where the voxels with obstacles are represented as black cubes. When the voxel data is encoded in the order from bottom to top, from left to right, and from back to front, the voxel data can be represented as 0010 0000 0000 0000 0001 0000 0000 0000 0000 0000 11001100

[0064] 0000 0000 0000 0110, that is, 0x2000 1000 00CC 0006, which means the voxel variable stored in the secondary child node 11 is 0x2000 1000 00CC 0006. It should be noted that the encoding order of voxel data is similar to the sorting of child node labels. In this application, the order from top to bottom, from left to right, and from back to front is used as an example for illustration, but it is not limited.

[0065] (3) Store the sparse octree in the form of a layer, rather than in the form of node pointers. The layer of the sparse octree is the layer between the root node in the sparse octree and the leaf node at the bottom layer of the sparse octree; the layer of a node is the layer between the node and the leaf node at the bottom layer of the sparse octree corresponding to the node. Store the nodes at the same layer in the same array (vector), and this array is an array with variable size that uses continuous memory to store data. Enabling the positioning of a node SvoNode in any layer only requires providing two components of the node link svo_link(layer_index, node_index), that is, (layer index, node index). The layer index is used to indicate the layer where the node is located, and the node index is used to indicate the offset of the node in the corresponding layer. As Figure 2 shown, when storing the sparse octree, store the root node 0 into the node array of layer 2, store the child nodes 0 - 7 of the root node into the node array of layer 1, and store the secondary child nodes 0 - 7 of child node 2 and the secondary child nodes 8 - 15 of child node 6 into the node array of layer 0. The node at position 2 in layer 1 can be found in the sparse octree through (1, 2). It should be noted that the layer of the sparse octree is related to the size of the 3D map and the size of the voxels. For example, in the case where both the 3D map and the voxels are cubes and the bottom layer of the sparse octree is layer 0, if the side length of the 3D map is 16 and the side length of the voxel is 1, then the side length of the finest-grained node of the sparse octree is 4, and the side lengths of the nodes at each layer of the sparse octree are 16, 8, 4 respectively, and the layer of the sparse octree is 2; if the side length of the 3D map is 16 and the side length of the voxel is 2, then the side length of the finest-grained node of the sparse octree is 8, and the side lengths of the nodes at each layer of the sparse octree are 16, 8 respectively, and the layer of the sparse octree is 1; if the side length of the 3D map is 64 and the side length of the voxel is 1, then the side length of the finest-grained node of the sparse octree is 4, and the side lengths of the nodes at each layer of the sparse octree are 64, 32, 16, 8, 4 respectively, and the layer of the sparse octree is 4.

[0066] (4) The eight children of each node are continuously stored in the vector at the corresponding level. A first_child field, that is, child node information, is added to each parent node to store the position (layer_index, node_index) of its first child node; a parent field, that is, parent node information, is added to each child node to store the position (layer_index, node_index) of its parent node. When locating a voxel under an indivisible node, (layer_index, node_index, subnode_index), that is, (level index, node index, voxel index), needs to be provided.

[0067] (5) Each node has a neighbours field, that is, neighbour information, to store the neighbour nodes in six directions: up, down, left, right, front, and back. The storage form of the neighbour nodes is (layer_index, node_index). The neighbour information can be represented as array<svo_link, 6>, and svo_link is (layer_index, node_index). The neighbour information is used for path search during pathfinding.

[0068] Open world: A form of game level design. In an open world, players can freely roam in a virtual world and freely choose the time point and method to complete game tasks. With the development of game technology, the open world has gradually shifted from two-dimensional to three-dimensional, that is, originally players could only control virtual characters to roam in a two-dimensional space, but now they can do so in a three-dimensional space. For example, players can control virtual characters to fly in the sky and dive into the sea, with more freedom. The above-mentioned sparse octree is a data structure that can well preserve three-dimensional map information and use the three-dimensional map information to perform a series of pathfinding, model construction, collision detection, etc.

[0069] Figure 3 The architecture diagram of a computer system provided by an exemplary embodiment of the present application is shown. The computer system includes: a server 210 and a terminal 220.

[0070] The server 210 can be an independent physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server, cloud database, cloud computing, cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, Content Delivery Network (CDN), and a cloud server providing basic cloud computing services such as big data and artificial intelligence platforms. The server 210 is used to store a sparse octree, which is used to save three-dimensional map data; the server 210 is also used to update the sparse octree; the server 210 is also used to plan a pathfinding path from a pathfinding start point to a pathfinding end point based on the sparse octree; the server 210 is also used to maintain the sparse octree.

[0071] The terminal 220 can be an electronic device such as a mobile phone, a tablet computer, a vehicle-mounted terminal (carputer), a wearable device, a PC (Personal Computer), an unattended reservation terminal, a smart speaker, etc. The client 230 that can run the target application can be installed in the terminal 220. The target application can be a game program that supports pathfinding in a three-dimensional space. The game program can be any one of a puzzle game, a casual competitive game, an MMOG (Massive Multiplayer Online Game), a board game, an MOBA (Multiplayer Online Battle Arena) game, an SLG (Simulation Game), a virtual reality application program, a three-dimensional map program, an FPS (First-Person Shooting Game), a multiplayer gunfight survival game, a casual game, a party game, a sandbox game. Exemplarily, the client 230 is an application program, a small program, a web page, etc. The client 230 is used to display a map of a three-dimensional space to the user. The terminal 220 is used to determine the obstacle information added or deleted by the user manipulating the virtual character in the three-dimensional map and upload the obstacle information to the server 210; the terminal 220 is also used to receive the pathfinding start point and pathfinding end point selected by the user and upload them to the server 210.

[0072] The server 210 is used to provide background services for the client 230 built in the terminal 220. For example, the server 210 can be the background server of the above-mentioned client 230. The server 210 can be a single server, a server cluster composed of multiple servers, or a cloud computing service center.

[0073] Communication can be carried out between the server 210 and the terminal 220 through a network, such as a wired or wireless network.

[0074] Those skilled in the art can know that the number of the above-mentioned terminals 220 can be more or less. For example, the above-mentioned terminal 220 can be only one, or dozens or hundreds, or a larger number. The embodiments of the present application do not limit the number and device type of the terminal 220.

[0075] Figure 4 The flowchart of the method for updating three-dimensional map data provided by an exemplary embodiment of the present application is shown, and the method is executed by a server, and the server can be such as Figure 3 the server shown. The method includes:

[0076] Step 310: Obtain a sparse octree for storing three-dimensional map data, and the three-dimensional map data is used to indicate the connectivity information of the three-dimensional space.

[0077] In some embodiments, the three-dimensional map data is used to indicate the connectivity of the three-dimensional space, that is, the three-dimensional map data is used to indicate which areas in the three-dimensional space allow passage and which areas do not allow passage. Exemplarily, in the case where there are obstacles in the three-dimensional space, the space where the obstacles are located is not connected, that is, this area does not allow passage.

[0078] In some embodiments, a sparse octree is used to store the three-dimensional map data, and each node of the sparse octree stores part of the three-dimensional map data; or, each leaf node of the sparse octree stores part of the three-dimensional map data.

[0079] Exemplarily, as Figure 1 shown, the space corresponding to the node being black indicates that the space is not connected, and the space corresponding to the node being white indicates that the space is connected; each node of the sparse octree stores part of the three-dimensional map data, and the node at level 2, that is, the root node 0, stores the connectivity of the space corresponding to the root node, and the nodes at level 1, that is, nodes 0 to 7, store the connectivity of the space corresponding to the nodes, and the nodes at level 0, that is, nodes 0 to 15, store the connectivity of the space corresponding to the nodes; or, each leaf node of the sparse octree stores part of the three-dimensional map data, and the nodes 0, 1, 3 to 5, and 7 at level 1 store the connectivity of the space corresponding to the nodes, and the nodes 0 to 15 at level 0 store the connectivity of the space corresponding to the nodes.

[0080] In some embodiments, the space corresponding to the node is a part of the three-dimensional space, the spaces corresponding to different leaf nodes do not intersect, and the combination of the spaces corresponding to all leaf nodes obtains the three-dimensional space or a part of the three-dimensional space.

[0081] Step 320: In response to receiving an obstacle update request from the client, obtain the obstacle information to be updated, where the obstacle information is used to indicate obstacles in the three-dimensional space that block the virtual character's progress.

[0082] In some embodiments, in response to receiving an obstacle update request from the client, obtain the obstacle information to be updated carried in the request; or, in response to receiving an obstacle update request from the client, obtain the obstacle information to be updated stored in advance. Optionally, the obstacle update request includes at least one of an add obstacle request and a delete obstacle request.

[0083] In some embodiments, when the user finishes updating the obstacles in the three-dimensional space, the client sends an obstacle update request to the server; or, when the user triggers an update to the obstacles in the three-dimensional space, the client sends an obstacle update request to the server.

[0084] Exemplarily, the user's update of the obstacles in the three-dimensional space is that the user uses basic components to build a virtual house in the virtual world, which is a three-dimensional space. The basic components are blocks or virtual furniture of different materials, and the basic components are obstacles that will block the virtual character's progress. When the user builds a virtual house in the virtual world, the user will enter the house building state. After the user triggers the operation to determine the completion of the construction, the client counts the obstacle information to be updated and triggers an obstacle update request; or, whenever the user updates a basic component in the virtual world, the client uploads the obstacle information to be updated and triggers an obstacle update request.

[0085] Step 330: Update the three-dimensional map data saved based on the sparse octree based on the obstacle information.

[0086] In some embodiments, in response to receiving an obstacle update request from the client, update the three-dimensional map data saved based on the sparse octree based on the obstacle information.

[0087] In some embodiments, a game program includes at least one three-dimensional space.

[0088] In some embodiments, a game program includes a sparse octree, which is used to save the three-dimensional map data corresponding to all the three-dimensional spaces of the game program. For example, all the three-dimensional spaces are stitched together in a fixed order to form a complete three-dimensional space, and the root node of the sparse octree is used to indicate the connectivity of the complete three-dimensional space; or, a game program includes at least one sparse octree, which is used to save the three-dimensional map data corresponding to a three-dimensional space in the game program; or, a game program includes at least one sparse octree, and one sparse octree is used to save a part of the three-dimensional map data corresponding to a three-dimensional space in the game program.

[0089] In some embodiments, based on the obstacle information, the three-dimensional map data corresponding to the three-dimensional space where the obstacle is located is updated, and the three-dimensional map data is stored based on a sparse octree.

[0090] In some embodiments, after the three-dimensional map data is updated, the updated three-dimensional map data is synchronized to the client.

[0091] In summary, in the method provided by the embodiments of the present application, whenever an update request for an obstacle is received, the three-dimensional map data corresponding to the three-dimensional space where the obstacle is located is updated, enabling real-time update of the three-dimensional map data. After a user adds a dynamic obstacle in the three-dimensional space through interaction with the map, the corresponding three-dimensional map data can be quickly updated, and the updated three-dimensional map data can be used in determinations such as pathfinding and collision detection, and the operation results of the interaction operations of different users can be synchronized in a timely manner, making determinations such as pathfinding and collision detection more accurate. Especially for some game programs with strong antagonism, quickly obtaining the updated three-dimensional map data can reduce the possibility of collision misjudgment.

[0092] In the optional embodiment based on Figure 4 Step 330 may be implemented as at least one of steps 331 to 334.

[0093] In some embodiments, the three-dimensional map data is stored in the nodes of the sparse octree. The three-dimensional map data is stored in each node of the sparse octree; or, the three-dimensional map data is stored in each leaf node of the sparse octree.

[0094] In some embodiments, the sparse octree has n levels, where n is a positive integer; the level is the level between the root node of the sparse octree and the bottommost leaf node of the sparse octree. The level of the root node is the largest, and the level of the leaf node is the smallest. The level of a node is the level between the node and the bottommost leaf node of the sparse octree. Optionally, the level of the bottommost leaf node is 0, that is, the bottommost leaf node is the node of the 0th layer; or, the level of the leaf node is 1, that is, the bottommost leaf node is the node of the 1st layer.

[0095] In some embodiments, the nodes of the same level in the sparse octree are stored in the same array, and the nodes of different levels are stored in different arrays. Exemplarily, as Figure 2 shown, the nodes of the 2nd layer, that is, the nodes of level 2 are stored in the same array; the nodes of the 1st layer, that is, the nodes of level 1 are stored in the same array; the nodes of the 0th layer, that is, the nodes of level 0 are stored in the same array.

[0096] Step 331: Obtain the target nodes at the i-th layer in the sparse octree. The target nodes are the nodes whose corresponding spaces intersect with the obstacle. i is an integer not less than 0, and the starting value of i is n or n - 1.

[0097] In some embodiments, obtain the target nodes at the i-th layer. The target nodes are the nodes whose corresponding spaces intersect with the obstacle, that is, the nodes that need to be updated.

[0098] It should be noted that Step 332 and Step 333 are parallel steps. For an obstacle update request, execute Step 332 or Step 333. Optionally, when the side length of the space cube corresponding to the target node is not the side length of the smallest space cube, the target node has no child nodes, and a part of the space corresponding to the target node is not inside the obstacle, execute Step 332; when the target node has no child nodes and the entire space corresponding to the target node is inside the obstacle, execute Step 333; when the side length of the space cube corresponding to the target node is the side length of the smallest space cube and a part of the space corresponding to the target node is inside the obstacle, execute Step 333.

[0099] Step 332: Based on the obstacle information, add child nodes to the target nodes at the i-th layer, and save the child nodes to the first position in the corresponding array at the (i - 1)-th layer. The first position is a free space in the array.

[0100] In some embodiments, the obstacle information includes at least one of the position information, size information, and range information of the obstacle. The position information is used to indicate the coordinates of the obstacle in the space coordinate system corresponding to the three-dimensional space; the size information is used to indicate the size of the obstacle; the range information is used to indicate the space range covered by the obstacle.

[0101] In some embodiments, a non-leaf node of the sparse octree has eight child nodes. When adding child nodes to the target nodes at the i-th layer, add eight child nodes to the target nodes at the i-th layer.

[0102] In some embodiments, based on the obstacle information, add child nodes to the target nodes at the i-th layer, and save the newly added child nodes to the first position in the corresponding array at the (i - 1)-th layer.

[0103] Optionally, the first position is the tail free position of the corresponding array at the (i - 1)-th layer; or, the first position is the middle free position of the corresponding array at the (i - 1)-th layer, and the middle free position is caused by deleting the nodes at the (i - 1)-th layer. Among them, the storage order of the nodes in the corresponding array at the (i - 1)-th layer is not related to the storage order of the nodes in the corresponding array at the i-th layer.

[0104] Exemplarily, such as Figure 5As shown in part (1) therein, the array of the i-th layer has 8 storage units, and these 8 storage units store 8 nodes. Among them, the storage unit indicated by the black square means that the node stored in this storage unit has child nodes, and the storage unit indicated by the white square means that the node stored in this storage unit has no child nodes. For ease of understanding, the node numbers are used to refer to the storage unit numbers. For example, the node stored in storage unit 0 is called node 0, the node stored in storage unit 1 is called node 1, and so on. The i - 1-th layer has 32 storage units. The storage units from 0 to 23 in the i - 1-th layer have stored the child nodes corresponding to the nodes in the i-th layer. Among them, the nodes stored in storage units 0 to 7 are the child nodes of node 2; the nodes stored in storage units 8 to 15 are the child nodes of node 6; the nodes stored in storage units 16 to 23 are the child nodes of node 5. The storage positions of the child nodes of node 5 are after the storage position of node 6. Therefore, the storage order of the nodes in the array corresponding to the i - 1-th layer is not related to the storage order of the nodes in the array corresponding to the i-th layer.

[0105] Exemplarily, when the array of the i-th layer and the array of the i - 1-th layer are as Figure 5 shown in the schematic diagram, when adding a child node to node 1 in the i-th layer, add this child node at the idle position at the end of the array of the i - 1-th layer. The arrays of the i-th layer and the i - 1-th layer after adding the child node of node 1 are as Figure 5 shown in part (2) therein. The child nodes of node 1 are added to the idle position at the end of the array of the i - 1-th layer. That is, the child nodes of node 1 are stored in storage units 24 to 31 of the array of the i - 1-th layer.

[0106] Exemplarily, as Figure 5 shown in part (3) therein, on the basis of part (1) in Figure 5 , the child nodes corresponding to node 6 are deleted, that is, the child nodes stored in storage units 8 to 9. In the case corresponding to part (3) in Figure 5 , when adding a child node to node 1, add the child node at the idle position in the middle of the array corresponding to the i - 1-th layer. The arrays of the i-th layer and the i - 1-th layer after adding the child node of node 1 are as Figure 5 shown in part (4) therein. The child nodes of node 1 are added to the idle position in the middle of the array of the i - 1-th layer. That is, the child nodes of node 1 are stored in storage units 8 to 15 of the array of the i - 1-th layer.

[0107] Step 333: Modify the blocking information of the target node in the i-th layer based on the obstacle information. The blocking information is used to indicate the blocking state of the node.

[0108] In some embodiments, the blocking information is used to indicate the blocking state of a node; or, the blocking information is used to indicate the blocking state of the space corresponding to a node. The blocking information of a target node is used to indicate the connectivity of the space corresponding to the target node.

[0109] In some embodiments, the blocking information includes full-blocking and non-blocking; full-blocking is used to indicate that the node intersects with an obstacle and will block the virtual character from advancing; non-blocking is used to indicate that the node does not intersect with an obstacle and will not block the virtual character from advancing.

[0110] In an alternative embodiment, the obstacle type includes at least one of an obstacle to be added and an obstacle to be deleted. Step 333 can be alternatively implemented as Step 3331 or Step 3332.

[0111] Step 3331: When the obstacle type is an obstacle to be added, based on the obstacle information, modify the blocking information of the target node to full-blocking.

[0112] In some embodiments, when the obstacle type is an obstacle to be added, an obstacle is added in the three-dimensional space. Therefore, it is necessary to modify the blocking information of the target node to full-blocking based on the obstacle information.

[0113] Step 3332: When the obstacle type is an obstacle to be deleted, based on the obstacle information, modify the blocking information of the target node to non-blocking.

[0114] In some embodiments, when the obstacle type is an obstacle to be deleted, an obstacle is deleted in the three-dimensional space. Therefore, it is necessary to modify the blocking information of the target node to non-blocking based on the obstacle information.

[0115] Step 334: When the traversal of the target nodes in the i-th layer is completed and the i-th layer is not the bottom layer, let i be equal to i - 1, and re-execute to obtain the target nodes in the i-th layer of the sparse octree.

[0116] In some embodiments, when the traversal of the target nodes in the i-th layer is not completed, continue to execute at least one of Steps 331 to 333.

[0117] In some embodiments, when the traversal of the target nodes in the i-th layer is completed and the i-th layer is the bottom layer, end the update of the sparse octree, that is, end the update of the three-dimensional map data.

[0118] In some embodiments, when the traversal of the target nodes in the i-th layer is completed and the i-th layer is not the bottom layer, let i be equal to i - 1, and re-execute at least one of Steps 331 to 333.

[0119] In summary, the method provided by the embodiments of the present application updates the target nodes by means of hierarchical traversal. The target nodes are the nodes where the space corresponding to the nodes intersects with the obstacles. That is, when the space corresponding to the nodes intersects with the obstacles, it is necessary to update the three-dimensional map data of the space corresponding to the nodes, rather than updating all the nodes. This can make the update of the three-dimensional map data faster. At the same time, when updating the nodes, that is, updating the three-dimensional map data, it includes adding child nodes to the target nodes and modifying the blocking information of the target nodes. Adding child nodes to the target nodes can further refine the three-dimensional map data, and modifying the blocking information of the target nodes can update the connectivity of the space corresponding to the target nodes. The above two update methods can ensure the correct update of the three-dimensional map data.

[0120] In an alternative embodiment, the target nodes need to be queried through index information. The method further includes step 335 and step 336, and step 331 can be alternatively implemented as step 3311.

[0121] Step 335: Obtain a list of nodes to be updated. The list of nodes includes at least the index information of the target nodes in the i-th layer. The target nodes in the i-th layer are root nodes in the initial situation. The index information includes a hierarchical index and a node index. The hierarchical index is used to indicate the layer where the node is located, and the node index is used to indicate the position of the node in the array of the i-th layer.

[0122] In some embodiments, the starting value of i is n or n - 1, and the target nodes in the i-th layer are root nodes in the initial situation.

[0123] Exemplarily, the expression form of the index information is (hierarchical index, node index); the index information of node 1 is (1, 2), indicating that node 1 is in the node array of the first layer and is stored in the storage unit sorted as 2 in the node array. Optionally, the starting value of the hierarchical index is 0 or 1, and the starting value of the node index is 0 or 1.

[0124] In some embodiments, the list of nodes to be updated is used to save the index information of the target nodes; or, the list of nodes to be updated is used to save the target nodes, and the target nodes include index information; or, the list of nodes to be updated is used to save partial information of the target nodes, and the partial information includes at least the index information.

[0125] Exemplarily, the node list is used to store index information. For example, the node list is {(1, 2), (1, 3), (1, 4), (1, 7), (0, 2), (0, 4)}; or, the node list is used to store target nodes, and the target nodes include index information. For example, the node list is {Node 0(1, 2), Node 1(1, 3), Node 2(1, 4), Node 3(1, 7), Node 4(0, 2), Node 5(0, 4)}. It should be noted that the above node numbers are only for illustration and have no direct association with the index information; or, the node list is used to store partial information of the target nodes. For example, the target nodes include index information and blocking information, and the target node list stores the index information and blocking information corresponding to the target nodes.

[0126] Step 336: Obtain the index information of the target nodes in the node list.

[0127] In some embodiments, the node list includes the index information of at least one target node.

[0128] In some embodiments, obtain the index information of the j-th target node from the node list, where j is a positive integer.

[0129] Step 3311: Based on the index information of the target nodes, query the target nodes at the i-th layer in the sparse octree.

[0130] In some embodiments, query the target nodes from the sparse octree based on the index information of the target nodes. For example, if the index information of the target node is (1, 2), first obtain the node array at level 1, i.e., the first layer, of the sparse octree, then query the storage unit ranked 2 from this node array, and take out the target node from this storage unit.

[0131] In summary, the method provided by the embodiments of the present application provides a method for querying the corresponding target nodes in the sparse octree using index information, which can support quickly querying the corresponding nodes through the index information during the traversal or query of the sparse octree, and can improve the traversal efficiency of the sparse octree.

[0132] In some embodiments, the maintenance of the node list is performed during the traversal of the target nodes at the i-th layer. The traversal of the target nodes at the i-th layer is as shown in the corresponding exemplary embodiments of steps 331 to 334 above. The node list at least includes the index information of the target nodes at the i-th layer, and the target nodes at the i-th layer are the root nodes initially. The method further includes:

[0133] Step 337: In the case of adding child nodes to the target nodes at the i-th layer, use the child nodes that meet the target condition as the target nodes at the (i - 1)-th layer and add them to the node list. The target condition is that the space corresponding to the node intersects with the obstacle.

[0134] In some embodiments, after adding eight child nodes to the target node of the i-th layer, obtain these eight child nodes, determine the child nodes that meet the target condition among the eight child nodes as the target node of the (i - 1)-th layer, and add the target node of the (i - 1)-th layer to the node list. The target condition is that the space corresponding to the node intersects with the obstacle.

[0135] Exemplarily, as Figure 1 shown, when adding child nodes to the target node 2 of layer 1, that is, the first layer, a total of eight child nodes from child node 0 to child node 7 are obtained. Among them, the black squares or circles indicate that the space corresponding to the node intersects with the obstacle. By determining whether child nodes 0 to 7 meet the target condition, it can be obtained that child nodes 3 and 7 meet the target condition. Therefore, child nodes 0 and 7 are added to the node list as the target nodes of layer 0, that is, the first layer.

[0136] In summary, the method provided by the embodiments of the present application uses the child nodes that meet the conditions among the child nodes of the target node of the i-th layer as the target node of the (i - 1)-th layer and adds them to the node list. By maintaining the node list in this way, it is ensured that when traversing the sparse octree, all target nodes of the entire sparse octree can be completely traversed. The target node is the node whose corresponding space intersects with the obstacle, that is, the node in the sparse octree that needs to be updated, enabling the update of the sparse octree to be faster.

[0137] In an alternative embodiment, the above step 332 can be alternatively implemented as step 3321, and step 333 can be alternatively implemented as step 3333 or step 3334.

[0138] In some embodiments, the obstacle information includes at least one of the position information, size information, and range information of the obstacle. The position information is used to indicate the coordinates of the obstacle in the spatial coordinate system corresponding to the three-dimensional space; the size information is used to indicate the size of the obstacle; the range information is used to indicate the spatial range covered by the obstacle.

[0139] In some embodiments, the node information of the target node includes at least one of grid information and child node information.

[0140] In some embodiments, the grid information includes at least one of the position information, size information, and range information. The position information is used to indicate the coordinates of the node in the spatial coordinate system corresponding to the three-dimensional space; the size information is used to indicate the size of the space corresponding to the node; the range information is used to indicate the spatial range covered by the space corresponding to the node.

[0141] Optionally, the side length of the minimum space cube is a preset value. In some embodiments, in order to save storage space, the side length of the minimum space cube is set during node division. For example, when the side length of a voxel is 1, a node stores the data of 4*4*4 voxels, so the side length of the minimum space cube is 4; when the side length of the space cube corresponding to a node reaches the side length of the minimum space cube, the node is no longer divided, that is, the node has no child nodes.

[0142] In some embodiments, the child node information is used to indicate the index information of the first child node of the node. Optionally, the child node information is represented as (hierarchical index, node index). The hierarchical index is used to indicate the level where the node is located, and the node index is used to indicate the position of the node in the array at the i-th level.

[0143] In some embodiments, based on the obstacle information and the node information, the intersection state between the obstacle and the space corresponding to the node is determined, and the intersection state is used to indicate the intersection between the space corresponding to the node and the obstacle.

[0144] Exemplarily, as shown in part (1) of Figure 6 , a spatial rectangular coordinate system is constructed for the three-dimensional space 115, and the side length of the three-dimensional space 115 is 16. The obstacle information to be updated in the three-dimensional space 115 corresponds to the obstacle 116. The obstacle 116 is a cuboid, and the obstacle information includes position information, dimension information, and range information. The position information of the obstacle represents the coordinates of the center of the obstacle in the spatial rectangular coordinate system corresponding to the three-dimensional space. The position information of the obstacle 116 in the three-dimensional space 115 is (4, 4, 8); the dimension information of the obstacle 116 is length 8, width 8, and height 16; the range information of the obstacle 116 is the eight vertex coordinates of the obstacle 116, which are (0, 0, 0), (0, 8, 0), (8, 0, 0), (8, 8, 0), (0, 0, 16), (0, 8, 16), (8, 0, 16), (8, 8, 16). The space corresponding to the target node 117 in the three-dimensional space 115 is as Figure 6As shown in part (2) thereof. The space corresponding to the target node 117 is a cube, and the node information includes position information, dimension information, and range information. The position information of the target node 117, that is, the coordinates of the space corresponding to the target node 117 in the three-dimensional space 115, is (4, 4, 8); the dimension information of the target node 117 is that the side length is 8, and the side length of 8 is the side length of the smallest space cube in the three-dimensional space 115; the range information of the target node 117 is the eight vertex coordinates of the space corresponding to the target node 117, which are (0, 0, 0), (0, 8, 0), (8, 0, 0), (8, 8, 0), (0, 0, 8), (0, 8, 8), (8, 0, 8), and (8, 8, 8). Based on the obstacle information of the obstacle 116 and the node information of the target node 117, it can be determined that the entire space corresponding to the target node 117 is located inside the obstacle 116.

[0145] Exemplarily, the space corresponding to the target node 118 in the three-dimensional space 115 is as Figure 6 shown in part (3) thereof. The space corresponding to the target node 118 is a cube, and the node information includes position information, dimension information, and range information. The position information of the node represents the coordinates of the center of the space corresponding to the node in the space rectangular coordinate system corresponding to the three-dimensional space. The position information of the target node 118, that is, the coordinates of the space corresponding to the target node 118 in the three-dimensional space 115, is (8, 8, 8); the dimension information of the target node 118 is that the side length is 16; the range information of the target node 118 is the eight vertex coordinates of the space corresponding to the target node 118, which are (0, 0, 0), (0, 16, 0), (16, 0, 0), (16, 16, 0), (0, 0, 16), (0, 16, 16), (16, 0, 16), and (16, 16, 16). Based on the obstacle information of the obstacle 116 and the node information of the target node 118, it can be determined that a part of the space corresponding to the target node 118 is located inside the obstacle 116, or a part of the space corresponding to the target node 118 is not located inside the obstacle 116.

[0146] Exemplarily, the obstacle 119 in the three-dimensional space 115 is as Figure 6As shown in part (4) thereof. The obstacle 119 is a cuboid. The obstacle information includes position information, dimension information, and range information. The position information of the obstacle 119, i.e., the coordinates in the three-dimensional space 115, is (4, 10, 8); the dimension information of the obstacle 116 is length 12, width 8, and height 16; the range information of the obstacle 119 is the coordinates of the eight vertices of the obstacle 119, which are (0, 4, 0), (0, 16, 0), (8, 4, 0), (8, 16, 0), (0, 4, 16), (0, 16, 16), (8, 4, 16), and (8, 16, 16). Based on the obstacle information of the obstacle 119 and the node information of the target node 117, it can be determined that a part of the space corresponding to the target node 117 is inside the obstacle 119, or a part of the space of the target node 117 is not inside the obstacle 119; based on the obstacle information of the obstacle 119 and the node information of the target node 118, it can be determined that a part of the space corresponding to the target node 118 is inside the obstacle 119, or a part of the space of the target node 118 is not inside the obstacle 119.

[0147] Step 3321: When it is determined based on the obstacle information that the target node meets the first condition, add a child node to the target node.

[0148] Wherein, the first condition includes that the side length of the space cube corresponding to the target node is not the side length of the smallest space cube, the target node has no child nodes, and a part of the space corresponding to the target node is not inside the obstacle. Optionally, the side length of the smallest space cube is a preset value.

[0149] In some embodiments, based on the obstacle information and the node information of the target node, it is determined whether the target node meets the first condition. When the target node meets the first condition, a child node is added to the target node. In some embodiments, the first condition includes that the side length of the space cube corresponding to the target node is not the side length of the smallest space cube. Based on the dimension information of the target node, it is determined whether the side length of the space cube corresponding to the target node is the side length of the smallest space cube.

[0150] In some embodiments, the first condition further includes that the target node has no child nodes. Based on the child node information in the node information, it is determined whether the child node information is empty. When the child node information is empty, the target node has no child nodes; when the child node information is not empty, the target node has child nodes.

[0151] In some embodiments, the first condition further includes that a part of the space corresponding to the target node is not located inside the obstacle. Based on the obstacle information and the node information of the target node, it is determined whether the space corresponding to the target node is entirely located inside the obstacle. Exemplarily, based on the obstacle information, the range coordinates covered by the obstacle are obtained, and based on the node information of the target node, the range coordinates covered by the space corresponding to the node are obtained; when there is an intersection between the range coordinates covered by the obstacle and the range coordinates covered by the space corresponding to the node, the obstacle intersects with the space corresponding to the node; when the range coordinates covered by the obstacle include all the range coordinates covered by the space corresponding to the node, the space corresponding to the node is entirely inside the obstacle; when the range coordinates covered by the space corresponding to the node include all the range coordinates covered by the obstacle, the obstacle is inside the space corresponding to the node.

[0152] Exemplarily, as Figure 6 shown, the obstacle is obstacle 116. When the side length of the space cube corresponding to the target node 117 is the side length of the smallest space cube, the target node 117 does not meet the first condition and no child node will be added to the target node 117; when the side length of the space cube corresponding to the target node 118 is not the side length of the smallest space cube, the target node 118 can be further divided into nodes with the same side length as the target node 117. When the obstacle is obstacle 116 or obstacle 119, child nodes are added to the target node 118.

[0153] Step 3333: When it is determined based on the obstacle information that the target node meets the second condition, modify the blocking information of the target node.

[0154] Wherein, the second condition includes that the target node has no child nodes, and the space corresponding to the target node is entirely located inside the obstacle.

[0155] In some embodiments, based on the obstacle information and the node information of the target node, it is determined whether the target node meets the second condition. When the target node meets the second condition, modify the blocking information of the target node. The blocking information is used to indicate the blocking state of the node.

[0156] In some embodiments, the second condition includes that the target node has no child nodes. Based on the child node information in the node information, it is determined whether the child node information is empty. When the child node information is empty, the target node has no child nodes; when the child node information is not empty, the target node has child nodes.

[0157] In some embodiments, the second condition further includes that the space corresponding to the target node is entirely located inside the obstacle. Based on the obstacle information and the node information of the target node, it is determined whether the space corresponding to the target node is entirely located inside the obstacle.

[0158] Exemplarily, asFigure 6 As shown, the obstacle is obstacle 116, the target node 117 has no child nodes, and all the space corresponding to the target node 117 is located inside the obstacle 116, satisfying the second condition, and modifying the blocking state of the target node 117; the obstacle is 116, the target node 117 has no child nodes, but a part of the space corresponding to the target node 117 is not located inside the obstacle 116, not satisfying the second condition.

[0159] Step 3334: When it is determined based on the obstacle information that the target node satisfies the third condition, modify the blocking information and voxel data of the target node, where the voxel data is used to indicate the blocking state of at least one voxel stored in the space corresponding to the target node.

[0160] Among them, the third condition includes that the side length of the space cube corresponding to the target node is the side length of the smallest space cube, and a part of the space corresponding to the target node is located inside the obstacle. Optionally, the side length of the smallest space cube is a preset value.

[0161] In some embodiments, based on the obstacle information and the node information of the target node, it is determined whether the target node satisfies the third condition. When the target node satisfies the third condition, the blocking information and voxel data of the target node are modified. The blocking information is used to indicate the blocking state of the node.

[0162] In some embodiments, the third condition includes that the side length of the space cube corresponding to the target node is not the side length of the smallest space cube. Based on the size information of the target node, it is determined whether the side length of the space cube corresponding to the target node is the side length of the smallest space cube.

[0163] In some embodiments, the finest-grained nodes include voxel data. The side length of the space cube corresponding to the finest-grained nodes is the side length of the smallest space cube, and the length of the voxel data is related to the number of voxels included in the node. Exemplarily, if the finest-grained node includes 32 voxels, the voxel data is a 32-bit variable; or, if the finest-grained node includes 64 voxels, the voxel data is a 64-bit variable. When a certain bit in the voxel data is 1, it indicates that the voxel corresponding to this bit has an obstacle; when a certain bit in the voxel data is 0, it indicates that the voxel corresponding to this bit has no obstacle.

[0164] In some embodiments, the third condition further includes that a part of the space corresponding to the target node is located inside the obstacle. Based on the obstacle information and the node information of the target node, it is determined whether all the space corresponding to the target node is located inside the obstacle.

[0165] Exemplarily, such as Figure 6As shown, the obstacle is obstacle 116. The side length of the spatial cube corresponding to target node 117 is the side length of the smallest spatial cube. The entire space corresponding to target node 117 is located inside obstacle 116, not meeting the third condition. The obstacle is obstacle 119. The side length of the spatial cube corresponding to target node 117 is the side length of the smallest spatial cube. A part of the space corresponding to target node 117 is located inside the obstacle, meeting the third condition. Modify the blocking information of the target node and the voxel data. For example, if the side length of a voxel is 2, then target node 117 stores the data of voxels of 4*4*4 as shown in the figure. Based on the obstacle information of obstacle 119 and the node information of target node 117, determine the intersection area between obstacle 119 and the space corresponding to target node 117. The initial voxel data of target node 117 is 0x000000000000 0000, and the state of the corresponding voxel is as shown in part (1) of Figure 7 ; when the obstacle type of obstacle 119 is the obstacle to be added, the state of the voxel corresponding to the modified voxel data is as shown in part (2) of Figure 7 , and the voxel data is 0x3333 3333 3333 3333.

[0166] In summary, the method provided by the embodiments of the present application details two ways of updating three-dimensional map data. One is to add child nodes to the target node to continue refining the sparse octree; the other is to modify the blocking information of the target node, that is, to modify the connectivity information of the space corresponding to the target node. Through the above methods, the update of three-dimensional map data can be realized.

[0167] In some embodiments, in addition to the obstacles added by the user through the interaction method in the three-dimensional space, there are also fixed obstacles designed by game developers, such as mountains, canyons, caves, etc. in the virtual environment corresponding to the three-dimensional space. These obstacles will not be updated or will be updated following the client version. To ensure the stability and integrity of the three-dimensional map data, in the above solution, there are often two sparse octrees. Among them, one is used to store the three-dimensional map data of the static map, and this static map will not be updated or will be updated following the client version; the other is used to store the three-dimensional map data of the dynamic map, and this dynamic map will be updated based on the user's interaction with the map. When it is necessary to reset the dynamic map, only need to use the sparse octree storing the three-dimensional map data of the static map to overwrite the sparse octree storing the three-dimensional map data of the dynamic map, without the need to record whether the source of the obstacle is added by the game developer or the user. In the case where the three-dimensional map data is relatively large, using two sparse octrees to save the three-dimensional map data may cause memory tension. Therefore, the following structure of the sparse octree is proposed. The sparse octree with this structure can be called a dynamic sparse octree.

[0168] The sparse octree includes a static root node and a dynamic root node. The static subtree corresponding to the static root node is used to store the three-dimensional map data of the static map, and the dynamic subtree corresponding to the dynamic root node is used to store the three-dimensional map data of the dynamic map. The dynamic map is used to indicate a map that is updated based on user interaction. The static subtree and the dynamic subtree share at least one node. Exemplarily, the dynamic sparse octree is as Figure 8 shown. Root node 0 is the static root node, and root node 1 is the dynamic root node. The static subtree and the dynamic subtree share nodes 0 to 7 in level 0. It should be noted that the space corresponding to nodes 0' to 7' in level 1 of the dynamic subtree is the same three-dimensional space as the space corresponding to nodes 0 to 7 in level 1 of the static subtree, and there are differences between the three-dimensional map data stored in the static subtree and the three-dimensional map data stored in the dynamic subtree; the space corresponding to nodes 8' to 15' in level 0 of the dynamic subtree is the same three-dimensional space as the space corresponding to nodes 8 to 15 in level 0 of the static subtree, and there are differences between the three-dimensional map data stored in the static subtree and the three-dimensional map data stored in the dynamic subtree.

[0169] Based on the above structure, in an optional embodiment based on Figure 4 , step 330 can be implemented as step 340.

[0170] Step 340: Update the three-dimensional map data saved in the dynamic subtree based on the obstacle information.

[0171] In some embodiments, initially, that is, when the three-dimensional map data of the dynamic subtree has not been updated, the static subtree and the dynamic subtree share all nodes except the root node. When the three-dimensional map data of the dynamic subtree is updated, the nodes shared by the static subtree and the dynamic subtree are the areas in the dynamic map that have not been modified compared to the static map.

[0172] In an optional embodiment, step 332 can be implemented as step 3322 or step 3323.

[0173] In some embodiments, based on the above structure, the above method for updating the three-dimensional map data is for the dynamic subtree. That is, the target node is a node in the dynamic subtree; in the list of nodes to be updated in step 335 above, the target node in the i-th layer is the dynamic root node initially.

[0174] Step 3322: When it is determined based on the obstacle information that the target node meets the first condition, add a child node for the target node in the dynamic subtree.

[0175] Optionally, the side length of the minimum space cube is a preset value. In some embodiments, to save storage space, the side length of the minimum space cube is set during node division. For example, when the side length of a voxel is 1, a node stores data of 4*4*4 voxels, so the side length of the minimum space cube is 4; when the side length of the space cube corresponding to a node reaches the side length of the minimum space cube, the node is no longer divided, that is, the node has no child nodes.

[0176] Wherein, the first condition includes that the side length of the space cube corresponding to the target node is not the side length of the minimum space cube, the target node has no child nodes, and a part of the space corresponding to the target node is not inside the obstacle.

[0177] In some embodiments, the determination method of the first condition is similar to step 3321 above, and will not be elaborated here.

[0178] In some embodiments, when it is determined based on the obstacle information that the target node meets the first condition, child nodes are added to the target node in the dynamic subtree. The target node is a node in the dynamic subtree, and the child nodes of the target node are also nodes in the dynamic subtree.

[0179] Step 3323: When it is determined based on the obstacle information that the target node meets the fourth condition, copy the child nodes of the target node in the static subtree to the dynamic subtree.

[0180] Wherein, the fourth condition includes that the target node has child nodes, and the child nodes of the target node are in the static subtree, and a part of the space corresponding to the target node is not inside the obstacle.

[0181] In some embodiments, the fourth condition includes that the target node has child nodes. Based on the child node information in the node information, it is judged whether the child node information is empty. When the child node information is empty, the target node has no child nodes; when the child node information is not empty, the target node has child nodes.

[0182] In some embodiments, the fourth condition further includes that the child nodes of the target node are in the static subtree. Optionally, the node information of the target node includes parent node information and child node information. The parent node information is used to indicate the index information of the parent node of this node. Based on the node information, it is judged whether the child nodes of the target node are in the static subtree.

[0183] Exemplarily, first, obtain the child node information of the target node; find the first child node A of the target node according to the child node information. According to the node information of child node A, query all the parent node information of child node A, find the corresponding all parent nodes according to the parent node information, and then search layer by layer upward until all the root nodes corresponding to child node A are found. When all the root nodes corresponding to child node A include static root nodes, the child nodes of the target node are located in the tree corresponding to the static root node; when all the root nodes corresponding to child node A are dynamic root nodes, the child nodes of the target node are located in the tree corresponding to the dynamic root node. As Figure 8 shown, the target node is node 2' in level 1. Query the child node information of the target node, and the first child node obtained is node 0 in level 0. According to the parent node information of node 0 in level 0, continuously query upward, and it is found that all its corresponding root nodes include dynamic root nodes and static root nodes. Therefore, node 0 in level 0 is a node in the static subtree. Similarly, it can be queried that its sibling nodes are also nodes in the static subtree, that is, the child nodes of the target node are located in the static subtree; the target node is node 6' in level 1. Query the child node information of the target node, and the first child node obtained is node 8' in level 0. According to the parent node information of node 8' in level 0, continuously query upward, and it is found that all its corresponding root nodes only include dynamic root nodes. Therefore, node 8' in level 0 is a node in the dynamic subtree. Similarly, it can be queried that its sibling nodes are also nodes in the dynamic subtree, that is, the child nodes of the target node are located in the dynamic subtree.

[0184] In some embodiments, the fourth condition further includes that a part of the space corresponding to the target node is not located inside the obstacle. Based on the obstacle information and the node information of the target node, determine whether the space corresponding to the target node is entirely located inside the obstacle.

[0185] In some embodiments, when it is determined based on the obstacle information that the target node meets the fourth condition, create eight new child nodes, and set the parent node information of the eight new child nodes as the target node; based on the child node information of the target node, query the child nodes of the target node in the static subtree; copy the child nodes of the target node in the static subtree to the eight new child nodes; use the first node among the eight new child nodes to overwrite the child node information in the target node; optionally, use the links of the eight new child nodes to overwrite the links between the target node and the child nodes in the static subtree. Thus, the child nodes of the target node in the static subtree are copied to the dynamic subtree, and the map data saved in the static subtree will not be changed.

[0186] In some embodiments, the above three-dimensional map data can be used for pathfinding in a three-dimensional space. Pathfinding is the process of calculating a connected path between a pathfinding start point and a pathfinding end point in a three-dimensional space. The method further includes:

[0187] Step 350: Obtain the pathfinding start point and the pathfinding end point;

[0188] In some embodiments, obtain the pathfinding start point and the pathfinding end point uploaded by the client. The pathfinding start point includes its coordinates in three-dimensional space; the pathfinding end point includes its coordinates in three-dimensional space.

[0189] Step 360: Based on the three-dimensional map data saved in the sparse octree, plan a pathfinding path, and the pathfinding path is used to indicate the path after avoiding obstacles between the pathfinding start point and the pathfinding end point.

[0190] In some embodiments, plan a pathfinding path based on the three-dimensional map data saved in the sparse octree and a pathfinding algorithm.

[0191] In some embodiments, the pathfinding algorithm includes at least one of the A* algorithm, the Depth First Search (DFS) algorithm, the Breadth First Search (BFS) algorithm, the Jump Point Search (JPS) algorithm, the Greedy Best First Search (GBFS) algorithm, and the Dijkstra algorithm.

[0192] In some embodiments, based on the blocking information stored in the sparse octree nodes, use a pathfinding algorithm to plan a pathfinding path.

[0193] In some embodiments, the sparse octree is the sparse octree with two root nodes mentioned above. The sparse octree includes a static root node and a dynamic root node. The static subtree corresponding to the static root node is used to save the three-dimensional map data of the static map, and the dynamic subtree corresponding to the dynamic root node is used to save the three-dimensional map data of the dynamic map. The dynamic map is used to indicate the map updated based on the user's interaction. The static subtree and the dynamic subtree share at least one node.

[0194] In some embodiments, plan a pathfinding path based on the three-dimensional map data saved in the dynamic subtree.

[0195] In summary, the method provided by the embodiments of the present application uses the three-dimensional map data saved in the sparse octree to perform pathfinding planning, so as to obtain a pathfinding path from the pathfinding start point to the pathfinding end point. Since the pathfinding path is planned according to the three-dimensional map data, the obtained pathfinding path is a path in three-dimensional space, that is, it can go up into the sky and down into the sea following the pathfinding path, and the pathfinding experience can be improved.

[0196] In an alternative embodiment, when performing pathfinding planning, it is planned step by step from the blocking information of the node corresponding to the pathfinding start point and its adjacent nodes. Step 360 can be implemented as steps 361 to 363.

[0197] Step 361: Obtain the first neighbor nodes adjacent to the current node in six directions: up, down, left, right, front, and back. The current node is used to indicate the node where pathfinding planning is being performed during pathfinding path planning. The first neighbor nodes include blocking information and are used to indicate nodes without child nodes. The current node is initially the node corresponding to the pathfinding start point in the sparse octree.

[0198] In some embodiments, the first neighbor nodes adjacent to the current node in six directions: up, down, left, right, front, and back are obtained. The first neighbor nodes include at least six neighbor nodes.

[0199] In some embodiments, according to the coordinates of the pathfinding start point, the node corresponding to the pathfinding start point is calculated. The node corresponding to the pathfinding start point has no child nodes.

[0200] In some embodiments, the node information of a node includes position information, which is used to indicate the coordinates in the spatial rectangular coordinate system corresponding to the space in three dimensions. The method for calculating the node corresponding to the pathfinding start point according to the coordinates of the pathfinding start point is as follows. First, obtain the position information of the root node and determine whether the root node has child nodes. If the root node has child nodes, determine which child node the pathfinding start point is located in. For example, if the pathfinding start point is located in child node a1, determine whether child node a1 has child nodes. If child node a1 has no child nodes, then child node a1 is the node corresponding to the pathfinding start point; if child node a1 has child nodes, then according to the position information of child node a1, determine which child node of child node a1 the pathfinding start point is located in, and continue to query downward in this way until the node corresponding to the pathfinding start point is found.

[0201] In some embodiments, the position information is the coordinates of the space corresponding to the node in the spatial rectangular coordinate system; or, the position information is the coordinates of the space corresponding to the preprocessed node in the spatial rectangular coordinate system.

[0202] Exemplarily, the position information is (3, 2, 4), indicating that the space corresponding to the node is at the position where x is 3, y is 2, and z is 4 in the spatial rectangular coordinate system; or, the coordinates of the node in the spatial rectangular coordinate system are (3, 2, 4), and the position information of the node is the quotient of the coordinates of the node divided by the side length of the space corresponding to the node. For example, when the side length of the node is 8, the position information of the node is (0, 0, 0); when the side length of the node is 4, the position information of the node is (0, 0, 1); when the side length of the node is 2, the position information of the node is (1, 1, 2).

[0203] When the position information is the coordinates in the space rectangular coordinate system after preprocessing, the method for calculating the node corresponding to the pathfinding start point is as follows. To illustrate this calculation method more clearly, the following takes the two-dimensional space and the sparse quadtree as specific examples. As Figure 9 shown in part (1) thereof, the coordinates of the pathfinding start point 120 in the two-dimensional space are (2, 11); the side length of the two-dimensional space is 16. The sparse quadtree corresponding to the two-dimensional space is as Figure 9 shown in part (2) thereof. It is known that the coordinates of the root node are (8, 8), and the side length corresponding to the root node is the side length of the two-dimensional space. Therefore, the side length corresponding to the root node is 16, and the position information of the root node can be calculated as (0, 0). Dividing the coordinates of the pathfinding start point 120 by the side length corresponding to the root node gives (0, 0), and it can be known that the pathfinding start point 120 is located in the space corresponding to the root node. Since the root node has child nodes, it is necessary to calculate in which child node of the root node the pathfinding start point is located. The sorting of the child nodes is as Figure 9 shown in part (3) thereof; since the side length of the child nodes of the root node is 8, dividing the coordinates of the pathfinding start point 120 by the side length corresponding to the child nodes gives (0, 1); among them, the coordinates of child node 2 of the root node are (4, 12), and the position information of child node 2 is (0, 1). Therefore, the pathfinding start point is located in child node 2 of the root node; since child node 2 has child nodes, the child nodes of child node 2 can be called secondary child nodes. The side length of the secondary child nodes is 4. Dividing the coordinates of the pathfinding start point 120 by the side length of the secondary child nodes gives (0, 2). The coordinates of secondary child node 0 are (2, 10), and the position information of secondary child node 0 is (0, 2). Therefore, the pathfinding start point is located in secondary child node 0. Since secondary child node 0 has no child nodes, the node corresponding to the pathfinding start point is secondary child node 0.

[0204] Step 362: When the blocking information of the first neighbor node is unblocked, determine the first neighbor node as a candidate node, and the candidate node is the node for pathfinding planning.

[0205] In some embodiments, when the blocking information of the first neighbor node is unblocked, it means that the first neighbor node will not block the virtual character from advancing. Therefore, it is set as a candidate node in the pathfinding planning process.

[0206] Step 363: Plan the pathfinding path between the current node and the candidate node.

[0207] In some embodiments, during the pathfinding planning process, there is at least one candidate node. According to the pathfinding algorithm, plan the pathfinding path between the current node and the candidate node.

[0208] In summary, the method provided by the embodiments of the present application splits the path planning process between the path finding start point and the path finding end point into path finding planning processes between nodes. The current node is the node that starts from the node corresponding to the path finding start point, passes through candidate nodes one by one, and finally reaches the path finding end point. The candidate nodes are the nodes adjacent to the current node but with unobstructed blocking information. Through the above method, it is possible to perform path finding in three-dimensional space according to the three-dimensional map data stored based on the sparse octree.

[0209] In an alternative embodiment, in order to be able to search for at least six first neighbor nodes corresponding to the current node more quickly, neighbor information is added to the nodes of the sparse octree. The neighbor information is used to store six second neighbor nodes of the current node in six directions. Step 361 can be alternatively implemented as steps 3611 and 3612.

[0210] Step 3611: Obtain the neighbor information of the current node. The neighbor information includes six second neighbor nodes of the current node. The six second neighbor nodes are the second neighbor nodes in the six directions of up, down, left, right, front, and back of the current node. The level of the second neighbor node is greater than or equal to the level of the current node.

[0211] In some embodiments, the neighbor information includes six second neighbor nodes of the current node in the six directions of up, down, left, right, front, and back. The level of the second neighbor node is greater than or equal to the level of the current node.

[0212] Step 3612: Based on the neighbor information, obtain at least six first neighbor nodes adjacent to the current node in six directions.

[0213] In some embodiments, the first neighbor node is the second neighbor node; or, the first neighbor node is the child node of the second neighbor node.

[0214] In some embodiments, based on the second neighbor node, obtain at least one first neighbor node of the current node in the direction corresponding to the second neighbor node.

[0215] In an alternative embodiment, the second neighbor node includes index information. The index information includes a level index and a node index. The level index is used to indicate the level where the node is located, and the node index is used to indicate the position of the node in the array at the corresponding level. Step 3612 can be implemented as steps 3613 to 3615.

[0216] Step 3613: Based on the neighbor information, set the six second neighbor nodes of the current node as candidate neighbor nodes.

[0217] In some embodiments, set the six second neighbor nodes of the current node as candidate neighbor nodes.

[0218] Step 3614: When the candidate neighbor node has child nodes, obtain the index information of the four child nodes adjacent to the current node of the candidate neighbor node, and set the four child nodes as the candidate neighbor nodes.

[0219] In some embodiments, when the candidate neighbor node has child nodes, obtain the index information of the four child nodes adjacent to the current node of the candidate neighbor node, and based on the index information of the four child nodes, obtain the four corresponding child nodes in the sparse octree respectively, and set the four child nodes as the candidate neighbor nodes.

[0220] Step 3615: When the candidate neighbor node has no child nodes, set the candidate neighbor node as the first neighbor node.

[0221] In some embodiments, when the candidate neighbor node has no child nodes, set the candidate neighbor node as a first neighbor node of the current node in the corresponding direction of the candidate neighbor node.

[0222] In summary, the method provided by the embodiments of the present application adds a neighbor information to the nodes of the sparse octree to save the neighbor nodes of the nodes in six directions: up, down, left, right, front, and back; when performing pathfinding planning, the neighbor information can be directly queried to obtain the second neighbor node of the node, and starting from the second neighbor node, query down to the node that has no child nodes in the direction of the second neighbor node, which is used as the first neighbor node for pathfinding. This can reduce the time for querying the neighbor nodes of the current node layer by layer during training and improve the efficiency of pathfinding planning.

[0223] To be able to understand this solution more conveniently, the following will comprehensively describe this solution based on the above method. First, a sparse octree is defined, and this sparse octree can be called a dynamic sparse octree.

[0224] In addition to the above five characteristics of the sparse octree, the dynamic sparse octree also has the following two characteristics.

[0225] (1) The dynamic sparse octree includes a static root node and a dynamic root node. The static subtree corresponding to the static root node is used to store the three-dimensional map data of the static map, and the dynamic subtree corresponding to the dynamic root node is used to store the three-dimensional map data of the dynamic map. The dynamic map is used to indicate the map updated based on user interaction. The static subtree and the dynamic subtree share at least one node. Exemplarily, the dynamic sparse octree is as Figure 8As shown. The root node 0 is a static root node, and the root node 1 is a dynamic root node. The static subtree and the dynamic subtree share the nodes 0 to 7 in level 0. It should be noted that the space corresponding to the nodes 0' to 7' in level 1 of the dynamic subtree is the same three-dimensional space as the space corresponding to the nodes 0 to 7 in level 1 of the static subtree, and there are differences in the three-dimensional map data stored in the static subtree and the three-dimensional map data stored in the dynamic subtree; the space corresponding to the nodes 8' to 15' in level 0 of the dynamic subtree is the same three-dimensional space as the space corresponding to the nodes 8 to 15 in level 0 of the static subtree, and there are differences in the three-dimensional map data stored in the static subtree and the three-dimensional map data stored in the dynamic subtree.

[0226] (2) The dynamic sparse octree does not maintain the order of nodes at the same level. In a sparse binary tree, in order to quickly find a certain node, the order of nodes at the same level is often maintained, so that all nodes at the same level are arranged in ascending or descending order according to the position information. In this way, only binary search is needed when searching for a certain node. However, for the scenario where the sparse octree needs to be frequently changed, maintaining the order of nodes at the same level will instead increase the overhead. When updating the map data and performing spatial partitioning, that is, adding 8 child nodes to a node, it is necessary to query the node information corresponding to the nodes sorted adjacent to this node and the node information of the child nodes corresponding to this adjacent node. Exemplarily, as Figure 10 shown, it is necessary to add child nodes to node 1 in the i-th layer. At this time, it is necessary to query the nodes with useful child nodes before and after node 1, and the positions of their corresponding child nodes; it is found that node 0 before node 1 has no child nodes, and node 2 after node 1 has child nodes. Therefore, the child nodes of node 1 need to be inserted before the child nodes of node 2. Since the nodes are saved using an array, therefore, it is necessary to postpone the positions of the child nodes of node 2 and the positions of the nodes after the child nodes of node 2, and insert the child nodes of node 1 into the original positions of the child nodes of node 2. The array of the (i - 1)-th layer with child nodes added to node 1 is as Figure 10 shown. The child nodes of node 1 are inserted into positions 0 - 7 of the array of the (i - 1)-th layer. The child nodes of node 2 originally saved in positions 0 - 7, the child nodes of node 5 saved in positions 8 - 15, and the child nodes of node 6 saved in positions 16 - 23 are postponed to positions 8 - 31.

[0227] Next, it will be described in combination with the dynamic sparse octree from two aspects: three-dimensional map data update and pathfinding using the three-dimensional map.

[0228] 1. Three-dimensional map data update

[0229] When updating 3D map data based on obstacle information, the obstacle types include obstacles to be added and obstacles to be deleted. Therefore, the 3D map data update includes adding obstacles and deleting obstacles.

[0230] 1.1 Adding obstacles

[0231] Figure 11 The flowchart of the method for updating 3D map data provided by an exemplary embodiment of the present application is shown. The method is executed by a server, and the server can be the server as shown in Figure 3 the figure. The method includes:

[0232] Step 410: Obtain the obstacle information to be added and the dynamic sparse octree.

[0233] In some embodiments, the obstacle information includes at least one of the position information, size information, and range information of the obstacle. The position information is used to indicate the coordinates of the obstacle in the spatial coordinate system corresponding to the three-dimensional space; the size information is used to indicate the size of the obstacle; the range information is used to indicate the spatial range covered by the obstacle.

[0234] In some embodiments, the obstacle is a cuboid, and the obstacle information includes position information and size information.

[0235] Step 411: Initialize the processing queue.

[0236] In some embodiments, a processing queue is initialized to update the dynamic sparse octree according to the obstacle information to be added. Optionally, the processing queue is used to update the dynamic subtrees of the dynamic sparse octree according to the obstacle information to be added.

[0237] Step 412: Put the dynamic root node into the processing queue.

[0238] In some embodiments, the dynamic root node of the dynamic sparse octree is put into the processing queue.

[0239] The dynamic root node includes child node information, and the child node information is used to indicate the index information of the first child node among the child nodes of the dynamic root node. Optionally, the child node information is represented as (level index, node index). The level index is used to indicate the level where the node is located, and the node index is used to indicate the node offset of the node in the corresponding level. For example, (2, 5) indicates that the node is located at the 5th position in level 2.

[0240] Step 413: Take out the i-th node from the processing queue.

[0241] In some embodiments, the initial value of i is 1, and i is a positive integer; or, the initial value of i is 0, and i is an integer.

[0242] In some embodiments, the i-th node includes node information, and the node information includes at least one of grid information, parent node information, and child node information.

[0243] In some embodiments, the grid information includes at least one of position information, dimension information, and range information. The position information is used to indicate the coordinates of the node in the spatial coordinate system corresponding to the three-dimensional space; the dimension information is used to indicate the size of the space corresponding to the node; the range information is used to indicate the spatial range covered by the space corresponding to the node.

[0244] In some embodiments, the parent node information is used to indicate the index information of the parent node of the node. Optionally, the parent node information is represented as (hierarchical index, node index). The hierarchical index is used to indicate the level where the node is located, and the node index is used to indicate the node offset of the node in the corresponding level.

[0245] In some embodiments, the child node information is used to indicate the index information of the first child node corresponding to the node. Optionally, the child node information is represented as (hierarchical index, node index). The hierarchical index is used to indicate the level where the node is located, and the node index is used to indicate the node offset of the node in the corresponding level. For example, (2, 5) indicates that the node is located at the 5th position in level 2.

[0246] Exemplarily, the nodes of the dynamic sparse octree are cubes in three-dimensional space, and the side lengths of the nodes in different levels are different. For example, the side length of the nodes in level 2 is 16, the side length of the nodes in level 1 is 8, and the side length of the nodes in level 0 is 4. In the voxel data corresponding to the node, that is, in the 4*4*4 voxels, the side length of each voxel is 1.

[0247] Step 414: Whether the i-th node intersects with the obstacle.

[0248] In some embodiments, it is determined whether the i-th node intersects with the obstacle to be added based on the node information of the i-th node and the obstacle information to be added.

[0249] Exemplarily, the node information includes position information and size information, and the obstacle information includes position information and size information. Among them, the position information is the center point coordinates. The position information of the i-th node is (2, 2, 2), and the size information is that the side length is equal to 4, that is, the i-th node is a cube centered at (2, 2, 2) with a side length of 4 in three-dimensional space. The position information of the obstacle to be added is (1, 1, 1), and the size information is that the side length is equal to 2, that is, the obstacle to be added is a cube centered at (1, 1, 1) with a side length of 2 in three-dimensional space. It can be determined that the obstacle to be added intersects with the i-th node. Or, the position information of the obstacle to be added is (8, 8, 8), and the size information is that the side length is equal to 2, that is, the obstacle to be added is a cube centered at (8, 8, 8) with a side length of 2 in three-dimensional space. It can be determined that the obstacle to be added does not intersect with the i-th node.

[0250] In the case where the i-th node intersects with the obstacle to be added, step 415 is executed; in the case where the i-th node does not intersect with the obstacle to be added, step 423 is executed.

[0251] Step 415: Whether the blocking information of the i-th node is full blocking.

[0252] In some embodiments, the node information of the i-th node further includes blocking information. The blocking information is used to indicate whether the node will block the virtual character from advancing. The blocking information includes full blocking and no blocking. Full blocking is used to indicate that the node will block the virtual character from advancing, and no blocking is used to indicate that the node will not block the virtual character from advancing.

[0253] In the case where the blocking information of the i-th node is full blocking, it means that the i-th node is impassable before adding the obstacle. Therefore, no other operations are required, and step 423 is directly executed; in the case where the blocking information of the i-th node is not full blocking, step 416 is executed.

[0254] Step 416: Whether the i-th node has child nodes.

[0255] In some embodiments, based on the node information of the i-th node, it is determined whether the i-th node has child nodes. The node information includes child node information. In the case where the child node information is empty, the i-th child node has no child nodes; in the case where the child node information is not empty, the i-th child node has child nodes.

[0256] In the case where the i-th node has no child nodes, step 417 is executed; in the case where the i-th node has child nodes, step 418 is executed.

[0257] Step 417: Whether the i-th node is located inside the obstacle.

[0258] In some embodiments, based on the node information of the i-th node and the information of the obstacle to be added, it is determined whether the i-th node is inside the obstacle.

[0259] Exemplarily, the node information includes position information and size information, and the obstacle information includes position information and size information. Among them, the position information is the center point coordinates. The position information of the i-th node is (2, 2, 2), and the size information is that the side length is equal to 4, that is, the i-th node is a cube centered at (2, 2, 2) with a side length of 4 in the three-dimensional space. The position information of the obstacle to be added is (1, 1, 1), and the size information is that the side length is equal to 4, that is, the obstacle to be added is a cube centered at (1, 1, 1) with a side length of 4 in the three-dimensional space. It can be determined that the i-th node intersects with the obstacle to be added but is not inside the obstacle to be added. Or, the position information of the obstacle to be added is (6, 6, 6), and the size information is equal to the side length of 8, that is, the obstacle to be added is a cube centered at (6, 6, 6) with a side length of 8 in the three-dimensional space. It can be determined that the i-th node is inside the obstacle to be added.

[0260] In some embodiments, based on the node information of the i-th node, it is determined whether the i-th node has child nodes. The node information includes child node information. When the child node information is empty, the i-th child node has no child nodes; when the child node information is not empty, the i-th child node has child nodes.

[0261] When the i-th node is inside the obstacle, step 420 is executed; when the i-th node is not inside the obstacle, step 421 is executed.

[0262] Step 418: Whether the child nodes of the i-th node are in the tree corresponding to the static root node.

[0263] In some embodiments, based on the node information of the i-th node, it is determined whether the child nodes of the i-th node are in the tree corresponding to the static root node.

[0264] Exemplarily, the node information includes parent node information and child node information. The parent node information is used to indicate the index of the parent node corresponding to the node at the corresponding level, and the child node information is used to indicate the index of the first child node corresponding to the node at the corresponding level. Both the parent node information and the child node information can be expressed as (level index, node index). First, obtain the child node information of the i-th node, and the obtained child node information is (1, 8); according to this child node information (1, 8), find the first child node A of the i-th node. According to the node information of the child node A, query all the parent node information of the child node A, and according to the parent node information, find the corresponding all parent nodes, and then search layer by layer upward until all the root nodes corresponding to the child node A are found. When all the root nodes corresponding to the child node A include static root nodes and dynamic root nodes, the child nodes of the i-th node are located in the tree corresponding to the static root node; when all the root nodes corresponding to the child node A only include dynamic root nodes, the child nodes of the i-th node are located in the tree corresponding to the dynamic root node.

[0265] When the child nodes of the i-th node are located in the tree corresponding to the static root node, it indicates that there is an intersection between the child nodes of the i-th node and the obstacle to be added, and it is necessary to update the child nodes of the i-th node, and execute step 422; when the child nodes of the i-th node are not located in the tree corresponding to the static root node, that is, the child nodes of the i-th node are located in the tree corresponding to the dynamic root node, execute step 419.

[0266] Step 419: Add the child nodes of the i-th node to the processing queue.

[0267] In some embodiments, add the eight child nodes of the i-th node to the processing queue and wait for processing.

[0268] In some embodiments, based on the node information of the i-th node, add the child nodes of the i-th node to the processing queue. Exemplarily, the node information includes child node information, and the child node information is used to indicate the index of the first child node corresponding to the node at the corresponding level. The child node information can be expressed as (level index, node index). According to the child node information (2, 8) saved by the i-th node, find the child node ranked 8 in level 2, and add this child node and the 7 child nodes ranked after this child node to the processing queue. Take out the child nodes of the i-th node, that is, take out the nodes ranked 8 - 15 in the array corresponding to level 2 and add them to the processing queue.

[0269] After executing step 419, execute step 423.

[0270] Step 420: Set the blocking information of the i-th node to full blocking.

[0271] In some embodiments, set the blocking information of the i-th node to full blocking; or, when the i-th node is a node at level 0, the node information of the i-th node includes voxel data, and update the voxel data of the i-th node based on the node information of the i-th node and the obstacle information to be added; or, when the i-th node is a node at level 0, the node information of the i-th node includes voxel data, set the blocking information of the i-th node to full blocking based on the node information of the i-th node and the obstacle information to be added, and update the voxel data of the i-th node based on the blocking information of the i-th node.

[0272] Exemplarily, when the i-th node is a node at level 2, set the blocking information of the i-th node to full blocking; or, when the i-th node is a node at level 0, the node information of the i-th node includes voxel data, and the voxel data is used to indicate whether there are obstacles in the 64 voxels corresponding to the i-th node; optionally, the node information of the i-th node includes position information and size information, and the obstacle information to be added includes position information and size information; update the voxel data of the i-th node to 0xffffffff ffff ffff; or, when the i-th node is a node at level 0, the node information of the i-th node includes voxel data, and the voxel data is used to indicate whether there are obstacles in the 64 voxels corresponding to the i-th node; optionally, the node information of the i-th node includes position information and size information, and the obstacle information to be added includes position information and size information; set the blocking information of the i-th node to full blocking, and set the voxel data of the i-th node to 0xffff ffff ffff ffff according to the full blocking of the blocking information of the i-th node.

[0273] After step 420 is executed, execute step 423.

[0274] Step 421: Create eight child nodes and add the eight child nodes to the processing queue.

[0275] In some embodiments, create eight child nodes for the i-th node and add the newly created eight child nodes to the processing queue.

[0276] In some embodiments, add the eight child nodes to the processing queue in ascending order; or, in descending order.

[0277] In some embodiments, the blocking information of the newly created eight child nodes is all unblocked.

[0278] In some embodiments, when the i-th node is a node at level 0, update the voxel data of the i-th node based on the obstacle information to be added and the node information of the i-th node.

[0279] Exemplarily, the voxel data of the i-th node before update is 0x0000 0000 0000 0000, and the intersection situation between the i-th node and the obstacle to be added is as Figure 12 shown. Set the blocked voxels to bit 1, and update the voxel data of the i-th node to 0010 0000 0000 0000 0001 0000 0000 0000 0000 0000 1100 1100 00000000 0000 0110, that is, 0x2000 1000 00CC 0006.

[0280] In some embodiments, when the i-th node is a node at level 0, the 64 voxels stored in the voxel data of the i-th node are added to the processing queue as nodes.

[0281] After step 421 is executed, step 423 is executed.

[0282] Step 422: Add the child nodes of the i-th node to the tree corresponding to the dynamic root node, and add the child nodes to the processing queue.

[0283] In some embodiments, eight child nodes are created for the i-th node, and the node information of the newly created eight child nodes is the same as the information of the eight child nodes corresponding to the i-th node in the tree corresponding to the static root node; or, the eight child nodes corresponding to the i-th node in the static root node are copied to the i-th node.

[0284] In some embodiments, first obtain the child node information corresponding to the i-th node, query the first child node corresponding to the i-th node according to the child node information, and the first child node is located in the tree corresponding to the static root node. Create eight child nodes for the i-th node, denoted as the second child nodes. Copy the node information of the first child node to the second child nodes. Update the child node information of the i-th node to the second child nodes.

[0285] In some embodiments, the eight copied child nodes are added to the processing queue in ascending order; or, in descending order.

[0286] After step 422 is executed, step 423 is executed.

[0287] Step 423: Whether the i-th node is the last node.

[0288] In some embodiments, determine whether the i-th node is the last node in the processing queue; or, determine whether the processing queue is empty.

[0289] In the case where the i-th node is the last node in the processing queue, the update of the dynamic sparse octree is ended, or the process of adding an obstacle is ended; in the case where the i-th node is not the last node in the processing queue, step 424 is executed.

[0290] Step 424: i = i + 1.

[0291] After step 424 is executed, step 413 is executed.

[0292] To more conveniently illustrate the changes when adding an obstacle to the dynamic sparse octree, the following is a specific illustration in the form of a quadtree.

[0293] The node structure of the quadtree is as shown in part (1) of Figure 13 Each node can query the corresponding child nodes according to the child node information. It can be understood that each node stores a link pointing to its corresponding child nodes. The order of the child nodes corresponding to each child node link is as shown in parts (1) and (2) of Figure 13

[0294] When the blocking information of a certain node is unblocked, as shown in part (1) of Figure 14 When the blocking information of a certain node is fully blocked, as shown in part (2) of Figure 14 When the child nodes of a certain node are nodes at level 0 and at least one of the four child nodes is fully blocked, as shown in part (3) of Figure 14

[0295] The map data in the initial situation is as shown in part (1) of Figure 15 The map data with an obstacle added is as shown in part (2) of Figure 15

[0296] The dynamic sparse quadtree corresponding to the map data in the initial situation is as shown in Figure 16 The quadtree pointed to by the dynamic root node 114 is the same as the quadtree pointed to by the static root node 113.

[0297] In the case of adding an obstacle, as shown in part (2) of Figure 15 The slanted area is the area corresponding to the obstacle. The process of adding an obstacle starts to be executed.

[0298] First, a processing queue is initialized, and the dynamic root node 114 is placed in the processing queue.

[0299] ​​​Take out the dynamic root node 114 for judgment, execute the above step 414, and the judgment result is that the dynamic root node 114 intersects with the obstacle; execute step 415 to determine that the dynamic root node 114 is not fully blocked; execute step 416 to determine that the dynamic root node 114 is not inside the obstacle; execute step 417 to determine that the dynamic root node 114 has child nodes; execute step 418 to determine that the child nodes of the dynamic root node 114 are located in the static root node 113; execute step 422 to add the child nodes 1' to 4' corresponding to the dynamic root node 114 to the tree corresponding to the dynamic root node 114, and add these four child nodes 1' to 4' to the processing queue.

[0300] The dynamic sparse quad-tree with nodes 1' to 4' added is as Figure 17 shown. The nodes 1' to 4' are obtained by directly copying the nodes 1 to 4. Therefore, the child nodes linked by the nodes 1' to 4' are the same as the child nodes linked by the nodes 1 to 4.

[0301] After adding the nodes 1' to 4', execute step 423 to determine that the dynamic root node 114 is not the last node in the processing queue. Therefore, execute step 413 to continue obtaining the second node from the processing queue, that is, the node 1' just added to the processing queue, and re-execute the judgment steps.

[0302] First, execute step 414 to determine whether the node 1' intersects with the obstacle. The judgment result is non-intersection; execute step 423 to determine that the node 1' is not the last node in the processing queue. Therefore, execute step 413 to continue obtaining the third node from the processing queue, that is, the node 2', and re-execute the judgment steps.

[0303] First, execute step 414 to determine that the node 2' intersects with the obstacle; execute step 415 to determine that the blocking information of the node 2' is not full blocking; execute step 416 to determine that the node 2' is not inside the obstacle; execute step 417 to determine that the node 2' has no child nodes; execute step 421 to create four child nodes 21' to 24' for the node 2', and set the blocking information of these four child nodes 21' to 24' to unblocked, and at the same time add these four child nodes 21' to 24' to the processing queue, as Figure 18 shown. At this time, the processing queue includes the node 3', the node 4', the node 21', the node 22', the node 23' and the node 24'. In this case, the map data corresponding to the dynamic root node 114 is as Figure 19 shown.

[0304] After executing step 421, execute step 423 to determine that the node 2' is not the last node in the processing queue. Therefore, execute step 413 to obtain the fourth node from the processing queue, that is, the node 3', and re-execute the judgment steps.

[0305] First, step 414 is executed to determine that node 3' does not intersect with the obstacle; step 423 is executed to determine that node 3' is not the last node in the processing queue. Therefore, step 413 is executed to obtain the 5th node from the processing queue, that is, node 4', and the judgment steps are executed again.

[0306] First, step 414 is executed to determine that node 4' does not intersect with the obstacle; step 423 is executed to determine that node 4' is not the last node in the processing queue. Therefore, step 413 is executed to obtain the 6th node from the processing queue, that is, node 21', and the judgment steps are executed again.

[0307] This judgment is repeated in a loop. The judgment results of nodes 21', 22', and 23' are the same as those of the above nodes 3' and 4'. Until node 24' is obtained from the processing queue, step 414 is executed to determine that node 24' intersects with the obstacle; step 415 is executed to determine that the blocking information of node 24' is not full blocking; step 416 is executed to determine that node 24' is not inside the obstacle; step 417 is executed to determine that node 24' has no child nodes; step 421 is executed to create four child nodes 241' to 244' for node 24', and set the blocking information of these four child nodes 241' to 244' to non-blocking. At the same time, these four child nodes 241' to 244' are added to the processing queue. As Figure 20 shown, the processing queue includes node 241', node 242', node 243', and node 244' at this time.

[0308] After step 421 is executed, step 423 is executed to determine that node 24' is not the last node in the processing queue. Therefore, step 413 is executed to obtain the 10th node from the processing queue, that is, node 241', and the judgment steps are executed again.

[0309] The judgment results of nodes 241', 242', and 243' are the same as those of the above nodes 3' and 4'. Node 244' is obtained from the processing queue. Step 414 is executed to determine that node 244' intersects with the obstacle; step 415 is executed to determine that the blocking information of node 244' is not full blocking; step 416 is executed to determine that node 244' is inside the obstacle, and this node 244' has no child nodes; step 420 is executed to set the blocking information of node 244' to full blocking; step 423 is executed to determine that node 244' is the last node in the processing queue, and the map update process ends. The finally obtained dynamic sparse quadtree is as Figure 21 shown. In this dynamic sparse quadtree, the map data corresponding to the dynamic root node 114 is as Figure 22 shown.

[0310] 1.2 Deleting Obstacles

[0311] Figure 23 The flowchart of the method for updating three-dimensional map data provided by an exemplary embodiment of the present application is shown. The method is executed by a server, which can be the server as shown in Figure 3 the figure. The method includes:

[0312] Step 510: Obtain the information of the obstacle to be deleted and the dynamic sparse octree.

[0313] The information of the obstacle to be deleted is similar to the information of the obstacle to be added, and step 510 is also similar to step 410 in 1.1, which will not be elaborated here.

[0314] Step 511: Initialize the processing queue.

[0315] Step 511 is similar to step 411 in 1.1, which will not be elaborated here.

[0316] Step 512: Put the dynamic root node into the processing queue.

[0317] Step 512 is similar to step 412 in 1.1, which will not be elaborated here.

[0318] Step 513: Take out the i-th node from the processing queue.

[0319] Step 513 is similar to step 413 in 1.1, which will not be elaborated here.

[0320] Step 514: Determine whether the i-th node intersects with the obstacle.

[0321] Step 514 is similar to step 414 in 1.1, which will not be elaborated here.

[0322] If the i-th node intersects with the obstacle, execute step 515; if the i-th node does not intersect with the obstacle, execute step 519.

[0323] Step 515: Determine whether the i-th node is inside the obstacle and has no child nodes.

[0324] In some embodiments, based on the node information of the i-th node and the information of the obstacle to be added, determine whether the i-th node is inside the obstacle.

[0325] Exemplarily, the node information includes position information and size information, and the obstacle information includes position information and size information. Among them, the position information is the center point coordinates. The position information of the i-th node is (2, 2, 2), and the size information is that the side length is equal to 4, that is, the i-th node is a cube centered at (2, 2, 2) with a side length of 4 in three-dimensional space. The position information of the obstacle to be added is (1, 1, 1), and the size information is that the side length is equal to 4, that is, the obstacle to be added is a cube centered at (1, 1, 1) with a side length of 4 in three-dimensional space. It can be determined that the i-th node intersects with the obstacle to be added but is not inside the obstacle to be added. Or, the position information of the obstacle to be added is (6, 6, 6), and the size information is that the side length is equal to 8, that is, the obstacle to be added is a cube centered at (6, 6, 6) with a side length of 8 in three-dimensional space. It can be determined that the i-th node is located inside the obstacle to be added.

[0326] In some embodiments, based on the node information of the i-th node, it is determined whether the i-th node has child nodes. The node information includes child node information. In the case where the child node information is empty, the i-th child node has no child nodes; in the case where the child node information is not empty, the i-th child node has child nodes.

[0327] In the case where the i-th node is located inside the obstacle and has no child nodes, step 517 is executed; otherwise, step 516 is executed. For example, the i-th node is located inside the obstacle, but the i-th node has child nodes; or, the i-th node intersects with the obstacle but is not located inside the obstacle and has child nodes.

[0328] Step 516: Add the child nodes of the i-th node to the processing queue.

[0329] In some embodiments, the eight child nodes of the i-th node are added to the processing queue and wait to be processed.

[0330] In some embodiments, based on the node information of the i-th node, the child nodes of the i-th node are added to the processing queue. Exemplarily, the node information includes child node information, and the child node information is used to indicate the index of the first child node corresponding to the node at the corresponding level. The child node information can be expressed as (level index, node index). According to the child node information (2, 8) saved by the i-th node, the child node ranked 8 in level 2 is found, and this child node and the 7 child nodes ranked after this child node are added to the processing queue. Take out the child nodes of the i-th node, that is, take out the nodes ranked 8 - 15 in the array corresponding to level 2 and add them to the processing queue.

[0331] After step 516 is executed, step 518 is executed.

[0332] Step 517: Set the blocking information of the i-th node to unblocked.

[0333] In some embodiments, set the blocking information of the i-th node to unblocked; or, when the i-th node is a node at level 0, the node information of the i-th node includes voxel data, and based on the node information of the i-th node and the obstacle information to be added, update the voxel data of the i-th node; or, when the i-th node is a node at level 0, the node information of the i-th node includes voxel data, and based on the node information of the i-th node and the obstacle information to be added, set the blocking information of the i-th node to fully blocked, and based on the blocking information of the i-th node, update the voxel data of the i-th node.

[0334] Exemplarily, when the i-th node is a node at level 2, set the blocking information of the i-th node to unblocked; or, when the i-th node is a node at level 0, the node information of the i-th node includes voxel data, and the voxel data is used to indicate whether there are obstacles in the 64 voxels corresponding to the i-th node; optionally, the node information of the i-th node includes position information and size information, and the obstacle information to be added includes position information and size information; update the voxel data of the i-th node to 0x00000000 0000 0000; or, when the i-th node is a node at level 0, the node information of the i-th node includes voxel data, and the voxel data is used to indicate whether there are obstacles in the 64 voxels corresponding to the i-th node; optionally, the node information of the i-th node includes position information and size information, and the obstacle information to be added includes position information and size information; set the blocking information of the i-th node to unblocked, and according to the blocking information of the i-th node being unblocked, set the voxel data of the i-th node to 0x0000 0000 0000 0000.

[0335] After step 517 is executed, execute step 518.

[0336] Step 518: Whether the i-th node is the last node.

[0337] In some embodiments, determine whether the i-th node is the last node in the processing queue; or, determine whether the processing queue is empty.

[0338] When the i-th node is the last node in the processing queue, end the update of the dynamic sparse octree, or end the obstacle deletion process; when the i-th node is not the last node in the processing queue, execute step 519.

[0339] Step 519: i = i + 1.

[0340] After step 519 is executed, execute step 513.

[0341] Since only the blocking information in the map data is considered when performing addition and deletion operations on obstacles, in the scenario where multiple obstacles intersect, when directly deleting an obstacle, the intersecting part between obstacles may be deleted. As shown in Figure 24 part (1) of [], the map includes obstacle 1 and obstacle 2, and there is an intersection between obstacle 1 and obstacle 2. The intersecting part is the intersecting part 3 of obstacle 1 and obstacle 2 outlined by the dashed box in the schematic Figure 1 In. After using the above method to delete obstacle 2, as shown in Figure 24 part (2) of [], obstacle 2 and the intersecting part 3 of obstacle 1 and obstacle 2 are deleted, leaving only part of obstacle 1'. However, the map after correctly deleting obstacle 2 should be as shown in Figure 24 part (3) of [].

[0342] That is, the map data currently directly obtained by using the above method 1.2 to delete obstacles is inaccurate. This problem can be solved by the following method.

[0343] Step 610: Obtain a set of obstacles that intersect with the obstacle to be deleted.

[0344] In some embodiments, based on the obstacle information of the obstacle to be deleted, query the set of obstacles that intersect with the obstacle to be deleted in the dynamic sparse octree. Or, obtain the obstacle list of the map corresponding to the dynamic sparse octree, and based on the obstacle information of the obstacle to be deleted, query the set of obstacles that intersect with the obstacle to be deleted from the obstacle list.

[0345] In some embodiments, the obstacle information includes position information and size information. Among them, the position information is the center point coordinates. For example, the obstacle to be deleted is obstacle X, the position information is (2, 2, 2), and the size information is that the side length is equal to 2. There are 3 obstacles B1 to B3 in the obstacle list. The position information of obstacle B1 is (3, 3, 3), and the size information is that the side length is equal to 1; the position information of obstacle B2 is (4, 4, 4), and the size information is that the side length is equal to 3; the position information of obstacle B3 is (2, 2, 2), and the size information is that the side length is equal to 1. The set of obstacles that intersect with obstacle X can be obtained as {B2, B3}.

[0346] Step 620: Perform the above operation 1.2 of deleting obstacles on the obstacle to be deleted and the obstacles in the set of obstacles.

[0347] In some embodiments, perform the operation of deleting obstacles of the above 1.2 on the obstacle to be deleted and the obstacles in the set of obstacles respectively.

[0348] Step 630: Perform the above-mentioned operation of adding obstacles to the obstacles in the obstacle set.

[0349] In some embodiments, perform the operation of adding obstacles to the obstacles in the obstacle set as described in 1.1 above.

[0350] 2. Using a 3D map for pathfinding

[0351] 2.1 Perform pathfinding based on the 3D map data saved in the dynamic sub-tree

[0352] Step 710: Obtain the pathfinding start point and the pathfinding end point;

[0353] In some embodiments, obtain the pathfinding start point and the pathfinding end point uploaded by the client. The pathfinding start point includes its coordinates in 3D space; the pathfinding end point includes its coordinates in 3D space.

[0354] In some embodiments, the pathfinding start point and the pathfinding end point are the start point and the end point that need to be path-planned set by the user.

[0355] In some embodiments, the representation forms of the pathfinding start point and the pathfinding end point are coordinates, such as (x, y, z).

[0356] Step 720: Based on the 3D map data saved in the dynamic sub-tree, plan a pathfinding path, and the pathfinding path is used to indicate the path after avoiding obstacles between the pathfinding start point and the pathfinding end point.

[0357] In some embodiments, plan a pathfinding path based on the 3D map data saved in the sparse octree and the pathfinding algorithm.

[0358] In some embodiments, the pathfinding algorithm includes at least one of the A* algorithm, the Depth First Search (DFS) algorithm, the Breadth First Search (BFS) algorithm, the Jump Point Search (JPS) algorithm, the Greedy Best First Search (GBFS) algorithm, and the Dijkstra algorithm.

[0359] In some embodiments, based on the blocking information stored in the dynamic sparse octree nodes, use the pathfinding algorithm to plan a pathfinding path.

[0360] In some embodiments, the node information of a node in a dynamic sparse octree includes neighbor information, which is used to store the node information of the six neighbor nodes corresponding to the node. These six neighbor nodes are the neighbor nodes in the six directions of up, down, left, right, front, and back of the node, and the levels of these six neighbor nodes are greater than or equal to the level of the node. Based on the stored node information of the neighbor nodes, a pathfinding algorithm is used to plan a pathfinding route.

[0361] 2.2 Obtaining the first neighbor node during pathfinding

[0362] The method for obtaining the first neighbor node during pathfinding is similar to the above steps 361 to 363, and will not be elaborated here.

[0363] The following is a specific illustration using a map corresponding to a two-dimensional space. In a two-dimensional space, the neighbor information of the current node includes the node information of the neighbor nodes in the four directions of up, down, left, and right. As Figure 25 shown, the current node is node 23, and the neighbor information of the current node is {1, 21, 24, 41}. The neighbor nodes corresponding to the neighbor information are placed in the candidate neighbor node list. First, obtain the first neighbor node 1 in the candidate neighbor node list, determine that the first neighbor node has no child nodes, and determine that the first node is the finest-grained neighbor node on the left of the current node 23; then obtain the second node 21, determine that the second neighbor node has no child nodes, and determine that the second node is the finest-grained neighbor node above the current node 23; then obtain the third neighbor node 24, determine that the third neighbor node 23 has child nodes, obtain the two child nodes adjacent to the current node, node 241 and node 243, and place them in the candidate neighbor node list. At this time, the candidate neighbor node list is {1, 21, 24, 41, 241, 243}; then obtain the fourth neighbor node 41, determine that the fourth neighbor node has child nodes, obtain the two child nodes adjacent to the current node, node 411 and node 412, and place them in the candidate neighbor node list. At this time, the candidate neighbor node list is {1, 21, 24, 41, 241, 243, 411, 412}; then obtain the fifth neighbor node 241. Since this neighbor node 241 is a node at the lowest level, this node includes 4*4 pixel data, and the arrangement of the pixels in the pixel data is as Figure 26As shown, four pixels adjacent to the current node 23 are determined, namely pixel 241-0, pixel 241-4, pixel 241-8, and pixel 241-12, which are used as the finest-grained neighbor nodes in this direction. The 6th - 8th neighbors are similar to the 5th neighbor 241. Finally, the finest-grained neighbor nodes of the current node 23 in each direction are: above {21}, below {411-0, 411-1, 411-2, 411-3, 412-0, 412-1, 412-2, 412-3}, left {1}, and right {241-0, 241-4, 241-8, 241-12, 243-0, 243-4, 243-8, 243-12}.

[0364] In some embodiments, when obtaining the finest-grained neighbor nodes, they are not obtained according to a list but in a recursive descent manner. For example, after determining that the 3rd neighbor node has child nodes, the child nodes adjacent to the current node 23, namely node 241 and node 243, are obtained, and it is directly determined whether node 241 and node 243 have child nodes and whether they are at the lowest level, until the finest-grained neighbor nodes on the right side {241-0, 241-4, 241-8, 241-12, 243-0, 243-4, 243-8, 243-12} are obtained, and then the finest-grained neighbor nodes in other directions are obtained.

[0365] 2.3 Obtaining the Second Neighbor Node in Neighbor Information

[0366] Step 810: Based on the position information of the current node, calculate the position information of six candidate neighbor nodes at the same level as the current node.

[0367] Among them, the current node is used to indicate the node that is currently performing pathfinding planning during pathfinding path planning; the position information is used to indicate the coordinates of the node in the spatial coordinate system corresponding to the map.

[0368] In some embodiments, the position information is the coordinates of the space corresponding to the node in a three-dimensional rectangular coordinate system; or, the position information is the coordinates of the space corresponding to the preprocessed node in a three-dimensional rectangular coordinate system.

[0369] Exemplarily, based on the position information of the current node and the side length corresponding to the level where the current node is located, calculate the position information of six candidate neighbor nodes at the same level as the current node. The position information is the coordinates of the space corresponding to the node in the spatial rectangular coordinate system; the position information of the current node is (6, 6, 6), the current node is the node corresponding to level 0, and the side length corresponding to level 0 is 4. It can be calculated that the position information of the candidate neighbor node above the current node is (6, 6, 6 + 4), that is, (6, 6, 10); the position information of the candidate neighbor node below the current node is (6, 6, 6 - 4), that is, (6, 6, 2); the position information of the candidate neighbor node on the left side of the current node is (6, 6 - 4, 6), that is, (6, 2, 6); the position information of the candidate neighbor node on the right side of the current node is (6, 6 + 4, 6), that is, (6, 10, 6); the position information of the candidate neighbor node in front of the current node is (6 + 4, 6, 6), that is, (10, 6, 6); the position information of the candidate neighbor node behind the current node is (6 - 4, 6, 6), that is, (2, 6, 6).

[0370] Exemplarily, based on the position information of the current node and the side length corresponding to the level where the current node is located, calculate the position information of six candidate neighbor nodes at the same level as the current node. The position information is the coordinates of the space corresponding to the preprocessed node in the spatial rectangular coordinate system. The coordinates of the current node are (6, 6, 6), the current node is the node corresponding to level 0, and the side length corresponding to level 0 is 4. It can be calculated that the position information of the current node is (2, 2, 2). It can be calculated that the position information of the candidate neighbor node above the current node is (2, 2, 2 + 1), that is, (2, 2, 3); the position information of the candidate neighbor node below the current node is (2, 2, 2 - 1), that is, (2, 2, 1); the position information of the candidate neighbor node on the left side of the current node is (2, 2 - 1, 2), that is, (2, 1, 2); the position information of the candidate neighbor node on the right side of the current node is (2, 2 + 1, 2), that is, (2, 3, 2); the position information of the candidate neighbor node in front of the current node is (2 + 1, 2, 2), that is, (3, 2, 2); the position information of the candidate neighbor node behind the current node is (2 - 1, 2, 2), that is, (1, 2, 2).

[0371] Step 811: Query whether there is a corresponding node in the dynamic sparse octree based on the position information of the candidate neighbor nodes.

[0372] In some embodiments, query whether there is a corresponding node in the dynamic sparse octree based on the position information of the six candidate neighbor nodes. When the level of the finest-grained neighbor node in a certain direction of the current node is greater than the level of the current node, using the position information of the candidate neighbor node in this direction will not be able to query the corresponding node in the dynamic sparse octree.

[0373] The method for querying whether there is a corresponding node in the dynamic sparse octree is as follows.

[0374] Step 8111: Initialize a processing queue and put the dynamic root node into the processing queue.

[0375] Step 8112: Obtain the i-th node from the processing queue.

[0376] When the position information of the i-th node is consistent with the position information of the candidate neighbor node, the i-th node is the candidate neighbor node, and there is a node corresponding to the position information of the candidate neighbor node in the dynamic sparse octree.

[0377] Step 8113: Determine the first node according to the position information of the i-th node and the position information of the candidate neighbor node, and add the first node to the processing queue. The first node is the child node of the i-th node closest to the candidate neighbor node.

[0378] In some embodiments, the position information of the i-th node is directly obtained from the dynamic sparse octree; or, the position information of the i-th node is calculated.

[0379] Exemplarily, when the i-th node is the dynamic root node, calculate according to the maximum side length corresponding to the dynamic sparse octree to obtain the position information of the dynamic root node. For example, if the maximum side length of the map is 16, the position information of the dynamic root node is (8, 8, 8); or, calculate the position information of the i-th node according to the index information (hierarchical index, node index) of the i-th node and the parent node information of the node. For example, the index information of the i-th node is (1, 6), the parent node information of the i-th node is (2, 1), the hierarchical value of the dynamic sparse octree is 0-2, and the maximum side length corresponding to the dynamic sparse octree is 16; it can be obtained that the parent node of the i-th node is the dynamic root node, and the position information of the parent node is (8, 8, 8), and the sub-node index corresponding to the node is as Figure 27 shown. The coordinates of the position of point 1 are the position information of the parent node. Thus, the position information of the i-th node can be obtained as (8 + 4, 8 - 4, 8 + 4), that is, the position information of the i-th node is (12, 4, 12).

[0380] In some embodiments, according to the position information of the i-th node and the position information of the candidate neighbor node, determine the first node, and the first node is the child node of the i-th node closest to the candidate neighbor node.

[0381] Exemplarily, the i-th node is the dynamic root node in the above example, the position information of the i-th node is (8, 8, 8), and the side length of the layer corresponding to the i-th node is 16; the position information of the candidate neighbor node is (6, 6, 6). Subtracting the position information of the i-th node from the position information of the candidate neighbor node gives (2, 2, 2), where x, y, and z are all positive. It can be determined that the first node is the 0-th child node of the i-th node; in the case where x is positive, y is positive, and z is negative, it is determined that the first node is the 4-th child node of the i-th node; in the case where x is positive, y is negative, and z is negative, it is determined that the first node is the 5-th child node of the i-th node; in the case where x is positive, y is negative, and z is positive, it is determined that the first node is the 1-st child node of the i-th node; in the case where x is negative, y is negative, and z is positive, it is determined that the first node is the 3-rd child node of the i-th node; in the case where x is negative, y is negative, and z is negative, it is determined that the first node is the 7-th child node of the i-th node; in the case where x is negative, y is positive, and z is positive, it is determined that the first node is the 2-nd child node of the i-th node; in the case where x is negative, y is positive, and z is negative, it is determined that the first node is the 6-th child node of the i-th node.

[0382] Step 8114: Determine whether the i-th node is the last node in the processing queue.

[0383] In the case where the i-th node is the last node in the processing queue, end the node search, and there are no candidate neighbor nodes in the dynamic sparse octree; in the case where the i-th node is not the last node in the processing queue, execute step 8115.

[0384] Step 8115: i = i + 1.

[0385] After executing step 8115, execute step 8112.

[0386] In the case where there is a node in the dynamic sparse octree corresponding to the position information of the candidate neighbor node, execute step 812; in the case where there is no node in the dynamic sparse octree corresponding to the position information of the candidate neighbor node, execute step 813.

[0387] Step 812: Save the candidate neighbor node as a neighbor node in the neighbor information.

[0388] In some embodiments, save the position information of the candidate neighbor node in the neighbor information; or, save the node information of the queried candidate neighbor node in the neighbor information.

[0389] Step 813: Determine a new candidate neighbor node based on the position information of the current node or the position information of the candidate neighbor node.

[0390] In some embodiments, in the case where there is no node corresponding to the position information of the candidate neighbor node in the dynamic sparse octree, a new candidate neighbor node is determined based on the position information of the current node or the position information of the candidate neighbor node, and the level of the candidate neighbor node is greater than that of the current node.

[0391] When step 813 is completed and the neighbor information is not full, step 811 is executed.

[0392] In some embodiments, the position information is the coordinates of the space corresponding to the node in the spatial rectangular coordinate system; or, the position information is the coordinates of the space corresponding to the preprocessed node in the spatial rectangular coordinate system. For example, the position information of the node is the quotient of the coordinates of the node divided by the side length of the space corresponding to the node.

[0393] Method 1: Determine a new candidate neighbor node based on the position information of the current node.

[0394] In some embodiments, the position information is the coordinates of the space corresponding to the node in the spatial rectangular coordinate system. Based on the position information of the current node, the corresponding current node in the dynamic sparse octree is queried, and the node information of the current node is obtained. According to the parent node information included in the node information of the current node, the parent node corresponding to the current node is queried. Based on the position information of the parent node, in the same manner as step 812, the position information of the neighbor node of the parent node in the original candidate neighbor direction is calculated, and the calculated neighbor node is recorded as the candidate neighbor node.

[0395] In some embodiments, based on the position information of the current node, the position information of the parent node of the current node is calculated. Based on the position information of the parent node of the current node, a new candidate neighbor node is determined.

[0396] Method 2: Determine a new candidate neighbor node based on the position information of the candidate neighbor node.

[0397] In some embodiments, the position information is the coordinates of the space corresponding to the preprocessed node in the spatial rectangular coordinate system. For example, the position information of the node is the quotient of the coordinates of the node divided by the side length of the space corresponding to the node. Based on the position information of the candidate neighbor node, the position information of the new candidate neighbor node is determined. Exemplarily, if the position information of the candidate neighbor node is (x, y, z), then the position information of the new candidate neighbor node is (x|2, y|2, z|2), where "|" represents the division symbol. In the case where the position information is the coordinates of the space corresponding to the preprocessed node in the spatial rectangular coordinate system, nodes with different side lengths can be regarded as being in different coordinate systems. The following is an example in a two-dimensional space. As Figure 29 shown, the side length of the root node is 16, so the position information of the root node is (8|16, 8|16), that is, (0, 0). AsFigure 29 As shown in part (1), the position information of the root node's child node A is (0, 0), the position information of the root node's child node B is (1, 0), the position information of the root node's child node C is (0, 1), and the position information of the root node's child node D is (1, 1). When finding the coordinates of the root node through its child nodes, it is sufficient to divide the coordinates of its child nodes by 2. The child node position information of node ABCD is as follows: Figure 29 As shown in part (2) of the figure, when determining a new candidate neighbor node, it is only necessary to know the location information of the candidate neighbor node.

[0398] 2.4 Maintenance of Neighbor Information

[0399] (1) When executing the above step 1.1 of adding obstacles, a new child node will be added to a node. When the child node is newly added, the neighbor information is determined using the above method for determining neighbor information in 2.3.

[0400] (2) When executing the above 1.1 step of adding obstacles, the node's neighbor nodes will also add new neighbor nodes. At this time, it may be necessary to update the node's neighbor information. For example, if node A Figure 28 As shown in part (1), the left neighbor of node 23 is node 1. When adding obstacles, a child node is added to node 1, such as Figure 28 As shown in part (2), at this time, the neighbor information of node 23 should store node 14, but the neighbor information of node 23 actually stores node 1. Therefore, the neighbor information of node 23 needs to be maintained.

[0401] The maintenance of neighbor information is performed in the process of obtaining the first neighbor node during path finding in 2.2 above. The method for maintaining neighbor information is as follows.

[0402] Step 814: Obtain neighbor nodes of the current node from the neighbor information.

[0403] In some embodiments, the neighbor information includes neighbor nodes of the current node in six directions.

[0404] Step 815: When the level of the neighbor node is greater than that of the current node and the neighbor node has child nodes, obtain the child nodes of the neighbor node adjacent to the current node and set them as the child nodes of the current node in the first direction, where the first direction is the direction corresponding to the neighbor node.

[0405] When the level of the neighbor node is greater than that of the current node and the neighbor node has child nodes, that is, when the neighbor node needs to be updated, continue to search for child nodes adjacent to the current node and repeat recursively.

[0406] When step 815 is completed and not all the neighbor nodes of the current node in six directions have been updated, step 814 is executed.

[0407] Step 816: When the level of the neighbor node is greater than that of the current node and the neighbor node has no child nodes, use the node information of the neighbor node to update the neighbor information of the current node.

[0408] When step 816 is completed and not all the neighbor nodes of the current node in six directions have been updated, step 814 is executed.

[0409] Step 817: When the level of the neighbor node is equal to that of the current node, use the node information of the neighbor node to update the neighbor information of the current node.

[0410] When step 817 is completed and not all the neighbor nodes of the current node in six directions have been updated, step 814 is executed.

[0411] When all the neighbor nodes of the current node in six directions have been updated, the maintenance of neighbor information ends.

[0412] Please refer to Figure 30 , which shows a structural block diagram of an update device for three-dimensional map data provided by an exemplary embodiment of the present application. This device has the function of implementing the example of the above-mentioned method for updating three-dimensional map data. The function can be implemented by hardware or by hardware executing corresponding software. This device can be the server introduced above or can be set in the server. As Figure 30 shown, this device may include: a first acquisition module 910, a second acquisition module 920, and an update module 930.

[0413] The first acquisition module 910 is used to acquire a sparse octree for storing the three-dimensional map data, and the three-dimensional map data is used to indicate the connectivity information of the three-dimensional space;

[0414] The second acquisition module 920 is used to acquire the obstacle information to be updated in response to receiving an obstacle update request from the client, and the obstacle information is used to indicate the obstacles in the three-dimensional space that block the virtual character from advancing;

[0415] The update module 930 is used to update the three-dimensional map data stored based on the sparse octree based on the obstacle information.

[0416] In some embodiments, the three-dimensional map data is stored in the nodes of the sparse octree; the sparse octree has n levels, where n is a positive integer; the levels are the levels between the root node in the sparse octree and the leaf nodes at the bottommost layer of the sparse octree, the level of the root node is the largest, and the level of the leaf nodes is the smallest; the nodes at the same level in the sparse octree are stored in the same array. The update module 930 includes: a first acquisition sub-module, an addition sub-module or a modification sub-module, and an execution sub-module.

[0417] The first acquisition sub-module is configured to acquire a target node at the i-th layer in the sparse octree, where the target node is a node whose corresponding space intersects with the obstacle, i is an integer not less than 0, and the starting value of i is n or n - 1;

[0418] The addition sub-module is configured to, based on the obstacle information, add child nodes to the target node at the i-th layer, and save the child nodes to the first position in the array corresponding to the (i - 1)-th layer, where the first position is an idle space in the array;

[0419] The modification sub-module is configured to, based on the obstacle information, modify the blocking information of the target node at the i-th layer, where the blocking information is used to indicate the blocking state of the node;

[0420] The execution sub-module is configured to, when the traversal of the target node at the i-th layer is completed and the i-th layer is not the bottommost layer, set i equal to i - 1, and re-execute the acquisition of the target node at the i-th layer in the sparse octree.

[0421] In some embodiments, the storage order of the nodes in the array corresponding to the (i - 1)-th layer is not related to the storage order of the nodes in the array corresponding to the i-th layer; the first position is the tail idle position of the array corresponding to the (i - 1)-th layer; or, the first position is the middle idle position of the array corresponding to the (i - 1)-th layer, and the middle idle position is caused by deleting the nodes at the (i - 1)-th layer.

[0422] In some embodiments, the apparatus further includes a third acquisition module and a fourth acquisition module. The first acquisition sub-module includes a first query unit.

[0423] The third acquisition module is configured to acquire a node list to be updated, where the node list at least includes the index information of the target node at the i-th layer, and the target node at the i-th layer is the root node in the initial case, and the index information includes a level index and a node index, the level index is used to indicate the level where the node is located, and the node index is used to indicate the position of the node in the array at the i-th layer;

[0424] A fourth acquisition module, configured to acquire index information of the target node in the node list;

[0425] A first query unit, configured to query the target node in the i-th layer of the sparse octree based on the index information of the target node.

[0426] In some embodiments, the apparatus further includes an addition module.

[0427] The addition module is configured to, when adding the child node to the target node in the i-th layer, use the child node that meets the target condition as the target node in the (i - 1)-th layer and add it to the node list, where the target condition is that the space corresponding to the node intersects with the obstacle.

[0428] In some embodiments, the addition sub-module includes an addition unit.

[0429] The addition unit is configured to add the child node to the target node when it is determined based on the obstacle information that the target node meets the first condition;

[0430] wherein, the first condition includes that the side length of the space cube corresponding to the target node is not the side length of the minimum space cube, the target node has no child nodes, and a part of the space corresponding to the target node is not located inside the obstacle.

[0431] In some embodiments, the modification sub-module includes at least one of a first modification unit and a second modification unit.

[0432] The first modification unit is configured to modify the blocking information of the target node when it is determined based on the obstacle information that the target node meets the second condition;

[0433] The second modification unit is configured to modify the blocking information and voxel data of the target node when it is determined based on the obstacle information that the target node meets the third condition, where the voxel data is used to indicate the blocking state of at least one voxel stored in the space corresponding to the target node;

[0434] wherein, the second condition includes that the target node has no child nodes and the space corresponding to the target node is entirely located inside the obstacle; the third condition includes that the side length of the space cube corresponding to the target node is the side length of the minimum space cube and a part of the space corresponding to the target node is located inside the obstacle.

[0435] In some embodiments, the blocking information includes full blocking and no blocking; the full blocking is used to indicate that when the node intersects with the obstacle, it will block the virtual character from moving forward; the no blocking is used to indicate that when the node does not intersect with the obstacle, it will not block the virtual character from moving forward; the modification sub-module further includes a third modification unit and a fourth modification unit.

[0436] The third modification unit is configured to, when the type of the obstacle is an obstacle to be added, based on the obstacle information, modify the blocking information of the target node to full blocking;

[0437] The fourth modification unit is configured to, when the type of the obstacle is an obstacle to be deleted, based on the obstacle information, modify the blocking information of the target node to no blocking.

[0438] In some embodiments, the sparse octree includes a static root node and a dynamic root node. The static subtree corresponding to the static root node is used to store the three-dimensional map data of the static map, and the dynamic subtree corresponding to the dynamic root node is used to store the three-dimensional map data of the dynamic map. The dynamic map is used to indicate a map updated based on user interaction. The static subtree and the dynamic subtree share at least one node; the update module 930 further includes a first update sub-module.

[0439] The first update sub-module is configured to, based on the obstacle information, update the three-dimensional map data stored in the dynamic subtree.

[0440] In some embodiments, the addition sub-module further includes a new addition unit and a copy unit.

[0441] The new addition unit is configured to, when it is determined based on the obstacle information that the target node meets the first condition, add the sub-node for the target node in the dynamic subtree;

[0442] The copy unit is configured to, when it is determined based on the obstacle information that the target node meets the fourth condition, copy the sub-node of the target node in the static subtree to the dynamic subtree;

[0443] Wherein, the first condition includes that the side length of the spatial cube corresponding to the target node is not the side length of the smallest spatial cube, the target node has no sub-node, and a part of the space corresponding to the target node is not located inside the obstacle; the fourth condition includes that the target node has a sub-node, and the sub-node of the target node is located in the static subtree, and a part of the space corresponding to the target node is not located inside the obstacle.

[0444] In some embodiments, the device further includes a fifth acquisition module and a planning module.

[0445] The fifth acquisition module is configured to acquire a pathfinding start point and a pathfinding end point.

[0446] The planning module is configured to plan a pathfinding path based on the three-dimensional map data stored in the sparse octree, and the pathfinding path is used to indicate a path after avoiding obstacles between the pathfinding start point and the pathfinding end point.

[0447] In some embodiments, the planning module includes a second acquisition sub-module, a determination sub-module, and a first planning sub-module.

[0448] The second acquisition sub-module is configured to acquire at least six first neighbor nodes adjacent to the current node in six directions of up, down, left, right, front, and back. The current node is used to indicate a node that is currently performing pathfinding planning during the pathfinding path planning. The first neighbor nodes include the blocking information, and the first neighbor nodes are used to indicate nodes without child nodes. The current node is initially the node corresponding to the pathfinding start point in the sparse octree.

[0449] The determination sub-module is configured to determine the first neighbor node as a candidate node when the blocking information of the first neighbor node is unblocked, and the candidate node is a node for pathfinding planning.

[0450] The first planning sub-module is configured to plan a pathfinding path between the current node and the candidate node.

[0451] In some embodiments, the second acquisition sub-module includes a first acquisition unit and a second acquisition unit.

[0452] The first acquisition unit is configured to acquire neighbor information of the current node, and the neighbor information includes six second neighbor nodes of the current node, and the six second neighbor nodes are second neighbor nodes in six directions of up, down, left, right, front, and back of the current node, and the level of the second neighbor node is greater than or equal to the level of the current node.

[0453] The second acquisition unit is configured to acquire the at least six first neighbor nodes adjacent to the current node in the six directions based on the neighbor information.

[0454] In some embodiments, the second neighbor node includes the index information, and the index information includes a level index and a node index. The level index is used to indicate the level where the node is located, and the node index is used to indicate the position of the node in the array corresponding to the level. The second acquisition unit includes a first setting unit, a third acquisition unit, and a second setting unit.

[0455] The first setting unit is configured to set the six second neighbor nodes of the current node as candidate neighbor nodes based on the neighbor information.

[0456] A third acquisition unit, configured to, when the candidate neighbor node has child nodes, acquire index information of four child nodes adjacent to the current node of the candidate neighbor node, and set the four child nodes as candidate neighbor nodes;

[0457] A second setting unit, configured to, when the candidate neighbor node has no child nodes, set the candidate neighbor node as the first neighbor node.

[0458] In some embodiments, the sparse octree includes a static root node and a dynamic root node. The static subtree corresponding to the static root node is used to store three-dimensional map data of a static map, and the dynamic subtree corresponding to the dynamic root node is used to store three-dimensional map data of a dynamic map. The dynamic map is used to indicate a map updated based on user interaction. The static subtree and the dynamic subtree share at least one node; the planning module includes a second planning sub-module.

[0459] The second planning sub-module is configured to plan the pathfinding path based on the three-dimensional map data stored in the dynamic subtree.

[0460] It should be noted that: when the device provided in the above embodiment implements its functions, only the above-mentioned division of each functional module is used for illustration. In practical applications, the above functions can be allocated to different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to complete all or part of the functions described above. In addition, the device provided in the above embodiment and the method embodiment belong to the same concept, and the specific implementation process is detailed in the method embodiment, which will not be repeated here.

[0461] Figure 31 The block diagram of a computer device provided by an exemplary embodiment of the present application is shown.

[0462] The computer device 1000 includes a central processing unit (CPU) 1001, a system memory 1004 including a random access memory (RAM) 1002 and a read-only memory (ROM) 1003, and a system bus 1005 connecting the system memory 1004 and the central processing unit 1001. The computer device 1000 also includes a basic input / output system (Input / Output system, I / O system) 1006 for facilitating information transmission between various devices within the computer device, and a mass storage device 1007 for storing an operating system 1013, application programs 1014, and other program modules 1015.

[0463] The basic input / output system 1006 includes a display 1008 for displaying information and input devices 1009 such as a mouse, keyboard, etc. for user input of information. Both the display 1008 and the input devices 1009 are connected to the central processing unit 1001 through an input / output controller 1010 connected to the system bus 1005. The basic input / output system 1006 may also include an input / output controller 1010 for receiving and processing inputs from multiple other devices such as a keyboard, mouse, or electronic stylus. Similarly, the input / output controller 1010 also provides output to a display screen, printer, or other types of output devices.

[0464] The mass storage device 1007 is connected to the central processing unit 1001 through a mass storage controller (not shown) connected to the system bus 1005. The mass storage device 1007 and its associated computer-readable storage medium provide non-volatile storage for the computer device 1000. That is, the mass storage device 1007 may include computer-readable storage media (not shown) such as a hard disk or a compact disc read-only memory (CD-ROM) drive.

[0465] Without loss of generality, the computer-readable storage medium may include computer storage media and communication media. Computer storage media includes volatile and non-volatile, removable and non-removable media implemented by any method or technology for storing information such as computer-readable storage instructions, data structures, program modules, or other data. Computer storage media includes RAM, ROM, erasable programmable read-only registers (EPROM), electrically-erasable programmable read-only memory (EEPROM), flash memory or other solid-state storage technologies, CD-ROM, digital versatile disc (DVD) or other optical storage, magnetic tape cartridges, tapes, disk storage or other magnetic storage devices. Of course, those skilled in the art know that the computer storage media is not limited to the above several types. The above system memory 1004 and mass storage device 1007 may be collectively referred to as memory.

[0466] The memory stores one or more programs, which are configured to be executed by one or more central processing units 1001. The one or more programs include instructions for implementing the method embodiments described above. The central processing unit 1001 executes the one or more programs to implement the methods provided in the various method embodiments described above.

[0467] According to various embodiments of the present application, the computer device 1000 may also run by connecting to a remote computer device on the network through a network such as the Internet. That is, the computer device 1000 may be connected to the network 1012 through the network interface unit 1011 connected to the system bus 1005. Or rather, the network interface unit 1011 may also be used to connect to other types of networks or remote computer device systems (not shown).

[0468] The memory further includes one or more programs, which are stored in the memory. The one or more programs include steps for performing the method executed by the terminal device in the embodiments of the present application.

[0469] In an exemplary embodiment, a non-transitory computer-readable storage medium is further provided, on which a computer program is stored. When the computer program is executed by a processor, it is used to implement the method for updating the three-dimensional map data described above.

[0470] In an exemplary embodiment, a computer program product is further provided. When the computer program product is executed by a processor, it is used to implement the method for updating the three-dimensional map data described above.

[0471] It should be understood that the term "plurality" mentioned herein refers to two or more. "And / or" describes the association relationship of associated objects and indicates that there can be three relationships. For example, A and / or B may represent: A exists alone, A and B exist simultaneously, and B exists alone. The character " / " generally represents an "or" relationship between the associated objects before and after. In addition, the step numbers described herein only exemplarily show a possible execution sequence between steps. In some other embodiments, the above steps may not be executed in the order of the numbers. For example, two steps with different numbers may be executed simultaneously, or two steps with different numbers may be executed in the reverse order of the illustration. The embodiments of the present application do not limit this.

[0472] The above are only optional embodiments of the present application and are not intended to limit the present application. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present application shall be included in the protection scope of the present application.

Claims

1. A method for updating three-dimensional map data, characterized in that, The method is executed by a server, and the method includes: Obtaining a sparse octree for storing the three-dimensional map data, where the three-dimensional map data is used to indicate the connectivity information of a three-dimensional space; In response to receiving an obstacle update request from a client, obtaining the obstacle information to be updated, where the obstacle information is used to indicate obstacles in the three-dimensional space that block the progress of a virtual character; Updating the three-dimensional map data stored based on the sparse octree based on the obstacle information.

2. The method according to claim 1, wherein The three-dimensional map data is stored in the nodes of the sparse octree; the sparse octree has n levels, and n is a positive integer; The levels are the levels between the root node in the sparse octree and the leaf nodes at the bottommost layer of the sparse octree. The level of the root node is the largest, and the level of the leaf nodes is the smallest; the nodes at the same level in the sparse octree are stored in the same array; The updating the three-dimensional map data stored based on the sparse octree based on the obstacle information includes: Obtaining a target node at the i-th layer in the sparse octree, where the target node is a node whose corresponding space intersects with the obstacle, i is an integer not less than 0, and the starting value of i is n or n - 1; Based on the obstacle information, adding child nodes to the target node at the i-th layer and saving the child nodes to the first position in the corresponding array at the (i - 1)-th layer, where the first position is a free space in the array; or, based on the obstacle information, modifying the blocking information of the target node at the i-th layer, where the blocking information is used to indicate the blocking state of the node; When the traversal of the target nodes at the i-th layer is completed and the i-th layer is not the bottommost layer, setting i equal to i - 1 and re-executing the step of obtaining the target nodes at the i-th layer in the sparse octree.

3. The method according to claim 2, characterized in that, The storage order of the nodes in the array corresponding to the (i - 1)-th layer is not related to the storage order of the nodes in the array corresponding to the i-th layer; The first position is the tail free position of the array corresponding to the (i - 1)-th layer; or, The first position is the middle free position of the array corresponding to the (i - 1)-th layer, and the middle free position is caused by deleting a node at the (i - 1)-th layer.

4. The method according to claim 2, characterized in that The method further includes: Obtaining a node list to be updated, where the node list at least includes the index information of the target nodes at the i-th layer. The target nodes at the i-th layer are initially the root node. The index information includes a level index and a node index. The level index is used to indicate the level where the node is located, and the node index is used to indicate the position of the node in the array at the i-th layer; Obtaining the index information of the target nodes in the node list; The obtaining the target nodes at the i-th layer in the sparse octree includes: Querying the target nodes at the i-th layer in the sparse octree based on the index information of the target nodes.

5. The method according to claim 4, wherein The method further includes: In the case of adding the child node to the target node of the i-th layer, the child nodes that meet the target condition in the child nodes are used as the target nodes of the (i - 1)-th layer and added to the node list, where the target condition is that the space corresponding to the node intersects with the obstacle.

6. The method according to claim 2, characterized in that, The adding of child nodes to the target node of the i-th layer in the sparse octree based on the obstacle information includes: Adding the child nodes to the target node when it is determined based on the obstacle information that the target node meets the first condition; where the first condition includes that the side length of the space cube corresponding to the target node is not the side length of the smallest space cube, the target node has no child nodes, and a part of the space corresponding to the target node is not located inside the obstacle.

7. The method according to claim 2, characterized in that, The modifying of the blocking information of the target node of the i-th layer in the sparse octree based on the obstacle information includes at least one of the following: Modifying the blocking information of the target node when it is determined based on the obstacle information that the target node meets the second condition; Modifying the blocking information and the voxel data of the target node when it is determined based on the obstacle information that the target node meets the third condition, where the voxel data is used to indicate the blocking state of at least one voxel saved in the space corresponding to the target node; where the second condition includes that the target node has no child nodes and the space corresponding to the target node is entirely located inside the obstacle; the third condition includes that the side length of the space cube corresponding to the target node is the side length of the smallest space cube and a part of the space corresponding to the target node is located inside the obstacle.

8. The method according to any one of claims 2 to 7, characterized in that, The blocking information includes full blocking and no blocking; the full blocking is used to indicate that the node intersects with the obstacle and will block the virtual character from advancing; the no blocking is used to indicate that the node does not intersect with the obstacle and will not block the virtual character from advancing; The modifying of the blocking information of the target node of the i-th layer based on the obstacle information includes: When the obstacle type is the obstacle to be added, modifying the blocking information of the target node to full blocking based on the obstacle information; When the obstacle type is the obstacle to be deleted, modifying the blocking information of the target node to no blocking based on the obstacle information.

9. The method according to any one of claims 1 to 7, characterized in that, The sparse octree includes a static root node and a dynamic root node. The static subtree corresponding to the static root node is used to save the three-dimensional map data of the static map, and the dynamic subtree corresponding to the dynamic root node is used to save the three-dimensional map data of the dynamic map. The dynamic map is used to indicate the map updated based on the user's interaction. The static subtree and the dynamic subtree share at least one node; The updating of the three-dimensional map data saved based on the sparse octree based on the obstacle information includes: Updating the three-dimensional map data saved in the dynamic subtree based on the obstacle information.

10. The method according to claim 9, wherein The adding of child nodes to the target node of the i-th layer based on the obstacle information includes: When it is determined based on the obstacle information that the target node meets the first condition, a child node is added to the target node in the dynamic subtree; When it is determined based on the obstacle information that the target node meets the fourth condition, the child nodes of the target node in the static subtree are copied to the dynamic subtree; Wherein, the first condition includes that the side length of the space cube corresponding to the target node is not the side length of the smallest space cube, the target node has no child nodes, and a part of the space corresponding to the target node is not located inside the obstacle; the fourth condition includes that the target node has child nodes, and the child nodes of the target node are located in the static subtree, and a part of the space corresponding to the target node is not located inside the obstacle.

11. According to the method described in any one of claims 1 to 8, characterized in that, The method further includes: Obtaining a pathfinding start point and a pathfinding end point; Based on the three-dimensional map data stored in the sparse octree, planning a pathfinding path, where the pathfinding path is used to indicate the path after avoiding obstacles between the pathfinding start point and the pathfinding end point.

12. The method according to claim 11, wherein The planning of the pathfinding path based on the three-dimensional map data stored in the sparse octree includes: Obtaining at least six first neighbor nodes adjacent to the current node in six directions of up, down, left, right, front, and back, where the current node is used to indicate the node that is currently performing pathfinding planning during the pathfinding path planning, the first neighbor nodes include the blocking information, the first neighbor nodes are used to indicate nodes without child nodes, and the current node is initially the node corresponding to the pathfinding start point in the sparse octree; When the blocking information of the first neighbor node is unblocked, determining the first neighbor node as a candidate node, and the candidate node is the node for pathfinding planning; Planning a pathfinding path between the current node and the candidate node.

13. The method according to claim 12, characterized in that, The obtaining of at least six first neighbor nodes adjacent to the current node in six directions of up, down, left, right, front, and back includes: Obtaining neighbor information of the current node, where the neighbor information includes six second neighbor nodes of the current node, the six second neighbor nodes are the second neighbor nodes in six directions of up, down, left, right, front, and back of the current node, and the level of the second neighbor node is greater than or equal to the level of the current node; Based on the neighbor information, obtaining the at least six first neighbor nodes adjacent to the current node in the six directions.

14. The method according to claim 13, characterized in that, The second neighbor node includes index information, where the index information includes a level index and a node index, the level index is used to indicate the level where the node is located, and the node index is used to indicate the position of the node in the array corresponding to the level; The obtaining of the at least six first neighbor nodes adjacent to the current node in the six directions based on the neighbor information includes: Based on the neighbor information, setting the six second neighbor nodes of the current node as candidate neighbor nodes; When the candidate neighbor node has child nodes, obtaining index information of four child nodes adjacent to the candidate neighbor node and the current node, and setting the four child nodes as candidate neighbor nodes; In the case where the candidate neighbor node has no child nodes, set the candidate neighbor node as the first neighbor node.

15. The method according to any one of claims 11 to 14, characterized in that, The sparse octree includes a static root node and a dynamic root node. The static subtree corresponding to the static root node is used to store the three-dimensional map data of the static map, and the dynamic subtree corresponding to the dynamic root node is used to store the three-dimensional map data of the dynamic map. The dynamic map is used to indicate a map updated based on user interaction. The static subtree and the dynamic subtree share at least one node. Planning a pathfinding path based on the three-dimensional map data stored in the sparse octree includes: Planning the pathfinding path based on the three-dimensional map data stored in the dynamic subtree.

16. An updating device for three-dimensional map data, characterized in that The device includes: A first acquisition module, configured to acquire a sparse octree for storing the three-dimensional map data, where the three-dimensional map data is used to indicate the connectivity information of the three-dimensional space. A second acquisition module, configured to acquire the obstacle information to be updated in response to receiving an obstacle update request from the client, where the obstacle information is used to indicate obstacles in the three-dimensional space that block the virtual character from advancing. An update module, configured to update the three-dimensional map data stored based on the sparse octree based on the obstacle information.

17. A computer device, characterized in that, The computer device includes a processor and a memory, and at least one segment of program is stored in the memory. The processor is configured to execute the at least one segment of program in the memory to implement the method for updating the three-dimensional map data as described in any one of claims 1 to 15 above.

18. A computer-readable storage medium, characterized in that, An executable instruction is stored in the computer-readable storage medium, and the executable instruction is loaded and executed by the processor to implement the method for updating the three-dimensional map data as described in any one of claims 1 to 15 above.

19. A computer program product, characterized in that, The computer program product includes computer instructions, the computer instructions are stored in the computer-readable storage medium, and the processor reads and executes the computer instructions from the computer-readable storage medium to implement the method for updating the three-dimensional map data as described in any one of claims 1 to 15 above.