[1.1.33] Trains don't route through train stations

Bugs that are actually features.
Post Reply
j3robins
Burner Inserter
Burner Inserter
Posts: 17
Joined: Thu May 11, 2017 1:16 am
Contact:

[1.1.33] Trains don't route through train stations

Post by j3robins »

When there's a path around a stopped train but it goes through a train station, a train will not pick that path and instead path through the waiting train and wait for the train to move.

See screenshots for example. There is a path around the train that goes past a train station and the train would rather wait for the train in front of it (forever in this case) rather than route around the train.
Screenshot showing path where train refuses to go around blocked train
Screenshot showing path where train refuses to go around blocked train
path_with_station.jpg (597.75 KiB) Viewed 1094 times
Using the screenshot as a reference, two trains are scheduled to the second station. The first train is at the station and the second train is waiting. The third train is scheduled to go the last station and paths straight through the waiting train. Incidentally the schedules are set to wait for passenger so the third train will never arrive at its destination.

If the first station is removed then the train will path correctly and arrive at its station.
Screenshot showing correct pathing
Screenshot showing correct pathing
path_without_station.jpg (610.73 KiB) Viewed 1094 times
Attachments
bug_report_train_pathing_stations.zip
(1.07 MiB) Downloaded 305 times
factorio-current.log
(6.85 KiB) Downloaded 305 times
Not a signal issue
Not a signal issue
signals.jpg (602.67 KiB) Viewed 1094 times

User avatar
NotRexButCaesar
Smart Inserter
Smart Inserter
Posts: 1121
Joined: Sun Feb 16, 2020 12:47 am
Contact:

Re: [1.1.33] Trains don't route through train stations

Post by NotRexButCaesar »

https://wiki.factorio.com/Railway/Train_path_finding
cost (distance) is calculated using the following weighting rules:
Base cost for a block/segment is the length of the segment (linear grid length along the center of the rail).
When the rail block is occupied by a train -> Add a penalty of 2 * length of the block divided by block distance from the start, so the far away occupied paths don't matter much.
When the rail block is guarded by a rail signal set to red by the circuit network -> Add a penalty of 1000.
When the path includes a train stop that is not the destination -> Add a penalty of 2000.
When the path includes a train stop with a train stopped in it -> Add a penalty of 500.
When the path includes a train stop with a train stopped in it that doesn't have other valid stops in its schedule -> Add a penalty of 1000.
When the path includes a manually controlled stopped train -> Add a penalty of 2000.
When the path includes a manually controlled stopped train without a passenger -> Add a penalty of 7000.
When the path includes a automatic train without a schedule -> Add a penalty of 7000.
When the path includes a train currently arriving to a train stop -> Add a penalty of 100.
When the path includes a train currently arriving to a rail signal -> Add a penalty of 100.
When the path includes a train currently waiting at a rail signal -> Add a penalty of 100 + 0.1 for every tick the train has already waited.
When the path includes a train that doesn't have a path -> Add a penalty of 1000.
Last edited by NotRexButCaesar on Thu May 13, 2021 4:52 am, edited 2 times in total.
—Crevez, chiens, si vous n'étes pas contents!

j3robins
Burner Inserter
Burner Inserter
Posts: 17
Joined: Thu May 11, 2017 1:16 am
Contact:

Re: [1.1.33] Trains don't route through train stations

Post by j3robins »

Okay, so reading the Path finding penalties, I guess it is expected that the train will wait for 19,000 ticks (a little over 5 minutes) before pathing through the station.

That still seems wrong to me.... Why is the penalty for going through a station so severe?

j3robins
Burner Inserter
Burner Inserter
Posts: 17
Joined: Thu May 11, 2017 1:16 am
Contact:

Re: [1.1.33] Trains don't route through train stations

Post by j3robins »

After playing with this a bit I found a workaround. By adding a train station where the second train is waiting, the correct pathing suddenly click in. My guess is the train station adds 2000 points to the center path so both paths are more "even" now.

This implies that the penalty for "When the path includes a train stop that is not the destination" should be reduced or perhaps the formula for "When the rail block is occupied by a train" needs to be improved / weighted more.

Post Reply

Return to “Not a bug”