Add/remove Graph to border of another graph

Hi Aron,

I have seen this asked in another thread a while back but it was never answered. I have attempted to gather enough information in order to do it myself but the docs or advice seems to lead me in circles, and some of the information in posts is quite old (5 years).

  1. As per the image above, I have a terrain divided into 9 graphs (recast), and saved to files.
  2. The Green dot is my characters original position, so just loading graph 5 is simple and suits my needs for the original characters position, as the border of the other graphs are enough in the distance so that it usable by my AI .

Now when my character is in position “red” I want to load and connect graph 1, 2, 4 and 5 so that my AI’s can cross the borders of the graphs, and when I am in position “blue”, I want to drop graph 1,2,4 and load 6,8,9.

I am not sure how to do this or is this is possible.

I though this was maybe something like DeserializeGraphsAdditive would do?

I also saw some documentation somewhere about removing graphs, but cant find that link anymore.

What does not make sense for my situation:

  1. Load all graphs at game startup (terrain is way to large - much more that the 9 1x1km graphs in image)
  2. Procedural - Actual procedural grid graph is quite small, so increasing it to 250x250 impacts the performance of the game too much. And at some stage of my terrain there are multi layers buildings.
  3. Runtime navmesh (250x250 graph), lags on update so that character stops when in motion.

Can you help?

Anyone help on this? @aron_granberg


This is unfortunately not something that is supported.
Note that if you only have 9 graphs, I’d recommend that you just scan 1 graph instead and use that. You don’t need to have the world geometry loaded for the graph to work.

An alternative if you want to scale to even larger worlds is to create 2 graph grids. One like the one you have and one which is offset by half a grid size along the x and z axes so the two graph grids overlap. Then for every position that the player is at you can always find one cached graph in one of the grids which has at least 250m margin to the edge (assuming the tiles are 1km by 1km).

My terrain is much bigger that 9 terrains so its not possible to scan from the beginning ,which is why I scan and save the graphs to file. The actual terrain chunks are static however they are placed randomly, so creating the entire graph beforehand is not possible.

This is only going to be an "issue for me when my character is near the edge of a terrain, so an alternative (not so attractive option) would be to load the single graph when needed (so when in area 5, load graph 5, when in 1 load 1, etc). I however dont know how to load graph 1 in the position as seen on the example (my character for example will be in a different vector3 location).

Sorry for the late answer.
You can load a graph and then move it using

1 Like