It's free to join Gamasutra!|Have a question? Want to know who runs this site? Here you go.|Targeting the game development market with your product or service? Get info on advertising here.||For altering your contact information or changing email subscription preferences.
Registered members can log in here.Back to the home page.

Search articles, jobs, buyers guide, and more.

By W. Bryan Stout
Gamasutra
February 12, 1999

Published in
Game Developer Magazine,
October 1996
Game Developer Magazine

Letters to the Editor:
Write a letter
View all letters


Features

The Star of the Search Algorithms (A* Search)

Contents

Introduction

Path-Finding On The Move

Looking Before You Leap

The Star of the Search Algorithms (A* Search)

How Do I Use A*?


Transforming the Search Space


Storing It Better


Fine-Tuning Your Search Engine


What If I'm in a Smooth World?

The best-established algorithm for the general searching of optimal paths is A* (pronounced "A-star"). This heuristic search ranks each node by an estimate of the best route that goes through that node. The typical formula is expressed as:


f(n) = g(n) + h(n)



where:

f(n)    is the score assigned to node n 

g(n)    is the actual cheapest cost of 

        arriving at n from the start 

h(n)    is the heuristic estimate of the 

         cost to the goal from n 

So it combines the tracking of the previous path length of Dijkstra's algorithm, with the heuristic estimate of the remaining path from best-first search. The algorithm proper is seen in Listing 3. Since some nodes may be processed more than once-from finding better paths to them later-we use a new list called Closed to keep track of them.

A* has a couple interesting properties. It is guaranteed to find the shortest path, as long as the heuristic estimate, h(n), is admissible-that is, it is never greater than the true remaining distance to the goal. It makes the most efficient use of the heuristic function: no search that uses the same heuristic function h(n) and finds optimal paths will expand fewer nodes than A*, not counting tie-breaking among nodes of equal cost. In Figures 9A through 9C, we see how A* deals with situations that gave problems to other search algorithms.

How Do I Use A*?


join | contact us | advertise | write | my profile
news | features | companies | jobs | resumes | education | product guide | projects | store



Copyright © 2003 CMP Media LLC

privacy policy
| terms of service