Page 1 of 1

Rail pathfinder.InitializePath clarification

Posted: 15 Oct 2010 08:42
by kirky_D
Hello there again!

Looking at the wiki this line confuses me a little bit.
The pathfinder expects an array of [start_tile, tile_before_start]-arrays and an array of [last_tile, tile_after_end]-arrays. since we only have one source and one goal tile, we'll just create two arrays with one element each. Now the pathfinder is ready to find a path.
I can get the pathfinder to find a path fine when I only have 1 set of start and end tiles, but if I have more than one it simply uses the first set of start tiles and the last set of end tiles. Can somebody tell what the point of adding in more start and end tiles is? The way I read it is that it will find a path for each set of start-end tiles, but this is not correct?

Cheers all!

Re: Rail pathfinder.InitializePath clarification

Posted: 15 Oct 2010 14:00
by Yexo
No, it'll find a path between from any start tile to any end tile. If you want multiple paths you'll have to call the function multiple times.

Re: Rail pathfinder.InitializePath clarification

Posted: 15 Oct 2010 14:09
by fanioz
kirky_D wrote:I can get the pathfinder to find a path fine when I only have 1 set of start and end tiles
true
kirky_D wrote:but if I have more than one it simply uses the first set of start tiles and the last set of end tiles
AFAIK, it was not that 'simple'. The pathfinder would likely to choose the shortest pair (in distance).
kirky_D wrote:Can somebody tell what the point of adding in more start and end tiles is?
The pathfinder could use any of tile-set defined, not restricted to only one set.
kirky_D wrote:The way I read it is that it will find a path for each set of start-end tiles, but this is not correct?
For example Let's have:
Source = [a, b] [c,d] [e,f] [g,h]
Dest = [z, y][x,w][v,u]

The pathfinder will only find one path regardless how many set you have. Look, even the source and destination set count is not same.
If the shortest distance in map is between 'f' and 'u', the pathfinder would return:
First Tile = v, and last tile = e

Edit:: Yexo was faster :)

Re: Rail pathfinder.InitializePath clarification

Posted: 15 Oct 2010 15:58
by kirky_D
Yeah that's pretty much what I thought.

Cheers guys!