Method, device and electronic device for reconstructing pathfinding graph

By establishing a mirror scene in the game scene and only rebuilding the pathfinding blocks corresponding to the updated scene objects, the problem of large memory usage and poor roadfinding in the existing technology is solved, and more efficient memory usage and better roadfinding effects are achieved.

CN115501607BActive Publication Date: 2025-03-04SHANGHAI NETEASE CUICAN NETWORK TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211015177.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-08-23
Publication Date
2025-03-04
Estimated Expiration
2042-08-23

AI Technical Summary

Technical Problem

When the existing technology updates the game scene objects dynamically, it is necessary to cache voxelized information of the entire target scene, resulting in large memory usage, poor road finding results after reconstruction, and increased the work costs of designers.

Method used

By establishing a mirror scene for the target scene, only rebuild the wayfinding blocks corresponding to the scene objects that are updated, avoid cached information of the entire target scene, reduce memory usage, and improve the effect of the roadfinding map.

Benefits of technology

This method reduces the computing volume and memory usage of the server, improves reconstruction efficiency and road map results, and reduces work costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115501607B_ABST
    Figure CN115501607B_ABST
Patent Text Reader

Abstract

The present invention provides a method, device and electronic device for reconstructing a pathfinding map, which obtains scene information of a target scene and establishes a mirror scene of the target scene based on the scene information; the scene information includes scene object information and an initial pathfinding map; if a first scene object in the target scene is updated, at least part of the pathfinding blocks in the initial pathfinding map are reconstructed in the mirror scene based on the updated first scene object, and in the target scene, at least part of the pathfinding blocks in the initial pathfinding map are replaced with the reconstructed pathfinding blocks to obtain a reconstructed pathfinding map. In this method, according to the scene information of the target scene, the pathfinding blocks corresponding to the updated scene objects in the mirror scene are reconstructed, and the pathfinding blocks in the target scene are replaced with the reconstructed pathfinding blocks in the mirror scene, thereby avoiding caching the relevant information of the entire target scene, reducing the computational workload and memory usage of the server, improving the reconstruction efficiency and the effect of the pathfinding map, and reducing the working cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of game technology, and in particular to a method, device and electronic equipment for reconstructing a pathfinding graph. Background Art

[0002] In some games, the behavior of NPCs (Non-Player Characters) is driven by the pathfinding system in the server. Usually, the server pre-generates the pathfinding map for NPCs in the game scene, and controls the NPCs to move in the target scene according to the pre-generated pathfinding map when the target scene is running. However, if the scene objects in the running target scene are updated, the pathfinding map needs to be dynamically updated according to the updated scene objects.

[0003] In the related art, the voxelized information of the pathfinding map of the target scene is usually cached in advance in an offline state, and the voxelized information is loaded when the target scene is run on the server, so that when the scene objects in the target scene are updated, the cached voxelized information is directly used to reconstruct the pathfinding map. However, in this method, the voxelized information of the entire target scene needs to be cached, which occupies a large amount of memory; in addition, since the updated scene objects may be irregular in shape and the pre-set parameters are regular graphics, it is necessary to use regular graphics to cover the entire pathfinding map area covered by the scene objects, resulting in poor effect of the reconstructed pathfinding map and high work costs for designers. Summary of the invention

[0004] In view of this, the purpose of the present invention is to provide a method, device and electronic device for reconstructing a pathfinding map. By mirroring the scene and scene information, only the pathfinding blocks corresponding to the updated scene are reconstructed, avoiding caching the voxelized information of the entire target scene, reducing memory usage, and at the same time improving the effect of the pathfinding map and reducing work costs.

[0005] In a first aspect, an embodiment of the present invention provides a method for reconstructing a pathfinding graph, the method comprising: obtaining scene information of a target scene, and establishing a mirror scene of the target scene based on the scene information; wherein the scene information of the mirror scene is the same as the scene information of the target scene; the scene information comprises scene object information and an initial pathfinding graph for a specified character; the initial pathfinding graph comprises a plurality of pathfinding blocks; if a first scene object in the target scene is updated, synchronizing the updated first scene object to the mirror scene, and in the mirror scene, reconstructing at least part of the pathfinding blocks in the initial pathfinding graph based on the updated first scene object to obtain the target pathfinding blocks; in the target scene, replacing at least part of the pathfinding blocks in the initial pathfinding graph with the target pathfinding blocks to obtain a reconstructed pathfinding graph.

[0006] Furthermore, the step of reconstructing at least part of the pathfinding blocks of the initial pathfinding map based on the updated first scene object to obtain the target pathfinding block includes: obtaining first scene object information of the updated first scene object; wherein the first scene object information includes: position information of the first scene object in the target scene, and shape information of the first scene object; determining the first pathfinding block occupied by the first scene object from the initial pathfinding map according to the position information and the shape information; and reconstructing the first pathfinding block based on the first scene object information to obtain the target pathfinding block.

[0007] Furthermore, the first object information also includes: posture information and attribute information of the first scene object; based on the first scene object information, reconstructing the first pathfinding block to obtain the target pathfinding block includes: determining the voxelization result of the first pathfinding block according to the shape information, posture information, attribute information, and the second scene object in the first pathfinding block; wherein the voxelization result includes: multiple sub-blocks divided by the first pathfinding block; the second scene object is the scene object in the first pathfinding block other than the first scene object; and constructing the target pathfinding block according to the voxelization result of the first pathfinding block.

[0008] Furthermore, the step of determining the voxelization result of the first pathfinding block based on the shape information, posture information, attribute information, and the second scene object in the first pathfinding block includes: dividing the first pathfinding block into multiple sub-blocks; configuring corresponding configuration information for each sub-block based on the shape information, posture information, attribute information and the second scene object information of the second scene object to obtain the voxelization result of the first pathfinding block; wherein the configuration information at least includes the pathfinding label corresponding to the attribute information.

[0009] Furthermore, according to the voxelization result of the first pathfinding block, the step of constructing a target pathfinding block includes: constructing a solid height field of multiple sub-blocks according to the configuration information in the voxelization result of the first pathfinding block; dividing the multiple sub-blocks after constructing the solid height field into regions to generate multiple pathfinding regions; wherein the multiple pathfinding regions include a first pathfinding region corresponding to the updated first scene object, and a second pathfinding region corresponding to the second scene object; generating an area outline of each pathfinding region to obtain the target pathfinding block.

[0010] Furthermore, after the step of determining the voxelization result of the first pathfinding block based on the shape information, posture information, attribute information, and the second scene object in the first pathfinding block, the method further includes: caching the voxelization result to a preset first storage space.

[0011] Furthermore, before the step of determining the voxelization result of the first pathfinding block based on the shape information, posture information, attribute information, and the second scene object in the first pathfinding block, the above method also includes: judging whether the voxelization result of the first pathfinding block is cached in a preset first storage space; if not, executing the step of determining the voxelization result of the first pathfinding block based on the shape information, posture information, attribute information, and the second scene object in the first pathfinding block; if yes, obtaining the voxelization result of the first pathfinding block from the preset first storage space.

[0012] Furthermore, after the step of updating the first scene object in the target scene, the above method also includes: determining whether the first pathfinding block occupied by the first scene object in the initial pathfinding graph is participating in reconstruction; if the first pathfinding block is participating in reconstruction, caching the update request of the first scene object to a preset second storage space.

[0013] Furthermore, in the target scene, at least part of the pathfinding blocks in the initial pathfinding map are replaced with the target pathfinding blocks to obtain a reconstructed pathfinding map, including: obtaining the target pathfinding blocks from the mirror scene; in the target scene, at least part of the pathfinding blocks in the initial pathfinding map are replaced with the target pathfinding blocks to obtain a reconstructed pathfinding map.

[0014] Furthermore, the above method also includes: at preset time intervals, determining from a preset second storage space whether there is a cached update request; if so, executing the step of reconstructing the pathfinding blocks affected by the first scene object in the initial pathfinding graph based on the first scene object information of the updated first scene object if the first scene object in the target game scene is updated to obtain the target pathfinding blocks.

[0015] In a second aspect, an embodiment of the present invention provides a device for reconstructing a pathfinding map, the device comprising: a mirror scene establishment module, used to obtain scene information of a target scene, and establish a mirror scene of the target scene based on the scene information; wherein the scene information of the mirror scene is the same as the scene information of the target scene; the scene information comprises scene object information and an initial pathfinding map of a specified character; the initial pathfinding map comprises multiple pathfinding blocks; a pathfinding block reconstruction module, used to synchronize the updated first scene object to the mirror scene if the first scene object in the target scene is updated, and in the mirror scene, reconstruct at least part of the pathfinding blocks in the initial pathfinding map based on the updated first scene object to obtain the target pathfinding blocks; a pathfinding block replacement module, used to replace at least part of the pathfinding blocks in the initial pathfinding map with the target pathfinding blocks in the target scene to obtain a reconstructed pathfinding map.

[0016] In a third aspect, an embodiment of the present invention provides an electronic device, comprising a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the method for reconstructing a pathfinding graph of any one of the first aspects.

[0017] In a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method for reconstructing a pathfinding graph of any one of the first aspects.

[0018] The embodiments of the present invention bring the following beneficial effects:

[0019] The present invention provides a method, device and electronic device for reconstructing a pathfinding map, which obtains scene information of a target scene and establishes a mirror scene of the target scene based on the scene information; the scene information includes scene object information and an initial pathfinding map; if a first scene object in the target scene is updated, at least part of the pathfinding blocks in the initial pathfinding map are reconstructed in the mirror scene based on the updated first scene object, and in the target scene, at least part of the pathfinding blocks in the initial pathfinding map are replaced with the reconstructed pathfinding blocks to obtain a reconstructed pathfinding map. In this method, according to the scene information of the target scene, the pathfinding blocks corresponding to the updated scene objects in the mirror scene are reconstructed, and the pathfinding blocks in the target scene are replaced with the reconstructed pathfinding blocks in the mirror scene, thereby avoiding caching the relevant information of the entire target scene, reducing the computational workload and memory usage of the server, improving the reconstruction efficiency and the effect of the pathfinding map, and reducing the working cost.

[0020] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.

[0021] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0022] In order to more clearly illustrate the specific implementation methods of the present invention or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.

[0023] Figure 1A schematic diagram of a dynamic pathfinding solution provided by an embodiment of the present invention;

[0024] Figure 2 A schematic diagram of another dynamic path-finding solution provided by an embodiment of the present invention;

[0025] Figure 3 A flowchart of a method for reconstructing a pathfinding graph provided by an embodiment of the present invention;

[0026] Figure 4 A flowchart of another method for reconstructing a pathfinding graph provided by an embodiment of the present invention;

[0027] Figure 5 A schematic diagram of a pathfinding graph reconstruction provided by an embodiment of the present invention;

[0028] Figure 6 A schematic diagram of another method for reconstructing a pathfinding graph provided by an embodiment of the present invention;

[0029] Figure 7 A schematic diagram of the structure of a path-finding graph reconstruction device provided by an embodiment of the present invention;

[0030] Figure 8 A schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0031] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of the present invention.

[0032] In massively multiplayer online role-playing games, different players' game clients are connected to the same server through the network, and the players' virtual characters in the game can be perceived by other players. Players can control virtual characters through manipulation behaviors, and then send the specific manipulated behaviors of the virtual characters to the server, which then synchronizes the network back to other clients, so that all players in the game can perceive and interact. However, the behavior of NPCs in the game is driven by the pathfinding system in the server. Under normal circumstances, the pathfinding information used by NPCs in the process of walking from point A to point B in the game scene is pre-generated before the server runs the game. However, if there is an additional obstacle between point A and point B when the server is running, then if the NPC needs to go around this obstacle at this time, dynamic pathfinding technology is required, that is, regenerating the pathfinding map.

[0033] In the related art, the voxelized information of the target scene's pathfinding map is usually cached in advance in an offline state, and the voxelized information is loaded when the target scene is run on the server, so that when the scene objects in the target scene are updated, the cached voxelized information can be directly used to rebuild the pathfinding map. However, in this method, the voxelized information of the entire target scene needs to be cached, which occupies a large amount of memory, usually 4-5 times the memory of the original pathfinding map; when placing a new scene object in the target scene, the range parameters pre-filled by the designer will be passed in, but these parameters can only be regular graphics. If the placed scene object is a particularly irregular graphic, such as Figure 1 As shown in the figure, if the placed scene object is a circle, then the scene object in the reconstructed pathfinding map may be a rectangle, so the effect of the reconstructed pathfinding map may not be consistent with the actual situation. In addition, designers often need to determine the specific size of the scene object and then wrap it as much as possible with a specific regular shape, which causes additional work costs for designers. At the same time, because the method of reconstructing the pathfinding map is to directly set the original walkable area to be unwalkable, such as Figure 2 As shown, if the updated virtual object is to place a staircase, due to the failure to take into account the attribute information of the scene object, the NPC will regard the staircase as an obstacle and cannot walk on the staircase, resulting in poor actual operation effect.

[0034] Based on this, an embodiment of the present invention provides a method, device and electronic device for reconstructing a pathfinding graph. The technology can be applied to electronic devices such as servers, and in particular, can be applied to servers with pathfinding systems.

[0035] To facilitate understanding of this embodiment, a method for reconstructing a pathfinding graph disclosed in an embodiment of the present invention is first described in detail. Figure 3 As shown, the method comprises the following steps:

[0036] Step S302, obtaining scene information of the target scene, and establishing a mirror scene of the target scene based on the scene information; wherein the scene information of the mirror scene is the same as the scene information of the target scene; the scene information includes scene object information and an initial pathfinding graph of a specified character; the initial pathfinding graph includes a plurality of pathfinding blocks;

[0037] The target scene can be a game scene of an online game, such as a multiplayer online role-playing game, etc., which includes a scene map, scene objects, virtual characters controlled by players, and non-player characters, wherein the scene objects can be movable objects or immovable objects. In addition, the target scene can be a physical scene, the purpose of which is to simulate collisions (such as bullet hits, collision simulations, etc.) with reference to the physical laws of reality. The scene object information generally includes the name (such as a tree, a staircase, etc.), shape, size, position, orientation, and object properties (such as water, a floor, a wall, etc.) of the scene object. The designated character is a non-player character in the target scene, which is controlled by the server to perform specific behaviors, and is controlled by the server's pathfinding system. The initial pathfinding graph refers to the data based on which the non-player character moves in the target scene. The pathfinding system needs to control the non-player character to move in the target scene based on the pathfinding graph, and the initial pathfinding graph is a three-dimensional pathfinding graph. The pathfinding block is the basic unit for constructing the pathfinding graph. A pathfinding graph is composed of multiple pathfinding blocks, and the pathfinding block is also three-dimensional.

[0038] Specifically, when the target scene is initialized, the scene object information and initial pathfinding map required to run the target scene will be loaded in the main thread, and the target scene will be constructed according to the scene object information, and the initial pathfinding map will be configured in the target scene. At the same time, in another sub-thread, the above scene object information and initial pathfinding map will also be obtained, and a mirror scene of the target scene will be constructed according to the scene object information and the initial pathfinding map. The scene objects in the mirror scene are the same as the scene objects in the target scene, that is, each scene object in the target scene will have a corresponding mirror in the mirror scene, and these mirrors have a one-to-one object relationship.

[0039] Step S304: if the first scene object in the target scene is updated, synchronize the updated first scene object to the mirror scene, and in the mirror scene, reconstruct at least part of the pathfinding blocks in the initial pathfinding graph based on the updated first scene object to obtain the target pathfinding blocks;

[0040] The update of the above-mentioned first scene object may be to add a new scene object, namely the above-mentioned first scene object, to the target scene, such as adding a tree, staircase, pool, etc. to the target scene, or to delete the first scene object in the target scene, or to update the first scene object in the target scene to another scene object, such as updating the pool in the target scene to grass, or updating the floor at the first position in the target scene to the second position. The above-mentioned at least partial pathfinding blocks refer to the pathfinding blocks in the pathfinding graph that are affected by the updated first scene object, or can be understood as the pathfinding blocks occupied by the updated first scene object. For example, if a floor is added to the first position of the target scene, the pathfinding blocks occupied by the floor, including the pathfinding blocks above the floor, are all the above-mentioned at least partial pathfinding blocks.

[0041] Specifically, when the first scene object in the target scene is updated, the scene object information of the first scene object can be extracted from the target scene, which can be called physical information (when the actual game is running, the physical laws of the real world will be referred to, so as to simulate the information used by similar physical phenomena), and then the scene object information of the first scene object is synchronized to the child thread, that is, synchronized to the mirror scene. In the mirror scene, the above-mentioned at least part of the pathfinding block is determined according to the scene object information of the first scene object, and finally the at least part of the pathfinding block is rebuilt. The reconstruction process can be to put at least part of the pathfinding block into the thread pool for reconstruction. Among them, in the reconstruction process, it is necessary to consider the shape, object attributes and other information of the first scene object, so that the reconstructed pathfinding block can contain the attribute information of the first scene object. In addition, the mirror scene object can be indexed through the scene object. If the scene object in the target scene moves, the movement information can be recorded, and the mirror image of the scene object can be determined from the mirror scene, and the same movement can be generated.

[0042] The above reconstruction process usually requires generating a voxelization result of the pathfinding block, that is, dividing the polygon into many squares of the same size (if smaller than a square, fill it to a square), and then reconstructing the pathfinding block based on the scene object information and voxelization result of the first scene object, so that the first scene object participates in the process of reconstructing the pathfinding block.

[0043] Step S306: In the target scene, at least part of the pathfinding blocks in the initial pathfinding graph are replaced with the target pathfinding blocks to obtain a reconstructed pathfinding graph.

[0044] In actual implementation, the main thread of the target scene is constructed, the target pathfinding blocks that have been reconstructed in the mirror scene are extracted, and at least part of the pathfinding blocks in the initial pathfinding map are replaced with the target pathfinding blocks, so as to obtain the reconstructed pathfinding map. The replacement will not have a real-time impact on the pathfinding behavior of the specified character (NPC), and at least part of the pathfinding blocks are reconstructed by the mirror scene, thereby avoiding the reconstruction of the pathfinding blocks in the target scene and not affecting the operation effect of the target scene.

[0045] An embodiment of the present invention provides a method for reconstructing a pathfinding map, which obtains scene information of a target scene and establishes a mirror scene of the target scene based on the scene information; the scene information includes scene object information and an initial pathfinding map; if a first scene object in the target scene is updated, at least part of the pathfinding blocks in the initial pathfinding map are reconstructed in the mirror scene based on the updated first scene object, and in the target scene, at least part of the pathfinding blocks in the initial pathfinding map are replaced with the reconstructed pathfinding blocks to obtain a reconstructed pathfinding map. In this method, the pathfinding blocks corresponding to the updated scene objects in the mirror scene are reconstructed according to the scene information of the target scene, and the pathfinding blocks in the target scene are replaced with the reconstructed pathfinding blocks in the mirror scene, thereby avoiding caching the relevant information of the entire target scene, reducing the computational workload and memory usage of the server, improving the reconstruction efficiency and the effect of the pathfinding map, and reducing the working cost.

[0046] A possible implementation of the above step S304, the step of reconstructing at least part of the path-finding blocks of the initial path-finding graph based on the updated first scene object to obtain the target path-finding blocks, is as follows:

[0047] Step 1, obtaining updated first scene object information of the first scene object; wherein the first scene object information includes: position information of the first scene object in the target scene, and shape information of the first scene object;

[0048] In actual implementation, the main thread obtains the position information of the updated first scene object in the target scene, such as the position coordinates, and the shape information of the updated first scene object, such as a circle, a sphere, a rectangle, or an irregular shape, and then synchronizes the first scene object information to the mirror scene, so that the mirror scene can obtain the first scene object information of the updated first scene object. In addition, the above-mentioned first scene object information generally also includes object attributes, update information (such as moving updates and moving distance, direction, etc., such as adding updates and adding positions, etc.), object orientation, etc.

[0049] Step 2, determining a first pathfinding block occupied by a first scene object from an initial pathfinding graph according to the position information and the shape information;

[0050] Specifically, in the mirror scene, according to the updated position information of the first scene object, the position of the updated first scene object and the path finding block corresponding to the position are first determined from the initial path finding map, and then according to the updated shape of the first scene object, the first path finding block within the shape range is determined from the path finding blocks at the position. It can be understood that the path finding block occupied within the shape range is the first path finding block, wherein the shape information of the first scene object can be a two-dimensional shape or a three-dimensional shape. For example, Figure 1 and Figure 5 As shown, it can be calculated that the updated scene object occupies two pathfinding blocks, the first row and the first column and the first row and the second column.

[0051] Step 3: Reconstruct the first pathfinding block based on the first scene object information to obtain the target pathfinding block.

[0052] In order to enable the updated first scene object to participate in the reconstruction process of the pathfinding block, the first pathfinding block can be reconstructed according to the first scene object information to obtain the target pathfinding block.

[0053] In this method, in the mirror scene, the first pathfinding block in the initial pathfinding block affected by the updated first scene object is rebuilt according to the pre-loaded scene information, without the need to rebuild all the pathfinding blocks, and will not cause lag in the main thread, resulting in poor running performance of the target scene.

[0054] The above-mentioned first object information also includes: posture information and attribute information of the first scene object; the posture information generally refers to the direction of the first scene object, etc., and the attribute information generally refers to the object name of the first scene object, such as water, floor, hill, stone, wall, etc.

[0055] A possible implementation of the above step 3, based on the first scene object information, reconstructing the first pathfinding block to obtain the target pathfinding block, is as follows:

[0056] (1) determining a voxelization result of the first pathfinding block according to the shape information, the posture information, the attribute information, and the second scene object in the first pathfinding block; wherein the voxelization result includes: a plurality of sub-blocks divided by the first pathfinding block; and the second scene object is a scene object other than the first scene object in the first pathfinding block;

[0057] (2) Construct the target pathfinding block based on the voxelization result of the first pathfinding block.

[0058] In actual implementation, the first pathfinding block may be voxelized, that is, the first pathfinding block may be divided into a plurality of sub-blocks of the same size, such as squares or cubes, wherein the divided block is filled to a sub-block if it is smaller than a sub-block.

[0059] The above-mentioned second scene object refers to the scene object occupying the first pathfinding block. In fact, in the process of reconstructing the first pathfinding block, not only the first scene object needs to participate in the reconstruction, but also the second scene object originally located in the first pathfinding block needs to participate in the reconstruction to ensure the integrity and timeliness of the pathfinding graph. Specifically, the first pathfinding block can be divided into sub-blocks first, and then various labels are configured for each sub-block according to the shape information, posture information, attribute information and the second scene object information of the second scene object, so that when a sub-block is obtained, the shape, attribute, position of the sub-block can be understood according to the voxelization result to which scene object the sub-block belongs. Finally, according to the voxelization result of the first pathfinding block, each sub-block can be reconstructed to obtain the above-mentioned target pathfinding block. In this way, the first sub-block is reconstructed through voxelization information, and only the affected first pathfinding block needs to be completely reconstructed, which has a better effect on the performance of the actual target scene. The designer no longer needs to judge how large a regular graphic should be used to wrap the irregular scene object, which reduces the designer's understanding and use costs.

[0060] A possible implementation method of the above-mentioned step of determining the voxelization result of the first pathfinding block based on the shape information, posture information, attribute information, and the second scene object in the first pathfinding block is as follows: dividing the first pathfinding block into multiple sub-blocks; configuring corresponding configuration information for each sub-block based on the shape information, posture information, attribute information and the second scene object information of the second scene object, to obtain the voxelization result of the first pathfinding block; wherein the configuration information at least includes the pathfinding label corresponding to the attribute information.

[0061] The above configuration information usually also includes the shape label, area label, posture label, etc. of the sub-square. According to the configuration information, it can be determined which sub-squares are occupied by the first scene object, which sub-squares are occupied by the second scene object, the solid part and the space part of the sub-square, and which scene object the sub-square belongs to.

[0062] The above-mentioned pathfinding label is used to indicate the attribute information of the first scene object. For example, when the attribute information of the first scene object is water, during the reconstruction process, the pathfinding label corresponding to the attribute information can be configured in the first pathfinding area corresponding to the first scene object, so that only NPCs with wading ability can move in the scene corresponding to the pathfinding area. For another example, when the attribute information of the first scene object is floor, during the reconstruction process, the pathfinding label corresponding to the attribute information can be configured in the first pathfinding area corresponding to the first scene object, so that when the NPC encounters the pathfinding area during the pathfinding process, it can directly walk in the scene corresponding to the pathfinding area. In this way, by setting the pathfinding label for the pathfinding area corresponding to the first scene object, the function of considering the attribute information of the first scene object in the process of reconstructing the pathfinding block is realized, and the operation effect of the target scene is further improved.

[0063] A possible implementation method of the above-mentioned step of constructing the target pathfinding block according to the voxelization result of the first pathfinding block is as follows: constructing a solid height field of multiple sub-blocks according to the configuration information in the voxelization result of the first pathfinding block; dividing the multiple sub-blocks after constructing the solid height field into regions to generate multiple pathfinding regions; wherein the multiple pathfinding regions include a first pathfinding region corresponding to the updated first scene object, and a second pathfinding region corresponding to the second scene object; generating an area outline of each pathfinding region to obtain the target pathfinding block.

[0064] Since the pathfinding block is three-dimensional, the part of each sub-block belonging to the obstacle area or scene object, that is, the solid part, and the part that does not belong to the obstacle area and scene object, that is, the hollow part, can be determined according to the label indicating the shape of the configuration information, and the solid height field of each sub-block is constructed. Then, according to the label indicating the area in the attribute information, it is determined which sub-blocks belong to an area, that is, a scene object, and divided into a pathfinding area, which usually includes a first pathfinding area corresponding to the updated first scene object and a second pathfinding area corresponding to the second scene object, wherein the first scene object and the second scene object may also include multiple ones, so the first pathfinding area and the second pathfinding area may also include multiple ones. Specifically, the sub-blocks in each pathfinding area can generate the above-mentioned target pathfinding block.

[0065] For example, the first scene object is the floor. According to the shape and posture of the floor, the first target sub-square occupied by the floor is determined from multiple sub-squares. If it is a three-dimensional sub-square, it means that the NPC can walk on the floor. It can also be determined that the sub-square above the floor is also the first target sub-square, and the first target sub-square is determined as the first pathfinding area. Similarly, if there are other scene objects in the first pathfinding block, that is, the second scene object mentioned above, according to the second scene object information (shape, posture and attributes, etc.) of the second scene object, the second target sub-square occupied by the second scene object is determined from multiple sub-squares to obtain the second pathfinding area, and finally the above multiple pathfinding areas are obtained. Among them, the reconstruction of the pathfinding block is completed in units of scene objects located in the target scene, and when the scene object is updated, the range that needs to be reconstructed can be automatically calculated and then automatically reconstructed, which reduces the amount of calculation of the server.

[0066] In this way, the thorough reconstruction of the first pathfinding block affected is more effective in the performance of the actual target scene. Designers no longer need to judge how large a regular graphic should be used to wrap irregular scene objects, reducing the designer's understanding and usage costs.

[0067] After the step of determining the voxelization result of the first pathfinding block according to the shape information, posture information, attribute information, and the second scene object in the first pathfinding block, the above method further includes: caching the voxelization result to a preset first storage space. Specifically, in order to facilitate the reconstruction of the pathfinding block when the subsequent scene object is updated, the voxelization result calculated during the reconstruction process can be cached, so that when the first pathfinding block is reconstructed, the corresponding voxelization result can be directly obtained from the first storage space. In this way, only the voxelization information of the local pathfinding block that needs to be reconstructed needs to be cached during the operation, which reduces memory usage.

[0068] Since the voxelization result of the pathfinding block will be cached during the reconstruction of the pathfinding block, in order to further improve the high reconstruction efficiency of the pathfinding graph, before the step of determining the voxelization result of the first pathfinding block according to the shape information, posture information, attribute information, and the second scene object in the first pathfinding block, the above method also includes: judging whether the voxelization result of the first pathfinding block is cached in the preset first storage space; if the voxelization result of the first pathfinding block is not cached in the preset first storage space, executing the step of determining the voxelization result of the first pathfinding block according to the shape information, posture information, attribute information, and the second scene object in the first pathfinding block, that is, calculating the voxelization result of the first pathfinding block; if the voxelization result of the first pathfinding block is cached in the preset first storage space, obtaining the voxelization result of the first pathfinding block from the preset first storage space. In this way, the corresponding voxelization result can be directly obtained from the first storage space without recalculating the voxelization result of the first pathfinding block, thereby improving the reconstruction efficiency.

[0069] Since multiple updates of scene objects may occur successively at the same position of the target scene, if the current pathfinding block is being rebuilt, and the scene objects occupying the pathfinding block are updated at this time, reconstruction overlap will occur. Therefore, after the step of updating the first scene object in the target scene, the above method also includes: determining whether the first pathfinding block occupied by the first scene object in the initial pathfinding graph is participating in the reconstruction, and if the first pathfinding block is participating in the reconstruction, caching the update request of the first scene object to a preset second storage space.

[0070] In actual implementation, when the first scene object in the target scene is updated, it is necessary to determine whether the first pathfinding block occupied by the first scene object in the initial pathfinding graph is participating in the reconstruction. If the first pathfinding block is participating in the reconstruction, update the first scene object in the target scene, but do not synchronize the first scene object to the mirror scene first. Instead, cache the update request of the first scene object to the preset second storage space to avoid rebuilding the same pathfinding block at the same time.

[0071] Furthermore, the above method also includes: at preset time intervals, determining from a preset second storage space whether there is a cached update request; if so, executing the step of reconstructing the pathfinding blocks affected by the first scene object in the initial pathfinding graph based on the first scene object information of the updated first scene object if the first scene object in the target game scene is updated to obtain the target pathfinding blocks.

[0072] The above-mentioned preset time can be 2 seconds, 3 seconds or 10 seconds, etc., and can be set according to actual needs. In actual implementation, the main thread will query whether there are any scene objects that have not been updated at preset time intervals, corresponding to the above-mentioned step of determining whether there are cached update requests from the preset second storage space. If so, the pathfinding blocks affected by the first scene object in the initial pathfinding graph are reconstructed based on the first scene object information of the updated first scene object to obtain the target pathfinding block. By having the main thread regularly query whether there are any scene objects that have not been updated, not only the problem of simultaneously rebuilding the same pathfinding block is avoided, but also the pathfinding blocks corresponding to the updated scene objects can be reconstructed in an orderly manner.

[0073] In the target scene, at least part of the pathfinding blocks in the initial pathfinding map are replaced with the target pathfinding blocks to obtain a reconstructed pathfinding map. A possible implementation method is as follows: obtaining the target pathfinding blocks from the mirror scene; in the target scene, at least part of the pathfinding blocks in the initial pathfinding map are replaced with the target pathfinding blocks to obtain a reconstructed pathfinding map.

[0074] In actual implementation, if the reconstruction of the first pathfinding block is completed and the target pathfinding block is obtained, the reconstruction thread will notify the main thread to synchronize the results, that is, the main thread obtains the target pathfinding block from the mirror scene, and then replaces at least part of the pathfinding blocks in the initial pathfinding graph with the target pathfinding block in the target scene to obtain the reconstructed pathfinding graph. By rebuilding the pathfinding blocks in other threads, the main thread only needs to replace the pathfinding blocks, which avoids the task jamming caused by the main thread and improves the running effect of the main thread.

[0075] A specific implementation method is described below. Figure 4As shown, first load the scene, load the physical information of the scene (corresponding to the aforementioned scene object information) and the pathfinding map (corresponding to the aforementioned scene object information) corresponding to the aforementioned step of obtaining the scene information of the target scene, synchronize to the mirror scene, which means synchronizing the physical information and the pathfinding map to the mirror scene, corresponding to the aforementioned step of establishing a mirror scene of the target scene based on the scene information, when adding, moving, or deleting scene objects, corresponding to the aforementioned step of if the first scene object in the target scene is updated, calculate the affected range, that is, calculate the pathfinding block occupied by the updated scene object, corresponding to the aforementioned step of determining the first pathfinding block occupied by the first scene object from the initial pathfinding map, and then need to determine whether the voxelization information of the first pathfinding block (i.e., the voxelization result) has been cached, if yes, directly extract the cached voxelization information, and reconstruct the first pathfinding block, if not, first calculate the voxelization information of the first pathfinding block, cache it at the same time, and then reconstruct the first pathfinding block, after the reconstruction is completed, replace the pathfinding block in the target scene with the reconstructed pathfinding block.

[0076] The reconstruction process is as follows: Figure 5 As shown in the figure, the main thread scene corresponds to the aforementioned target scene, and the sub-thread scene corresponds to the aforementioned mirror scene. When a scene object (i.e., the aforementioned first scene object) is placed in the target scene, the first scene object is synchronized to the mirror scene. In the initial pathfinding graph of the mirror scene, the pathfinding block occupied by the first scene object is reconstructed according to the first scene object information of the first scene object, i.e., the aforementioned first pathfinding block. Finally, after the reconstruction is completed, the main thread will extract the reconstructed first pathfinding block from it and replace it with the corresponding pathfinding block in the target scene, thereby completing the reconstruction of the pathfinding graph. Taking the first scene object as a walkable staircase as an example, as shown in Figure 6 The figure shows the effect after the path-finding graph is reconstructed. Since the attribute information of the first scene object is taken into account when reconstructing the path-finding block, the Actor (ie, the aforementioned designated role) can walk on the first scene object after the reconstruction is completed.

[0077] In the above method, the reconstruction of the pathfinding graph is completed with the scene objects located in the target scene as units, and the range to be rebuilt can be automatically calculated and then automatically rebuilt when the scene objects are added, deleted, or moved. Only local, dynamically required regional voxel information is cached. In the reconstruction process, the physical information already carried in the scene is effectively utilized, and all scene objects in the reconstruction range are thoroughly reconstructed, achieving faster and better results. In addition, the parallel multi-threaded design used in the reconstruction process accelerates the reconstruction process. After the reconstruction is completed, the main thread will be notified to synchronize the results, which will not cause task jams to the main thread. In addition, some pathfinding tags can be set and divided according to the information of the scene object itself. For example, the water body placed in the game has this mark in its physical information. Then, during reconstruction, this mark can be used to set the water body tag in the pathfinding information of the range covered by the water body. Then, only those NPCs with wading ability can walk through here.

[0078] Corresponding to the above method embodiment, the present invention provides a path-finding graph reconstruction device, such as Figure 7 As shown, the device comprises:

[0079] A mirror scene establishment module 71 is used to obtain scene information of a target scene and establish a mirror scene of the target scene based on the scene information; wherein the scene information of the mirror scene is the same as the scene information of the target scene; the scene information includes scene object information and an initial pathfinding graph of a specified role; the initial pathfinding graph includes a plurality of pathfinding blocks;

[0080] A pathfinding block reconstruction module 72, configured to synchronize the updated first scene object to the mirror scene if the first scene object in the target scene is updated, and in the mirror scene, reconstruct at least part of the pathfinding blocks in the initial pathfinding graph based on the updated first scene object to obtain a target pathfinding block;

[0081] The pathfinding block replacement module 73 is used to replace at least part of the pathfinding blocks in the initial pathfinding graph with the target pathfinding blocks in the target scene to obtain a reconstructed pathfinding graph.

[0082] An embodiment of the present invention provides a device for reconstructing a pathfinding map, which obtains scene information of a target scene and establishes a mirror scene of the target scene based on the scene information; the scene information includes scene object information and an initial pathfinding map; if a first scene object in the target scene is updated, at least part of the pathfinding blocks in the initial pathfinding map are reconstructed in the mirror scene based on the updated first scene object, and in the target scene, at least part of the pathfinding blocks in the initial pathfinding map are replaced with the reconstructed pathfinding blocks to obtain a reconstructed pathfinding map. In this method, the pathfinding blocks corresponding to the updated scene objects in the mirror scene are reconstructed according to the scene information of the target scene, and the pathfinding blocks in the target scene are replaced with the reconstructed pathfinding blocks in the mirror scene, thereby avoiding caching the relevant information of the entire target scene, reducing the computational workload and memory usage of the server, improving the reconstruction efficiency and the effect of the pathfinding map, and reducing the working cost.

[0083] Furthermore, the reconstruction module of the above-mentioned pathfinding block is also used to: obtain the first scene object information of the updated first scene object; wherein the first scene object information includes: the position information of the first scene object in the target scene, and the shape information of the first scene object; according to the position information and the shape information, determine the first pathfinding block occupied by the first scene object from the initial pathfinding map; based on the first scene object information, reconstruct the first pathfinding block to obtain the target pathfinding block.

[0084] Furthermore, the above-mentioned first object information also includes: posture information and attribute information of the first scene object; the reconstruction module of the above-mentioned pathfinding block is also used to: determine the voxelization result of the first pathfinding block according to the shape information, posture information, attribute information, and the second scene object in the first pathfinding block; wherein the voxelization result includes: multiple sub-blocks divided by the first pathfinding block; the second scene object is the scene object in the first pathfinding block other than the first scene object; and construct the target pathfinding block according to the voxelization result of the first pathfinding block.

[0085] Furthermore, the reconstruction module of the above-mentioned pathfinding block is also used to: divide the first pathfinding block into multiple sub-blocks; configure corresponding configuration information for each sub-block according to the shape information, posture information, attribute information and second scene object information of the second scene object, to obtain the voxelization result of the first pathfinding block; wherein the configuration information at least includes the pathfinding label corresponding to the attribute information.

[0086] Furthermore, the reconstruction module of the above-mentioned pathfinding block is also used to: construct a solid height field of multiple sub-blocks according to the configuration information in the voxelization result of the first pathfinding block; divide the multiple sub-blocks after constructing the solid height field into regions to generate multiple pathfinding areas; wherein the multiple pathfinding areas include a first pathfinding area corresponding to the updated first scene object, and a second pathfinding area corresponding to the second scene object; generate an area outline of each pathfinding area to obtain a target pathfinding block.

[0087] Furthermore, the above-mentioned device also includes a result caching module, which is used to: cache the voxelization result to a preset first storage space.

[0088] Furthermore, the reconstruction module of the above-mentioned pathfinding block is also used to: if the voxelization result of the first pathfinding block is not cached in the preset first storage space, calculate the voxelization result of the first pathfinding block; if the voxelization result of the first pathfinding block is cached in the preset first storage space, obtain the voxelization result of the first pathfinding block from the preset first storage space.

[0089] Furthermore, the above-mentioned device method also includes a reconstruction judgment module, which is used to: judge whether the first pathfinding block occupied by the first scene object in the initial pathfinding graph is participating in the reconstruction; if the first pathfinding block is participating in the reconstruction, cache the update request of the first scene object to a preset second storage space.

[0090] Furthermore, the above-mentioned pathfinding block replacement module is also used to: obtain a target pathfinding block from a mirror scene; in the target scene, replace at least part of the pathfinding blocks in the initial pathfinding graph with the target pathfinding blocks to obtain a reconstructed pathfinding graph.

[0091] Furthermore, the above-mentioned device also includes an update judgment module, which is used to: determine whether there is a cached update request from a preset second storage space at every preset time; if so, execute the step of reconstructing the pathfinding blocks affected by the first scene object in the initial pathfinding map based on the first scene object information of the updated first scene object if the first scene object in the target game scene is updated to obtain the target pathfinding blocks.

[0092] The path-finding graph reconstruction device provided in the embodiment of the present invention has the same technical features as the path-finding graph reconstruction method provided in the above-mentioned embodiment, so it can also solve the same technical problems and achieve the same technical effects.

[0093] This embodiment also provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned path-finding block reconstruction method. The electronic device can be a server or a terminal device.

[0094] See also Figure 8 As shown, the electronic device includes a processor 100 and a memory 101, wherein the memory 101 stores machine executable instructions that can be executed by the processor 100, and the processor 100 executes the machine executable instructions to implement the above-mentioned path-finding block reconstruction method.

[0095] Further, Figure 8The electronic device shown further includes a bus 102 and a communication interface 103 , and the processor 100 , the communication interface 103 and the memory 101 are connected via the bus 102 .

[0096] The memory 101 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 103 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 102 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.

[0097] The processor 100 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 100. The above processor 100 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present invention can be implemented or executed. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present invention can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 101, and the processor 100 reads the information in the memory 101 and completes the steps of the method of the above embodiment in combination with its hardware. The method specifically includes:

[0098] Obtain the scene information of the target scene, and establish a mirror scene of the target scene based on the scene information; wherein the scene information of the mirror scene is the same as the scene information of the target scene; the scene information includes scene object information and an initial pathfinding map of a specified character; the initial pathfinding map includes multiple pathfinding blocks; if the first scene object in the target scene is updated, synchronize the updated first scene object to the mirror scene, and in the mirror scene, reconstruct at least part of the pathfinding blocks in the initial pathfinding map based on the updated first scene object to obtain the target pathfinding blocks; in the target scene, replace at least part of the pathfinding blocks in the initial pathfinding map with the target pathfinding blocks to obtain the reconstructed pathfinding map. In this method, according to the scene information of the target scene, the pathfinding blocks corresponding to the updated scene objects in the mirror scene are reconstructed, and the pathfinding blocks in the target scene are replaced with the reconstructed pathfinding blocks in the mirror scene, thereby avoiding caching the relevant information of the entire target scene, reducing the computational workload and memory usage of the server, improving the reconstruction efficiency and the effect of the pathfinding map, and reducing the work cost.

[0099] The above-mentioned step of reconstructing at least part of the pathfinding blocks of the initial pathfinding graph based on the updated first scene object to obtain the target pathfinding block includes: obtaining the first scene object information of the updated first scene object; wherein the first scene object information includes: the position information of the first scene object in the target scene, and the shape information of the first scene object; determining the first pathfinding block occupied by the first scene object from the initial pathfinding graph according to the position information and the shape information; and reconstructing the first pathfinding block based on the first scene object information to obtain the target pathfinding block. In this method, in the mirror scene, the first pathfinding block affected by the updated first scene object in the initial pathfinding block is reconstructed according to the pre-loaded scene information, without the need to rebuild all the pathfinding blocks, and will not cause lag in the main thread, resulting in poor operation of the target scene.

[0100] The above-mentioned first object information also includes: posture information and attribute information of the first scene object; based on the first scene object information, the first pathfinding block is reconstructed to obtain the step of the target pathfinding block, including: determining the voxelization result of the first pathfinding block according to the shape information, posture information, attribute information, and the second scene object in the first pathfinding block; wherein the voxelization result includes: multiple sub-blocks divided by the first pathfinding block; the second scene object is the scene object other than the first scene object in the first pathfinding block; and constructing the target pathfinding block according to the voxelization result of the first pathfinding block. In this method, the first sub-block is reconstructed through voxelization information, and only the affected first pathfinding block is completely reconstructed, which has a better effect in the performance of the actual target scene. Designers no longer need to judge how large a regular graphic should be used to wrap irregular scene objects, reducing the designer's understanding and use costs.

[0101] The above-mentioned step of determining the voxelization result of the first pathfinding block according to the shape information, posture information, attribute information, and the second scene object in the first pathfinding block includes: dividing the first pathfinding block into a plurality of sub-blocks; configuring corresponding configuration information for each sub-block according to the shape information, posture information, attribute information, and the second scene object information of the second scene object, and obtaining the voxelization result of the first pathfinding block; wherein the configuration information at least includes a pathfinding label corresponding to the attribute information. By setting a pathfinding label for the pathfinding area corresponding to the first scene object, the function of considering the attribute information of the first scene object in the process of reconstructing the pathfinding block is realized, and the operation effect of the target scene is further improved.

[0102] The step of constructing the target pathfinding block according to the voxelization result of the first pathfinding block includes: constructing a solid height field of multiple sub-blocks according to the configuration information in the voxelization result of the first pathfinding block; dividing the multiple sub-blocks after the solid height field is constructed into regions to generate multiple pathfinding regions; wherein the multiple pathfinding regions include a first pathfinding region corresponding to the updated first scene object and a second pathfinding region corresponding to the second scene object; generating a region outline of each pathfinding region to obtain the target pathfinding block. The reconstruction of the pathfinding block is completed through the configuration information, and when the scene object is updated, the range that needs to be reconstructed can be automatically calculated and then automatically reconstructed, which reduces the amount of calculation of the server.

[0103] After the step of determining the voxelization result of the first pathfinding block according to the shape information, the posture information, the attribute information, and the second scene object in the first pathfinding block, the method further includes: caching the voxelization result to a preset first storage space. In this way, only the voxelization information of the local pathfinding block with reconstruction requirements needs to be cached during operation, thereby reducing memory usage.

[0104] Before the step of determining the voxelization result of the first pathfinding block based on the shape information, posture information, attribute information, and the second scene object in the first pathfinding block, the method further includes: determining whether the voxelization result of the first pathfinding block is cached in the preset first storage space, and if not, executing the step of determining the voxelization result of the first pathfinding block based on the shape information, posture information, attribute information, and the second scene object in the first pathfinding block; if yes, obtaining the voxelization result of the first pathfinding block from the preset first storage space. In this way, the corresponding voxelization result can be directly obtained from the first storage space without recalculating the voxelization result of the first pathfinding block, thereby improving the reconstruction efficiency.

[0105] After the above step of updating the first scene object in the target scene, the method further includes: determining whether the first pathfinding block occupied by the first scene object in the initial pathfinding graph is participating in reconstruction, and if the first pathfinding block is participating in reconstruction, caching the update request of the first scene object in a preset second storage space. In this method, the update request of the first scene object is cached in the preset second storage space to avoid rebuilding the same pathfinding block at the same time.

[0106] The above step of replacing at least part of the pathfinding blocks in the initial pathfinding graph with the target pathfinding blocks in the target scene to obtain a reconstructed pathfinding graph includes: obtaining the target pathfinding blocks from the mirror scene; and replacing at least part of the pathfinding blocks in the initial pathfinding graph with the target pathfinding blocks in the target scene to obtain a reconstructed pathfinding graph. In this method, by reconstructing the pathfinding blocks in other threads, the main thread only needs to replace the pathfinding blocks, thereby avoiding the task jamming caused by the main thread and improving the operation effect of the main thread.

[0107] The above method also includes: determining whether there is a cached update request from the preset second storage space at every preset time; if so, executing the step of reconstructing the pathfinding block affected by the first scene object in the initial pathfinding graph based on the first scene object information of the updated first scene object if the first scene object in the target game scene is updated, and obtaining the target pathfinding block. In this method, the main thread periodically queries whether there are scene objects that have not been updated, which not only avoids the problem of rebuilding the same pathfinding block at the same time, but also enables the pathfinding block corresponding to the updated scene object to be rebuilt in an orderly manner.

[0108] This embodiment also provides a machine-readable storage medium, which stores machine-executable instructions. When the machine-executable instructions are called and executed by a processor, the machine-executable instructions prompt the processor to implement the above-mentioned path-finding block reconstruction method. The method specifically includes:

[0109] Obtain the scene information of the target scene, and establish a mirror scene of the target scene based on the scene information; wherein the scene information of the mirror scene is the same as the scene information of the target scene; the scene information includes scene object information and an initial pathfinding map of a specified character; the initial pathfinding map includes multiple pathfinding blocks; if the first scene object in the target scene is updated, synchronize the updated first scene object to the mirror scene, and in the mirror scene, reconstruct at least part of the pathfinding blocks in the initial pathfinding map based on the updated first scene object to obtain the target pathfinding blocks; in the target scene, replace at least part of the pathfinding blocks in the initial pathfinding map with the target pathfinding blocks to obtain the reconstructed pathfinding map. In this method, according to the scene information of the target scene, the pathfinding blocks corresponding to the updated scene objects in the mirror scene are reconstructed, and the pathfinding blocks in the target scene are replaced with the reconstructed pathfinding blocks in the mirror scene, thereby avoiding caching the relevant information of the entire target scene, reducing the computational workload and memory usage of the server, improving the reconstruction efficiency and the effect of the pathfinding map, and reducing the work cost.

[0110] The above-mentioned step of reconstructing at least part of the pathfinding blocks of the initial pathfinding graph based on the updated first scene object to obtain the target pathfinding block includes: obtaining the first scene object information of the updated first scene object; wherein the first scene object information includes: the position information of the first scene object in the target scene, and the shape information of the first scene object; determining the first pathfinding block occupied by the first scene object from the initial pathfinding graph according to the position information and the shape information; and reconstructing the first pathfinding block based on the first scene object information to obtain the target pathfinding block. In this method, in the mirror scene, the first pathfinding block affected by the updated first scene object in the initial pathfinding block is reconstructed according to the pre-loaded scene information, without the need to rebuild all the pathfinding blocks, and will not cause lag in the main thread, resulting in poor operation of the target scene.

[0111] The above-mentioned first object information also includes: posture information and attribute information of the first scene object; based on the first scene object information, the first pathfinding block is reconstructed to obtain the step of the target pathfinding block, including: determining the voxelization result of the first pathfinding block according to the shape information, posture information, attribute information, and the second scene object in the first pathfinding block; wherein the voxelization result includes: multiple sub-blocks divided by the first pathfinding block; the second scene object is the scene object other than the first scene object in the first pathfinding block; and constructing the target pathfinding block according to the voxelization result of the first pathfinding block. In this method, the first sub-block is reconstructed through voxelization information, and only the affected first pathfinding block is completely reconstructed, which has a better effect in the performance of the actual target scene. Designers no longer need to judge how large a regular graphic should be used to wrap irregular scene objects, reducing the designer's understanding and use costs.

[0112] The above-mentioned step of determining the voxelization result of the first pathfinding block according to the shape information, posture information, attribute information, and the second scene object in the first pathfinding block includes: dividing the first pathfinding block into a plurality of sub-blocks; configuring corresponding configuration information for each sub-block according to the shape information, posture information, attribute information, and the second scene object information of the second scene object, and obtaining the voxelization result of the first pathfinding block; wherein the configuration information at least includes a pathfinding label corresponding to the attribute information. By setting a pathfinding label for the pathfinding area corresponding to the first scene object, the function of considering the attribute information of the first scene object in the process of reconstructing the pathfinding block is realized, and the operation effect of the target scene is further improved.

[0113] The step of constructing the target pathfinding block according to the voxelization result of the first pathfinding block includes: constructing a solid height field of multiple sub-blocks according to the configuration information in the voxelization result of the first pathfinding block; dividing the multiple sub-blocks after the solid height field is constructed into regions to generate multiple pathfinding regions; wherein the multiple pathfinding regions include a first pathfinding region corresponding to the updated first scene object and a second pathfinding region corresponding to the second scene object; generating a region outline of each pathfinding region to obtain the target pathfinding block. The reconstruction of the pathfinding block is completed through the configuration information, and when the scene object is updated, the range that needs to be reconstructed can be automatically calculated and then automatically reconstructed, which reduces the amount of calculation of the server.

[0114] After the step of determining the voxelization result of the first pathfinding block according to the shape information, the posture information, the attribute information, and the second scene object in the first pathfinding block, the method further includes: caching the voxelization result to a preset first storage space. In this way, only the voxelization information of the local pathfinding block with reconstruction requirements needs to be cached during operation, thereby reducing memory usage.

[0115] Before the step of determining the voxelization result of the first pathfinding block based on the shape information, posture information, attribute information, and the second scene object in the first pathfinding block, the method further includes: determining whether the voxelization result of the first pathfinding block is cached in the preset first storage space, and if not, executing the step of determining the voxelization result of the first pathfinding block based on the shape information, posture information, attribute information, and the second scene object in the first pathfinding block; if yes, obtaining the voxelization result of the first pathfinding block from the preset first storage space. In this way, the corresponding voxelization result can be directly obtained from the first storage space without recalculating the voxelization result of the first pathfinding block, thereby improving the reconstruction efficiency.

[0116] After the above step of updating the first scene object in the target scene, the method further includes: determining whether the first pathfinding block occupied by the first scene object in the initial pathfinding graph is participating in reconstruction, and if the first pathfinding block is participating in reconstruction, caching the update request of the first scene object in a preset second storage space. In this method, the update request of the first scene object is cached in the preset second storage space to avoid rebuilding the same pathfinding block at the same time.

[0117] The above step of replacing at least part of the pathfinding blocks in the initial pathfinding graph with the target pathfinding blocks in the target scene to obtain a reconstructed pathfinding graph includes: obtaining the target pathfinding blocks from the mirror scene; and replacing at least part of the pathfinding blocks in the initial pathfinding graph with the target pathfinding blocks in the target scene to obtain a reconstructed pathfinding graph. In this method, by reconstructing the pathfinding blocks in other threads, the main thread only needs to replace the pathfinding blocks, thereby avoiding the task jamming caused by the main thread and improving the operation effect of the main thread.

[0118] The above method also includes: determining whether there is a cached update request from the preset second storage space at every preset time; if so, executing the step of reconstructing the pathfinding block affected by the first scene object in the initial pathfinding graph based on the first scene object information of the updated first scene object if the first scene object in the target game scene is updated, and obtaining the target pathfinding block. In this method, the main thread periodically queries whether there are scene objects that have not been updated, which not only avoids the problem of rebuilding the same pathfinding block at the same time, but also enables the pathfinding block corresponding to the updated scene object to be rebuilt in an orderly manner.

[0119] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0120] In addition, in the description of the embodiments of the present invention, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, and it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in the present invention can be understood according to specific circumstances.

[0121] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc., which can store program codes.

[0122] In the description of the present invention, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present invention and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present invention. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.

[0123] Finally, it should be noted that the above embodiments are only specific implementations of the present invention, which are used to illustrate the technical solutions of the present invention, rather than to limit them. The protection scope of the present invention is not limited thereto. Although the present invention is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed by the present invention, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be based on the protection scope of the claims.

Claims

1. A method for reconstructing a pathfinding graph, characterized in that: The method comprises: Acquire scene information of a target scene, and establish a mirror scene of the target scene based on the scene information; wherein the scene information of the mirror scene is the same as the scene information of the target scene; the scene information includes scene object information and an initial pathfinding graph of a designated character; the initial pathfinding graph includes a plurality of pathfinding blocks; If the first scene object in the target scene is updated, synchronizing the updated first scene object to the mirror scene, and in the mirror scene, reconstructing at least part of the pathfinding blocks in the initial pathfinding graph based on the updated first scene object to obtain the target pathfinding blocks; In the target scene, replacing at least part of the pathfinding blocks in the initial pathfinding graph with the target pathfinding blocks to obtain a reconstructed pathfinding graph; The step of reconstructing at least part of the pathfinding blocks of the initial pathfinding graph based on the updated first scene object to obtain a target pathfinding block comprises: Acquire updated first scene object information of the first scene object; wherein the first scene object information includes: position information of the first scene object in the target scene, and shape information of the first scene object; Determining a first pathfinding block occupied by the first scene object from the initial pathfinding graph according to the position information and the shape information; Based on the first scene object information, the first pathfinding block is reconstructed to obtain the target pathfinding block.

2. The method according to claim 1, characterized in that The first scene object information further includes: posture information and attribute information of the first scene object; The step of reconstructing the first pathfinding block based on the first scene object information to obtain the target pathfinding block includes: Determine a voxelization result of the first pathfinding block according to the shape information, the posture information, the attribute information, and the second scene object in the first pathfinding block; wherein the voxelization result includes: a plurality of sub-blocks divided by the first pathfinding block; the second scene object is a scene object in the first pathfinding block other than the first scene object; The target pathfinding block is constructed according to the voxelization result of the first pathfinding block.

3. The method according to claim 2, characterized in that The step of determining a voxelization result of the first pathfinding block according to the shape information, the posture information, the attribute information, and the second scene object in the first pathfinding block comprises: Dividing the first pathfinding block into a plurality of sub-blocks; According to the shape information, the posture information, the attribute information and the second scene object information of the second scene object, corresponding configuration information is configured for each of the sub-blocks to obtain a voxelization result of the first pathfinding block; wherein the configuration information at least includes a pathfinding label corresponding to the attribute information.

4. The method according to claim 2, characterized in that: The step of constructing the target pathfinding block according to the voxelization result of the first pathfinding block comprises: Constructing solid height fields of the plurality of sub-blocks according to the configuration information in the voxelization result of the first pathfinding block; Dividing the multiple sub-blocks after constructing the solid height field into regions to generate multiple pathfinding regions; wherein the multiple pathfinding regions include a first pathfinding region corresponding to the updated first scene object and a second pathfinding region corresponding to the second scene object; Generate an area outline of each of the pathfinding areas to obtain the target pathfinding block.

5. The method according to claim 2, characterized in that: After the step of determining a voxelization result of the first pathfinding block according to the shape information, the posture information, the attribute information, and the second scene object in the first pathfinding block, the method further includes: The voxelization result is cached in a preset first storage space.

6. The method according to claim 2, characterized in that Before the step of determining a voxelization result of the first pathfinding block according to the shape information, the posture information, the attribute information, and the second scene object in the first pathfinding block, the method further includes: Determine whether a voxelization result of the first pathfinding block is cached in a preset first storage space, and if not, perform a step of determining a voxelization result of the first pathfinding block according to the shape information, the posture information, the attribute information, and the second scene object in the first pathfinding block; If yes, obtain the voxelization result of the first pathfinding block from the preset first storage space.

7. The method according to claim 1, characterized in that If after the step of updating the first scene object in the target scene, the method further comprises: Determine whether the first pathfinding block occupied by the first scene object in the initial pathfinding graph is participating in reconstruction; if the first pathfinding block is participating in reconstruction, cache the update request of the first scene object in a preset second storage space.

8. The method according to claim 1, characterized in that: In the target scene, the step of replacing at least part of the pathfinding blocks in the initial pathfinding graph with the target pathfinding blocks to obtain a reconstructed pathfinding graph comprises: Obtain the target pathfinding block from the mirror scene; In the target scene, at least part of the pathfinding blocks in the initial pathfinding graph are replaced with the target pathfinding blocks to obtain a reconstructed pathfinding graph.

9. The method according to claim 1, characterized in that: The method further comprises: At every preset time, determining from the preset second storage space whether there is a cache update request; If so, execute the step of reconstructing the path-finding blocks in the initial path-finding graph affected by the first scene object based on the updated first scene object information if the first scene object in the target scene is updated to obtain the target path-finding blocks.

10. A device for reconstructing a path finding graph, characterized in that: The device comprises: A mirror scene establishment module, used for acquiring scene information of a target scene, and establishing a mirror scene of the target scene based on the scene information; wherein the scene information of the mirror scene is the same as the scene information of the target scene; the scene information includes scene object information and an initial pathfinding graph of a specified role; the initial pathfinding graph includes a plurality of pathfinding blocks; A pathfinding block reconstruction module, configured to synchronize the updated first scene object to the mirror scene if the first scene object in the target scene is updated, and in the mirror scene, reconstruct at least part of the pathfinding blocks in the initial pathfinding graph based on the updated first scene object to obtain a target pathfinding block; A pathfinding block replacement module, used to replace at least part of the pathfinding blocks in the initial pathfinding graph with the target pathfinding blocks in the target scene to obtain a reconstructed pathfinding graph; The reconstruction module of the pathfinding block is further used to: obtain updated first scene object information of the first scene object; wherein the first scene object information includes: position information of the first scene object in the target scene, and shape information of the first scene object; Determining a first pathfinding block occupied by the first scene object from the initial pathfinding graph according to the position information and the shape information; Based on the first scene object information, the first pathfinding block is reconstructed to obtain the target pathfinding block.

11. An electronic device, characterized in that: It includes a processor and a memory, wherein the memory stores computer-executable instructions that can be executed by the processor, and the processor executes the computer-executable instructions to implement the method for reconstructing a pathfinding graph as described in any one of claims 1-9.

12. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by the processor, the computer-executable instructions prompt the processor to implement the method for reconstructing a pathfinding graph as described in any one of claims 1-9.

Citation Information

Patent Citations

  • Navigation way-finding path planning method and device

    CN110523081A

  • Multi-thread updating method of path-finding grid

    CN112295225A