Topic was automatically imported from the old Question2Answer platform.
Asked By
Solanich
For my npc movement AI I’m using godot’s built in AStar class, it works pretty well except that when there are 2 possible paths (for example, go up then right or go right then up) it always picks the same one (right first then up), it’s never random.
How could I include randomness to the paths?
You could either temporarily or periodically adjust the weights of the path points in question, by a tiny amount (say 1.0 to 1.01). Or you could temporarily or periodically disable and reenable said points. If you didn’t want to keep track of those points on a per path basis you might just periodically sweep the grid, toggling weights from 1.0 to 1.01. Just my two cents since I haven’t actually begun programming yet