Routing in the old days
In the old days Kore used to just use the .fld instead of .dist to do the routing right?
I found this in Route.pm : $weights = join('', (map chr($_), (255, 7, 6, 3, 2, 1)));
And even here walkable water IS flagged as 255 weight, wich is equal to the weight of a wall lol, thats bad.
Note that the snipables are NOT flagged as 255 weight, wich is good, we want our bot to take advantage of snipable.
But hey, the non-default weights have no function anymore, want to know why? Read next paragraph.
Disadvantage of .dist over .fld in routing
Actually, at this moment there is no point in specifying these weights for specific types of tiles,
since the pathfinding algorithm only looks at the .dist and not the .fld!
Its not possible anymore to avoid specifical blocks like we could in the old days. (if my hypothese about the past is right)
And therefore the weights argument when creating a pathfinding object has no real function anymore.
But what if we want our bot to walk on water (waterball) and avoid non-water walkable blocks.
Or what if we want our bot to not avoid snipable walls. (an even better alternative would be that kore would take advantage of this, and walk close to it)
We could always not use the "do not walk close to a wall" function but is that really a solution?
Maybe we could generate a different .dist according to our preferences during routing.
Kore = wall-hugger by default now?
newg = fullList->array[cur].g + weight[CalcPath_getMap(map, width, height, &fullList->array[suc].p)];
CalcPath_getMap(map, width, height, &fullList->array[suc].p) will return the closest distance to a wall/nonwalkable (0 for a tile that is non walkable)
weight[CalcPath_getMap(map, width, height, &fullList->array[suc].p)]
255 if distance to the closest wall is 0,
1 if distance to the closest wall is 1,
2 if distance to the closest wall is 2, ... and so on
But wait lol, one bug here fixes another, thanks to the weights argument,
we do (unknowingly) give the tiles that have a distance 7, 6, 3, 2 or 1, weight 255.
So the bot will actually avoid walking in a distance of 7 to a wall.
LOL or CRY?
One ST0 to rule them all? One PE viewer to find them!
One ST_kRO to bring them all and in the darkness bind them...
Mount Doom awaits us, fellowship of OpenKore!