Radius modifier on a grid graph

hello,

Im trying to use a radius modifier on a grid graph in a tower defense style game.
The results im getting are not so good.(path is crossing unwalkable nodes)
Is this a good practice to use this modifier on a grid graph?
And if not how can i handle the width of a seeker in a grid graph?

Thank you for your answer.

Hi

The radius modifier is primarily intended for navmesh based graphs.
Usually I recommend just using multiple graphs and use a graphMask (search this forum for sample code and explanations).
If you are really memory constrained you can take a look at http://arongranberg.com/astar/docs/class_pathfinding_1_1_grid_graph.php#af156f09628f08d32091ea67e48e42b71, but that has some drawbacks when there is no possible path to be found.

thank you for your answer, will check it out(if you have a reference link to the code example it would be nice as didn’t found it).

Is there plan to add width support(modifier) to a grid graph in the future?

hi,

Still waiting, Can you please share a link to an example?

Thank you.

Hi

Essentially what you would do is create two graphs, the first one would have index 0, and the second one would have index 1. The Seeker.StartPath method has an optional parameter called ‘graphMask’. It indicates which graphs that the pathfinder should search on to find the start and end nodes of the path.

The graphMask parameter is a bitmask (see https://en.wikipedia.org/wiki/Mask_(computing) ) so if you wanted it to search on only one graph you would set it to

int graphMask = 1 << 0; // Search graph with index 0
int graphMask = 1 << 1; // Search graph with index 1

You can then pass that to the Seeker.StartPath method like

seeker.StartPath(startPos, endPos, OnPathComplete, graphMask);

There is currently no plan to adjust the radius modifier to work better with the grid graph. You can try adding a Raycast Simplifier component to the object as well as the radius modifier, that will likely make it look better.

hi,

thank you for the answer. there is some thing that i still miss here.
How search in a different graphs will solve the radius issue?
Are both of them grid graphs, and the change is in the ray thickness?
Or one is grid and the other is mesh?

Thank you.

Hi

Yes, the different graphs would have different settings. For example the erosion or collision diameter could be different.

Will try that, thank you.

Also if i understand correctly this means that i need a graph for each unit width i have,if this is true i would recommend to improve this feature as this is for my opinion a pretty basic RTS behavior.

Best Regards.