G score is always higher going through current node

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: any ways to make this guess—this lecture shows just one way UC Santa Cruz Computer Science – Game Design CompuDng H using Manhapan method •  Manhapan method –  Calculate the total number of nodes moved horizontally/verDcally to reach the target node (B) from the current square –  Ignore diagonal movement, and ignore obstacles that may be in the way. –  MulDply total # of nodes by 10, the cost for moving one node horizontally/ verDcally. –  Called Manhapan method because it is like calculaDng the number of city blocks from one place to another, where you can’t cut across the block diagonally. Ager first step, showing costs for each node. G = movement cost to reach the current node (lower leg) H = Manhapan esDmate of cost to reach the desDnaDon from node (lower right) F = G + H (total cost) UC Santa Cruz Computer Science – Game Design ConDnuing the search •  Pick the node with lowest F value –  Drop it from open list, add to closed list –  Check adjacent nodes •  Add those that are walkable, and not already on open list •  The parent of the added nodes is the current node –  If an adjacent nodes is already on the open list, check to see if this path to that node is a beper one. •  Check if G score for that node is lower if we use the current node to get there. If not, don’t do anything. •  On the other hand, if G cost of new path is lower change the parent of the adjacent square to the selected square –  (in the diagram, change the direcDon of the pointer to point at the selected square) –  Finally, recalculate both the F and G scores of that square. Ager picking node with lowest F value. Node is in blue, indicaDng it is now in closed list. UC Santa Cruz Computer Science – Game Design Example Consider node to right. Check adjacent squares. Ignore starDng point (on closed list). Ignore walls (unwalkable). Remaining nodes already on open list, so check to see if it is beper to reach those nodes via the cu...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online