[kovarex] [0.17.42] Train not looking far enough for alternate routes

Bugs that are actually features.
Post Reply
computerneek
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu May 23, 2019 8:45 am
Contact:

[kovarex] [0.17.42] Train not looking far enough for alternate routes

Post by computerneek »

Image
Here we are: The train that refuses to reach the station. The station is occupied in the screenshot; I have, however, vacated the station and found the issue to remain.

The problem is that the train should be pathing through one of those three open slots on the right side of this stack to reach the station, rather than through another train (in particular, one that's waiting for one of the "Iron Plates" stations). This stack system was specifically designed to allow a large number of trains to show up and even wait at a station, such as this iron smeltery, without obstructing other trains coming in to the same. This train is waiting at a chain signal; each slot begins with a regular signal, and each train in the stack is waiting at a chain signal. The two-train queues leading to the stations are with regular signals, but all in the connecting area- with the curved tracks- are chain signals. The tracks are built so that a train may path from any slot of the stack to any station.

It is worth note, if the train instead chooses to path to one of the ore stations further to the right, it will correctly find the open slots and pick one to wait in- or advance through. It may be worth note that the first available slot, in this case, is the 31st one from the mainline; this is not the first occurrence of this issue, though the other occurrences also had the first couple dozen slots occupied. When the destination station is full, toggling the train to manual and back will sometimes convince it to find an open slot; in this case, however, it does nothing. My world is fairly heavily modded in the photo; however, I stripped the mods from the save and the errant behavior persisted.

World save (with mods removed, don't mind the iron/copper/steel/wood lying around, I cancelled several hours of handcrafting to get it to not crash on load without mods): https://www.dropbox.com/s/t1xfd3vr462oh ... t.zip?dl=0 If you get run over by a train immediately after loading the world, the problem's been fixed.

kovarex
Factorio Staff
Factorio Staff
Posts: 8078
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [kovarex] [0.17.42] Train not looking far enough for alternate routes

Post by kovarex »

Hello, thanks for the report, but this isn't really a bug.

The behaviour is direct implication of the train path finding penalty system. We give certain kind of penalties for certain kind of things. The penalties specified in utility-constants.lua this way:

Code: Select all

 train_path_finding =
    {
      train_stop_penalty = 2000,
      stopped_manually_controlled_train_penalty = 2000,
      stopped_manually_controlled_train_without_passenger_penalty = 7000,
      signal_reserved_by_circuit_network_penalty = 1000,
      train_in_station_penalty = 500,
      train_in_station_with_no_other_valid_stops_in_schedule = 1000,
      train_arriving_to_station_penalty = 100,
      train_arriving_to_signal_penalty = 100,
      train_waiting_at_signal_penalty = 100,
      train_waiting_at_signal_tick_multiplier_penalty = 0.1,
      train_with_no_path_penalty = 1000
    },
The value of 100 of the train_waiting_at_signal_penalty implies, that the train is willing to go through path up to 100 tiles longer without a train. I tried and increased the penalty to 200, and it train was willing to stack on the empty platform.

Luckily, since these constants are specified in the "data system", it can be easily moddable, but one needs to be careful about thoese.
Yes, increasing the value a lot will allow more and more platforms work as you desire, but it will also make trains avoid other trains too rigidly, which would trigger weird behaviour.

computerneek
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu May 23, 2019 8:45 am
Contact:

Re: [kovarex] [0.17.42] Train not looking far enough for alternate routes

Post by computerneek »

Okay... so if I want this station to work fluidly every time in vanilla, I have to redesign the stack to separate the three types of inbound trains (ore, fuel, and plate). Which isn't hard...

Also tells me this stacking system is only "flawless"ly reliable up to 26 slots. Good thing I know exactly how many trains go to either of the first two categories (22 ore trains, 5 coal) every time- makes it easy! It's that last one that might vary, depending on demand for iron... so it just gets "all the rest".

Thank you!

... I suppose there's also the part where, in an unmodified version of this stacking system, the extra bridges between the stack and the stations don't exist- I modified it for increased throughput here. In the unmodified version, the distances are all about the same, going through the stack...

robot256
Filter Inserter
Filter Inserter
Posts: 596
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: [kovarex] [0.17.42] Train not looking far enough for alternate routes

Post by robot256 »

In the unmodified version, the distances are all about the same, going through the stack...
Exactly, stackers are only infinitely expandable if the exit is on the opposite end of the entrance, so that each path is the same length.


Actually, you could try adding a second rail signal with a circuit connection at the entrance to each track, so that it closes the outer signal when the track is full. The penalty for a circuit-closed signal is larger than (and added to) that of the waiting train, so you could get the effect you want without mods. I made an example picture.

But dividing the stacker is probably the best solution anyways, to make sure trains can always take the shortest path.
Attachments
Stacker penalty.png
Stacker penalty.png (1.52 MiB) Viewed 1333 times

computerneek
Burner Inserter
Burner Inserter
Posts: 7
Joined: Thu May 23, 2019 8:45 am
Contact:

Re: [kovarex] [0.17.42] Train not looking far enough for alternate routes

Post by computerneek »

Dividing the stacker, especially when the number of trains to two of the three stations is known (and fixed), is definitely going to be the best solution- puts the trains for each station actually closest to that station. After doing that, I'm left with exactly 25 slots for the last station... Meh, no biggie.

Post Reply

Return to “Not a bug”