How to change max tile count of recast graph

Hi @aron_granberg

Could you please tell me how to change the recast graph’s max tile count (524287) to one million?
I just changed the TileIndexMask in NavmeshBase, but something went wrong.
“There was an error generating the graphs:
System.IndexOutOfRangeException: Index was outside the bounds of the array.”

Hi

Why do you need such a huge number of tiles?

Hi, @aron_granberg
My game has a big tile-map that using grid graph. There are many obstacles so I can’t instantiate them all at the start of game.
my current solution is update each tile directly when game start, but the grid graph is not doing good for dynamic polygon obstacle like what NavmeshCut does.
So I wanna test if recast graph can handle both issues ---- update some of the tiles at runtime and use NavmeshCut for some special dynamic obstacles.

Hi

You really don’t want to use a recast graph with the same tile size as a grid graph. Tiles in a recast graph are typically much larger than in grid graphs.

You might also want to check out the DynamicGridObstacle component (take a look at the “Example2 Terrain” example scene)

Hi,
The “larger” means the size or the memory?
I have tested all solutions for grid graph and it’s not very flexible for some dynamic obstacles with Irregular shape. That’s why I consider the reacast graph, is it easy to change the max tile count?

I mean that they are typically larger in terms of world size. They are however also much larger in terms of memory as it is assumed that you have a lot fewer of them.

You can double the max tile count by changing these fields in the NavmeshBase.cs file and setting them as in the following code snippet:

public const int VertexIndexMask = 0x7FF;

public const int TileIndexMask = 0xFFFFF;
public const int TileIndexOffset = 11;

However I strongly recommend that you increase your tile size instead and use fewer tiles.

@aron_granberg

Thank you! I’m going to try it.

Hi @aron_granberg

Sorry to bothering you again.
I’ve generated a recast map with one million tiles.
Is it possible to make some of the tiles are walkable and some are unwalkable like what grid graph can do?I didn’t find a bool like isWalkable or something.
Maybe GraphUpdataObject can handle this, I tried but failed.
Could you please give some advices?

Hi

A recast graph represents unwalkable regions by cutting them away. You can technically make nodes unwalkable just like a grid graph, but that’s not how they are intended to be used.