Generating a procedural grid Graph from Recast Navmesh

It could be really cool if after first generating a very sparse recast navmesh, we could generate a procedural grid graph by raterizing the triangles of the recast graph into grid points. I know that procedural grid graphs are already a thing, but I’ve found that they can be somewhat slow to generate and create a lot of garbage if generating over terrain tiles. I think by using the triangles from a recast graph’s tiles as a template for the grid graph, we could generate a grid that fits within the navmesh triangles very quickly, if it was bursted, and multithreaded over each tile.

This would be a really handy feature because recast graphs weakness is that they do not handle changing environments very well. But, by using the recast graph as a template to quickly create a grid graph, we could have a much more fine grained pathfinding, and do things like heatmaps of enemies/allies for pathing and group behaviors, heatmaps of hazards on the ground to path around, etc.

We could potentially even mark ‘edge nodes’ for grid nodes that have less than 8 neighbors(assuming it’s hexagonal) , and then when Npcs are pathing, we could do querries over the grid with filters like “greater than 4 meters from an edge node” and only pathfind over those valid nodes. This would allow very large npcs to pathfind on the same graph while avoiding running into edges. (Npcs would primarily only pathfind using the grid graph) But, the recast graph would still be available for long distance pathing or heirarchical pathfinding if desired.

I’m curious what your thoughts are on something like this. Basically, I’m thinking for very large worlds, it would be handy to be able to store the overall shape of the navmesh as sparsely as possible, and then use that data to more efficiently generate a fine grained procedural grid graph that follows the player around, that would be used for pathfinding and open up opportunities for more dynamic changes/querries on that grid. (Thinking like influence maps if you are familiar with those.)

Hi

I very much doubt that this would be faster than a regular grid graph. The recast graph is typically significantly slower to scan compared to a grid graph.

If you want more performance, I can recommend you to check out the beta version, though. Grid graph scanning has been jobified and burstified in the beta.

We could potentially even mark ‘edge nodes’ for grid nodes that have less than 8 neighbors(assuming it’s hexagonal) , and then when Npcs are pathing, we could do querries over the grid with filters like “greater than 4 meters from an edge node” and only pathfind over those valid nodes.

Check out GridGraph - A* Pathfinding Project