Pathfinding

I've written two articles about pathfinding for the GNU/Linux Magazine, a french journal that includes an Artificial Intelligence section I'm responsible of. To illustrate those articles, I've developped an open source (GPL) Java software that implements the Dijkstra and the A* (A-star) algorithms. The main goal of this application is to compare algorithms and implementation strategies. Algorithms work on tile based terrains. The terrains are described by very basic XML files and support a tile based mouvement cost.

Limitations

The current version of the software does not include documentation, except the source code and this page! I've tested the software with the 1.4.2 version of the SUN jdk under linux. It should work on any system that supports java 1.4. It will not work with straight 1.3 java (or earlier) as it uses a XML parser.

The current version (0.0) is very basic and contains a lot of bugs. As any GPL program, it comes with no warranty.

Instructions for use

To use the program, you need of course to download the jar file, but also terrain description files. As any jar file, the program is started with the -jar option, that is you have to use the command java -jar pathfinding.jar.

The first thing to do after the application is started is to load a terrain from the File menu with the Open entry. You have to load an XML file that contain a terrain description. Example files are available through the downloading section.

When a terrain is loaded, it is displayed by the main window. You can interact with this display. You can for instance zoom in with the + key (and zoom out with the - key). You can turn on/off a grid that represents tiles with the g. You can move around the terrain (if it is too big to be displayed completely into the window) thanks to the direction keys.

The main purpose of the application is to calculate optimal path. To trigger such calculation, you just have to click on the terrain to specify the starting point and then to click again for the ending point. The optimal path calculation is automatically started. After completion, the optimal path is drawn on the terrain. The status line gives information about the path:

Most of the interface is dedicated to modification of the algorithm, of the underlying data structures and of the terrain model:

After a path has been calculated, it is displayed on the terrain. Final status of the Open and Closed lists is also displayed. A blue circle means that the corresponding tile is in the Open list. Green circles corresponds to tiles in the Closed list. This display can be controlled with the o key (to turn on/off Open display), the c key (to turn on/off Closed display), the f key (to have full circles) and the e (to turn back to the circle display).

Downloading