READ INSTRUCTIONS FIRST, YOU WILL BE CONFUSED OTHERWISE!!! Click to create a node Click two nodes to connect them Click two nodes again to remove the connection Press R to reset Double click a node to get a choice: (D) Delete node / (S) Make start node / (E) Make end node Once a start and end node is selected, press SPACE to find a path.
(Please, report any bugs or issues you find. Try to describe the kind of map you made when you got the problem, and what problem you found) Pathfinding by humanitymanu (mrmayman is my other name). All state is stored in mpf - Nodes and mpf - Connections, to store the nodes and their connections respectively. Everything under (mpf -) is the public API, and everything under (Pathfinding -) is the internal stuff. This pathfinding algorithm isn't ideal. It won't give you the SHORTEST POSSIBLE path, but it definitely will give you a path. Useful for map navigation systems in games, I guess? You can use this but give me credit (humanitymanu). If you find any bugs or have any feedback, feel free to tell me. Here is an example of how to use this. You can throw away all of the editor stuff. # Why? I had favorited another node pathfinding project by monoblaster2 and was considering using it for my game, but it is clone based which I don't want, so I made this. No code is taken from that project. # How to use? Click see inside, and you will see a basic example of how to use this project. Click the green flag, then click the snippet and you will see what happens. # How does it work It starts by checking the neighbours of a start node. It evaluates all the neighbours from closest-to-end to furthest-to-end. Starting with the most ideal neighbour (the one closest to the end), the neighbours of that neighbour is checked, and again and again. If any neighbour leads to a dead end, then other neighbours are checked instead. Essentially it is a recursive search through the map, but it prioritises nodes closer to the end, so it can stop early.