Hi,
In my game, I have two different types of AI agents. Both agents can transverse the same map for the most part. However, one of the agents has a few select areas that it cannot enter.
My first instinct was to try and use one big graph and then use penalties to block areas for one of the agents. However, I’ve noticed that penalties are causing warnings to appear in the inspector about path failed and gives a recommendation to use calculatePartial although this comes with a performance cost. Looking through the forums it appears the solution was to go into the SearchPath function and the calculatePartial line like this:
ABPath p = ABPath.Construct(start, end, null);
p.calculatePartial = true;
SetPath(p, false);
This made most of the warnings go away, but I’m still getting them every so often.
This lead me to perhaps another solution where I have 2 grid graphs (stacked on top of each other). One for one set of agents and one for another set of AI Agents. I thought this might be preferable so that the calculatePartial didn’t have to be used for all agents (since calculatePartial supposedly comes with a performance cost). I’m not sure if it is faster to have two grid graphs (one for each agent type) or 1 grid graph with penalites and all agents using calculate partial?
However, I’m running into a bit of an issue when trying to use two grid graphs of the same map. I thought I could use the graph update scene component to mark areas as not walkable for certain AI agents. However, the graph update scene component doesn’t appear to have a graph mask on it. So when it scans it updates all grid graphs instead of just a specific grid graph that I set. So if I have two grid graphs stacked it is updating the graph for both in that area, instead of just an area for a single graph.
Overall, I think using two separate graphs would be the easiest solution (especially if it is more performant than making all agents use recalculatePartial and using the penalties). I just would need a way to be able to apply a graphUpdateScene to a specific agent graph and not all graphs.
What do you suggest?