Advertisement

AStar question

Started by August 19, 2008 04:04 AM
0 comments, last by markgame66 16 years, 3 months ago
I found some phrases in common AI literatures for astar difficult to understand. If we have a node in the open list (the node the Agent standing on), why does the program pop the node from the list right away in the subsequent statements from the start? If we do so, the open list immediately gets emptied. And should stop in the case? 2 books I am reading,AI programming Wisdom 1 and Game programming Gems 1, both say this thing... Do I misunderstand them? And a second question about it in AIW1 void CAStar::LinkChild(_asNode* node, _asNode *temp) { int x = temp->x; int y = temp->y; int g = node->g + udFunc(udCost, node, temp, 0, m_pCBData); int num = Coord2Num(x,y); ... _asNode *check = NULL; if (check = CheckList(m_pOpen, num)) { node->children[node->numchildren++] = check; if (g < check->g) { ... I don't understand what the differences are between g and check->g? Anyone remember and share insights? Thanks Jack [Edited by - lucky6969b on August 19, 2008 4:27:37 AM]
lucky6969b,

The open list will indeed be emptied straight away, and the start node will go onto the closed list. However, you'll then start looping round adding (if possible) elements to the open list as you find the best scoring node in the sourrounding selection.

See:

http://www.gamedev.net/reference/programming/features/astar/

Very useful

Mark

This topic is closed to new replies.

Advertisement