A-Star Algorithm Pathfinding Engine
It's perfectly suitable for grid based games with obstacles, or even mazes.
Compatible with GM 6 Registered and GM 7 Pro.
- straight and diagonal costs are now saved in variables which can be changed with AStar_setAll
- the grid can have an offset
- you can now choose one of two coordinate systems and path returning systems
- most of the variables now have retrievable default values
- the estimate has been rewritten
- if the goal node is blocked, the engine doesn't even start searching
- more information in the scripts' headers
- corrected some lower/upper-case var errors
- enlarged the example grid - part is now maze-like, part map-like (with obstacles)
- you can set whether to allow diagonal movement and cutting through obstacles when moving diagonally (AStar_setAll)
- changed scripts: AStar_init, AStar_getNeighbors
- corrected a bug which caused the blocked direction setting to work only one-way
- enhanced the example - added a default maze and two new controls (see Example Controls in the game info)
- corrected the AStar_getCost script - previously, the system didn't return the shortest path in some cases
- fixed a bug which caused individual direction blocking not to work at all + some little polishments
- the scripts changed are AStar_init, AStar_setBlocked and AStar_setDirBlocked
- the initial release
- 4- or 8- directional movement
- cell blocking (obstacles)
- individual direction blocking for each cell
- allow/disable cutting through obstacles when moving diagonally
- always finds the shortest path
- fast and fairly easy to implement
More details are in the examples' game information (viewed in-game by pressing F1).
Sorry for the lack of proper documentation and script comments, I may improve it sometime later - but no promises.
Here are the download links:
GM6 Example (0.03 MB)
GM7 Example (0.04 MB)
GML File - just the scripts (0.01 MB)
Use this freely in your projects and modify it to your liking. Credit is appreciated, but won't be enforced through lawsuits .
This engine was created by Ansgar (Oskar Maxa) with some help from DFortun81.
It is based on David Brackeen's "Game Character Path Finding in Java" article, which can be found on the following address:
Please post your questions, bug reports, comments, ideas, ratings, suggestions, and all that stuff.
Edited by Ansgar, 02 June 2007 - 02:25 PM.