0 votes

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?

asked Feb 20, 2019 in Engine by Solanich (23 points)

1 Answer

0 votes

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 :P

answered Sep 26, 2019 by glenneric1 (22 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.