FS#1944 - RVs not picking empty DT platform

Attached to Project: OpenTTD
Opened by Expresso (Expresso) - Monday, 21 April 2008, 22:06 GMT
Last edited by Remko Bijker (Rubidium) - Friday, 04 December 2009, 20:53 GMT
Type Bug
Category Vehicles
Status Closed
Assigned To No-one
Operating System All
Severity Low
Priority Normal
Reported Version trunk
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


It occurred to me to report this bug in r12820, however it's been bugging me for a while already.

In the attached savegame there are 2 drive-through road stops, one side is of road stop A is occupied so the vehicle should find a route to the empty platform (which is available). However, vehicle 2 stops right after vehicle 1, instead of finding a route to the empty platform.

To replicate: release vehicle 2 from the depot. rv 2 will wait behind rv 1, instead of going for the free platform (to which a route is available).

I increased yapf.road_stop_penalty to 10000, to make sure waiting isn't cheaper for the pathfinder as driving around to the empty platform.
This task depends upon

Closed by  Remko Bijker (Rubidium)
Friday, 04 December 2009, 20:53 GMT
Reason for closing:  Fixed
Additional comments about closing:  In r18404; might need a higher occupancy penalty before it actually thinks driving around is better; primarily because the stop is half filled.
Comment by Remko Bijker (Rubidium) - Thursday, 24 April 2008, 08:02 GMT
The pathfinder just thinks that the waiting takes shorter than the driving around it.

Furthermore making it go to the other side causes the same:
a) one vehicle at the station as it is now and then four vehicles are going to the stop. They see one side is empty and all go to the other side.
b) same as the above case, but when a slot is freed/used all other vehicles going to the station rethink the side to go to. This can cause a vehicle indefinitely do go around the station without ever having the chance to load.

So as it stands there are no viable issues that do solve the issue and do not cause unwanted side effects.
Comment by Expresso (Expresso) - Wednesday, 20 August 2008, 10:05 GMT
Well, maybe it's a good idea to implement a system in which road vehicles reserve a platform and wait for that platform to come free?
Of course a road vehicle should only try to reserve a platform if it's at a certain distance from the station (less then 10 tiles, for example). If all road stops are full, the road vehicle should be put on a list of waiting vehicles (fifo) to prevent strange situations and either drive in circles for a while or stop somewhere (at this point the traffic lights patch could come in handy).
Comment by frosch (frosch) - Tuesday, 09 December 2008, 22:07 GMT
Just to mention it:
There is another aspect of this bug in nightlies. The slot reservation only works for road stops which are part of the orders. But now road vehicles can also stop at other road stops (non-non-stop orders).
Comment by frosch (frosch) - Saturday, 20 December 2008, 15:32 GMT
Note: YAPF performed especially bad with drive-through stops. Since r14703 it is as good/bas as NPF at least.
Comment by Expresso (Expresso) - Friday, 05 June 2009, 13:57 GMT
The pathfinder (yapf at least) seems to treat drive-through road stops the same as normal road stops. If (for example) there's a north-south DT road stop, a vehicle arriving from the south should notice that the other platform can only be accessed from the north. CYapfCostRoadT.OneTileCost (lines 63-66 in yapf_road.cpp) doesn't seem to check for this.

Could this be the culprit?
Comment by frosch (frosch) - Friday, 05 June 2009, 17:06 GMT
The problem consists of at least four parts:
1. The roadstops cannot dinstinguish which slot is reserved by a road vehicle, resp. how many vehicles are heading for which slot.
2. The multistop code cannot compute the costs for reaching the different slots, as all pathfinders only get a destination tile. Same applies to the vehicle itself after reserving a slot. dest_tile cannot identify the direction.
3. Driving through roadstops of a station to reach another roadstop of the same station won't work. (Again applies for both pathfinding during reservation and during driving)
4. When multiple drivethrough stops are sequential in a row, they would need to be treated as one drivethrough stop. But depending on  FS#1495  with less penalty for multiple vehicles heading to it.