1
\$\begingroup\$

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?

\$\endgroup\$
4
  • \$\begingroup\$ Maybe this will clear up some of the confusion? gamedev.stackexchange.com/questions/15/… \$\endgroup\$
    – bummzack
    Aug 16, 2013 at 7:41
  • \$\begingroup\$ Are you still struggling with this? Is that why you edited the question? \$\endgroup\$ Aug 16, 2013 at 13:16
  • \$\begingroup\$ @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. \$\endgroup\$
    – Dave
    Aug 16, 2013 at 20:43
  • \$\begingroup\$ Perhaps point to Amit's site here instead: theory.stanford.edu/~amitp/GameProgramming \$\endgroup\$ Aug 16, 2013 at 20:45

1 Answer 1

5
\$\begingroup\$

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.

\$\endgroup\$
4
  • \$\begingroup\$ 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 \$\endgroup\$
    – Dave
    Apr 17, 2012 at 4:07
  • \$\begingroup\$ @Dave If there's a shorter path then it gets replaced by it. I'm only talking about when they have the same value. \$\endgroup\$
    – Pubby
    Apr 17, 2012 at 4:08
  • \$\begingroup\$ 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 =/ \$\endgroup\$
    – Dave
    Apr 17, 2012 at 4:11
  • 6
    \$\begingroup\$ 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. \$\endgroup\$
    – House
    Apr 17, 2012 at 4:12

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .