{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}


map squares are uc santa cruz computer science game

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: Science – Game Design A* pathfinding •  A* algorithm is widely used as the conceptual core for pathfinding in computer games –  Most commercial games use variants of the algorithm tailored to the specific game –  Original paper: •  A* is a graph search algorithm •  A Formal Basis for the HeurisDc DeterminaDon of Minimum Cost Paths •  Hart, P.E.; Nilsson, N.J.; Raphael, B. •  IEEE Trans. Systems Science and Cyberne6cs, 4(2), July 1968, pp. 100 ­107 –  There is a large research literature on graph search algorithms, and computer game pathfinding UC Santa Cruz Computer Science – Game Design Overview of A* algorithm •  The following slides borrow heavily from: •  Problem –  A* Pathfinding for Beginners, by Patrick Lester •  hpp://www.policyalmanac.org/games/aStarTutorial.htm –  A unit wants to move from point A to point B on a game map, ideally along the shortest path •  Assume the game map is a rectangular grid –  Makes explanaDon easier, algorithm can accommodate many grid types –  The literature views the map as a graph –  Open/walkable (open terrain) –  Or closed/unwalkable (walls, water, etc.) •  Map squares are UC Santa Cruz Computer Science – Game Design Running Example •  A unit in the green square wants to move to the red square –  From here on out, we’ll call the squares “nodes” to be consistent with the research literature •  Moving •  ObservaDons –  Horizontally or verDcally requires 10 movement points –  Diagonal movement requires 14 movement points –  Cannot move through blue squares (wall, unwalkable) –  Can’t just draw a line between A and B and follow that line –  It’s not ideal to just follow the minimal line between A and B unDl you hit the wall, then walk along wall •  Not an opDmal path •  Wall in ­between Pathfinding example. Green square is starDng locaDon, red square is desired goal. Blue is a wall. Black is walkable, blue is unwalkable. UC Santa Cruz Computer Science – Game Design Open and Closed Lists •  StarDng the search –  Add A to open list of nodes to be consi...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online