FS#5713 - Boats sent to impossible depots

Attached to Project: OpenTTD
Opened by A. Taylor (Leftie) - Saturday, 17 August 2013, 22:34 GMT
Last edited by Remko Bijker (Rubidium) - Tuesday, 12 November 2013, 21:01 GMT
Type Bug
Category Vehicles → YAPF
Status Confirmed
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version 1.3.2
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 1
  • A. Taylor (Leftie) (2013-09-04)
Private No



Boats sometimes attempt to go to places they are simply unable to reach. I first saw this on the TT-F forum, here

I then tried to replicate it to see if it was still possible in the current version (1.3.2). Using YAPF, i managed to recreate this. Boats attempted to go to a depot that was nearer, but was completely inaccessible through any valid means, and totally ignored a boat yard further away, but in clear open waters.

My attempt at replication is in the below screenshot, using OpenTTD 1.3.2 and YAPF as the pathfinder in advanced settings.
This task depends upon

Comment by A. Taylor (Leftie) - Saturday, 17 August 2013, 22:35 GMT
Whoops, screenshot attached, it seems it wasn't done in the original post, possibly due to my forgetting to add the title and being prompted to re-enter ;)

edit: also if its of value, this is a vanilla game, there are no GRFs involved, at all, although i did cheat (ctrl+alt+c) to get the money needed to mess with terrain.
Comment by Alberth (Alberth) - Sunday, 18 August 2013, 07:59 GMT
Could you please provide a save game before the problem happens, and a (preferably) short sequence of steps to do, to replicate the issue?
That gives us the certainty we talk about the exact same problem, gives an easy means to examine the issue closer, and also verify afterwards that it is fixed.

A vanilla game without newgrf would be preferable, cheating for money is no problem. In general using trunk or a recent nightly is best, but latest stable will work too.
Comment by Charles Pigott (LordAro) - Sunday, 18 August 2013, 10:21 GMT
I got bored and decided to reproduce this


Comment by Charles Pigott (LordAro) - Sunday, 18 August 2013, 10:43 GMT
far as i can tell, the unreachable depot must be closer to the ship than the 'reachable' depot
Comment by pagnon stephane (krinn) - Sunday, 18 August 2013, 14:36 GMT
Have a look at /task/5656
i have a savegame there, it is not limited to boats or limited to the YAPF (but i'm unsure if road vehicle use it or not)
Comment by A. Taylor (Leftie) - Sunday, 18 August 2013, 16:21 GMT
LordAros save is accurate. You basically just need a boat and two depots, one of them (the nearest) being impossible to go to due to land. The boat will always choose the nearest depot. My best guess is that clicking on the depot button is missing a check, and it doesn't actually see if its possible to go to the depot, it just chooses the nearest instead of trying to plot routes to see.
Comment by Remko Bijker (Rubidium) - Tuesday, 12 November 2013, 21:01 GMT
  • Field changed: Status (New → Confirmed)
Ships are stupid... they find the closest depot by finding the one with the shorted manhattan distance, instead of the distance it would need to travel. Probably as optimisation for finding the closest one, which can be extremely expensive when there isn't a reachable depot but it still has to search a vast amount of the map.

I'm not quite sure whether we actually want this 'optimisation' fixed or not.
Comment by frosch (frosch) - Sunday, 29 May 2016, 14:17 GMT
I guess it needs both:
* First check whether there is a depot near-by using the bird-distance heuristic.
* Then run the pathfinder to check the actual distance/reachability.

As mentioned by juanjo in  FS#6410 , YAPF only supports limited search distances for trains. Road- and ship pathfinder always search to the destination, without limit.