[kovarex] [0.17.44] train ignoring red signal by circuit in special case

This subforum contains all the issues which we already resolved.
Post Reply
Zanostra
Long Handed Inserter
Long Handed Inserter
Posts: 82
Joined: Mon Apr 03, 2017 8:03 pm
Contact:

[kovarex] [0.17.44] train ignoring red signal by circuit in special case

Post by Zanostra »

the rail system is divided into blocks, formed by (chain)signals.
signalbug.png
signalbug.png (1.09 MiB) Viewed 6452 times
in this example the upper red signal is circuit controlled, to be always red, yet the train goes trough ignoring the signal.
it happens because the block the signal is guarding is the same block as where the train just came from ( crosses actually ) before entering the spot where I want it to wait.
I think because the train already had permission to cross that block, it ignores the second circuit controlled signal because his speed is too high to come to a stop.
signalbug2.png
signalbug2.png (2.91 MiB) Viewed 6452 times
I had to separate the waitingbay because of space issues, but I wanted my trains to all enter the same block so I can controll them with signals from my factory.
But the trains in the left waitingbay need to cross that specific block to get to their spot.
The stations there have no wait conditions so trains are not forced to stop.
Now if they have enough speed they continue trough the red signal and crash upon the one that's already unloading down outside of the screenshot.

to recreate:
place the blueprint, fuel the train, and start it's shedule.

( it's the upper screenshot )

knightelite
Fast Inserter
Fast Inserter
Posts: 132
Joined: Fri Oct 05, 2018 3:49 pm
Contact:

Re: [0.17.44] train ignoring red signal by circuit in special case

Post by knightelite »

Did you actually figure out a way to get multiple trains that start in separate signal blocks to all enter the same block? I was wanting to find a way to do something like that but was unable to make it work (my efforts resulted in trains insta-braking at the signal when I tried it). Here was my try at it: https://www.reddit.com/r/factorio/comme ... gnals_too/

Theikkru
Filter Inserter
Filter Inserter
Posts: 353
Joined: Wed Mar 27, 2019 2:18 pm
Contact:

Re: [0.17.44] train ignoring red signal by circuit in special case

Post by Theikkru »

Probably caused by this:
kovarex wrote:
Wed May 15, 2019 1:20 pm
Red signal is generally ignored when the train reserved for the block is the same as the one trying to go through. The rule is there since forever and it can't be easily removed.
Is there some reason you can't use the train stops to control your trains (with a circuit condition) instead of the rail signals?

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3699
Joined: Tue May 13, 2014 11:06 am
Contact:

Re: [0.17.44] train ignoring red signal by circuit in special case

Post by DaveMcW »

knightelite wrote:
Thu May 30, 2019 11:11 pm
Did you actually figure out a way to get multiple trains that start in separate signal blocks to all enter the same block? I was wanting to find a way to do something like that but was unable to make it work (my efforts resulted in trains insta-braking at the signal when I tried it). Here was my try at it: https://www.reddit.com/r/factorio/comme ... gnals_too/
You would be an excellent beta tester for my new mod Magnet Signals.

Zanostra
Long Handed Inserter
Long Handed Inserter
Posts: 82
Joined: Mon Apr 03, 2017 8:03 pm
Contact:

Re: [0.17.44] train ignoring red signal by circuit in special case

Post by Zanostra »

Theikkru wrote:
Fri May 31, 2019 2:40 am
Is there some reason you can't use the train stops to control your trains (with a circuit condition) instead of the rail signals?
I have never really thought about that,
I've always used the signals, this way the trains can go forward for about 4 meters, so the waitingbay can be 3 rail segments shorter :P
knightelite wrote:
Thu May 30, 2019 11:11 pm
Did you actually figure out a way to get multiple trains that start in separate signal blocks to all enter the same block?
I didn't see it happening, but i saw 1 train continuously pushing against 2 locos, all the cargos were gone.
So they had to enter the same block to achieve that collision.
Today I'll try to recreate that

Edit:
I did, and here is a link to the collision:
https://www.youtube.com/watch?v=JLccqb- ... e=youtu.be

to recreate:
1 - ploink down this blueprint:

2 - give the trains some uranium fuel and start their shedule.
3 - go stand on the cross.
4 - put 1 thing on each belt in front of you, anything will do, and which order isn't important.
5 - now wait.
it should work in vanilla, I made this blueprint with maximum breaking force researched and with the use of uranium fuel.
collision.png
collision.png (79.13 KiB) Viewed 6376 times

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

Re: [0.17.44] train ignoring red signal by circuit in special case

Post by robot256 »

Yup, since the train already reserved that block at the crossing (and is still occupying it), it has no reason to stop at the signal.

If you want the track after the circuit signal to be reserved as a separate block from the earlier crossing, then you have to make it a separate block by putting a signal on the vertical track somewhere. Normally the vertical and horizontal tracks at the crossing would both need entrance chain and exit rail signals, but it looks like you might be doing something creative. In that case, you should figure out how to make it work with the game dynamics that exist. A few more signals (or chain signals) around the crossing, and maybe some circuit wires to copy signal states to before the crossing.

Your larger blueprint has the same potential issue of there being crossings without all the signals. Looks like you could be using the crossing blocks as a flow control device, instead of circuits. Make sure to look at the block colors when holding a signal, and make sure the divisions are where you want them to be.

Theikkru
Filter Inserter
Filter Inserter
Posts: 353
Joined: Wed Mar 27, 2019 2:18 pm
Contact:

Re: [0.17.44] train ignoring red signal by circuit in special case

Post by Theikkru »

If you're using the same signal to control all the waiting bay rail signals together, this should fix everything:
try.png
try.png (2.69 MiB) Viewed 6356 times

Zanostra
Long Handed Inserter
Long Handed Inserter
Posts: 82
Joined: Mon Apr 03, 2017 8:03 pm
Contact:

Re: [0.17.44] train ignoring red signal by circuit in special case

Post by Zanostra »

sadly no, the stone gets green when the stone signal hits zero ( out of stone )
and the same goes for metal, copper, everything.
on that green wire you can find the whole logistic network inventory.
I can think of various ways to make it work, involving more circuit logic, or give the waypoint stations a 0 seconds waiting condition.
But I like to keep thinks as clean as possible within my abilities.
So I deliberately made it one block, asuming the trains will wait before a red signal.
And the trains DO wait if it's red when NOT controlled by the circuit,
but when I force the signals to be closed, even when they would do the same without me forcing them to, the trains ignore the red light.

for example, the factory only needs red boards ( the red train ).
but first the green train gets green light to go to his waiting bay, where I want it to wait for the red signal controlled by circuit ( because factory has plenty uranium )
when it's completely in it's waiting bay, the unload block is empty and the red train gets green light when the green train still has red light.
so the red train gets moving, meanwhile the green train ignores the red light because he just came from that unloading block and still has high enough speed.
at this point both trains have permission to enter the same block, and so they do, and collide.
But when that signal in front of the green train was NOT controlled by the circuit, it would have stopped.
I think that this difference in behavior is a bug.
Like it is now, the trains at the left bay will never stop at all, flooding the system.

Theikkru
Filter Inserter
Filter Inserter
Posts: 353
Joined: Wed Mar 27, 2019 2:18 pm
Contact:

Re: [0.17.44] train ignoring red signal by circuit in special case

Post by Theikkru »

Yeah, I'm reasonably sure that this problem is emergent behavior from the facts that trains ignore their own reserved blocks, and that the circuit holds the signal red. In your video, you can see (from the pathing markers) that the left train gets permission for the problem block first, and paths all the way down the unloading dock before leaving the problem block (the first time), at which point it unreserves that block, allowing the right train to reserve it. The problem is, because the circuit holds the signal in front of the left train red even after it leaves that block, it does not get a trigger to revalidate its path or re-reserve the problem block when the other train reserves it, so its pathing assumes it still has the problem block reserved and continues down into the unloading dock. The right train, not knowing that the left train barged into its reserved block, enters the problem block, expecting (correctly) to find it empty. Crunch.

eduran
Filter Inserter
Filter Inserter
Posts: 344
Joined: Fri May 09, 2014 2:52 pm
Contact:

Re: [0.17.44] train ignoring red signal by circuit in special case

Post by eduran »

Why is it important that all waiting bays merge into the same block? How does a signal anywhere on the bypass cause an issue for your circuit control?

Zanostra
Long Handed Inserter
Long Handed Inserter
Posts: 82
Joined: Mon Apr 03, 2017 8:03 pm
Contact:

Re: [0.17.44] train ignoring red signal by circuit in special case

Post by Zanostra »

eduran wrote:
Fri May 31, 2019 3:36 pm
Why is it important that all waiting bays merge into the same block? How does a signal anywhere on the bypass cause an issue for your circuit control?
signalbug2_2.png
signalbug2_2.png (2.86 MiB) Viewed 6331 times
in this situation some extra signals will be fine by coincidence, true.
if the red train got to go it will wait at the red-lined-spot, no problem, then if the blue train gets a go signal, it will be on that merge-point, still no problem.
but now what if the right waiting bay was designed to hold trains with 30 cargos, it would block the green train coming in, and thus blocking the rail system.
then it would require a bigger bypass, that would not fitt in this situation.

If you buy a car and there are only 3 wheels on it, sure, it would be possible to take really slow left turns to not roll over.
But it should have 4 wheels.
For me, a train should stop at a red light, every other solution feels like an unnecessary workaround.

Theikkru
Filter Inserter
Filter Inserter
Posts: 353
Joined: Wed Mar 27, 2019 2:18 pm
Contact:

Re: [0.17.44] train ignoring red signal by circuit in special case

Post by Theikkru »

Zanostra wrote:
Fri May 31, 2019 4:02 pm
For me, a train should stop at a red light, every other solution feels like an unnecessary workaround.
I agree, and if you can convince the devs of this I would be very happy. Unfortunately that doesn't seem likely, though, judging from past statements.

eduran
Filter Inserter
Filter Inserter
Posts: 344
Joined: Fri May 09, 2014 2:52 pm
Contact:

Re: [0.17.44] train ignoring red signal by circuit in special case

Post by eduran »

Zanostra wrote:
Fri May 31, 2019 4:02 pm
eduran wrote:
Fri May 31, 2019 3:36 pm
Why is it important that all waiting bays merge into the same block? How does a signal anywhere on the bypass cause an issue for your circuit control?
in this situation some extra signals will be fine by coincidence, true.
if the red train got to go it will wait at the red-lined-spot, no problem, then if the blue train gets a go signal, it will be on that merge-point, still no problem.
but now what if the right waiting bay was designed to hold trains with 30 cargos, it would block the green train coming in, and thus blocking the rail system.
then it would require a bigger bypass, that would not fitt in this situation.
Add only one chain and one normal signal before and after the crossing. That way a train entering the crossing from the right stacker will reserve a path into the exit block of the left stacker the moment it approaches the crossing. Any train getting a circuit green signals on the left will have to wait until the train from the right makes its way past it.
Zanostra wrote:
Fri May 31, 2019 4:02 pm
For me, a train should stop at a red light, every other solution feels like an unnecessary workaround.
I don't disagree with your bug report. Just trying to help in case it gets classified as not-a-bug, or in case it takes a long time to resolve.

knightelite
Fast Inserter
Fast Inserter
Posts: 132
Joined: Fri Oct 05, 2018 3:49 pm
Contact:

Re: [0.17.44] train ignoring red signal by circuit in special case

Post by knightelite »

This is super interesting. If this is classified as not a bug then there are some very interesting things one could potentially do with getting multiple trains into the same block while still maintaining the usefulness of a signaled train network in the rest of the base. Curious to see what the dev response is to this one.

knightelite
Fast Inserter
Fast Inserter
Posts: 132
Joined: Fri Oct 05, 2018 3:49 pm
Contact:

Re: [0.17.44] train ignoring red signal by circuit in special case

Post by knightelite »

I tried to replicate it using your blueprint and instructions, but I'm not getting any collisions.

https://gfycat.com/CharmingMajesticIraniangroundjay

Theikkru
Filter Inserter
Filter Inserter
Posts: 353
Joined: Wed Mar 27, 2019 2:18 pm
Contact:

Re: [0.17.44] train ignoring red signal by circuit in special case

Post by Theikkru »

Aren't the lights by the rail signals supposed to be red when the circuit is holding the rail signals at red? At that resolution I can't tell if the circuit is controlling the 2 rail signals or not.

Edit: found the problem: the blueprint is missing a green wire from the substation that's between the rail signals to the nearest large power pole

knightelite
Fast Inserter
Fast Inserter
Posts: 132
Joined: Fri Oct 05, 2018 3:49 pm
Contact:

Re: [0.17.44] train ignoring red signal by circuit in special case

Post by knightelite »

Theikkru wrote:
Sat Jun 01, 2019 1:40 am
Aren't the lights by the rail signals supposed to be red when the circuit is holding the rail signals at red? At that resolution I can't tell if the circuit is controlling the 2 rail signals or not.

Edit: found the problem: the blueprint is missing a green wire from the substation that's between the rail signals to the nearest large power pole
Nice work, I should have looked at the wiring bit more closely.

Here's a fixed blueprint that does cause the trains to collide:

knightelite
Fast Inserter
Fast Inserter
Posts: 132
Joined: Fri Oct 05, 2018 3:49 pm
Contact:

Re: [0.17.44] train ignoring red signal by circuit in special case

Post by knightelite »

After looking at this more closely and figuring out the interactions, I've made a video explaining what's happening:

https://www.youtube.com/watch?v=53t52o6i6Us

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

Re: [kovarex] [0.17.44] train ignoring red signal by circuit in special case

Post by kovarex »

Thank you all for contributing.

The problem is based on the fact that a train can reserve the same block twice - something not accounted for when the logic was written.

Because when the train is entering the block that is reserved twice, it cancels the reservation (virtually both of them), so when it enters the same block for the second time, the other train could also enter it in the meantime as it was not reserved anymore.

Exactly what is demonstrated by this reproducible example.
Zanostra wrote:
Fri May 31, 2019 8:45 am
I did, and here is a link to the collision:
https://www.youtube.com/watch?v=JLccqb- ... e=youtu.be

to recreate:
1 - ploink down this blueprint:

2 - give the trains some uranium fuel and start their shedule.
3 - go stand on the cross.
4 - put 1 thing on each belt in front of you, anything will do, and which order isn't important.
5 - now wait.
it should work in vanilla, I made this blueprint with maximum breaking force researched and with the use of uranium fuel.
collision.png
The (obvious) fix is, that the train now calculates "how many times" did it reserve the block, and when it enters it, it subtracts from it. So in this example, when it is entering the center block in situation when it is reserved twice, instead of cancelling the reservation, it just decreases the counter from 2 to 1, and only when it enters the second time, it decreases it from 1 to 0 which cancels the reservation.
knightelite wrote:
Fri May 31, 2019 4:59 pm
This is super interesting. If this is classified as not a bug then there are some very interesting things one could potentially do with getting multiple trains into the same block while still maintaining the usefulness of a signaled train network in the rest of the base. Curious to see what the dev response is to this one.
The whole train signaling logic is built around the premise that only one train can occupy a block. I'm quite curious what would be your motivation and gain from trying to get more trains to the same block.

Anyway, I expect this to be fixed for the next release.

P.S. The fun part for me is, that when the rail block is in the state of being reserved by two different state (by signals), the game would desynchronise if someone joins it at that moment in multiplayer, as the block reservation isn't part of the savegame, but deduced from the signal reservations.

knightelite
Fast Inserter
Fast Inserter
Posts: 132
Joined: Fri Oct 05, 2018 3:49 pm
Contact:

Re: [kovarex] [0.17.44] train ignoring red signal by circuit in special case

Post by knightelite »

kovarex wrote:
Wed Jun 05, 2019 12:47 pm

The whole train signaling logic is built around the premise that only one train can occupy a block. I'm quite curious what would be your motivation and gain from trying to get more trains to the same block.
I thought about it, and I think while possible, for more than two trains the method this bug allows would become extremely impractical (you would basically have to have all the trains you wanted into the shared block all lined up in a preset sequence to trigger this exact behavior on each of their tracks in the right sequence such that they all end up in the shared block at the end, and it wouldn't work if any trains are already in that block).

However, regarding the question of why I might want to have a way to force multiple trains into the same block, I think something similar to DaveMcW's Magnet Signals mod would be pretty cool to include in the base game (forcing signals green via the circuit network perhaps), as then you could do things like this:
  • Ethereal Trains grid station
  • Nose-to-tail trains
  • I had an idea for using it as part of a train routing engine to increase throughput (since signals massively decrease throughput due to requiring at least braking distance between trains) (basically using this behavior (the repathing turned out to be caused by a signal)). Even without the throughput benefits, this idea would seriously benefit from it due to the fact that this method fails if the train ever brakes (and therefore repaths) before committing to its final destination.
while still retaining the benefit of signals of in the main part of your rail network. None of these are terribly practical to do using this bug, but could work well if there was a "force green" setting for signals. And there are probably applications no one has thought of yet!

Post Reply

Return to “Resolved Problems and Bugs”