If one try to get the eagle to travel back to it's last node while he's travelling he'll stop another node and he reaches it. Also while the eagle is traveling if you switch the eagles path to a path that involves the last node the eagle will skip that node within the path.
Aquila - A* Pathfinding for GameMaker
A downloadable library
GameMaker has some really nice built-in pathfinding in the form of mp_grids; in fact, I often go as far as saying they're my favorite built-in system of GameMaker. They're great if you want to be able to navigate through a grid-based structure like a maze, but sometimes they're not quite the right tool for the job. Did you ever want to implement Google Maps in GameMaker? Probably not, but bear with me.
Enter the pathfinding algorithm known as A*! mp_grids actually use A* under the hood, but they're set up in a special way such that each node is automatically connected to its neighbors, creating a grid rather than a generic mesh. This way, the network is defined only by the connections between each node (see: graphs), rather than their physical location in space.
This requires GameMaker Studio 2.3.3 in order to work. It relies heavily on the new language features.
The system performs pretty well, at least within reason. Graph traversal in general tends to get expensive on bigger networks with more connections, so try not to do anything like running this consistantly in the Step event, but you can get an idea for the amount of time each navigation takes in the status message. Naturally, the YYC yields much better performance than the VM.
Eventually I want to write a DLL version of this to make it even speedier, but for the time being I want to work on some other things.
is available here. Github wikis are the best thing ever.
As usual, the asset is free as-is. I'll fix simple or game-breaking bugs but more involved support requires payment via either Itch or Patreon. I get the final say in what constitutes "game-breaking." With that said, it passes all of the test cases I can think of so there shouldn't be any problems.
- The demo makes use of Emu (also by me), which uses Scribble by @jujuadams
- Icon is Bald Eagle by Icons Producer from the Noun Project
Click download now to get access to the following files:
- Small bug fixes (already), and the documentationSep 12, 2021