A* Pathfinding Project

AI Pathfinding on large terrain


#1

Hi, I have some questions before I commit to buying the full version.

I need pathing for my NPCs, using a Unity terrain approximately 5km x 5km. Will the recast graph handle this well?

Would it be feasible to have a relatively small grid-graph (40x40, say) which moves with the NPC and gets updated in the AI loop?

Your software is very impressive! Thanks.


#2

Hi

The recast graph can handle a 5x5 km terrain. I have heard of users using it with as large as 7x7km terrains. However scanning the graph may take a bit of time. I would strongly advice that you use the cached startup setting (https://www.arongranberg.com/astar/docs/save-load-graphs.php) or save your graph to a file. For prototyping you can scan a much smaller portion of the terrain, this will allow you to change settings and see the results much quicker. Make sure you enable tiling on the recast graph (should be the default).

If you are doing any updates to the graph during runtime I would recommend that you use the “Rasterize Colliders” option and not the “Rasterize Meshes” option. This is because it is not possible to efficiently find all meshes within the region that is to be updated, so updates will be very slow for large worlds with the “Rasterize Meshes” setting enabled.

You can also use a small grid graph and move it around with the player. Take a look at the example scene called “Procedural”. However I would not recommend having more than one such graph to avoid FPS drops.


#3

Great, sounds like recast will do the job.
Thanks for your quick reply.