OpenTTD

Tasklist

FS#5531 - "Ship is lost" when it's not

Attached to Project: OpenTTD
Opened by Ricardo (Samu) - Sunday, 21 April 2013, 13:08 GMT
Last edited by Remko Bijker (Rubidium) - Tuesday, 14 May 2013, 20:36 GMT
Type Bug
Category Vehicles → YAPF
Status Closed
Assigned To No-one
Operating System Windows
Severity Low
Priority Normal
Reported Version 1.3.0
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

I was in a game using YAPF for ships with forced 90 degrees.

The "Ship is lost" message briefly pops and disappears in a matter of a second while in truth the ship isn't lost. I noticed it happens when a ship suddenly needs to service at a randomly chosen depot and that depot happens to be behind its direction on a river.

In another case, when the distance from one place to another is quite long, the same message is shown for as long as it takes and only disappears when the distance towards its destination is shorter. I fixed this using buoys, though they shouldn't be needed, as the ships were never lost.

In either of these two issues, the ships were never lost, it's only the message showing up erroneously.


On a completely different issue, I had one ship that would never service on its own. I was aware of it when I was autoreplacing one model to another and this one had never been replaced. I found out its reliability was down to 0% and 44 breakdowns. I appended a new order to it to service at a specific ship depot and not even now the message "Ship is lost" would appear.

So I ended up appending a service order on all other ships to specificed depots and the vast majority of "Ship is lost" messages simply never have shown up again.
This task depends upon

Closed by  Remko Bijker (Rubidium)
Tuesday, 14 May 2013, 20:36 GMT
Reason for closing:  Won't fix
Additional comments about closing:  See the comment
Comment by Remko Bijker (Rubidium) - Tuesday, 14 May 2013, 20:35 GMT
The problem is that we limit the search space for the pathfinder. We do this to prevent malicious people from completely draining the resources of a server.

With road vehicles and trains you will generally not reach this limit quickly since there are, relatively, few locations where you can choose between routes. For ships you can choose 3 different directions for every tile you enter. If the route is not near straight, but has to navigate around something, the pathfinder will try searching from the closest tile in it's search list towards the end point in the list of tiles to search. Since the ship needs to navigate around a bump, it first needs to move away from its destination, which means it is going to visit a lot of tiles even if it is fruitless. So, the ship reaches it's pathfinder search space limit and simply tells: "I don't know". After that, it lets the ship continue with its best guess of the direction, which in this case means it will eventually reach a location from the destination is within the search space. In other cases, your ship might be lost indefinitely.

So, algorithmically the ship is really lost; it does not know where is has to go to. You can work around this by either placing buoys in strategic places + preventing ships from using "the wrong" depots by setting service orders for depots on the route. Alternatively you increase the pf.yapf.max_search_nodes, however this will slow your game down over using buoys.
Comment by Peter Nelson (peter1138) - Tuesday, 28 March 2017, 22:26 GMT
It happens when a ship enters a dock on TILE_X or TILE_Y facing the dock. The ship will pathfind from the tile it is on but the only way it can move is into the dock. Then it will be forced around and after that it can find a path.

Loading...