Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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:

Path

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? gamedev.stackexchange.com/questions/15/… –  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: theory.stanford.edu/~amitp/GameProgramming –  Pieter Geerkens Aug 16 '13 at 20:45

1 Answer 1

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
6  
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

 
discard

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.