Streaming

Hi,

When using a NavMeshGraph (or a RecastGraph generated offline) is their any way to dynamically add and remove parts to/from the graph as sections of a level are streamed in and out?

Thanks.

I recommend that you load the whole graph at once. Recast/navmesh graphs don’t take up that much memory even for large worlds. This will give you more stable pathfinding since units can request paths to anywhere in the world.

If it wasn’t possible to know the layout of the entire world upfront, could the graphs be updated somehow? Looking through the code, could DeserializeGraphsAdditive() be utilized in some way? Or, if I manage adding and removing sections of a mesh myself, could I use a recastgraph which has one tile, and recreate this tile with my updated mesh verts and tris every time I stream a section in and out? Would this be a workable solution? Would it be slow?

Hi

I think you can do something like this.
Offline, you generate a recast graph for each section of the world.
You should probably generate them so that they are overlapping.

The image below shows overlapping graphs, colored orange and green for visibility purposes.
http://imgur.com/9bicVK9

When the character reaches a spot so that another graph center would be closer. You load the new graph using AstarData.DeserializeGraphs.
I recommend that you only have a single graph loaded at a time, multiple graphs can cause issues when units cannot decide which graph they are on.

You can use a tiled recast graph with the TileHandler class (only available in the beta) to update smaller sections of the graph manually. But it is more work for little gain.