Grid Graphs and Tags

Hi,

I am currently using grid graphs in a 2D procedural generated game with a certain amount of rooms, and I am generating the gridgraphs at runtime. I have two questions about it:

1- Would it be better to generate initially a “giant” grid graph and when I randomly generate the levels, update only the bounds of the newly created levels? Or is it better to create a new GridGraph for each level that has the level dimensions?
2- I want to use tags in each grid graph. I have looked into the tutorial videos but I haven’t figured out how to assign a tag to each grid graph. I have a Pathfinder with multiple Grid Graphs and I want to assign a different Tag to each Grid Graph. Is it possible to do that? And how can I do it through scripts?

Thank you very much! :slight_smile:

Regards,
Albert

If all levels fit inside a reasonable world region then yes, having a single graph is simpler and easier.
Also if the rooms are connected so that you need pathfinding from one room to another I would strongly recommend a single large graph.

For what purpose do you want this? Most cases where you need to differentiate between different graphs is already solved in other ways. E.g. on the Seeker component there is an option to specify which graphs it should be valid for the agent to search on.

Thank you very much for the responses! :slight_smile:

1- After reading the first answer seems like having one big grid graph and just updating each room once they are created. However, the issue that I am facing now is that I create a big grid graph and I try to update only the bounds of the rooms. And it seems like the UpdateGraphs function doesn’t take effect unless I have used the Scan function first. And since there are gaps between the rooms, I would like to not have to Scan it first, since it Scan all the places where there is nothing. Am I doing something wrong? Is there a way to make this big graph and only scan certain areas?

2- I wanted to have two different graphs with different Diameters, one for units that are smaller and one for units that are bigger. In this case, should I be using the Seeker component to select the graph as you mentioned?