Hi, I’m working on an RTS game. I need 4 graphs for 4 different sized unit types. I tried the grid graph and the re-cast graph, both have the same issue.
Im using for local avoidance purposes the GraphUpdate method to make under a unity the graph available for pathfinding or not. I have about 10 GraphUpdate calls in 2-3 seconds, where some of the units collides with each other for testing purposes. The graphs are default re-cast graps, just the player margin size is different. The GraphUpdate calls delays, block the pathfinding calculation, and so they comes through after 10s to 30s, depends on how much GraphUpdates are in the queue.
This 4 graph configuration works with 250x250 grid graphs, but that I cannot apply for a 2000x2000 terrain. It would be very inaccurate. With 4 grid graps with the resolution 1000x1000 the GraphUpdates are by far worser.
Not sure how to use this pathfinding solution for my needs. I need to move 4 different sized unit types, for that reason I created the 4 different graphs (known solution for this issue). Maybe the multiple graphs are not well updated, maybe it causes some kind of redundant calculations?
I’m using the following code:
if (gameObject.layer != toLayer) {
//GraphUpdateObject guo = new GraphUpdateObject(this.GetComponent<BoxCollider>().bounds);
// Check the new layer.
Bounds bounds = GetComponent<Collider>().bounds;
if (toLayer == UnitsLayer) {
GraphUpdateObject guo = new GraphUpdateObject(bounds);
AstarPath.active.UpdateGraphs(guo);
} else {
exactBlockedBounds = bounds;
GraphUpdateObject guo = new GraphUpdateObject(exactBlockedBounds);
AstarPath.active.UpdateGraphs(guo);
}
gameObject.layer = toLayer;