Method, device, electronic device and medium for generating fused pathfinding grid

By marking voxel span levels and simplifying edges to generate a fused navigation mesh, the inconvenience of generating navigation meshes in multi-entity scenes is solved, and efficient memory utilization and fast scene iteration are achieved.

CN115814409BActive Publication Date: 2025-10-10NETEASE (HANGZHOU) NETWORK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211351169.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-31
Publication Date
2025-10-10
Estimated Expiration
2042-10-31

AI Technical Summary

Technical Problem

In the existing technology, the process of generating a navigation grid requires generating multiple navigation grids for a variety of entities with significant differences, resulting in large memory usage and repeated generation when the scene collision changes, which consumes a lot of time.

Method used

Based on the entity parameters in the game scene, the entity attribute levels of the voxel span are marked to generate multi-level entity attribute areas, and the edges are simplified and reorganized into convex polygonal walkable areas to generate a fused pathfinding mesh that adapts to multiple entity parameters.

Benefits of technology

Pathfinding for multiple entity types is achieved through a single navigation mesh, reducing generation and debugging time, reducing memory and hard disk pressure, and quickly responding to scene changes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115814409B_ABST
    Figure CN115814409B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method and device for generating a fusion pathfinding grid, electronic equipment and medium, belonging to the technical field of navigation. The method comprises: based on N groups of entity parameters corresponding to entities in a game scene, marking the entity attribute level of the voxel span and the entity level of each entity; based on the marked entity attribute level of the voxel span, generating a multi-level entity attribute area that can be walked in the game scene marked with the entity attribute level; simplifying the edges of the multi-level entity attribute area; recombining the polygon obtained after edge simplification into a convex polygon walkable area marked with the entity attribute level; based on the convex polygon walkable area, generating a fusion pathfinding grid of entities adapted to the N groups of entity parameters, so that pathfinding is performed based on the entity level of each entity and the convex polygon in the fusion pathfinding grid marked with the entity attribute level. The technical solution provided by the embodiments of the present disclosure can make the generation of the pathfinding grid more convenient.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure belongs to the field of navigation technology, and particularly relates to a method, device, electronic device, and medium for generating a fused pathfinding grid. Background Art

[0002] Currently, navigation meshes (NMs) are primarily used as the data foundation for artificial intelligence (AI) mobility. Also known as pathfinding meshes, they are polygonal mesh data structures used for navigation in complex spaces, marking areas where movement is permitted.

[0003] Typically, a game scene may include multiple sets of entities with different entity parameters. A set of entity parameters may include the entity's height, radius, walking slope, and crossing height, etc. The generation of the navigation grid in related technologies is based on a set of entity parameters and a scene collision model.

[0004] However, since the entire game's navigation mesh generation process is based on a single set of entity parameters, if there are multiple entities with significant differences in the game scene, multiple different navigation meshes need to be generated based on these parameters. Since navigation meshes are typically resident in memory, this consumes a significant amount of memory space. Furthermore, when scene collisions change, the navigation meshes corresponding to all entities need to be regenerated, requiring significant debugging and iteration time. Therefore, current navigation mesh generation is not very convenient. Summary of the Invention

[0005] The purpose of the embodiments of the present disclosure is to provide a method, device, electronic device, and medium for generating a fused navigation grid, which can solve the problem that the generation of the navigation grid is not convenient enough.

[0006] In order to solve the above technical problems, the present disclosure is implemented as follows:

[0007] In a first aspect, an embodiment of the present disclosure provides a method for generating a fused navigation grid, the method comprising: based on N groups of entity parameters corresponding to entities in a game scene, marking the entity attribute level of the voxel span and the entity level of each entity, where N is an integer greater than 1; based on the marked entity attribute level of the voxel span, generating a multi-level entity attribute area in the game scene marked with the entity attribute level; simplifying the edges of the multi-level entity attribute area; reorganizing the polygons obtained after the edge simplification into a convex polygon walkable area marked with the entity attribute level; based on the convex polygon walkable area marked with the entity attribute level, generating a fused navigation grid of entities adapted to the N groups of entity parameters, so that navigation is performed based on the entity level of each entity and the convex polygon marked with the entity attribute level in the fused navigation grid.

[0008] Optionally, N groups of entity parameters include N levels of entity attribute thresholds; based on the N groups of entity parameters corresponding to the entities in the game scene, marking the entity levels includes: sorting the N levels of entity attribute thresholds in order from small to large according to the restrictions imposed on the entities; marking the levels of the entities in the order of the entity attribute thresholds, and marking the last j-1 bits of the mark bit of the j-th level entity as 1, 1≤j≤N.

[0009] Optionally, the entity attributes include a slope threshold and a height threshold of the entity; based on N groups of entity parameters corresponding to the entity in the game scene, the entity attribute level of the voxel span is marked, including: marking the slope attribute level of the voxel span based on the slope of the voxel span and the slope threshold in the N groups of entity parameters; marking the height attribute level of the voxel span based on the height difference between adjacent voxel spans in the vertical direction and the height threshold in the N groups of entity parameters; wherein, the marking bit includes a mark of the slope attribute level and a mark of the height attribute level; or, determining the slope attribute level of the voxel span based on the slope of the voxel span and the slope threshold in the N groups of entity parameters; determining the height attribute level of the voxel span based on the height difference between adjacent voxel spans in the vertical direction and the height threshold in the N groups of entity parameters; determining the attribute level with a higher limit between the slope attribute level of the voxel span and the height attribute level of the voxel span as the entity attribute level of the voxel span; wherein, the marking bit includes a mark of the entity attribute level.

[0010] Optionally, N groups of entity parameters include N levels of entity attribute thresholds, and the restriction on the entity by the i-th level entity attribute threshold is less than the restriction on the entity by the i+1-th level entity attribute threshold; based on the N groups of entity parameters corresponding to the entities in the game scene, the entity attribute level of the voxel span is marked, including: for the voxel span that does not meet the level 1 entity attribute threshold, no level marking is performed; for the voxel span that meets the N-th level entity attribute threshold, it is recorded as the level 1 voxel span, and the mark bit of the level 1 voxel span is marked as all 0; for the voxel span that meets the i-th level entity attribute threshold and does not meet the i+1-th level entity attribute threshold, it is recorded as the i+1-th level voxel span, and the last i-1 bit in the mark bit of the i+1-th level voxel span is marked as 1, and the other bits in the mark bit are marked as 0, 1 <i<N。

[0011] Optionally, the entity parameters include an entity radius; after generating a walkable multi-level entity attribute area in a game scene marked with the entity attribute level based on the entity attribute level of the marked voxel span, the method further includes: determining a non-walkable area of ​​the corresponding entity in the multi-level entity attribute area based on the target entity parameters; performing regional expansion on the non-walkable area of ​​the entity corresponding to the target entity parameters based on the entity radius in the target entity parameters; wherein the target entity parameters are any set of entity parameters in the N groups of entity parameters except the first-level entity parameters, and the entity attribute labels of each voxel span in the same non-walkable area are the same.

[0012] Optionally, based on the entity radius in the target entity parameters, the non-walkable area of ​​the entity corresponding to the target entity parameters is regionally expanded, including: if the entity radius in the target entity parameters is greater than the unit voxel width, the non-walkable area of ​​the entity corresponding to the target entity parameters is regionally expanded.

[0013] Optionally, the region where the entity corresponding to the target entity parameters cannot be walked is expanded, including: if the entity radius / voxel width is rounded up to M, then each non-walkable region of the entity corresponding to the target entity parameters is processed M times in the following manner: determining whether there is a first neighbor voxel span with a different entity attribute level mark from the first voxel span among the 8-way neighbors of the first voxel span; marking the entity attribute level of the first neighbor voxel span with the entity attribute level of the first voxel span; wherein the first voxel span is the voxel span in the first region, and the first region is any region in the non-walkable region of the entity corresponding to the target entity parameters.

[0014] Optionally, the boundary voxel span includes a first boundary voxel span and a second boundary voxel span; the first boundary voxel span indicates a voxel span with an unconnected neighboring voxel span in the 8-direction; the second boundary voxel span indicates a voxel span above which one cannot walk; when the entity radius of the j-th level entity is greater than the unit voxel width, the method further includes: when j=1, marking the voxel span whose distance to the first boundary voxel span or the second boundary voxel span is less than the entity radius of the j-th level entity as impassable; when j≠1, allowing the level 1 entity to walk, The voxel span whose distance to the first boundary voxel span is less than the entity radius of the j-th level entity is marked as the j-th level voxel span; when j≠1, if the distance from the second voxel span to the second boundary voxel span is less than the entity radius of the j-th level entity, traverse the 8-way neighbors of the second voxel span to determine whether there is a second neighbor voxel span with a different entity attribute level mark from the second voxel span; use the entity attribute level of the second voxel span to mark the entity attribute level of the second neighbor voxel span; wherein, the second voxel span is the voxel span in the area where the j-th level entity cannot walk.

[0015] Optionally, based on the entity attribute levels of the marked voxel spans, a multi-level entity attribute area that can be walked in a game scene marked with the entity attribute levels is generated, including: for each level of the voxel span of the marked entity attribute levels, the area is divided according to the following processing method of the k-th level voxel span to obtain a multi-level entity attribute area: if the number of neighboring voxel spans that can be connected to the third voxel span is less than 8, and the entity attribute level marks of the third voxel span and the neighboring voxel spans of the third voxel span are different, then the third voxel span is marked as a boundary, and the third voxel span is any voxel span in the k-th level voxel span; the distance from each voxel span in the k-th level voxel span to the boundary is determined to generate a distance field; the k-th level voxel span is divided into different regions based on the distance field, and the entity attribute level of each region is marked; wherein the entity attribute level of the voxel span in the same region is the same, and the entity attribute level of the voxel span in the region is equal to the entity attribute level of the region.

[0016] Optionally, after dividing the k-th level voxel span into different regions based on the distance field and marking the entity attribute level of each region, the method also includes: if the non-island region obtained after dividing the region includes a second region whose area is smaller than a first area threshold, the second region is merged into an adjacent third region, and the entity attribute level of the second region is updated to the same entity attribute level as the entity attribute of the third region; if the non-island region obtained after dividing the region includes a fourth region whose area is greater than or equal to the first area threshold and smaller than the second area threshold, and there is no region with the same entity attribute level within a preset range of the fourth region, the fourth region is not processed.

[0017] Optionally, simplifying the edges of multi-level entity attribute areas includes: after extracting key points, determining the edge type of a first edge formed between a first key point and a second key point, where the first key point and the second key point are any two adjacent key points; if the first edge belongs to a first type of internal edge, retaining the first key point and the second key point, and the areas on both sides of the first type of internal edge belong to the same entity attribute level; if the first edge belongs to a second type of internal edge, determining that the target distance from other points between the first key point and the second key point to the first edge is greater than or equal to a distance threshold, and the point with the farthest target distance is the retained key point; the areas on both sides of the second type of internal edge belong to different entity attribute levels.

[0018] Optionally, before marking the entity attribute level of the voxel span based on the N groups of entity parameters corresponding to the entities in the game scene, the method also includes: if the area of ​​the game scene is greater than the third area threshold, dividing the game scene into uniform tiles along the XZ plane; marking the entity attribute level of the voxel span based on the N groups of entity parameters corresponding to the entities in the game scene, including: marking the entity attribute level of the voxel span in each tile based on the N groups of entity parameters corresponding to the entities in the game scene.

[0019] Optionally, after simplifying the edge of the multi-level entity attribute region, the method further includes: performing edge adsorption on edge points of the multi-level entity attribute region where the edge falls on the tile edge, so as to adjust the shape of the multi-level entity attribute region.

[0020] Optionally, edge adsorption is performed on edge points of the edge of the multi-level entity attribute area that fall on the edge of the tile, including: determining a first direction of the edge of the first tile, the edge of the first tile is the tile edge where the first point to be adsorbed falls on the first tile, the first point to be adsorbed is any point on the edge of the target area where the edge point falls on the first tile edge, and the target area is any area in the multi-level entity attribute area; obtaining a second tile adjacent to the first tile in the first direction; obtaining a target anchor point on the edge of the second tile in the opposite direction to the first direction on the second tile with the smallest distance from the first point to be adsorbed; if the size relationship between the coordinate values ​​of the first point to be adsorbed and the second point to be adsorbed on the edge of the first tile in the first direction is the same as the size relationship between the coordinate values ​​of the target anchor point and the second point to be adsorbed in the first direction, then determining that the target anchor point is the adsorption position of the first point to be adsorbed, and the second point to be adsorbed and the first point to be adsorbed are two adjacent points constituting the same polygon; updating the coordinates of the first point to be adsorbed to the coordinates of the adsorption anchor point of the adsorption position.

[0021] Optionally, edge adsorption is performed on edge points of the multi-level entity attribute area that fall on the edge of the tile, including: dividing the tiles into a first group of tiles and a second group of tiles in a chessboard-like distribution, and using the edge points of the multi-level entity attribute area that fall on the edge of the tile of the first group of tiles as adsorption anchor points; for the adsorption points that fall on the edge of the tile of the second group of tiles, edge adsorption is performed based on the adsorption anchor points generated by the first group of tiles; wherein the tiles in the second group of tiles are neighbor tiles of the tiles in the first group.

[0022] In a second aspect, an embodiment of the present disclosure provides a device for generating a fused navigation grid, and the device for generating a fused navigation grid includes: a level marking module, an area generation module, an edge simplification module, a polygon reorganization module, and a grid generation module; the level marking module is used to mark the entity attribute level of the voxel span and the entity level of each entity based on N groups of entity parameters corresponding to the entities in the game scene, where N is an integer greater than 1; the area generation module is used to generate a multi-level entity attribute area in the game scene that is marked with the entity attribute level based on the marked entity attribute level of the voxel span; the edge simplification module is used to simplify the edges of the multi-level entity attribute area; the polygon reorganization module is used to reorganize the polygons obtained after edge simplification into a convex polygon walkable area marked with the entity attribute level; the grid generation module is used to generate a fused navigation grid of entities that adapt to N groups of entity parameters based on the convex polygon walkable area marked with the entity attribute level, so that navigation is performed based on the entity level of each entity and the convex polygon marked with the entity attribute level in the fused navigation grid.

[0023] Optionally, the level marking module is specifically used to: sort the attribute thresholds of N-level entities in order of the restrictions imposed on the entities from small to large; mark the levels of the entities in the order of the entity attribute thresholds, and mark the last j-1 bits of the mark bit of the j-th level entity as 1, 1≤j≤N.

[0024] Optionally, the entity attributes include a slope threshold and a height threshold of the entity; the level marking module is specifically used to: mark the slope attribute level of the voxel span based on the slope of the voxel span and the slope threshold in N groups of entity parameters; mark the height attribute level of the voxel span based on the height difference between adjacent voxel spans in the vertical direction and the height threshold in N groups of entity parameters; wherein, the marking bit includes a mark of the slope attribute level and a mark of the height attribute level; or, determine the slope attribute level of the voxel span based on the slope of the voxel span and the slope threshold in N groups of entity parameters; determine the height attribute level of the voxel span based on the height difference between adjacent voxel spans in the vertical direction and the height threshold in N groups of entity parameters; determine the attribute level with a higher limit between the slope attribute level of the voxel span and the height attribute level of the voxel span as the entity attribute level of the voxel span; wherein, the marking bit includes a mark of the entity attribute level.

[0025] Optionally, N groups of entity parameters include N levels of entity attribute thresholds, and the restriction on the entity by the i-th level entity attribute threshold is less than the restriction on the entity by the i+1-th level entity attribute threshold; the level marking module is specifically used for: not performing level marking for the voxel span that does not meet the level 1 entity attribute threshold; recording the voxel span that meets the N-th level entity attribute threshold as the level 1 voxel span, and marking the mark bit of the level 1 voxel span as all 0s; recording the voxel span that meets the i-th level entity attribute threshold and does not meet the i+1-th level entity attribute threshold as the i+1-th level voxel span, marking the last i-1 bit in the mark bit of the i+1-th level voxel span as 1, and marking the other bits in the mark bit as 0, 1 <i<N。

[0026] Optionally, the generation device of the fused navigation grid also includes: a determination module and an area expansion module; the entity parameters include an entity radius; the determination module is used to determine the non-walkable area of ​​the corresponding entity in the multi-level entity attribute area based on the target entity parameters after the area generation module generates a walkable multi-level entity attribute area in the convex polygon game scene with the entity attribute level marked based on the entity attribute level of the marked voxel span; the area expansion module is used to perform area expansion on the non-walkable area of ​​the entity corresponding to the target entity parameter based on the entity radius in the target entity parameter; wherein the target entity parameter is any set of entity parameters in the N groups of entity parameters except the first-level entity parameters, and the entity attribute mark of each voxel span in the same non-walkable area is the same.

[0027] Optionally, the region expansion module is specifically configured to: if the entity radius in the target entity parameters is greater than the unit voxel width, then perform region expansion on the entity non-walkable region corresponding to the target entity parameters.

[0028] Optionally, the region expansion module is specifically used to: if the entity radius / voxel width is rounded up to M, then each non-walkable area of ​​the entity corresponding to the target entity parameters is processed M times in the following manner: determine whether there is a first neighbor voxel span with a different entity attribute level mark from the first voxel span among the 8-way neighbors of the first voxel span; use the entity attribute level of the first voxel span to mark the entity attribute level of the first neighbor voxel span; wherein the first voxel span is the voxel span in the first area, and the first area is any area in the non-walkable area of ​​the entity corresponding to the target entity parameters.

[0029] Optionally, the boundary voxel span includes a first boundary voxel span and a second boundary voxel span; the first boundary voxel span indicates a voxel span with an unconnected neighboring voxel span in the 8-direction; the second boundary voxel span indicates a voxel span above which one cannot walk; in the case where the entity radius of the j-th level entity is greater than the unit voxel width, the level marking module is further used to mark the voxel span whose distance to the first boundary voxel span or the second boundary voxel span is less than the entity radius of the j-th level entity as impassable when j=1; in the case where j≠1, the level 1 entity will be allowed to walk. , and the voxel span whose distance to the first boundary voxel span is less than the entity radius of the j-th level entity is marked as the j-th level voxel span; in the case of j≠1, if the distance from the second voxel span to the second boundary voxel span is less than the entity radius of the j-th level entity, traverse the 8-way neighbors of the second voxel span to determine whether there is a second neighbor voxel span with an entity attribute level different from the second voxel span; use the entity attribute level of the second voxel span to mark the entity attribute level of the second neighbor voxel span; wherein, the second voxel span is the voxel span in the area where the j-th level entity cannot walk.

[0030] Optionally, the region generation module is specifically used to: for each level of the voxel span of the marked entity attribute level, perform region division according to the following processing method of the k-th level voxel span to obtain a multi-level entity attribute region marked with the entity attribute level: if the number of neighboring voxel spans that can be connected to the third voxel span is less than 8, and the entity attribute level markings of the third voxel span and the neighboring voxel spans of the third voxel span are different, then the third voxel span is marked as a boundary, and the third voxel span is any voxel span in the k-th level voxel span; determine the distance from each voxel span in the k-th level voxel span to the boundary to generate a distance field; divide the k-th level voxel span into different regions based on the distance field, and mark the entity attribute level of each region; wherein the entity attribute level of the voxel span in the same region is the same, and the entity attribute level of the voxel span in the region is equal to the entity attribute level of the region.

[0031] Optionally, the generating device of the fused navigation grid further includes: a fragment area processing module; the fragment area processing module is used to, after dividing the k-th level voxel span into different areas based on the distance field and marking the entity attribute level of each area, if the non-island area obtained after the area division includes a second area whose area is smaller than the first area threshold, then the second area is merged into the adjacent third area, and the entity attribute level of the second area is updated to the same entity attribute level as the entity attribute of the third area; if the non-island area obtained after the area division includes a fourth area whose area is greater than or the first area threshold and less than the second area threshold, and there is no area with the same entity attribute level within the preset range of the fourth area, then the fourth area is not processed.

[0032] Optionally, the edge simplification module is specifically used to: after extracting the key points, determine the edge type of the first edge formed between the first key point and the second key point, the first key point and the second key point are any two adjacent key points; if the first edge belongs to the first type of internal edge, retain the first key point and the second key point, and the areas on both sides of the first type of internal edge belong to the same entity attribute level; if the first edge belongs to the second type of internal edge, determine that the target distance of other points between the first key point and the second key point to the first edge is greater than or equal to the distance threshold, and the point with the farthest target distance is the retained key point; the areas on both sides of the second type of internal edge belong to different entity attribute levels.

[0033] Optionally, the generation device of the fused navigation grid also includes: a tile generation module; a tile generation module, which is used to divide the game scene into uniform tiles along the XZ plane before marking the entity attribute level of the voxel span based on N groups of entity parameters corresponding to the entities in the game scene, if the area of ​​the game scene is greater than a third area threshold; the level marking module is specifically used to: mark the entity attribute level of the voxel span in each tile based on N groups of entity parameters corresponding to the entities in the game scene.

[0034] Optionally, the generation device of the fused pathfinding grid also includes: an edge point adsorption module; the edge point adsorption module is used to perform edge adsorption on the edge points of the edge of the multi-level entity attribute area that fall on the edge of the tile after simplifying the edge of the multi-level entity attribute area, so as to adjust the shape of the multi-level entity attribute area.

[0035] Optionally, the edge point adsorption module is specifically used to: determine the first direction of the edge of the first tile, the edge of the first tile is the tile edge where the first point to be adsorbed falls on the first tile, the first point to be adsorbed is any point on the edge of the target area where the edge point falls on the first tile, and the target area is any area in the multi-level entity attribute area; obtain the second tile adjacent to the first tile in the first direction; obtain the target anchor point on the edge of the second tile in the opposite direction to the first direction on the second tile with the smallest distance from the first point to be adsorbed; if the size relationship between the coordinate values ​​of the first point to be adsorbed and the second point to be adsorbed on the edge of the first tile in the first direction is the same as the size relationship between the coordinate values ​​of the target anchor point and the second point to be adsorbed in the first direction, then determine that the target anchor point is the adsorption position of the first point to be adsorbed, and the second point to be adsorbed and the first point to be adsorbed are two adjacent points in the same polygon; update the coordinates of the first point to be adsorbed to the coordinates of the adsorption anchor point of the adsorption position.

[0036] Optionally, the edge point adsorption module is specifically configured to: divide the tiles into a first group of tiles and a second group of tiles according to a chessboard distribution form, and take the edge points of the tiles in the first group of tiles as adsorption anchor points; and perform edge adsorption on the adsorption points of the tiles in the second group of tiles based on the adsorption anchor points generated by the first group of tiles; wherein the tiles in the second group of tiles are neighbor tiles of the tiles in the first group of tiles.

[0037] In a third aspect, an electronic device is provided, which includes a processor, a memory, and a program or instructions stored in the memory and executable on the processor, and the program or instructions, when executed by the processor, implement the steps of the method for generating a fusion pathfinding grid according to the first aspect.

[0038] In a fourth aspect, a readable storage medium is provided, which stores a program or instructions, and the program or instructions, when executed by a processor, implement the steps of the method for generating a fusion pathfinding grid according to the first aspect.

[0039] In a fifth aspect, a chip is provided, which includes a processor and a communication interface, the communication interface is coupled to the processor, and the processor is configured to run a program or instructions to implement the method for generating a fusion pathfinding grid according to the first aspect.

[0040] In a sixth aspect, a computer program product is provided, which includes instructions, and when the computer program product is run on a computer, the computer is caused to perform the steps of the method for generating a fusion pathfinding grid according to the first aspect.

[0041] In the embodiments of the present disclosure, first, the entity levels of entities are marked based on the entity attribute threshold values of a plurality of different entities in a game scene, the levels of walkable voxel spans are marked, and the entities through which the voxel spans can pass are indicated, then the multi-level entity attribute region marked with the entity attribute levels is generated based on the voxel spans marked with the entity attribute levels, then the edges of the multi-level entity attribute region are simplified, and are recombined into convex polygon walkable regions carrying the entity attribute levels, then the fusion pathfinding grid is generated based on the convex polygon walkable regions carrying the entity attribute levels, so that pathfinding can be performed based on the entity levels of various entities and the convex polygons in the fusion pathfinding grid marked with the entity attribute levels. Since the fusion pathfinding grid is a single pathfinding grid, pathfinding of multiple types of entities can be completed based on one pathfinding grid, and it is not necessary to generate a pathfinding grid for each entity, so the time for pathfinding grid generation and debugging can be greatly reduced, and scene iteration and adjustment can be quickly completed. Even if the scene collides, at most, the number of times of generating the scene collision can be re-generated, and the pathfinding grid set generated by different entity parameters can be replaced, so as to reduce the memory pressure and hard disk pressure of the pathfinding system. BRIEF DESCRIPTION OF THE DRAWINGS

[0042] Figure 1 A schematic flow chart of a method for generating a fused navigation grid provided in an embodiment of the present disclosure;

[0043] Figure 2 A schematic diagram of a method for sorting entity parameters provided in an embodiment of the present disclosure;

[0044] Figure 3 A schematic diagram of sorting entity attribute thresholds provided in an embodiment of the present disclosure;

[0045] Figure 4 A schematic diagram of a triangle normal direction provided in an embodiment of the present disclosure;

[0046] Figure 5 A schematic diagram of a marking position provided in an embodiment of the present disclosure;

[0047] Figure 6 A schematic diagram of a slope attribute labeling of a voxel span provided by an embodiment of the present disclosure;

[0048] Figure 7 A schematic diagram of a height attribute labeling of a voxel span provided by an embodiment of the present disclosure;

[0049] Figure 8 A schematic diagram of a processing logic for regional expansion provided by an embodiment of the present disclosure;

[0050] Figure 9 A schematic diagram of a region expansion provided by an embodiment of the present disclosure;

[0051] Figure 10 A schematic diagram of a voxel span provided in an embodiment of the present disclosure;

[0052] Figure 11 A logical diagram of voxel span classification provided by an embodiment of the present disclosure;

[0053] Figure 12 A schematic diagram of an edge of a region provided in an embodiment of the present disclosure;

[0054] Figure 13 A comparative schematic diagram of simplified edge processing provided by an embodiment of the present disclosure;

[0055] Figure 14 A schematic diagram of an edge point misalignment phenomenon provided by an embodiment of the present disclosure;

[0056] Figure 15 A schematic diagram of tile grouping provided in an embodiment of the present disclosure;

[0057] Figure 16A logical diagram of a pathfinding method provided by an embodiment of the present disclosure;

[0058] Figure 17 A schematic diagram of a possible structure of a device for generating a fused navigation grid provided in an embodiment of the present disclosure;

[0059] Figure 18 A possible structural diagram of an electronic device provided in an embodiment of the present disclosure;

[0060] Figure 19 A hardware schematic diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0061] First, let's introduce the technical terms and generation process of the navigation grid in related technologies:

[0062] 1. Entity parameters

[0063] Entity parameters include entity height, entity radius, entity walking slope, and entity spanning height.

[0064] Navigation mesh generation is primarily based on the following rules to determine areas in the scene where entities can and cannot walk.

[0065] (1) Entity height

[0066] The height span of the non-blocked area in the scene is smaller than the entity's height, so the entity cannot walk.

[0067] (2) Entity radius

[0068] The entity cannot walk in areas of the scene that are closer to the edge than the entity's radius.

[0069] (3) Walking slope

[0070] In areas of the scene where the slope is greater than the entity's walking slope, the entity cannot walk.

[0071] (4) Crossing height

[0072] If the height difference between adjacent objects in the scene is greater than the entity's span height, the entity cannot walk.

[0073] 2. The generation steps of the navigation mesh in the related art include the following five steps: voxelization, distance field and area generation, edge generation and simplification, convex polygon generation, and detailedMesh generation.

[0074] Step 1: Voxelization stage

[0075] First, we convert from vector space to raster space and divide the scene into regular voxel cubes (voxels) based on the scene model's AABB (Axis-aligned bounding box). Next, we traverse the triangles in the scene model, recording whether each voxel is blocked or not, and merge the upper and lower consecutive blocked voxels into a voxel span. Finally, based on the entity's height and the entity's walking slope in the entity parameters, we determine whether the upper surface of the voxel span is passable, and obtain the voxel span with a passable upper surface.

[0076] Step 2: Distance Field and Region Generation

[0077] First, impassable voxel spans are marked as edges. Second, a distance field is generated based on the distance from the voxel span to the edge. Then, impassable voxel spans are further filtered out based on the entity radius. Finally, the impassable voxel spans in the scene are divided into different regions based on the watershed algorithm.

[0078] Step 3: Edge Generation and Simplification

[0079] Extract region edges and remove unimportant edge points. Specifically, for internal boundaries, only important nodes that distinguish different regions are retained; for edge boundaries, more nodes are retained to maintain the integrity of the edge shape. Internal boundaries indicate the boundaries between walkable regions, while edge boundaries indicate the boundaries between walkable and non-walkable regions.

[0080] Step 4: Convex polygon generation

[0081] First, the polygons obtained by simplifying the edges are split into triangles; then the triangles are reorganized into convex polygons; among them, each convex polygon constitutes all the walkable areas of the target entity.

[0082] Step 5: detailedMesh generation

[0083] Although convex polygon pathfinding is more efficient, it does not completely fit the scene surface, which can easily lead to errors in the height of some areas. You can use detailed mesh to obtain more accurate height information.

[0084] Generally, the pathfinding grid is resident in memory, and the pathfinding grid generation process in the related art is generated based on a set of entity parameters. If the scene includes a plurality of entities with large differences, for example, 5 entities with different parameters, 5 pathfinding grids for each entity need to be generated and stored in memory. If the scene collision causes the scene to change, all the pathfinding grids corresponding to the entities also need to be regenerated. For example, if there are 4 collisions in the game, 5 pathfinding grids for each entity need to be generated, and 25 pathfinding grids need to be stored in memory. Therefore, a large amount of time cost is required for iteration and debugging, resulting in that the pathfinding grid is not convenient to generate.

[0085] The technical solutions in the embodiments of the present disclosure will be described clearly and completely in combination with the drawings in the embodiments of the present disclosure. Obviously, the described embodiments are part of the embodiments of the present disclosure, rather than all the embodiments. Based on the embodiments in the present disclosure, all other embodiments obtained by those skilled in the art without creative labor fall within the protection scope of the present disclosure.

[0086] The terms "first", "second", and the like in the specification and claims of the present disclosure are used to distinguish similar objects, and are not used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present disclosure can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally a category and do not limit the number of objects, for example, the first object can be one or more. In addition, "and / or" in the specification and claims indicates at least one of the connected objects, and the character " / ", generally indicates that the objects before and after are in an "or" relationship.

[0087] The fusion pathfinding grid generation method provided by the embodiments of the present disclosure will be described in detail below in combination with the drawings, specific embodiments and application scenarios.

[0088] Figure 1 A fusion pathfinding grid generation method flowchart provided by the embodiments of the present disclosure is shown in FIG. 1, which includes the following S101-S105: Figure 1

[0089] S101, based on the N sets of entity parameters corresponding to the entities in the game scene, marking the entity attribute level of the voxel span and the entity level of each entity.

[0090] Wherein, N is an integer greater than 1.

[0091] ​Specifically, in the embodiment of the present disclosure, during the process of generating the navigation grid, after the voxel span is divided into walkable voxel spans and non-walkable voxel spans in the voxelization stage, it can be marked which entities are allowed to walk in each walkable voxel span.

[0092] S102 : Based on the marked entity attribute levels of the voxel spans, generate a multi-level entity attribute area in the game scene that is marked with the entity attribute levels and is walkable.

[0093] It can be understood that the entity attribute level of each multi-level entity attribute area can indicate the entities that can walk in the area.

[0094] S103. Simplify the edge of the multi-level entity attribute area.

[0095] S104: Reorganize the polygons obtained after edge simplification into convex polygonal walkable areas marked with entity attribute levels.

[0096] S105 : Based on the convex polygon walkable area, generate a fused pathfinding grid of entities adapted to N groups of entity parameters, so that pathfinding is performed based on the entity level of each entity and the convex polygons marked with the entity attribute levels in the fused pathfinding grid.

[0097] Specifically, in the above-mentioned S105, a detailmesh may be generated based on the convex polygons marked with the entity attribute levels to obtain more accurate height information, thereby obtaining a fused pathfinding mesh.

[0098] For example, an AND operation may be performed based on the entity-level mark bits of each entity and the entity-attribute-level mark bits of each convex polygon to determine whether each entity can pass through each polygon, thereby performing pathfinding for the entity.

[0099] The present disclosure provides a method for generating a fused navigation mesh. First, based on entity attribute thresholds of multiple different entities in a game scene, the entity levels of the entities are marked, the levels of walkable voxel spans are marked, and entities that can be passed through the voxel spans are indicated. Then, based on the voxel spans marked with the entity attribute levels, multi-level entity attribute regions marked with the entity attribute levels are generated. The edges of the multi-level entity attribute regions are then simplified and reorganized into convex polygonal walkable regions carrying the entity attribute levels. Finally, a fused navigation mesh is generated based on the convex polygonal walkable regions carrying the entity attribute levels. This allows for pathfinding based on the entity levels of each entity and the convex polygons marked with the entity attribute levels in the fused navigation mesh. Because the fused navigation mesh is a single navigation mesh, it can be used to complete pathfinding for multiple types of pathfinding entities, eliminating the need to generate a separate navigation mesh for each entity. This significantly reduces the time required for generating and debugging navigation meshes, allowing for rapid scene iteration and adjustment. Even if a scene collision occurs, the maximum number of collisions required to regenerate the scene is equal to the number of collisions that occurred. This method can replace navigation mesh groups generated separately based on different entity parameters, thereby reducing memory and disk pressure on the navigation system.

[0100] Optionally, the N groups of entity parameters include N groups of entity attribute thresholds, wherein the entity attribute thresholds may indicate the range of the maximum walkable area of ​​the entity.

[0101] Furthermore, in the method for generating a fused navigation grid provided by the embodiment of the present disclosure, marking entity levels in the above-mentioned S101 can be specifically performed by the following steps A1 and A2:

[0102] Step A1: Sort the attribute thresholds of N-level entities in ascending order of the restrictions imposed on the entities.

[0103] Figure 2 A schematic diagram of a sorting method for entity parameters provided in an embodiment of the present disclosure is provided. Assume that N=3, that is, it includes three levels of entity parameters, among which the range in which an entity with level 1 entity parameters can move is the largest, the range in which an entity with level 2 entity parameters can move is the second largest, and the range in which an entity with level 3 entity parameters can move is the smallest.

[0104] Step A2: Mark the levels of entities in the order of entity attribute thresholds, and mark the last j-1 bits of the mark bits of the j-th level entity as 1. Where 1≤j≤N.

[0105] For example, Table 1 is an exemplary table of entity levels provided in an embodiment of the present disclosure. Assuming that the entity level is marked with 8 bits and the entity level includes 3 levels, the entity level can be marked as shown in Table 1 below.

[0106] Table 1

[0107] Entity Level Lv1 Lv2 Lv3 Mark bit 00000000 00000001 00000011

[0108] Based on this solution, the entity level of each entity included in the game scene can be marked based on the sorting of the entity attribute thresholds, thereby facilitating pathfinding based on the subsequent generation of a fused pathfinding grid and the marking positions corresponding to different entity levels.

[0109] Optionally, the entity attributes include a slope threshold and a height threshold of the entity.

[0110] That is, in the embodiment of the present disclosure, after the triangular faces of the traversed scene model are converted into voxels and the voxel span is determined in the voxelization stage, the slope attribute and the height attribute of each voxel span can be marked.

[0111] Figure 3 This is a schematic diagram of the sorting of entity attribute thresholds provided in an embodiment of the present disclosure. Both the height threshold and the slope threshold can be sorted from low to high based on the restrictions on the entity. The order of the height thresholds is: height threshold 1, height threshold 2, and height threshold 3. The order of the slope thresholds is: slope threshold 1, slope threshold 2, and slope threshold 3.

[0112] For example, a height threshold of 10 indicates that the lowest height that an entity can pass is 10, and the height difference between voxel spans in the vertical direction is less than 10, and the entity corresponding to the height threshold cannot pass; a slope threshold of 10 indicates that the maximum slope that an entity can walk is 10, and the slope of the voxel span is greater than 10, and the entity corresponding to the slope threshold cannot pass.

[0113] Furthermore, in the method for generating a fused navigation grid provided by the embodiment of the present disclosure, the entity attribute level of marking the voxel span in the above-mentioned S101 may include the following steps A3 and A4, or steps A5 to A7:

[0114] Step A3: Based on the slope of the voxel span and the slope threshold in the N sets of entity parameters, the slope attribute level of the voxel span is marked.

[0115] For example, Figure 4 A schematic diagram of a triangle normal direction provided by an embodiment of the present disclosure. During the voxelization stage, all triangular faces can be converted to voxels. After determining the voxel span, the slope attribute of each voxel span can be marked based on the triangle normal direction of the voxel span and the slope threshold in the entity parameters. The y value of the normalized normal of the triangle is the same as the cosine value of the slope.

[0116] Step A4: Based on the height difference between adjacent voxel spans in the vertical direction and the height threshold in the N sets of entity parameters, the height attribute level of the voxel span is marked.

[0117] wherein the mark bits include marks of the slope attribute level and marks of the height attribute level.

[0118] It can be understood that the height difference between the adjacent voxel spans in the vertical direction is the distance between a voxel span and the voxel span above it.

[0119] Step A5: determining the slope attribute level of the voxel span based on the slope of the voxel span and the slope threshold in the N sets of entity parameters.

[0120] Step A6: determining the height attribute level of the voxel span based on the height difference between the adjacent voxel spans in the vertical direction and the height threshold in the N sets of entity parameters.

[0121] Step A7: determining the entity attribute level of the voxel span as the higher attribute level between the slope attribute level of the voxel span and the height attribute level of the voxel span.

[0122] wherein the mark bits include marks of the entity attribute level.

[0123] It can be understood that in this scheme, the slope attribute level and the height attribute level can be combined into the entity attribute level mark.

[0124] Exemplarily, when the attribute levels of the slope and the height are combined, the larger one is combined in the direction of limiting the entity, for example, if any mark of the attribute levels of the slope and the height is all 0, the mark of the other attribute level is combined; if there is no all 0 in the marks of the attribute levels of the slope and the height, the larger one is taken as the combined mark.

[0125] For example, the mark of the slope level is 1000 and the mark of the height level is 0000, and the entity attribute mark is 1000.

[0126] Exemplarily, Figure 5 A schematic diagram of a mark bit provided by an embodiment of the present disclosure is shown in the figure, wherein 31-24 bits in 32 bits of one byte can be used to mark the height attribute level of the walking height, 23-16 bits can be used to mark the slope attribute level of the walking slope, and 15-0 bits can be used to mark other information. 31-24 bits of one byte can also be used to mark the entity attribute level, and other bits can be used to mark other information.

[0127] In the embodiment of the present disclosure, the entity level of each entity can be marked based on the format of the mark bit, and the entity attribute level of each voxel span, the entity attribute level of the region, and the entity attribute level of the polygon can also be marked based on the format of the mark.

[0128] Figure 6 A schematic diagram of a slope attribute mark of a voxel span provided by an embodiment of the present disclosure is shown in the figure, wherein the mark of the slope attribute level of the voxel span is marked in 23-16 bits of one byte. Figure 6As shown in , assuming that the slope threshold includes 4 levels, namely Lv1 slope threshold is less than or equal to 60 degrees, Lv2 slope threshold is less than or equal to 45 degrees, Lv3 slope threshold is less than or equal to 30 degrees, Lv4 slope threshold is less than or equal to 15 degrees, you can follow Figure 6 , Step 01: Based on the Lv1 slope threshold, voxel spans are divided into walkable and non-walkable. Non-walkable voxel spans are not marked, and walkable voxel spans are marked as 000. Step 02: Based on the Lv4 slope threshold, the voxel span marked as 000 is split into voxel span set 000 and voxel span set 100. Step 03: Based on the Lv3 slope threshold, the voxel span marked as 100 is split into voxel span set 100 and voxel span set 010. Step 04: Based on the Lv2 slope threshold, the voxel span marked as 010 is split into voxel span set 010 and voxel span set 001. Afterwards, the voxel span marked as 000 is recorded as Lv1 voxel span, indicating that all entities can walk, the voxel span marked as 001 is recorded as Lv2 voxel span, indicating that Lv1 entities can walk, the voxel span marked as 010 is recorded as Lv3 voxel span, indicating that Lv1 entities and Lv2 entities can walk, and the voxel span marked as 100 is marked as Lv4 voxel span, indicating that Lv1 entities, Lv2 entities, and Lv3 entities can walk.

[0129] Figure 7 A schematic diagram of a height attribute mark of a voxel span provided by an embodiment of the present disclosure, such as Figure 7 As shown in , assuming that the height threshold includes 4 levels, namely Lv1 height threshold is less than or equal to 20, Lv2 height threshold is less than or equal to 15, Lv3 height threshold is less than or equal to 10, Lv4 height threshold is less than or equal to 5, you can follow Figure 7In the marking manner shown in the table, step 01: based on the Lv1 height threshold, the voxel span is divided into walkable and non-walkable, the non-walkable voxel span is not marked, and the walkable voxel span is marked as 000. Step 02: based on the Lv4 height threshold, the voxel span marked as 000 is split into voxel span set 000 and voxel span set 100. Step 03: based on the Lv3 height threshold, the voxel span marked as 100 is split into voxel span set 100 and voxel span set 010. Step 04: based on the Lv2 height threshold, the voxel span marked as 010 is split into voxel span set 010 and voxel span set 001. Then, the voxel span marked as 000 is recorded as the Lv1 voxel span, indicating that all entities can walk, the voxel span marked as 001 is recorded as the Lv2 voxel span, indicating that the Lv1 entity can walk, the voxel span marked as 010 is recorded as the Lv3 voxel span, indicating that the Lv1 entity and the Lv2 entity can walk, and the voxel span marked as 100 is recorded as the Lv4 voxel span, indicating that the Lv1 entity, the Lv2 entity, and the Lv3 entity can walk.

[0130] It should be noted that the above Figure 6 and Figure 7 Both are to determine the walkable voxel span set and the non-walkable voxel span set from the whole, wherein Figure 6 and Figure 7 Both are to split the voxel span set from the attribute threshold with the lowest limit except the Lv1 threshold. Since the thresholds of the slope and the height have different meanings, Figure 6 The splitting direction of the above is from right to left, Figure 7 The splitting direction of the above is from left to right. The 000 in the marking of the last row is the first-level voxel span, and the rest Figure 6 The marking order from left to right in the above is the marking bit corresponding to the level order of the voxel span divided according to the splitting order, Figure 7 The marking order from right to left in the above is the marking bit corresponding to the level order of the voxel span divided according to the splitting order.

[0131] Based on the scheme, the slope attribute level and the height attribute level of the entity walkable voxel span can be marked respectively, or the slope attribute level and the height attribute level of the entity walkable voxel span can be marked in combination to indicate the entity attribute of the entity through which each voxel span can pass, so as to facilitate subsequent pathfinding based on the entity attribute level of each voxel span. If the form of combined marking is adopted, the probability of a large number of fragmented areas can be reduced, and the complexity of the subsequent processing flow can be reduced.

[0132] Optionally, the N groups of entity parameters include N levels of entity attribute thresholds, and the entity attribute threshold of the i-th level is less restrictive than the entity attribute threshold of the i+1-th level. Furthermore, in the method for generating a fused pathfinding grid provided in the embodiment of the present disclosure, the above-mentioned S101 may specifically include the following steps B1, B2, and B3:

[0133] Step B1: For voxel spans that do not meet the level 1 entity attribute threshold, no level labeling is performed.

[0134] For example, the first entity attribute threshold is 60 degrees among 15 degrees, 30 degrees, 45 degrees, and 60 degrees. For voxel spans with a slope greater than 60 degrees, no entity can pass through.

[0135] Step B2: The voxel span that meets the Nth level entity attribute threshold is recorded as the first-level voxel span, and the flag bit of the first-level voxel span is marked as all 0s.

[0136] Exemplarily, the Nth entity attribute threshold is 15 degrees among 15 degrees, 30 degrees, 45 degrees, and 60 degrees, and each entity can pass through the voxel span with a slope less than 15 degrees.

[0137] Step B3: For the voxel span that meets the entity attribute threshold of level i but does not meet the entity attribute threshold of level i+1, record it as the voxel span of level i+1, mark the penultimate i-1 bit in the mark bit of the voxel span of level i+1 as 1, and mark the other bits in the mark bit as 0, 1≤i <N。

[0138] For example, if the level 1 slope threshold is met but the level 2 slope threshold is not met (45<slope of voxel span≤60 degrees), it is recorded as the level 2 voxel span (Lv2 voxel span), and the penultimate bit of the slope mark of the Lv2 voxel span is marked as 1, and the other bits of the slope mark are marked as 0.

[0139] It should be noted that, in the embodiment of the present disclosure, if the entity type angle in the game scene. Entity parameters may overlap, for example, the slope limit of the target entity is: Lv2 entity < target entity <Lv3实体;目标实体的高度限制为:目标实体=Lv1实体;则可以将实体分为两组进行融合寻路网格的生成,每一组的生成方式是相同的。

[0140] Table 2 is an exemplary table of level division provided by an embodiment of the present disclosure, which includes the corresponding relationships between threshold values, entity levels and labels, area levels and labels, and walkable entity levels at each area level.

[0141] Table 2

[0142]

[0143] Based on this solution, when marking the entity attribute level of the voxel span, each voxel span can also be marked based on the above method, that is, the level and marking position of the voxel span can be quickly determined based on the size relationship between the height and slope in the voxel span attribute and each entity threshold.

[0144] Regional expansion:

[0145] It should be noted that in some games, the walking radius of entities varies, which has an important impact on the performance of pathfinding. Therefore, in the embodiment of the present disclosure, the non-walkable areas of entities other than Lv1 can be expanded to obtain a more accurate walkable area of ​​each entity.

[0146] Optionally, in the method for generating a fused navigation grid provided by an embodiment of the present disclosure, the entity parameters include an entity radius.

[0147] Furthermore, after the above S102, the following S106 and S107 may be included:

[0148] S106. Determine a non-walkable area of ​​the corresponding entity in the multi-level entity attribute area based on the target entity parameters.

[0149] The target entity parameters are any set of entity parameters except the first-level entity parameters in the N sets of entity parameters, and the entity attribute labels of each voxel span in the same unwalkable area are the same.

[0150] It can be understood that after determining the multi-level entity attribute area, the area in which the entity corresponding to a single entity parameter cannot walk in the walkable area can be determined based on the slope threshold and height threshold of the entity.

[0151] S107 . Based on the entity radius in the target entity parameters, perform regional expansion on the non-walkable area of ​​the entity corresponding to the target entity parameters.

[0152] Based on this scheme, after generating the walkable multi-level entity attribute area, the non-walkable area in the multi-level entity attribute area can be determined for each entity, and then the determined non-walkable area can be expanded based on the entity radius to obtain a more accurate area where the entity can walk.

[0153] Optionally, in the method for generating a fused navigation grid provided in an embodiment of the present disclosure, the above-mentioned S107 may be specifically performed by the following S71:

[0154] S71. If the entity radius in the target entity parameters is larger than the unit voxel width, then the region where the entity cannot walk corresponding to the target entity parameters is expanded.

[0155] It can be understood that if the entity radius is greater than the unit voxel width, the entity walkable region determined based on the height threshold and the slope threshold is greater than the region that the entity can actually walk.

[0156] It can be understood that in the embodiments of the present disclosure, for the N groups of entity parameters, if the radius of each entity is greater than the unit voxel span, at most N times of the above-mentioned region expansion processing needs to be performed.

[0157] Based on this scheme, in the case that there is an entity parameter with an entity radius greater than the unit voxel width in the N groups of entity parameters, the region expansion processing can be performed on the non-walkable region of each entity with an entity radius greater than the unit voxel width, so that the determined walkable region is a region more suitable for the entity radius.

[0158] Optionally, the S71 in the method for generating a fusion pathfinding grid provided by the embodiments of the present disclosure can be performed through the following step C.

[0159] Step C: if the entity radius / unit voxel width is rounded up to M, then the M times of the following step C1 and step C2 are performed on each non-walkable region of the entity corresponding to the target entity parameter.

[0160] That is, in the embodiments of the present disclosure, first, the expansion times of the region to be expanded are determined according to the entity radius and the voxel width, and the expansion times are equal to the integer voxel number obtained by dividing the entity radius by the unit voxel width. Then, step C1 and step C2 are repeated M times to expand the region.

[0161] Step C1: determine whether there is a first neighbor voxel span different from the entity attribute level marker of the first voxel span in the 8-direction neighbors of the first voxel span.

[0162] Among them, the first voxel span is a voxel span in the first region, and the first region is any one of the non-walkable regions of the entity corresponding to the target entity parameter.

[0163] Step C2: adopt the entity attribute level of the first neighbor voxel span as the entity attribute level of the first voxel span.

[0164] Figure 8 A processing logic diagram for region expansion provided by the embodiments of the present disclosure is as follows: Figure 8As shown in , the current voxel span set corresponding to the to-be-expanded area can be traversed, and for each voxel span in the set, its eight-way neighbor voxel spans are traversed. If the neighbor voxel span exists and its entity attribute level is different from that of the to-be-expanded area, the neighbor voxel span is marked as "to be expanded." After traversing the voxel span set of the to-be-expanded area, the expanded voxel span set is obtained, and then the voxel spans marked as to-be-expanded in the expanded voxel span set are assigned a mark with the same entity attribute level as that of the to-be-expanded area.

[0165] Figure 9 A schematic diagram of a region expansion provided by an embodiment of the present disclosure, such as Figure 9 As shown in , assuming the fill pattern is The area to be expanded is area 1, the area where Lv2 entities cannot walk. When the radius of Lv2 entities is greater than the unit voxel width, the part where Lv2 entities cannot walk is actually larger than area 1. Therefore, the area is expanded based on area 1 and the surrounding voxels are given the same attributes as the span, resulting in area 1 and the area filled with Area 2, so the area where Lv2 entities cannot walk is Area 1 + Area 2.

[0166] Based on this scheme, the non-walkable area of ​​each entity can be expanded according to the above-mentioned area expansion method, and the entity attribute level of the determined voxel span set to be expanded can be updated, so as to facilitate the subsequent accurate determination of the entity's walkable area based on the updated entity attribute level.

[0167] Boundary voxel span markers

[0168] It is understandable that, considering the entity radius, if the distance from an entity to the boundary is less than the entity radius, the entity cannot walk. Therefore, the boundary voxel span can be re-marked after the region expansion to make the determined boundary more accurate.

[0169] Optionally, defining the boundary voxel span includes a first boundary voxel span and a second boundary voxel span; the first boundary voxel span indicates the voxel span with unconnected neighboring voxel spans in the 8-direction; the second boundary voxel span indicates the voxel span above which one cannot walk.

[0170] Furthermore, in the method for generating a fused navigation grid provided by an embodiment of the present disclosure, when the entity radius of the j-th level entity is greater than the unit voxel width, the method may further include at least one of the following steps D1, D2, and D3:

[0171] Step D1: In the case of j=1, mark the voxel span whose distance to the first boundary voxel span or the second boundary voxel span is less than the entity radius of the j-th level entity as impassable.

[0172] Step D2: In the case of j≠1, the level 1 entity is allowed to walk, and the voxel span whose distance to the first boundary voxel span is less than the entity radius of the level j entity is marked as the level j voxel span.

[0173] Step D3: When j≠1, if the distance from the second voxel span to the second boundary voxel span is less than the entity radius of the j-th level entity, traverse the 8-way neighbors of the second voxel span to determine whether there is a second neighbor voxel span with a different entity attribute level mark from the second voxel span; use the entity attribute level of the second voxel span to mark the entity attribute level of the second neighbor voxel span.

[0174] Figure 10 A schematic diagram of a voxel span provided in an embodiment of the present disclosure is shown in FIG. Figure 10 As shown, for Lv1 entities: unsatisfied voxel spans are directly marked as impassable, that is, filled with The area of ​​​​includes the voxel span, which no longer parameters the subsequent mesh generation process. Assume that the filling is If an area allows Lv1 entities to walk, but does not meet the walking radius of Lv2 entities, you can assign this voxel span to the Lv2 attribute tag. The same process can be applied to non-Lv1 entities.

[0175] Figure 11 A logical schematic diagram of voxel span classification is provided for an embodiment of the present disclosure. It can be understood that in the embodiment of the present disclosure, in the voxelization stage, all voxel spans can be divided into two categories, namely non-walkable voxel spans and walkable voxel spans, and then the walkable voxel spans are divided into multiple levels of voxel spans such as Lv1 voxel span, Lv2 voxel span, and Lv3 voxel span based on entity parameters.

[0176] Based on this solution, different types of boundary voxel spans can be marked in consideration of the entity radius, so that the level of the determined voxel span is more accurate.

[0177] It can be understood that in the embodiment of the present disclosure, the region generation stage may include two types of processing: generating multi-level regions and processing fragment regions.

[0178] 1) Multi-level region generation

[0179] Optionally, in the method for generating a fused navigation grid provided in an embodiment of the present disclosure, the above-mentioned S102 may be specifically performed by the following S20:

[0180] S20 , for each level of the marked entity attribute level, perform region division according to the following processing method for the k-th level voxel span to obtain multi-level entity attribute regions.

[0181] Step E1: If the number of neighboring voxel spans that the third voxel span can connect to is less than 8, or the entity attribute level labels of the third voxel span and its neighboring voxel spans are different, then the third voxel span is marked as a boundary.

[0182] The third voxel span is any voxel span in the k-th level voxel span.

[0183] Step E2: Determine the distance from each voxel span in the k-th level voxel span to the boundary to generate a distance field.

[0184] Step E3: Divide the k-th level voxel span into different regions based on the distance field, and mark the entity attribute level of each region.

[0185] The entity attribute level of the voxel span in the same region is the same, and the entity attribute level of the voxel span in the region is equal to the entity attribute level of the region.

[0186] For example, the region divided by the k-th level voxel span may be marked as the k-th level region.

[0187] Specifically, the voxel span with the largest distance from the voxel span to the boundary in the k-th level voxel span may be used as the valley bottom, and the voxel span in the k-th level voxel span may be divided into different regions based on the watershed algorithm.

[0188] Exemplarily, the above-mentioned steps E1 to E3 are respectively performed on the Lv1 voxel span set, the Lv2 voxel span set, and the Lv3 voxel span set obtained in the voxelization stage.

[0189] It should be noted that after the above processing, all walkable voxel span sets are divided into different areas, and the voxel spans in each area have the same entity labeling attributes, where adjacent areas can have the same entity labeling attributes or different entity labeling attributes.

[0190] 2) Fragmentation area processing

[0191] Typically, during the region generation process, small island regions and non-island regions are generated. Small island regions can be directly filtered out using traditional methods. For non-island regions, the present embodiment provides a fragmentation processing method based on region area.

[0192] Optionally, in the method for generating a fused navigation grid provided in the embodiment of the present disclosure, after dividing the multi-level regions, the following S108 or S109 may be further included:

[0193] S108. If the non-island area obtained after the area division includes a second area whose area is smaller than the first area threshold, the second area is merged into an adjacent third area, and the entity attribute level of the second area is updated to the same entity attribute level as the entity attribute of the third area.

[0194] S109. If the non-island area obtained after the area division includes a fourth area whose area is greater than or equal to the first area threshold and less than the second area threshold, and there is no area with the same entity attribute level within the preset range of the fourth area, then the fourth area is not processed.

[0195] It can be understood that neither fusion processing nor filtering processing is performed on the fourth region, so that the independence of the fourth region can be retained, thereby ensuring the integrity of the region boundary.

[0196] Based on this solution, in order to distinguish the non-island type fragment areas generated after generation, the particularly small areas can be directly merged into other larger areas based on the area, and the entity attribute level of the fragment area can be changed to the entity attribute level of the merged area, so as to retain the independence of the areas that are not particularly small.

[0197] Edge generation and simplification:

[0198] After the region generation phase is complete, for example, after merging the fragmented regions, high-precision edges can be calculated for each region and extracted, for example, by using the WalkContour algorithm to extract the corner points of the region edge voxel span. Generally, two types of edges can be extracted: external edges and internal edges. External edges are edges where the target segment belongs to only a single region, while internal edges are edges shared by at least two regions.

[0199] Figure 12 This is a schematic diagram of an edge of a region provided by an embodiment of the present disclosure, such as Figure 12 As shown in, including non-walkable areas, area 1, area 2 and area 3, after edge extraction, it can include Figure 12 Among them, the boundary extra points are used to mark the walkable area, and the key points are used to mark the boundary points in the walkable area.

[0200] It can be understood that the edge data obtained after edge extraction is a continuous set of points with a voxel width of 1 between adjacent points. This high data density is not conducive to the generation of subsequent pathfinding networks, which means that the edges need to be simplified. For internal edges, the simplification method in related technologies is to retain points where the ID of adjacent areas changes when walking along the area boundary and retain points where the external edge enters the internal edge, that is, retain key points. For external edges, the simplification method in related technologies is to retain additional boundary points in addition to key points.

[0201] Optionally, in an embodiment of the present disclosure, internal edges may be defined as including first-type internal edges and second-type internal edges, where the areas on both sides of the first-type internal edges belong to the same entity attribute level; and the areas on both sides of the second-type internal edges belong to different entity attribute levels.

[0202] Furthermore, in the method for generating a fused navigation grid provided by the embodiment of the present disclosure, the above-mentioned S104 can be specifically performed by the following S41 and S42, or S41 and S43:

[0203] S41 . After extracting the key points, determine the edge type of a first edge formed between a first key point and a second key point.

[0204] The first key point and the second key point are any two adjacent key points.

[0205] S42: If the first edge belongs to the first type of internal edge, retain the first key point and the second key point.

[0206] That is, for the edges between regions of the same level, key points where the IDs of adjacent regions change while walking along the region boundary are retained.

[0207] S43. If the first edge belongs to the second type of internal edge, determine whether the target distances of other points between the first key point and the second key point to the first edge are greater than or equal to the distance threshold, and the point with the farthest target distance is the retained key point.

[0208] For example, for edges between regions of different levels, when the pathfinding entity level is greater than 1, the probability of the inter-region edge being an external edge during pathfinding is high. Once it is an external edge, it needs to be as accurate as possible, so the high precision of the edges between regions of different levels is maintained as much as possible. For example, the edges between regions of different levels can be simplified based on the Douglas-Peucker algorithm: first, the edges formed by all key points are used as the initial simplified edges; then all simplified edges are traversed. When the edge between the first key point and the second key point of the target simplified edge belongs to an edge between regions of different levels, the points between the first key point and the second key point are traversed (fixed vertices of each voxel span). If at least one point between the first key point and the second key point has a target distance to the target line greater than or equal to the distance threshold, then the point with the farthest target distance among the at least one point is added as a new key point (referred to as the third key point, also called a simplified point or insertion point) between the first key point and the second key point. The target line is the line between the first key point and the second key point. Afterwards, the above process is repeated for the line between the first key point and the third key point, and the line between the third key point and the second key point, until all edges are traversed.

[0209] Figure 13 A comparative schematic diagram of edge simplification processing provided by an embodiment of the present disclosure, wherein: Figure 13 In (a), the edge of the region is deformed, which will cause certain errors when finding the path. Figure 13 In (b), the regions retain relatively complete inter-region edges, and the error in pathfinding is small.

[0210] Based on this scheme, in the edge simplification stage of generating the pathfinding grid, the internal edges can be re-classified into new categories, and different edge simplification methods can be used for different types of internal edges, so that more accurate inter-regional edges can be obtained, thereby reducing the errors in pathfinding based on the pathfinding network generated by simplifying the edges, thereby improving the accuracy of pathfinding.

[0211] It should be noted that if there are areas with concave polygonal edges, the concave polygons can be split into triangles, and then the triangles can be reassembled into convex polygons. The bit mark of the concave polygon is then added to the convex polygon. This allows the entity to filter the area when pathfinding based on the navigation grid.

[0212] Edge point adsorption:

[0213] For game scenes with a relatively large area, if the navigation grid is generated directly based on the entire area of ​​the game scene, the processing time will be long. The entire area can be divided into tiles, and the navigation grid can be generated and managed based on the tiles.

[0214] Optionally, the method for generating a fused navigation grid provided in an embodiment of the present disclosure may further include the following step S100 before the above step S101:

[0215] S100: If the area of ​​the game scene is greater than a third area threshold, divide the game scene into uniform tiles along the XZ plane.

[0216] The third area threshold may be manually set by a developer or configured by default, and this embodiment of the present disclosure does not specifically limit this.

[0217] Furthermore, the above-mentioned S101 can be executed by the following S101a:

[0218] S101a, based on N groups of entity parameters corresponding to entities in the game scene, mark the entity attribute level of the voxel span in each tile.

[0219] It should be noted that, in the embodiments of the present disclosure, any of the above steps can be processed based on tiles.

[0220] Based on the scheme, in the case that the area of the game scene is large, the game scene can be divided into the form of tiles, and the generation of the fusion pathfinding grid based on the tiles can improve the generation efficiency of the fusion pathfinding grid.

[0221] Further, the fusion pathfinding grid generation method provided by the embodiments of the present disclosure can further include the following S110 after S104:

[0222] S110, edge points of the edge of the multi-level entity attribute region falling on the edge of the tile are edge adsorbed to adjust the shape of the multi-level entity attribute region.

[0223] It should be noted that when the pathfinding grid is generated by splitting into tiles, if a region boundary crosses two adjacent tiles, an edge point misplacement phenomenon will occur. This phenomenon does not affect the subsequent process of pathfinding grid generation, but it will cause more polygons to be searched when using the fusion pathfinding grid for pathfinding, thereby reducing the pathfinding efficiency. Therefore, in the embodiments of the present disclosure, the edge points can be adsorbed for the case that the edge of the multi-level entity attribute region falls on the edge of the tile, thereby adjusting the shape of each region to reduce the edge point misplacement and improve the pathfinding efficiency of the pathfinding grid.

[0224] Exemplarily, Figure 14 An edge point misplacement phenomenon diagram is provided for the embodiments of the present disclosure. As shown in Figure 14 (a) of FIG. 1, each adjacent square is a divided tile, and the polygonal region shown in the figure is a generated multi-level entity attribute region. Some edges of the multi-level entity attribute region fall on the edge of the tile. Points of the same region falling on adjacent tiles can not be in the same position, thereby causing edge misplacement, such as a1 and a2, a3 and a4, b1 and b2, and b3 and b4.

[0225] Based on the scheme, if the pathfinding grid is generated based on the tile, after the edge of the multi-level entity attribute region is simplified, the edge points of the edge of each region falling on the edge of the tile can be edge adsorbed to adjust the shape of the multi-level entity attribute region, thereby improving the pathfinding efficiency of the generated fusion pathfinding grid.

[0226] Specifically, the S110 in the fusion pathfinding grid generation method provided by the embodiments of the present disclosure can be executed through the following steps F1 to F5:

[0227] Step F1: Determine the first direction of the first tile edge.

[0228] The first tile edge is the tile edge where the first target adsorption point falls on the first tile. The first target adsorption point is any point on the edge of the target area where the target area falls. The target area is any area in the multi-level entity attribute area. The first direction can be upward, downward, left, or right.

[0229] Step F2: Acquire a second tile adjacent to the first tile in the first direction.

[0230] Step F3: Acquire a target anchor point on the edge of the second tile in the opposite direction to the first direction on the second tile, which has the shortest distance from the first point to be adsorbed.

[0231] Step F4: If the coordinate relationship between the first point to be adsorbed and the second point to be adsorbed on the edge of the first tile in the first direction is the same as the coordinate relationship between the target anchor point and the second point to be adsorbed in the first direction, then the target anchor point is determined to be the adsorption position of the first point to be adsorbed.

[0232] The second point to be adsorbed and the first point to be adsorbed are two adjacent points in the same polygon.

[0233] That is to say, the coordinate relationship between the first point to be adsorbed and the second point to be adsorbed before it is adsorbed to an anchor point and the coordinate relationship between the first point to be adsorbed and the second point to be adsorbed after it is adsorbed to an anchor point cannot change, which can prevent the polygon formed by the first point to be adsorbed and the second point to be adsorbed from deformation.

[0234] It can be understood that if the size relationship between the coordinate values ​​of the first point to be adsorbed and the second point to be adsorbed on the edge of the first tile in the first direction is different from the size relationship between the coordinate values ​​of the target anchor point and the second point to be adsorbed in the first direction, it is determined that the adsorption of the first point to be adsorbed has failed, and the first adsorption point can be used as the adsorption anchor point corresponding to the edge of the second tile and cached to the first tile edge of the first tile.

[0235] Step F5: updating the coordinates of the first point to be adsorbed to the coordinates of the adsorption anchor point of the adsorption position.

[0236] Exemplarily, after edge generation and edge simplification, the points to be adsorbed that fall on the edge of the tile are traversed. For each point to be adsorbed, the direction of the tile edge (i.e., up, down, left, and right) is calculated, and then the neighbor tile in that direction is obtained. If there is no neighbor tile, no processing is performed. If there is a neighbor tile, the adsorption anchor points in the opposite direction on the neighbor tile are traversed. For example, if the adsorption point is on the left edge of the current tile, it is necessary to traverse the adsorption anchor points on the right edge of the left tile, and obtain the adsorption anchor point closest to the point to be adsorbed as the adsorption position. If the distance from the adsorption anchor point to the point to be adsorbed is less than a certain threshold and will not be interspersed between the points on both sides of the point to be adsorbed, the coordinates of the point to be adsorbed are set to the adsorption position. Otherwise, it is considered that the adsorption of the point to be adsorbed has failed, and the nearest neighbor tile does not exist or has not been processed, then the point to be adsorbed is converted into an adsorption anchor point and cached to the corresponding edge of the current tile.

[0237] Combine Figure 14 (a) in the figure, after the above adsorption process is performed on the edge points, we can get Figure 14 The effect shown in (b) is that a2 is adsorbed onto a1, a3 is adsorbed onto a4, b2 is adsorbed onto b1, and b3 is adsorbed onto b4.

[0238] Based on this solution, when performing edge point adsorption, adsorption can be performed based on the adsorption anchor points on the neighboring tiles, thereby adjusting the shape of the polygon, reducing the number of polygons, and reducing the number of polygons that need to be traversed during pathfinding, thereby improving the pathfinding effect based on the fused training grid obtained after this processing.

[0239] Parallel processing

[0240] Optionally, in the method for generating a fused navigation grid provided in an embodiment of the present disclosure, the above-mentioned S110 may be performed by the following steps G1 and G2:

[0241] Step G1: Divide the tiles into a first group of tiles and a second group of tiles in a chessboard-like distribution, and use the edge points of the multi-level entity attribute area that fall on the edge of the tiles of the first group as adsorption anchor points.

[0242] The tiles in the second group are neighbor tiles of the tiles in the first group.

[0243] Step G2: For the points to be adsorbed that fall on the edge of the second group of tiles, edge adsorption is performed based on the adsorption anchor points generated by the first group of tiles.

[0244] Figure 15 A schematic diagram of a tile grouping provided in an embodiment of the present disclosure is shown in FIG. Figure 15As shown in , both groups of tiles are distributed in a chessboard pattern, where the tiles marked as 1 are the first group of tiles, and the tiles marked as 2 are the second group of tiles. It can be understood that the points to be adsorbed on the first group of tiles are processed first, and the first group of tiles cannot find neighboring tiles. Therefore, the points to be adsorbed on the first group of tiles are not adsorbed at the edge points, and are all converted into adsorption anchor points of the second group of tiles. The second group of tiles is adsorbed based on the adsorption anchor points generated by the first group of tiles, thereby adjusting and optimizing the shape of the polygon.

[0245] Specifically, in the disclosed embodiment, tiles have an adsorption dependency relationship, and tiles can be divided into two groups for processing: the first group of tiles is distributed in a checkerboard pattern, consisting of tiles separated by one tile in all directions within the region; the second group of tiles consists of the neighboring tiles of the first group, i.e., the tiles in the region other than the first group of tiles. The first group of tiles is processed first, and the neighboring tiles of the first group have not yet been processed, i.e., the anchor points of the first group of tiles cannot be found for adsorption. Therefore, all points on the edges of the tiles in the first group are adsorption anchor points. After all the tiles in the first group have been processed, the second group of tiles undergoes edge adsorption based on the adsorption anchor points generated by the first group of tiles to adjust and optimize the polygon shape.

[0246] Based on this solution, based on the adsorption dependency between tiles, the tiles can be divided into two groups and processed in the above-mentioned parallel manner, which reduces the processing time and improves the efficiency of generating the fused pathfinding grid.

[0247] It can be understood that in the embodiment of the present disclosure, a fused navigation grid is generated, which is composed of polygons, each polygon is marked with a set of mark bits, indicating the maximum walking slope grouping and maximum walking height grouping supported by the polygon; each entity is also marked with a set of mark bits, indicating the walking slope grouping and walking height grouping of the entity; in the navigation stage, the nearest polygon is found, and an AND operation is performed based on the mark bits of the entity and the mark bits of the polygon to determine whether the entity can pass through the upper surface of the polygon, thereby filtering out polygons that cannot be walked.

[0248] For example, Figure 16 A logical diagram of a pathfinding method provided by an embodiment of the present disclosure, such as Figure 16 As shown in (a), the fused navigation grid corresponding to the game scene includes polygons 1, 2, and 3. The game scene includes entity 1, where the markers include markers for the slope attribute level and the height attribute level:

[0249] The mark bits of polygon 1 are: 00000100*00000100*00000000*000000000;

[0250] The mark bit of polygon 2 is: 00000010*00000010*00000000*000000000;

[0251] The mark bits of polygon 3 are: 00001000*00000100*00000000*000000000;

[0252] The tag bits of entity 1 are: 00000111*00000011*00000000*000000000.

[0253] Perform AND operations on the mark bit of entity 1 and the three polygons mentioned above, and we get Figure 16 In the result of (a), the mark bit of polygon 3 and the mark bit of entity 1 are all 0 after AND operation, and the others are not all 0. Therefore, entity 1 can pass through polygon 3, and polygon 3 can find the path for entity 1. Polygon 1 and polygon 2 do not allow entity 1 to pass through, so polygon 1 and polygon 2 can be marked as not participating in the path finding of entity 1.

[0254] like Figure 16 As shown in (b), the fused navigation grid corresponding to the game scene includes polygons 1, 2, and 3. The game scene includes entity 1, where the mark bit includes the entity attribute level:

[0255] The mark bits of polygon 1 are: 00000100*00000000*00000000*000000000;

[0256] The mark bit of polygon 2 is: 00000010*00000000*00000000*000000000;

[0257] The mark bits of polygon 3 are: 00001000*00000000*00000000*000000000;

[0258] The tag bits of entity 1 are: 00000111*00000000*00000000*000000000.

[0259] Perform AND operations on the mark bit of entity 1 and the three polygons mentioned above, and we get Figure 16 In the result of (b), the mark bit of polygon 3 and the mark bit of entity 1 are all 0 after AND operation, and the others are not all 0. Therefore, entity 1 can pass through polygon 3, and polygon 3 can find the path for entity 1. Polygon 1 and polygon 2 do not allow entity 1 to pass through, so polygon 1 and polygon 2 can be marked as not participating in the path finding of entity 1.

[0260] It should be noted that the above Figure 16The attribute level flag in (b) can be based on Figure 16 The mark bit of the slope attribute level in (a) and the mark bit of the height attribute level are fused together, for example:

[0261] Polygon 1: 00000100 and 00000100 are merged into 00000100;

[0262] Polygon 2: 00000010 and 00000010 are merged into 00000010;

[0263] Polygon 3: 00001000 and 00000100 are merged into 00001000;

[0264] Entity 1: 00000111 and 00000011 merged into 00000111.

[0265] It should be noted that, when generating a fused navigation mesh, the embodiment of the present disclosure performs corresponding processing at different stages compared to related technologies: 1) In the voxelization stage, the slope attribute of the voxel span is marked according to the direction of the triangle normal, and the height attribute of the voxel span is marked according to the height difference between the voxel spans in the vertical direction. Based on this mark, it can be judged whether the voxel span is passable for different entities. 2) When performing region generation, the embodiment of the present disclosure adapts entities of different radii through an expansion algorithm and boundary marking. On this basis, the voxel span is graded based on the entity attributes of the voxel span, and regions are generated for each level of voxel span respectively. This method is used to migrate the bit mark from the voxel to the region. 3) In the navigation mesh generated by the embodiment of the present disclosure, for different levels of navigation entities, part of the internal edges of the mesh will be converted into external navigation boundaries for use. This type of edge needs to retain a high degree of precision, but the traditional navigation mesh generation method only retains the key points of the internal edges. The disclosed embodiment simplifies the edges between regions of different levels based on the Douglas Peucker algorithm to ensure that such edges have high accuracy when used as external edges. 4) For large-scale pathfinding grid generation, the entire scene is divided into uniform tiles, and edge point misalignment often occurs across tile areas, affecting the efficiency of pathfinding search. The disclosed embodiment adsorbs edge points based on a four-way edge anchor cache and a query of the common edge anchor points of the nearest neighbor tiles to adjust the polygon shape, and removes the dependencies between neighbor tiles through chessboard layout grouping for lock-free parallel processing. 5) In the disclosed embodiment, when polygon generation is performed, the bit mark of the area is further migrated to the pathfinding polygon to provide a data basis for pathfinding filtering.

[0266] It's understandable that when the related art navigation mesh generation methods are used to generate a navigation mesh for a single scene with multiple entity types, each entity type must complete the entire process, from voxelization to detail mesh generation, separately. This can be time-consuming for large scenes. In the fused navigation mesh generation process provided by the present embodiment, for multiple sequentially arranged entity types, all stages except the region generation stage only need to be performed once, ensuring efficient navigation mesh generation. Furthermore, the fused navigation mesh can serve as the data foundation for pathfinding across multiple different entities, rather than generating a separate navigation mesh for each entity as in the related art. Typically, the size of the fused navigation mesh is roughly the same as the largest single entity in a single-entity navigation mesh. When two entity types are included, the fused navigation mesh generation method can reduce the navigation mesh size by up to approximately 50%. With more sequentially arranged entities, the theoretical compression rate is higher, effectively reducing the storage pressure and cost of the pathfinding system's memory and hard disk. Based on edge point adsorption and checkerboard tile grouping, the present embodiment optimizes the morphology of pathfinding polygons at the edges of some tiles while ensuring high tile parallelization, improving pathfinding search efficiency.

[0267] It should be noted that the method for generating a fused navigation mesh provided in the embodiments of the present disclosure can be executed by a device for generating a fused navigation mesh, or by a control module within the device for generating a fused navigation mesh that executes the method. The present embodiments use the method for generating a fused navigation mesh performed by the device for generating a fused navigation mesh as an example to illustrate the device for generating a fused navigation mesh provided in the embodiments of the present disclosure.

[0268] Figure 17 A schematic diagram of a structure of a device for generating a fused navigation grid provided by an embodiment of the present disclosure, such as Figure 17As shown, the fused navigation grid generation device 800 includes: a level marking module 801, an area generation module 802, an edge simplification module 803, a polygon reorganization module 804, and a grid generation module 805; the level marking module 801 is used to mark the entity attribute level of the voxel span and the entity level of each entity based on N groups of entity parameters corresponding to the entities in the game scene, where N is an integer greater than 1; the area generation module 802 is used to generate a multi-level entity attribute area in the game scene marked with the entity attribute level based on the marked entity attribute level of the voxel span; the edge simplification module 803 is used to simplify the edges of the multi-level entity attribute area; the polygon reorganization module 804 is used to reorganize the polygons obtained after the edge simplification into a convex polygon walkable area marked with the entity attribute level; the grid generation module 805 is used to generate a fused navigation grid of entities adapted to the N groups of entity parameters based on the convex polygon walkable area marked with the entity attribute level, so that pathing is performed based on the entity level of each entity and the convex polygon marked with the entity attribute level in the fused navigation grid.

[0269] Optionally, the level marking module is specifically used to: sort the attribute thresholds of N-level entities in order of the restrictions imposed on the entities from small to large; mark the levels of the entities in the order of the entity attribute thresholds, and mark the last j-1 bits of the mark bit of the j-th level entity as 1, 1≤j≤N.

[0270] Optionally, the entity attributes include a slope threshold and a height threshold of the entity; the level marking module is specifically used to: mark the slope attribute level of the voxel span based on the slope of the voxel span and the slope threshold in N groups of entity parameters; mark the height attribute level of the voxel span based on the height difference between adjacent voxel spans in the vertical direction and the height threshold in N groups of entity parameters; wherein, the marking bit includes a mark of the slope attribute level and a mark of the height attribute level; or, determine the slope attribute level of the voxel span based on the slope of the voxel span and the slope threshold in N groups of entity parameters; determine the height attribute level of the voxel span based on the height difference between adjacent voxel spans in the vertical direction and the height threshold in N groups of entity parameters; determine the attribute level with a higher limit between the slope attribute level of the voxel span and the height attribute level of the voxel span as the entity attribute level of the voxel span; wherein, the marking bit includes a mark of the entity attribute level.

[0271] Optionally, N groups of entity parameters include N levels of entity attribute thresholds, and the restriction on the entity by the i-th level entity attribute threshold is less than the restriction on the entity by the i+1-th level entity attribute threshold; the level marking module is specifically used for: not performing level marking for the voxel span that does not meet the level 1 entity attribute threshold; recording the voxel span that meets the N-th level entity attribute threshold as the level 1 voxel span, and marking the mark bit of the level 1 voxel span as all 0s; recording the voxel span that meets the i-th level entity attribute threshold and does not meet the i+1-th level entity attribute threshold as the i+1-th level voxel span, marking the last i-1 bit in the mark bit of the i+1-th level voxel span as 1, and marking the other bits in the mark bit as 0, 1 <i<N。

[0272] Optionally, the generation device of the fused navigation grid also includes: a determination module and an area expansion module; the entity parameters include an entity radius; the determination module is used to determine the non-walkable area of ​​the corresponding entity in the multi-level entity attribute area based on the target entity parameters after the area generation module generates a walkable multi-level entity attribute area in the convex polygon game scene with the entity attribute level marked based on the entity attribute level of the marked voxel span; the area expansion module is used to perform area expansion on the non-walkable area of ​​the entity corresponding to the target entity parameter based on the entity radius in the target entity parameter; wherein the target entity parameter is any set of entity parameters in the N groups of entity parameters except the first-level entity parameters, and the entity attribute mark of each voxel span in the same non-walkable area is the same.

[0273] Optionally, the region expansion module is specifically configured to: if the entity radius in the target entity parameters is greater than the unit voxel width, then perform region expansion on the entity non-walkable region corresponding to the target entity parameters.

[0274] Optionally, the region expansion module is specifically used to: if the entity radius / voxel width is rounded up to M, then each non-walkable area of ​​the entity corresponding to the target entity parameters is processed M times in the following manner: determine whether there is a first neighbor voxel span with a different entity attribute level mark from the first voxel span among the 8-way neighbors of the first voxel span; use the entity attribute level of the first voxel span to mark the entity attribute level of the first neighbor voxel span; wherein the first voxel span is the voxel span in the first area, and the first area is any area in the non-walkable area of ​​the entity corresponding to the target entity parameters.

[0275] Optionally, the boundary voxel span includes a first boundary voxel span and a second boundary voxel span; the first boundary voxel span indicates a voxel span with an unconnected neighboring voxel span in the 8-direction; the second boundary voxel span indicates a voxel span above which one cannot walk; in the case where the entity radius of the j-th level entity is greater than the unit voxel width, the level marking module is further used to mark the voxel span whose distance to the first boundary voxel span or the second boundary voxel span is less than the entity radius of the j-th level entity as impassable when j=1; in the case where j≠1, the level 1 entity will be allowed to walk. , and the voxel span whose distance to the first boundary voxel span is less than the entity radius of the j-th level entity is marked as the j-th level voxel span; in the case of j≠1, if the distance from the second voxel span to the second boundary voxel span is less than the entity radius of the j-th level entity, traverse the 8-way neighbors of the second voxel span to determine whether there is a second neighbor voxel span with an entity attribute level different from the second voxel span; use the entity attribute level of the second voxel span to mark the entity attribute level of the second neighbor voxel span; wherein, the second voxel span is the voxel span in the area where the j-th level entity cannot walk.

[0276] Optionally, the region generation module is specifically used to: for each level of the voxel span of the marked entity attribute level, perform region division according to the following processing method of the k-th level voxel span to obtain a multi-level entity attribute region marked with the entity attribute level: if the number of neighboring voxel spans that can be connected to the third voxel span is less than 8, and the entity attribute level markings of the third voxel span and the neighboring voxel spans of the third voxel span are different, then the third voxel span is marked as a boundary, and the third voxel span is any voxel span in the k-th level voxel span; determine the distance from each voxel span in the k-th level voxel span to the boundary to generate a distance field; divide the k-th level voxel span into different regions based on the distance field, and mark the entity attribute level of each region; wherein the entity attribute level of the voxel span in the same region is the same, and the entity attribute level of the voxel span in the region is equal to the entity attribute level of the region.

[0277] Optionally, the generating device of the fused navigation grid further includes: a fragment area processing module; the fragment area processing module is used to, after dividing the k-th level voxel span into different areas based on the distance field and marking the entity attribute level of each area, if the non-island area obtained after the area division includes a second area whose area is smaller than the first area threshold, then the second area is merged into the adjacent third area, and the entity attribute level of the second area is updated to the same entity attribute level as the entity attribute of the third area; if the non-island area obtained after the area division includes a fourth area whose area is greater than or the first area threshold and less than the second area threshold, and there is no area with the same entity attribute level within the preset range of the fourth area, then the fourth area is not processed.

[0278] Optionally, the edge simplification module is specifically used to: after extracting the key points, determine the edge type of the first edge formed between the first key point and the second key point, the first key point and the second key point are any two adjacent key points; if the first edge belongs to the first type of internal edge, retain the first key point and the second key point, and the areas on both sides of the first type of internal edge belong to the same entity attribute level; if the first edge belongs to the second type of internal edge, determine that the target distance of other points between the first key point and the second key point to the first edge is greater than or equal to the distance threshold, and the point with the farthest target distance is the retained key point; the areas on both sides of the second type of internal edge belong to different entity attribute levels.

[0279] Optionally, the generation device of the fused navigation grid also includes: a tile generation module; a tile generation module, which is used to divide the game scene into uniform tiles along the XZ plane before marking the entity attribute level of the voxel span based on N groups of entity parameters corresponding to the entities in the game scene, if the area of ​​the game scene is greater than a third area threshold; the level marking module is specifically used to: mark the entity attribute level of the voxel span in each tile based on N groups of entity parameters corresponding to the entities in the game scene.

[0280] Optionally, the generation device of the fused pathfinding grid also includes: an edge point adsorption module; the edge point adsorption module is used to perform edge adsorption on the edge points of the edge of the multi-level entity attribute area that fall on the edge of the tile after simplifying the edge of the multi-level entity attribute area, so as to adjust the shape of the multi-level entity attribute area.

[0281] Optionally, the edge point adsorption module is specifically used to: determine the first direction of the edge of the first tile, the edge of the first tile is the tile edge where the first point to be adsorbed falls on the first tile, the first point to be adsorbed is any point on the edge of the target area where the edge point falls on the first tile, and the target area is any area in the multi-level entity attribute area; obtain the second tile adjacent to the first tile in the first direction; obtain the target anchor point on the edge of the second tile in the opposite direction to the first direction on the second tile with the smallest distance from the first point to be adsorbed; if the size relationship between the coordinate values ​​of the first point to be adsorbed and the second point to be adsorbed on the edge of the first tile in the first direction is the same as the size relationship between the coordinate values ​​of the target anchor point and the second point to be adsorbed in the first direction, then determine that the target anchor point is the adsorption position of the first point to be adsorbed, and the second point to be adsorbed and the first point to be adsorbed are two adjacent points in the same polygon; update the coordinates of the first point to be adsorbed to the coordinates of the adsorption anchor point of the adsorption position.

[0282] Optionally, the edge point adsorption module is specifically used to: divide the tiles into a first group of tiles and a second group of tiles in a chessboard-like distribution form, and use the edge points of the multi-level entity attribute area that fall on the edge of the tiles of the first group of tiles as adsorption anchor points; for the adsorption points that fall on the edge of the tiles of the second group of tiles, edge adsorption is performed based on the adsorption anchor points generated by the first group of tiles; wherein the tiles in the second group of tiles are neighbor tiles of the tiles in the first group.

[0283] The disclosed embodiments provide a device for generating a fused navigation mesh. The device first labels the entity levels of multiple entities in a game scene based on entity attribute thresholds, labels the levels of walkable voxel spans, and indicates which entities can pass through the voxel spans. A multi-level entity attribute region labeled with the entity attribute levels is then generated based on the voxel spans labeled with the entity attribute levels. The edges of the multi-level entity attribute region are then simplified and reorganized into convex polygonal walkable regions carrying the entity attribute levels. A fused navigation mesh is then generated based on the convex polygonal walkable regions carrying the entity attribute levels. This allows for pathfinding based on the entity levels of each entity and the convex polygons labeled with the entity attribute levels in the fused navigation mesh. Because the fused navigation mesh is a single navigation mesh, it can be used to complete pathfinding for multiple types of pathfinding entities, eliminating the need to generate a separate navigation mesh for each entity. This significantly reduces the time required for generating and debugging navigation meshes, allowing for rapid scene iteration and adjustment. Even if a scene collision occurs, the device can be regenerated at most for the number of collisions that occurred. This device can replace navigation mesh groups generated based on different entity parameters, thereby reducing memory and disk pressure on the navigation system.

[0284] The device for generating the fused pathfinding grid in the embodiments of the present disclosure may be a device, or a component, integrated circuit, or chip in a terminal. The device may be a mobile electronic device or a non-mobile electronic device. For example, the mobile electronic device may be a mobile phone, a tablet computer, a laptop computer, a PDA, an in-vehicle electronic device, a wearable device, a UMPC (ultra-mobile personal computer), a netbook, or a PDA (personal digital assistant), etc. The non-mobile electronic device may be a server, a NAS (Network Attached Storage), a PC (personal computer), a TV (television), an ATM, or an kiosks, etc., which are not specifically limited in the embodiments of the present disclosure.

[0285] The device for generating the fused pathfinding grid in the embodiments of the present disclosure may be a device having an operating system. The operating system may be an Android operating system, an iOS operating system, or other possible operating systems, which are not specifically limited in the embodiments of the present disclosure.

[0286] The generation device of the fused navigation grid provided by the embodiment of the present disclosure can achieve Figures 1 to 16 To avoid repetition, the various processes implemented in the method embodiment are not described here.

[0287] Alternatively, as Figure 18 As shown, the embodiment of the present disclosure further provides an electronic device 900, including a processor 901, a memory 902, and a program or instruction stored in the memory 902 and executable on the processor 901. When the program or instruction is executed by the processor 901, each process of the embodiment of the method for generating a fused navigation grid described above is implemented, and the same technical effect can be achieved. To avoid repetition, it will not be described here.

[0288] It should be noted that the electronic devices in the embodiments of the present disclosure include the mobile electronic devices and non-mobile electronic devices mentioned above.

[0289] Figure 19 This is a schematic diagram of the hardware structure of an electronic device implementing an embodiment of the present disclosure. The electronic device 1000 includes, but is not limited to, components such as a radio frequency unit 1001, a network module 1002, an audio output unit 1003, an input unit 1004, a sensor 1005, a display unit 1006, a user input unit 1007, an interface unit 1008, a memory 1009, and a processor 1010.

[0290] Those skilled in the art will understand that the electronic device 1000 may also include a power source (such as a battery) to power each component, and the power source may be logically connected to the processor 1010 through a power management system, thereby implementing functions such as charging, discharging, and power consumption management through the power management system. Figure 19 The electronic device structure shown in the figure does not constitute a limitation on the electronic device. The electronic device may include more or fewer components than shown in the figure, or combine certain components, or arrange the components differently, which will not be repeated here.

[0291] It should be understood that in the embodiments of the present disclosure, the input unit 1004 can include a GPU (Graphics Processing Unit) 1041 and a microphone 1042. The GPU 1041 processes image data of a still picture or a video obtained by an image capture device (such as a camera) in a video capture mode or an image capture mode. The display unit 1006 can include a display panel 1061, which can be configured in the form of a liquid crystal display, an organic light-emitting diode, etc. The user input unit 1007 includes a touch panel 1071 and other input devices 1072. The touch panel 1071 is also called a touch screen. The touch panel 1071 can include two parts of a touch detection device and a touch controller. The other input devices 1072 can include, but are not limited to, a physical keyboard, function keys (such as volume control keys, on-off keys, etc.), a trackball, a mouse, a joystick, and the like, which are not described here. The memory 1009 can be used to store software programs and various data, including but not limited to application programs and operating systems. The processor 1010 can integrate an application processor and a modem processor, wherein the application processor mainly processes operating systems, user interfaces and application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above-mentioned modem processor can also not be integrated into the processor 1010.

[0292] The embodiments of the present disclosure also provide a readable storage medium, which stores a program or instructions, and the program or instructions are executed by a processor to realize the processes of the above-mentioned generation method of a fusion pathfinding grid and achieve the same technical effects. To avoid repetition, details are not described here.

[0293] The processor is the processor in the electronic device described in the above-mentioned embodiments. The readable storage medium includes a computer readable storage medium, such as a computer ROM (Read-Only Memory), a RAM (Random Access Memory), a magnetic disk or an optical disk, etc.

[0294] The embodiments of the present disclosure also provide a chip, which includes a processor and a communication interface. The communication interface is coupled with the processor. The processor is used to run a program or instructions to realize the processes of the above-mentioned generation method of a fusion pathfinding grid and achieve the same technical effects. To avoid repetition, details are not described here.

[0295] It should be understood that the chip mentioned in the embodiments of the present disclosure can also be called a system-level chip, a system chip, a chip system or a system-on-chip, etc.

[0296] An embodiment of the present disclosure provides a computer program product comprising instructions, which, when executed on a computer, enables the computer to perform the steps of the method for generating a fused navigation grid as described above.

[0297] It should be noted that, in this article, the terms "comprise", "include" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, an element defined by the sentence "comprises a..." does not exclude the presence of other identical elements in the process, method, article or device comprising the element. In addition, it should be pointed out that the scope of the methods and devices in the embodiments of the present disclosure is not limited to performing functions in the order shown or discussed, and may also include performing functions in a substantially simultaneous manner or in the opposite order according to the functions involved. For example, the described method may be performed in an order different from that described, and various steps may also be added, omitted, or combined. In addition, the features described with reference to certain examples may be combined in other examples.

[0298] Through the description of the above embodiments, those skilled in the art can clearly understand that the above embodiment methods can be implemented by means of software plus the necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is a better embodiment. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) to execute the methods described in each embodiment of the present disclosure.

[0299] The embodiments of the present disclosure are described above in conjunction with the accompanying drawings, but the present disclosure is not limited to the above-mentioned specific implementation methods. The above-mentioned specific implementation methods are merely illustrative and not restrictive. Under the guidance of the present disclosure, ordinary technicians in this field can also make many forms without departing from the scope of protection of the purpose of the present disclosure and the claims, all of which are protected by the present disclosure.

Claims

1. A method for generating a fused navigation grid, characterized in that: The method comprises: Based on N sets of entity parameters corresponding to entities in the game scene, the entity attribute level of the voxel span and the entity level of each entity are marked, where N is an integer greater than 1; Based on the entity attribute levels of the marked voxel spans, generating a multi-level entity attribute area in the game scene that is walkable and marked with the entity attribute levels; Simplifying the edges of the multi-level entity attribute region; Reorganize the polygons obtained after edge simplification into convex polygonal walkable areas marked with entity attribute levels; Based on the convex polygon walkable area marked with the entity attribute level, a fused navigation grid of entities adapted to the N groups of entity parameters is generated, so that pathing is performed based on the entity level of each entity and the convex polygon marked with the entity attribute level in the fused navigation grid.

2. The method according to claim 1, characterized in that The N groups of entity parameters include N levels of entity attribute thresholds; the marking of entity levels based on the N groups of entity parameters corresponding to entities in the game scene includes: Sort the attribute thresholds of the N-level entities in ascending order of the restrictions imposed on the entities; The levels of entities are marked in the order of entity attribute thresholds, and the last j-1 bits of the mark bits of the j-th level entity are marked as 1, 1≤j≤N.

3. The method according to claim 1, characterized in that The entity attributes include a slope threshold and a height threshold of the entity; the entity attribute level of the voxel span marked based on the N groups of entity parameters corresponding to the entities in the game scene includes: Based on the slope of the voxel span and the slope threshold value in the N sets of entity parameters, the slope attribute level of the voxel span is marked; based on the height difference between adjacent voxel spans in the vertical direction and the height threshold value in the N sets of entity parameters, the height attribute level of the voxel span is marked; wherein the mark bit includes a mark for the slope attribute level and a mark for the height attribute level; or, Based on the slope of the voxel span and the slope threshold in the N groups of entity parameters, the slope attribute level of the voxel span is determined; based on the height difference between adjacent voxel spans in the vertical direction and the height threshold in the N groups of entity parameters, the height attribute level of the voxel span is determined; the attribute level with a higher limit between the slope attribute level of the voxel span and the height attribute level of the voxel span is determined as the entity attribute level of the voxel span; wherein the mark bit includes a mark of the entity attribute level.

4. The method according to any one of claims 1 to 3, characterized in that The N groups of entity parameters include N levels of entity attribute thresholds, and the restriction imposed on the entity by the i-th level entity attribute threshold is less than the restriction imposed on the entity by the i+1-th level entity attribute threshold; The entity attribute level of the voxel span is marked based on N groups of entity parameters corresponding to the entities in the game scene, including: For voxel spans that do not meet the threshold of level 1 entity attributes, no level labeling is performed; The voxel span that meets the Nth level entity attribute threshold is recorded as the first level voxel span, and the flag bit of the first level voxel span is marked as all 0; For the voxel span that meets the entity attribute threshold of level i but does not meet the entity attribute threshold of level i+1, it is recorded as the voxel span of level i+1. The penultimate i-1 bit in the tag bit of the voxel span of level i+1 is marked as 1, and the other bits in the tag bit are marked as 0, 1 <i<N。 5. The method according to claim 4, characterized in that The entity parameters include an entity radius; the entity attribute level based on the marked voxel span, and after generating a multi-level walkable entity attribute area in the game scene marked with the entity attribute level, the method further includes: Determine a non-walkable area of ​​a corresponding entity in the multi-level entity attribute area based on target entity parameters; Based on the entity radius in the target entity parameter, performing regional expansion on the non-walkable area of ​​the entity corresponding to the target entity parameter; The target entity parameters are any set of entity parameters except the first-level entity parameters in the N sets of entity parameters, and the entity attribute labels of each voxel span in the same non-walkable area are the same.

6. The method according to claim 5, characterized in that The step of performing regional expansion on the non-walkable area of ​​the entity corresponding to the target entity parameter based on the entity radius in the target entity parameter includes: If the entity radius in the target entity parameters is greater than the unit voxel width, the region where the entity cannot walk corresponding to the target entity parameters is expanded.

7. The method according to claim 6, characterized in that The performing regional expansion on the area where the entity cannot walk corresponding to the target entity parameters includes: If the entity radius / voxel width is rounded up to M, then each unwalkable area of ​​the entity corresponding to the target entity parameter is processed M times in the following manner: determining whether, among the eight-way neighbors of the first voxel span, there is a first neighbor voxel span having an entity attribute level label different from that of the first voxel span; labeling the entity attribute level of the first neighboring voxel span with the entity attribute level of the first voxel span; The first voxel span is a voxel span in a first region, and the first region is any region in the region where the entity corresponding to the target entity parameters cannot walk.

8. The method according to claim 4, characterized in that The boundary voxel span includes a first boundary voxel span and a second boundary voxel span; the first boundary voxel span indicates the voxel span of the neighboring voxel span that cannot be connected in the 8 direction; the second boundary voxel span indicates the voxel span on which it is impossible to walk; In a case where the entity radius of the j-th level entity is greater than the unit voxel width, the method further includes: In the case of j=1, a voxel span whose distance to the first boundary voxel span or the second boundary voxel span is less than the entity radius of the j-th level entity is marked as impassable; In the case of j≠1, the level 1 entity is allowed to walk, and the voxel span whose distance to the first boundary voxel span is less than the entity radius of the j-th level entity is marked as the j-th level voxel span; In the case of j≠1, if the distance from the second voxel span to the second boundary voxel span is less than the entity radius of the j-th level entity, traverse the 8-way neighbors of the second voxel span to determine whether there is a second neighbor voxel span with an entity attribute level label different from that of the second voxel span; use the entity attribute level of the second voxel span to label the entity attribute level of the second neighbor voxel span; The second voxel span is the voxel span in the area where the j-th level entity cannot walk.

9. The method according to claim 4, characterized in that The generating of multi-level entity attribute areas in the game scene marked with entity attribute levels based on the marked voxel span entity attribute levels includes: For each level of the labeled entity attribute level voxel span, region division is performed according to the following processing method for the k-th level voxel span to obtain a multi-level entity attribute region labeled with the entity attribute level: If the number of neighboring voxel spans that the third voxel span can connect to is less than 8, or the entity attribute level labels of the third voxel span and the neighboring voxel spans of the third voxel span are different, then the third voxel span is marked as a boundary, and the third voxel span is any voxel span in the k-th level voxel span; determining a distance from each voxel span in the k-th level voxel span to a boundary to generate a distance field; Dividing the k-th level voxel span into different regions based on the distance field, and marking the entity attribute level of each region; The entity attribute level of the voxel span in the same region is the same, and the entity attribute level of the voxel span in the region is equal to the entity attribute level of the region.

10. The method according to claim 9, characterized in that After dividing the k-th level voxel span into different regions based on the distance field and marking the entity attribute level of each region, the method further includes: If the non-island area obtained after the area division includes a second area whose area is smaller than the first area threshold, the second area is merged into an adjacent third area, and the entity attribute level of the second area is updated to the same entity attribute level as the entity attribute of the third area; If the non-island area obtained after the area division includes a fourth area whose area is greater than or equal to the first area threshold and less than the second area threshold, and there is no area with the same entity attribute level within the preset range of the fourth area, the fourth area will not be processed.

11. The method according to claim 9 or 10, characterized in that The simplifying of the edge of the multi-level entity attribute area includes: After extracting the key points, determining an edge type of a first edge formed between a first key point and a second key point, wherein the first key point and the second key point are any two adjacent key points; If the first edge belongs to the first type of internal edge, retaining the first key point and the second key point, and the areas on both sides of the first type of internal edge belong to the same entity attribute level; If the first edge belongs to the second type of internal edge, it is determined that the target distance of other points between the first key point and the second key point to the first edge is greater than or equal to the distance threshold, and the point with the farthest target distance is the retained key point; the areas on both sides of the second type of internal edge belong to different entity attribute levels.

12. The method according to claim 11, characterized in that Before marking the entity attribute level of the voxel span based on the N groups of entity parameters corresponding to the entities in the game scene, the method further includes: If the area of ​​the game scene is greater than a third area threshold, dividing the game scene into uniform tiles along the XZ plane; The entity attribute level of the voxel span is marked based on N groups of entity parameters corresponding to the entities in the game scene, including: Based on N sets of entity parameters corresponding to entities in the game scene, the entity attribute level of each voxel span in each tile is marked.

13. The method according to claim 12, characterized in that After simplifying the edge of the multi-level entity attribute region, the method further includes: Edge adsorption is performed on edge points of the multi-level entity attribute region where the edge falls on the tile edge, so as to adjust the shape of the multi-level entity attribute region.

14. The method according to claim 13, characterized in that Performing edge adsorption on edge points where the edge of the multi-level entity attribute region falls on the edge of a tile, including: Determining a first direction of a first tile edge, where the first tile edge is a tile edge where a first point to be adsorbed falls on the first tile, the first point to be adsorbed is any point where an edge point of a target area falls on the first tile edge, and the target area is any area in the multi-level entity attribute area; Acquire a second tile adjacent to the first tile in the first direction; Acquire a target anchor point on the edge of the second tile in the opposite direction to the first direction on the second tile, which is the smallest distance from the first point to be adsorbed; If the magnitude relationship between the coordinate values ​​of the first point to be adsorbed and the second point to be adsorbed on the edge of the first tile in the first direction is the same as the magnitude relationship between the coordinate values ​​of the target anchor point and the second point to be adsorbed in the first direction, then the target anchor point is determined to be the adsorption position of the first point to be adsorbed, and the second point to be adsorbed and the first point to be adsorbed are two adjacent points in the same polygon; The coordinates of the first point to be adsorbed are updated to the coordinates of the adsorption anchor point of the adsorption position.

15. The method according to claim 13, characterized in that The performing edge adsorption on edge points where the edge of the multi-level entity attribute region falls on the edge of a tile includes: Dividing the tiles into a first group of tiles and a second group of tiles in a chessboard-like distribution form, and taking the edge points of the multi-level entity attribute region falling on the edge of the tiles of the first group of tiles as adsorption anchor points; For adsorption points falling on the edge of tiles of the second group of tiles, edge adsorption is performed based on the adsorption anchor points generated by the first group of tiles; The tiles in the second group of tiles are neighboring tiles of the tiles in the first group.

16. A device for generating a fused navigation grid, characterized in that: The device comprises: a level marking module, a region generation module, an edge simplification module, a polygon reorganization module, and a grid generation module; The level marking module is used to mark the entity attribute level of the voxel span and the entity level of each entity based on N groups of entity parameters corresponding to the entities in the game scene, where N is an integer greater than 1; The region generation module is configured to generate walkable multi-level entity attribute regions in the game scene marked with entity attribute levels based on the marked entity attribute levels of the voxel spans; The edge simplification module is used to simplify the edge of the multi-level entity attribute area; The polygon reorganization module is used to reorganize the polygons obtained after edge simplification into convex polygonal walkable areas marked with entity attribute levels; The grid generation module is used to generate a fused navigation grid of entities adapted to the N groups of entity parameters based on the convex polygon walkable area marked with the entity attribute level, so that pathing is performed based on the entity level of each entity and the convex polygon marked with the entity attribute level in the fused navigation grid.

17. An electronic device, characterized in that: The method comprises a processor, a memory, and a program or instruction stored in the memory and executable on the processor, wherein the program or instruction, when executed by the processor, implements the steps of the method for generating a fused navigation grid according to any one of claims 1 to 15.

18. A readable storage medium, characterized in that The readable storage medium stores a program or instruction, and when the program or instruction is executed by the processor, the steps of the method for generating a fused navigation grid according to any one of claims 1 to 15 are implemented.

Citation Information

Patent Citations

  • Navigation grid automatic-generation method and navigation grid automatic-generation device

    CN104548597A

  • A super-large map movement optimization method

    CN109685903A