r/programming • u/hazadess • Apr 23 '13
PathFinding algorithm, visually explained
http://qiao.github.io/PathFinding.js/visual/
2.2k
Upvotes
r/programming • u/hazadess • Apr 23 '13
View all comments
Show parent comment
9
u/Zarokima Apr 23 '13
Not with an actual pathfinding algorithm, I don't think so. Although there are ways to make pathing work dynamically only looking one step ahead, such as potential fields.
Basically, it works like electrical charges in physics. An objective might emanate an attractive field, and an enemy might emanate a repulsive field. The unit just moves to wherever it is most attracted to. The environment can change as often as you want to change, add, or delete fields, and movement works out just fine. Though of course it's not really "pathfinding".