Astar Pathfinding

The problem is that you actually need to combine the results of the heuristic with the cost so far. So if just using the square of the heuristic you’d have f(x) = g(x) + h(x)*h(x), which for heuristic values greater than 1 would make the search tend to a best-first (and the heuristic is non-admissible).

Taking the square of the cost so far doesn’t fix it either, because g(x)*g(x) + h(x)*h(x) still doesn’t have the same metric properties as g(x) + h(x).

Yes, I should have clarified, I meant between Manhattan and Euclidean distances. :slight_smile:

In my game Sinuosity because it’s a maze where you can never go diagonally Manhattan distance works excellently. I would imagine that if you allowed diagonals you could just do a smarter version of Manhattan where you use sqrt(2) for the diagonals and 1 for direct angles. That is, if you consider a diagonal to cost more than u/d/l/r, considering it is in fact a longer distance.

Few years ago I worked on a pathfinder project.

If you’re interested you can see it here: http://gamadu.com/temp/stuff/Pathfinder.zip

Hi,
When running the applet from the browser, the path does not start after the two clicks.
When building and running from sources, the pathfind returns a null path at the following call :frowning:

GridPath aPath = pathfinding.getPath(mouse.getStart(), mouse.getEnd(), draw.getMap());

Any suggestion to have the demo running?! It seems great!
Cheers :slight_smile:
Martin

Just test it and it still work fine. You need to do a right click and a left click and you need to click on empty space.

That’s what I did :confused:
I will tell you if I find the reason.
Cheers,
Martin