Recast Immediate Runtime Update in Small Region

Hi everyone,

I am trying to get the RecastGraph to bend to my will here but I’m stuck on one part. I have a world consisting of 1x1x1 blocks (Think Minecraft, but it isn’t, its an RTS).

The snag is when I am building new structures. I am able to reserve the space on the RecastGraph using NavMeshCuts when construction begins;

But once the construction is complete, I want to quickly regenerate the nodes around this structure. The update call to the graph is called the same frame that the NavMeshCut objects are removed, but it has a large enough delay to warrant discomfort. This construction is short for this gif, but it usually is like 10-15 seconds and doesn’t happen too much.

The update call I am using is

            var bounds = Structure.GetBounds();
            SteelKeep.AStarPath.UpdateGraphs(bounds);

I figure this is how it is supposed to work, but are there any tricks to make this happen faster in this region? I have the Pro version, and I am using Colliders for everything. I have a similar project using the LayeredGridGraph, but the 4 point movement feels more limiting and there are some geometry edge cases that are very difficult to deal with.

Thanks for your time,

CS

Hi

The best way is to enable tiling on the recast graph. When you call UpdateGraphs it will update only the tiles the bounding box touches. Usually a tile size of 64, 128 or 256 works best.
What resolution are you using for the graph?

1 Like

Aron thank you for the support - I was using a voxel size of 0.05 for a 35 x 20 region. (500 x 700 voxels)

I made the swap to using tiles and it helped with rebuild performance greatly. I have been playing around with the tile sizes and 20 seems to work since it is 1:1 with the world block size. I noticed that going with 30 or 40 seemed a little faster but it could miss single tiles when the grid size was an even width or height sometimes.

I’m pretty happy with this, are there any other ideas about how to further increase this performance or is this about as optimized as I can get it?

Thanks!

CS

Hi

Nice! That tile size looks very small to me. I would have used one which was maybe 3 or 4 times as large (about the same size as a building). But it’s best to experiment to see what fits best.

What do you mean by

?

As for graph updates I think it’s going to be hard to get significantly better performance.

I am continually impressed with this -

The tile size was user error and correlation not causation… I thought tile size was the problem, but it was actually the min region size. I adjusted min region size to 0 and it now reliably gets every spot I hoped it to.

Tile Size 256, Min region size 0.

This is working great, thanks Aron.

CS

1 Like