Page 1 of 1

[0.16.51] Train station ignoring stationed train

Posted: Thu Jun 21, 2018 7:18 pm
by Allaizn
Today's report is quite interesting:
I recently showed an infinite braking force setup on reddit, and decided to built a bigger setup using those.
I suppose you already know about this, but here's a quick recap anyway:
The idea is to shorten the clearing time between trains to increase station throughput by making trains break much harder than they usually would. This is achieved by setting up to train stations X, Y that both get the exact same name. Enabling X and disabling Y now makes trains go to X only. If you then disable X and enable Y in the same tick, all trains immediately repath to Y. If the train happens to be right in front of Y, it'll as much as necessary to not overshoot the station. Enabling X and disabling Y in the same tick again, then resets the whole station for the next train.
Now to the bug:
Since I plan on creating a high throughput station, stopping a single train is of course not enough, and I hence decided to tighten the reset timing for the instant braking station as far as possible:
- Enabling Y for a single tick will never reliably stop max speed trains, even though they only travel at 82.8m/sec=1.38 m/tick and could therefore never overshoot the station in a single tick, so that's kind of a bug itself, but not the main point of this post
- But enabling Y for two ticks stops most trains, even though some overshoot by a little bit (which is again surprising).
What's more surprising is that trains stopped in the second way seem to "disconnect" from their station: Signals on the station are never transferred to the train, and the station also showes no stopped train. But the train definitely stopped, since it's "time passed" timer does start, and the train will start its path to the next station if set to look at only that timer.

What I think is happening:
When switching X and Y in the same tick the train arrives at X, it repaths to Y and at the same time stops at X. So some weird race condition?

Now to reproducibility:
1. Load up the attached save file in a vanillia 0.16.51 version of factorio:
trains 3.zip
save file
(2.1 MiB) Downloaded 82 times
2. Enter the train using the 'Enter'-hotkey, and open it's control GUI
3. Select the "unload01" station and click "Go to the station"
4. Enjoy a ~30sec ride to it.
5. Notice that the train stops at the station, and then automatically contines after its set time of 6 sec
6. Enjoy the ~30sec ride back.
7. Notice how the train stops at the station, but won't leave again, even though it's signal condition "I=0" is fullfilled.
8. Notice that the train station doesn't see the train by hovering your cursor over the power pole connected by green wire (station is set to read stopped train to T)
9. Connect the output of the upper two decider combinators with red wire and follow step 3-6 again. (The extra combinator delays the station switch to 3 ticks instead of 2 ticks)
10. Notice how the station now "sees" the train, and the train leaves.

Further comments:
- The train indeed does not overshoot the station, as running the following command

Code: Select all

/c game.print(game.player.selected.name .. " " .. (game.player.selected.position.x%1*256) .. " " .. (game.player.selected.position.y%1*256) .. " " .. (game.player.selected.speed))
confirms its position to be exact integers (as is the case for normally stopped trains), and its speed to be exactly 0.
- Even though the work around isn't that hard in my case, I'd still like to see it fixed, maybe even the 1 tick case...
- It could be that I'm misunderstanding some mechanic about trains, since I have only messed around about 10h
- Log file is attached for completeness

Re: [0.16.51] Train station ignoring stationed train

Posted: Thu Jun 21, 2018 9:25 pm
by Rseding91
Thanks for the report however I'm not going to try to fix this. If you want to use the "infinite braking force" aspect of trains failing to path correctly then you have to deal with the side effects of when it doesn't work for what you want.

Re: [0.16.51] Train station ignoring stationed train

Posted: Thu Jun 21, 2018 9:31 pm
by Allaizn
To bad, but also quite expected. Thanks for your time :)