A* Pathfinding Project

Adding tiles to a Recast graph


#1

First off I want to say, this is a very cool project!

A bit about what I’m trying to build : I’m working on a city building game. I want to have quite a large world. There will be “town centers” that are placed at runtime and have graph nodes in a defined radius around them. Town centers can be connected by the user placing roads. I will have thousands of agents requesting pathfinding within town centers and on roads. So I think I have a case of a large world/graph that is quite sparse in terms of the meshes that I actually make available to A* to scan. I also want to have explorer units which can go anywhere in the world, but these only need to have pathfinding data in a small area around their current location.

I’ve been working with a recast graph with a size of 1000x40x1000 that initially starts empty and have had some success using graph updates to add new roads to the existing navmesh. One problem I am seeing is that as a road gets longer, updating the graph can take ~10 seconds during which all pathfinding stops. Can anyone provide guidance on whether a recast graph is a good approach or whether there is a way to improve this performance?

Maybe a grid graph would be better since I’m willing to limit most pathfinding to town centers/roads.


#2

Hi

How exactly do you update the graph?


#3

Sorry, it was a logic error on my end. I was using

AstarPath.active.UpdateGraphs(new GraphUpdateObject(bounds));

but my bounds were always encapsulating the origin… so embarrassing.