Jump to content
  • Advertisement
Sign in to follow this  
eknathiyer

help reqd in path finding algorthms

This topic is 3257 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, Following is my problem: Given is a matrix with a label for each vertex saying it is a "danger spot" or a "safe spot". Also the starting and destination vertex are provided at run time. I need to figure out the quickest route possible with this given input. Any suggestions as to which algorithm I should use?

Share this post


Link to post
Share on other sites
Advertisement
By a "matrix", I assume you mean you're pathing on a 2D grid? A* is the most commonly used algorithm for this sort of thing.

Share this post


Link to post
Share on other sites
Quote:
Or you could also try Dijkstra's Shortest Path algorithm
My understanding is that A* is a variation of Dijkstra. A* incorporates a heuristic, which causes it to perform better than Dijkstra in the general case. However, there are cases where a meaningful heuristic may not be available, in which case Dijkstra is the better choice.

So in other words, A* vs. Dijkstra isn't really a 'six of one, half dozen of the other' choice; they have different characteristics and different uses.

Given the information that the OP provided, it seems pretty clear that A* is the better choice in this case (unless I've overlooked something).

Share this post


Link to post
Share on other sites
Just figured it would be easier for OP to understand and find a working Dijkstra's then try to get A* working (its just a breadth first search with a heuristic anyway as you point out), but for a beginner DSP might be easier.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!