help calculating G cost of A* algorithm

Started by
20 comments, last by ankhd 12 years, 1 month ago

I see my path taking shape, but trying to debug areas where the parent is wrong.

If a better path was found because it has a lower G cost, and then after G, H, and F scores along w/ its parent has been updated ... do I then drop it from the open list to closed list? Or does a better path found mean that better path node stays on the open list?

It stays on the open list.

So far the only time I see that I ever drop a node from the open to closed list is when a node is checked for the low F score. And up until my path is screwed up, I can see when I backtrace for parent nodes, they're all on the closed list. So my path looks good from the start to point of screw-up and all those nodes are on the closed list. At the point of screwup, I see nodes on the open list.
[/quote]
So your algorithm finishes but then you have trouble when recovering the path? I don't know how that can ever lead to a node in that's not in the closed list. Check wherever you assign a parent in your code. It should be obvious that the node was just put in the closed list at that point.

Oh, and you should never put a node from the closed list back in the open list.
Advertisement
hello. heres a link to a XNA A*, its very clear and written well.
http://xnatd.blogspot.com.au/2011/06/pathfinding-tutorial-part-1.html


rolleyes.gif

This topic is closed to new replies.

Advertisement