A* Pathfinding Program
I have been making a small application in the past few weeks in practice for my Java exam and also to get a decent Java & OpenGL demo together. The result is a program called A* Pathfinder.
For the initiated, A* is a pathfinding algorithm found in many of todays games, such as Age of Empires or Command & Conquer. The algorithm searches for the best path from point A to point B, taking terrain into consideration. In my program, I have kept things simple in terms of the terrain:

Impassable terrain is shown in black. The user can change a node to be impassable by clicking on it ('node' is the term used in A* literature, but in this case it means a square). The user can also set a start point and an end point with a right-click pop-up menu.
I have also built in the ability to save and reload grids that have been created. I made this mainly for my benefit, so that during debugging I didn't need to create the grid each time!
When the user is ready to evaluate a path, they can click on the 'Calculate path' button and the result is shown below:

The path is highlighted in blue and evaluated nodes are shown in yellow.
I still have some bugs to solve, such as:
- Under Windows Vista, the help file doesn't open with out downloading WinHelp32.exe from the update site as Microsoft decided to ditch it from Vista. I am going to try and make a .chm file instead.
- Under Windows Vista, the menu screens display icons correctly until the user clicks on something. Then it just renders a tick. I have to say, there are a few 'issues' with using native look & feel in Java on Vista...
- An error is thrown when trying to open a grid file outside of the NetBeans IDE environment that I used to make the program. I get an "Unknown protocol c" exception and with a bit of Googling it seems I'm not the only one. Hopefully I can debug this.
Once I have worked these out, I will make a download available.
For the initiated, A* is a pathfinding algorithm found in many of todays games, such as Age of Empires or Command & Conquer. The algorithm searches for the best path from point A to point B, taking terrain into consideration. In my program, I have kept things simple in terms of the terrain:
Impassable terrain is shown in black. The user can change a node to be impassable by clicking on it ('node' is the term used in A* literature, but in this case it means a square). The user can also set a start point and an end point with a right-click pop-up menu.
I have also built in the ability to save and reload grids that have been created. I made this mainly for my benefit, so that during debugging I didn't need to create the grid each time!
When the user is ready to evaluate a path, they can click on the 'Calculate path' button and the result is shown below:
The path is highlighted in blue and evaluated nodes are shown in yellow.
I still have some bugs to solve, such as:
- Under Windows Vista, the help file doesn't open with out downloading WinHelp32.exe from the update site as Microsoft decided to ditch it from Vista. I am going to try and make a .chm file instead.
- Under Windows Vista, the menu screens display icons correctly until the user clicks on something. Then it just renders a tick. I have to say, there are a few 'issues' with using native look & feel in Java on Vista...
- An error is thrown when trying to open a grid file outside of the NetBeans IDE environment that I used to make the program. I get an "Unknown protocol c" exception and with a bit of Googling it seems I'm not the only one. Hopefully I can debug this.
Once I have worked these out, I will make a download available.
0 Comments:
Post a Comment
<< Home