[2.0.10] Train interrupts triggers on too many trains if train limit > 1

Bugs that are actually features.
User avatar
sheepy
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Oct 25, 2024 4:27 pm
Contact:

[2.0.10] Train interrupts triggers on too many trains if train limit > 1

Post by sheepy »

Unload station with limit = 1, with 2 trains dispatched to it
Unload station with limit = 1, with 2 trains dispatched to it
factorio_itDduIQtPL.png (249.67 KiB) Viewed 2037 times
I encountered this while creating a Many to Many train network without using a mod like LTM or Project Cybersyn. Using train interrupts, I was able to do so, however, I noticed that some trains would stop at a Load station and go to idle.
I narrowed it down to train limits:
1. Single Load station has a train limit > 1
2. Single Unload station, which has a train limit = 1, enables due to circuit condition (low item count)
3. The interrupt triggers on 2 trains, which both go to the Load station.
4. However, only 1 proceeds to the Unload, the second train enters idle at the Load

I have managed to recreate it without any mods on a test save I've attached. In it, simply turn on the right-most "green tick" Combinator to enable the Load station. This is the Interrupt that's present on the trains in the test save:
Train interrupt
Train interrupt
factorio_3Ju1Zvuzb9.png (66.02 KiB) Viewed 2037 times
The Unload station having a limit of 2 does not produce this behavior. However there are situations where a station has enough output to load 2 trains in a row, or in a station with a dynamically set train limit (1 if there's enough to fill 1 train, 2 if there's enough for 2 trains etc.)
I fully accept that this might be the result of intended mechanics. However, I think this is a case of the interrupts incorrectly triggering even though "Unload is not full" is false.
Attachments
Train Test.zip
(3.06 MiB) Downloaded 22 times
factorio-current.log
(9.03 KiB) Downloaded 20 times
Xyletic
Manual Inserter
Manual Inserter
Posts: 4
Joined: Sat Sep 24, 2016 6:14 pm
Contact:

Re: [2.0.10] Train interrupts triggers on too many trains if train limit > 1

Post by Xyletic »

Hi!

I've been trying to work around this as well.

It's not really a "bug" in the sense that the game is performing something incorrectly. Train limits work with trains that are either at the station or actively on its way to the station. So even though the train has it in its schedule, it does not register that train until the train is headed to that station. So, in other words, if you have a station Load station with 3 train limit and 3 trains, and an Unload with a 1 train limit, all 3 of those trains will head to the load station because the Unload station does not hit 1/1 until the first train starts heading to the unload station.

I've been trying to think of ways of addressing this on my save. Thinking of ways of using circuit conditions to "reserve" the train to that by reducing its limit count if a train is sent off.

It's almost possible to fully recreate LTN (through simplistic methods), but I think the biggest thing missing is the ability to account for a train that is planned to visit the station.
User avatar
sheepy
Manual Inserter
Manual Inserter
Posts: 2
Joined: Fri Oct 25, 2024 4:27 pm
Contact:

Re: [2.0.10] Train interrupts triggers on too many trains if train limit > 1

Post by sheepy »

It took longer for me to notice, but this issue also happens when two separate Load stations are available at the same time. It was rarer to see as I didn't have many mines that were simultaneously ready for loading.

@Xyletic I agree, but I feel like it's a carry-over from the normal fixed train schedule system. While it makes perfect sense for normal stops, temporary stops that the Interrupts schedule disappear after being fulfilled, which would free up the limit. I think there are 3 solutions to this:
1. Making the "[station] is not full" Condition for Interrupts also count "Trains with this stop"
2. Adding a new "[station] will not be full" Condition
3. Adding a toggle to the train stops which will make the train limit count and apply to all scheduled trains

For now, I'll install Cybersyn. It's not a major loss, but it's a shame as the Interrupt system is really elegant, and having the functionality of LTN be part of the vanilla game would be nice.
nopanicman
Manual Inserter
Manual Inserter
Posts: 1
Joined: Sat Nov 09, 2024 4:22 am
Contact:

Re: [2.0.10] Train interrupts triggers on too many trains if train limit > 1

Post by nopanicman »

I was testing my train station and depot designs while encountered it just like you. More than 1 slot for input but less slots for outputs causing idleing and IMO it is against the nature of the design of LTN like networks. But I think I found a workaway after all.

For my vanilla design, I'm calculating the empty item slots and limiting the train count at the stations according to fullness or emptiness. I also have a manually entered parameter for the stations' physical train limit. Calculated L gets stuck at the manually entered parameter. Meanwhile at the depot, trains are receiving signals. Problem starts here just like you said. Multiple trains are receiving the same signal and causing unnecessary accumulations at the stations.

I tried to make the train signal receiving process a stepped structure to prevent the signal from reaching the next station until the station is empty but failed miserably. Even if this worked, it would still cause problems when I built more than one depot area.

Tried to make them get their signals randomly by using random input selector with constant and decider combinator. It worked for a bit, but eventually some of the trains will come across each other at the same time. I don't even need to say that the probability increases as the scale increases.

These and a couple of failed attempts forced me to approach the issue from a different perspective. What is the problem here? Trains are lining up at the first station even though they won't needed in the second station. But if the second stations train limits are lower than the firsts then its okay because trains aren't set off according to the second station. What if we can set them off according to the low limited station? What if we could limit the loading stations depending on the total number of stations that can be unloaded. Luckily for me I was already using both radar circuirts for sending and receiving the limit counts for each unloading and loading stations. I rerouted the total sum of the unloader limits back to the loading stations. Now they take as many trains as the unloading stations can handle.
Last edited by nopanicman on Sat Nov 09, 2024 6:39 am, edited 1 time in total.
User avatar
Klonan
Factorio Staff
Factorio Staff
Posts: 5403
Joined: Sun Jan 11, 2015 2:09 pm
Contact:

Re: [2.0.10] Train interrupts triggers on too many trains if train limit > 1

Post by Klonan »

I understand the problem here as:
1. You have 10 load
2. You have 2 unload
3. You trigger the generic interrupt, with Load -> Unload

Expected result: 2 Trains are dispatched
Actual result: 10 Trains are dispatched

I see the issue, and for now the logic is working as intended, but we will take this as an idea for future improvement,
Such as a wait condition for "Trains with this stop" or such
But no promises
Post Reply

Return to “Not a bug”