Lets explore pathfinding by implementing Dijkstra’s Algorithm. Dijkstra’s Algorithm is a pathfinding algorithm that works by calculating the distance from any node in a graph to a target node. To find a path from any node in the graph to the target node you need to find the next adjacent node with the shortest remaining distance to the target. We’ll be implementing this for a dynamic graph of bi-directional nodes, however this can be implemented in a similar fashion for other areas like a tile system from a strategy game.
Wikipedia goes deeper into Dijkstra’s Algorithm implementation and includes visual examples and pseudo code: https://en.wikipedia.org/wiki/Dijkstra%27s_algorithm
Recently I’ve been streaming some of my longer projects and playing games on Twitch. You can find my streams at: https://www.twitch.tv/worldofzerodev
Join the World of Zero Discord Server: https://discord.gg/hU5Kq2u