I implemented two of the most popular technique use in video game to help a artificial agent navigates on the map : Dijkstra and A *
Dijkstra
Dijkstra is use so for a pathfinding process. The idea of the Dijkstra algorithm to start from the start node and scan all his neighbor until its find the destination route.
Dijkstra advantage it that he will always find the shortest route, but his weakness is that Dijkstra over exploring, and sometime we don't need it
A *
A* is I think it's the most use pathfinding technique in video game. Like on the previous subject, Dijkstra is good but it's over exploring to get the shortest path, it's can be an optimization issue
Sometime we don't need the shortest path, we just need a path to the destination, and that what A* does.
The main difference with A* and Dijkstra is A* Heuristic system which influence a lot about calculation of the path. On my project I use distance between the current scan node and the destination
Demo
He is the map
And some results
Source code
Link to this project : https://github.com/NicolasBunn/Pathfinding
Aucun commentaire:
Enregistrer un commentaire