Units on boats moving on bridges

If you find a bug please report it here

Units on boats moving on bridges

Postby LichKing » Tue Jan 03, 2012 11:24 am

Game 5066, I had 4 units (pala+DK+2 units) on boat (galley) near the town Northport (north-center of the map), I wanted to join them with a Pegasus that was produced in that town, and I selected the tile over a bridge. They should have traveled by sea and reach the bridge, and the movement path displayed this route. I give the movement order, and.. they disembark and go on the bridge by foot.. It was a rather important move, in a ladder game.. I guess nothing can do about it, right?
LichKing
 
Posts: 178
Joined: Tue Feb 15, 2011 7:53 pm

Re: Units on boats moving on bridges

Postby SnotlinG » Tue Jan 03, 2012 1:21 pm

Im afraid nothing can be done about the game, but if the units are not moving as expected its a bug we need to fix.
Im looking at your game but Im not sure I understand where your units started before ending up on the bridge.
Also, are you saying that it did draw one path first, and then when you hit move, it moved another path than expected? It sounds a bit unlikely considering the move-code :-)

If you could get me some more details what happened I might be able to reconstruct the problem :-)
SnotlinG
 
Posts: 2148
Joined: Sat Feb 13, 2010 12:42 am

Re: Units on boats moving on bridges

Postby LichKing » Tue Jan 03, 2012 2:22 pm

There were those 4 units on the dock, galleys with 19 moves. Near the town there's a bridge, I ordered them to move on it, because there was a Pegasus in Northport and it could join the army, sparing some moves. The army on boats, instead of going to the bridge by sea (it would have reached with 14 moves left), disembarked and reached the bridge by foot, with 0 moves left.

It is possible that when the path was drawn first, I selected a tile right under the bridge (I don't remember well, but if you say it's impossible it's probably as you say), and that thereafter I double-clicked on the bridge without noticing that it would have reached it by land. Anyway, units on boat trying to move on a bridge should not disembark, since the fastest way to that tile is by boat, not by foot. Maybe it's a problem with pathfinding that recognize bridges always as 'land terrain', even if boats can pass through it. Never mind the lost 2 turns :roll: :)
LichKing
 
Posts: 178
Joined: Tue Feb 15, 2011 7:53 pm

Re: Units on boats moving on bridges

Postby SnotlinG » Tue Jan 03, 2012 3:10 pm

I have checked the code now, and yes it does not calculate the best path under these circumstances. The problem is that your ships already were located on the Anchor, the pathfinding algortihm then incorrectly thinks it can convert to Landunit for no cost, so thats why it suggest you move this way if you click on the bridge.
(I guess you had some bad luck also to select 1 tile below the bridge so you got an almost correct path, and then when doubleclicking it calculates diffrently because of the bridge)

Since it is a very rare thing to happen, I wont update the code now since it is a risk that would have performance impact for the pathfinding (adding more logic there will have a cost unfortunately since it is iterating through that function thousands of times for each path you click out :-) )
I have added it to the to-do list though and will see if I can update it in the future when I can test performance without affecting the current games.

Thanks for reporting, and sorry about your lost turns :-(
SnotlinG
 
Posts: 2148
Joined: Sat Feb 13, 2010 12:42 am

Re: Units on boats moving on bridges

Postby LichKing » Tue Jan 03, 2012 3:55 pm

No problem, the important thing, as I see it, is that the pathfinding system doesn't always think that bridges can be reached only by land if units are on boats.. The lost turns shouldn't be so tragic :).
LichKing
 
Posts: 178
Joined: Tue Feb 15, 2011 7:53 pm


Return to Bug reports

Who is online

Users browsing this forum: No registered users and 18 guests

cron
Not able to open ./cache/data_global.php