Pathfinding for Grids & Graphs
Pathfinding for Grids & Graphs!
This is my demo of my own implementation of two methods of path planning - Dijkstra and A* - in both grids and graphs (hex-based and node-based).
Heuristics
You can specify how to measure the heuristic distance, although since Dijkstra is not heuristic, this only effects A*.
Hexagons?
I find hexagonal arrays more interesting than traditional 'square' arrays since more thought is needed in how to define them and convert their coordinates into world space. For this implementation, I decided to use an odd-row offset hexagonal array, and wrote my own functions for measuring distance from array tiles (used for heuristics) and converting their array coordinates into world space. This is a very comprehensive guide to hexagonal arrays and all the common functions you're likely to need when using them.
Controls
Controls are specified on the relevant pages. For the graph option, road distance is multiplied by the selected multiplier (slow = 3, medium = 2, and fast = 1).
Please comment below with any questions!
Leave a comment
Log in with itch.io to leave a comment.