Support Forum

Constant Path Spread Function

Hello and good day,

I am trying to make a similar path generation similar to the 3rd approach here regarding the random path.
https://arongranberg.com/astar/documentation/dev_4_1_2_9dcd8927/wander.php

But instead of relying on a random path i wanna use a constant path and get the path in the spread radius like shown, would that be the proper way to go about it, and if yes could i implore your suggestion on how i could implement such a solution since i am not really sure how i should go regarding reading Gscore and whatnot to make my own function for that.

Why do you want to use a ConstantPath instead? The random path would essentially be equivalent I think, but it would be a lot faster.

If you want to use a ConstantPath you can calculate it, and then pick a random node in its allNodes field to use as the destination for a regular ABPath. So you will have to calculate two paths, first one to get all the potential targets, and then one to calculate the actual path to the chosen target.

The G score is essentially the world-space length of the path multiplied by 1000.