Recast Graphs Limit?

Hello,

I noticed on my Seeker components that I have 31 graphs that the agents can walk on. On my terrains I plan to have many small graphs with different names for a better workflow, but am I limited to just 31?

Thanks in advance!

Hi, is there anyone that can help answering this?

Hi

Sorry for the late reply. I’ve been on holiday.

You can use up to 255 graphs. However, the graph masks are, as you’ve noted only 32 bits wide.
You can subclass the NNConstraint class and override the SuitableGraph method to do custom graph filtering.

However, there are very rare cases where you’d need more than 32 graphs.

Hi,

I think am misunderstanding something, can you please give me an example of how you’d setup these for a large MMO with many many zones and continents if they are only 32? Am I supposed to reuse them? I didnt really understand what the purpose of them really is.

First off, a large MMO with many continents is quite a challenge in itself. Just from a coordinate precision point of view, I don’t think it’s reasonable to have multiple continents on a single client in Unity.

In most games, you’ll only need a single graph that covers the whole world. You typically use multiple graphs if you have multiple agent types with different movement behaviors.

If you have parts of the world far from each other (like continents) then using multiple graphs is also reasonable. But at the MMO scale you will need some kind of streaming to not run out of memory (which is possible in this package, but it requires some custom code).

The problem is that my enemies are prefabs, those enemies can be spawned in many zones.

My levels are made out of multiple recast graphs rather than one big graph, because I have areas that dont have any AI on them so I dont see a reason to cover them at all its just the player going thro puzzles (but maybe I should?).

So lets say I have 1 scene that has 5 recast graphs (small ones) That’s 5 out of 32 already taken by just 1 level. What If I have 20 levels?

And also since the Seeker is a component on a Prefab, how does it know what kind of graphs I will be having in every scene? If its 32 graphs per scene then okay, but I guess its 32 per project? Another question comes, lets say my enemy must not walk on Graph named “Water” with index 15 on scene 5, that enemy is a prefab spawned at runtime so in different scenes the graph with index 15 may represent different things like grass, dirt, water etc.

Please let me know how do I plan forward for this.

My understanding so far is that there are 32 graphs per project and I should write down on paper what every index means and it must be true for every scene like:

index 0: ground - all enemies
index 1: water enemies only
index 2: mud enemies only
etc etc

Still a problem remains that I wanted to split my scene into many smaller recast graphs rather than 1 big so as I keep adding them they automatically take up space (I got no control to say what the current graph is) and my workflow to have many smaller graphs is kinda useless. It’s a Doom style game where I only need AI in some parts of the level and there are many zones where you only got the player roaming so I didnt want to cover 80% of the space when there will never be any AI on it.

Most games will have the same graphs in all scenes, so this is typically not an issue.
But for your use case you may want to attach a separate script which configures the graph mask using graph names instead. Like:

seeker.graphMask = GraphMask.FromGraphName("My cool graph") | GraphMask.FromGraphName("My other cool graph");

Usually it’s not a problem wasting a bit of space on empty regions of the world. This is all a matter of scale, though. Covering an entire ocean with a graph for ground units is probably not advisable.

1.I understand, now the thing is why did you decide each Recast Graph created to waste 1 graph mask instead of creating Recast Graphs in the A* component and then assigning a graph mask to each one? That way we can have 2 Recast Graphs in the same scene that use the same Graph mask, for example “ground”

  1. Is there someone a tutorial on how to setup my graphs one after the other in a way that’d work in most games / how most games do it? Like 0 = ground, 1 = mud, 2 = sand, 3= water etc etc…