AStar Navigator Library for Processing

The AStar algorithm finds the shortest route through a series of nodes. It does this by combining a calculation of the cost to reach the target and the distance to the target. By accident the author has incoporated the Best First Search (BFS) algorithm which is inaccurate but offers a massive speed increase over AStar. This is an optional extra.

This library also comes with a basic node-web generator to get you started on simple projects. This library works in up to 4 dimensions, allowing you to add terrain modifiers to nodes or link worlds together. A hexagon tile generator and a polyhedral node generator are in the works, as well as Dijkstra's algorithm amongst other things, contributions to the AStar library are welcome.

This library assumes you know how to utilise Java's Vector class, a dynamic array for objects.

Java Vector documentation

There are some explanations of the AStar algorithm below that will help you in using the library:

A* Pathfinding for Beginners
A* Algorithm Tutorial (This one comes with a range of good links)

Documentation

AStar

Node

Examples

Pathfinding and Terrain example

Snake Charmer

If you put together any work using the AStar library Just drop me a line and I'll be happy to link to it here. Same goes for if you find any bugs, typos or just simply don't understand how this library works. Contact me at the Processing forums (st33d) or mail me: info[at]robotacid[dot]com.

Download

AStar Library

To add the library to your project, put the unzipped folder aStarLibrary into the folder processing-###/libraries/
Next time you start Processing you should have a menu option of Sketch > Import Library > aStarLibrary
Click on that option to add the code: import aStarLibrary.*;

Source code can be downloaded here.

The AStar Navigator Library is released under the GNU Lesser General Public License

Tested with Processing and compiled with Eclipse

Powered by cups of tea and spice melange