Is it okay to use multiple graphs like this?

I want to create a simple traffic system using AILerp for movement. For creating lanes, is it appropriate to use multiple point graphs that represent those lanes? Then certain vehicles would pathfind only along a certain graph. Im assuming this may be a little performance intensive? Is there a better way to go about something like this?

Hey,
Using multiple graphs is quite good actually, in the seeker component you can specify which graphs the agent can use.

Even if there are, potentially, hundreds of lanes, resulting in hundreds of graphs?

Thanks

Hi

I’d recommend not doing this. Traffic systems is something this package does not have explicit support for. You can do it with a point graph, but it is kinda tricky when different lanes overlap and that kind of stuff. Traffic has complex rules and it might be better to use a custom pathfinding algorithm for it.

In any case. You can get what you want with a single graph by using a custom PathNNConstraint.
Create a class which inherits from PathNNConstraint and then also override the AILerp’s SearchPath method. When you search for the path assign the path.nnConstraint field with an instance of your constraint class. Your constraint class can then filter which nodes are considered by the search.