Djikstra Pathfinding
Created on 2021-05-20T18:29:13-05:00
Initialize all nodes in the graph to have an infinite travel cost and no incoming direction. Have an empty set of active nodes. Put the starting path tile in the active set.
Now iterate the active set: if the cost of moving from current tile to that tile is less than its current navigation score, change that tiles direction to point at the current tile and update its best navigation score while adding that tile back to the active set. Remove the current tile from the active set.
Eventually the entire graph is pathed and explored. Once this is done start at the destination tile, trace the tile directions backwards to find the beginning. This is your optimal movement path.