Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have been reading up about path finding and find it all very confusing, however this is probably the best I have found for a logical explanation:


If the cost of two nodes has the same value, I'm not sure how the path would be worked out though. How would it be worked out?

share|improve this question
Maybe this will clear up some of the confusion?… – bummzack Aug 16 '13 at 7:41
Are you still struggling with this? Is that why you edited the question? – Pieter Geerkens Aug 16 '13 at 13:16
@PieterGeerkens no the link in my question was dead but it still seems to be dead =/ wanted to fix it encase future users find it useful. – Dave Aug 16 '13 at 20:43
Perhaps point to Amit's site here instead: – Pieter Geerkens Aug 16 '13 at 20:45
up vote 5 down vote accepted

If two paths have the same value then it doesn't matter which one you pick. There may be multiple paths with the same distance, but you're only concerned with a single one.

In that example diagram it uses < for the comparison, which means the earliest shortest path found will be chosen over latter ones.

share|improve this answer
Yeh but its only shortest in that moment, it could Infact take longer later on if you blindly follow the shortest path initially surely? So wouldn't you have to some how go back on yourself or something – Dave Apr 17 '12 at 4:07
@Dave If there's a shorter path then it gets replaced by it. I'm only talking about when they have the same value. – Pubby Apr 17 '12 at 4:08
Well yeh but if you find 2 nodes with same values, you have to pick at random pretty much so if you found the end for one node took 10 steps... how do you know if the other was any shorter =/ – Dave Apr 17 '12 at 4:11
The algorithms do not just pick a way and go with it. They do all of them until the destination is reached. That's when the shortest path is returned. – Byte56 Apr 17 '12 at 4:12

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.