Page 1 of 1

Red train signal set by circuit only has 1000 penalty?

Posted: Mon May 10, 2021 7:35 pm
by MEOWMI
I finally encountered this problem when using trains.

So, as we know,
Factorio wiki on train pathfinding wrote:When [a] rail block is guarded by a rail signal set to red by the circuit network -> Add a [path finding] penalty of 1000.
Why is this penalty only 1000 again? Wouldn't you almost always want for a red-signaled path to be extremely undesirable to choose?

Context:
I have a train going to stations A and B, stations have signals controlled by circuits. Even when the signals are red at A and green at B, trains still try to path to A presumably because it's so much closer. I can't see any other reason for the train not going to B other than A still somehow being more favorable despite having a literal red signal (which is going to be there for a long time no less).

Troubleshooting:
  • I cannot simply disable stations with circuits to work around this. That was my initial approach actually, but it causes the problem that if all stops are disabled, the train will simply skip the station, effectively running around in circles pointlessly because no other stations exist to stop it.
  • I cannot add a "waiting station" because there is no condition to wait for, the "conditions" are either the stations being enabled/disabled or the station signals being enabled by circuits, neither which are available at such a waiting station.
  • Station B is definitely reachable by train, I checked by giving a temporary station at B to go to.
Any idea how I can solve this, to make trains path to station B when A is not ready? I could obviously add tons of red signals at A, but that sounds like the wrong way to do it, like an ugly hack, and isn't even guaranteed to not break at some point.

Re: Red train signal set by circuit only has 1000 penalty?

Posted: Mon May 10, 2021 8:33 pm
by Nosferatu
I used to use 3 red signals when I did something like that and I allways made sure that there is a failsafe in case a train still wanted to go the wrong way ;)

But in your case their might be a cleaner solution:
MEOWMI wrote: Mon May 10, 2021 7:35 pm I cannot simply disable stations with circuits to work around this. That was my initial approach actually, but it causes the problem that if all stops are disabled, the train will simply skip the station, effectively running around in circles pointlessly because no other stations exist to stop it.
If you add an unreachable station with the same name the train will "no path" instead of skipping.

Re: Red train signal set by circuit only has 1000 penalty?

Posted: Mon May 10, 2021 8:38 pm
by ptx0
Nosferatu wrote: Mon May 10, 2021 8:33 pm If you add an unreachable station with the same name the train will "no path" instead of skipping.
that's a great way to cripple the game performance over time as the No Path trains will all check for a path every time you change a signal or place rail, even disconnected from the main rail network.

Re: Red train signal set by circuit only has 1000 penalty?

Posted: Mon May 10, 2021 8:43 pm
by Impatient
How far is "far" away? Can you reproduce this and show us a sandbox example? This might be useful for troubleshooting the problem.

Re: Red train signal set by circuit only has 1000 penalty?

Posted: Mon May 10, 2021 11:38 pm
by MEOWMI
I've been testing adding extra red signals and it's a huge hassle to add it to everything if your stations don't have the exact same rail shape at the entrance. The chained signals require multiple different circuit conditions as well...

Nosferatu wrote: Mon May 10, 2021 8:33 pm
MEOWMI wrote: Mon May 10, 2021 7:35 pm I cannot simply disable stations with circuits to work around this. That was my initial approach actually, but it causes the problem that if all stops are disabled, the train will simply skip the station, effectively running around in circles pointlessly because no other stations exist to stop it.
If you add an unreachable station with the same name the train will "no path" instead of skipping.
This is a nice idea! As mentioned by ptx0, I do wonder how much lag this could potentially cause. Will definitely keep it in mind as an option.

Impatient wrote: Mon May 10, 2021 8:43 pm How far is "far" away? Can you reproduce this and show us a sandbox example? This might be useful for troubleshooting the problem.
I'm not sure, as I don't know of an easy way to measure rail lengths, but I think currently the furthest ones are about 2000 units at most, though I feel like it would be quite wise to attempt to future-proof this kind of system as well, making me think I want at least 3000-4000 penalty if I go for such a system.


My rail network is currently fairly low traffic, but I feel like for a high traffic network you would almost have to use station disabling...

Re: Red train signal set by circuit only has 1000 penalty?

Posted: Tue May 11, 2021 3:28 am
by Zanthra
What are you trying to accomplish with the circuit controlled signals? It's possible the best way to solve the problem is to find an alternative means of accomplishing that objective without using them.

If it's just controlling when the train goes to a given station, it's possible you can largely accomplish what you want with the stations by using the circuit network to set the trains limit to 0 instead of disabling them, as a train with a station in it's schedule, but no free slots gives a "destination full" message instead of skipping the station (as long as it sees all stations of that name otherwise a "no path" message). This would not require a circuit controlled rail signal to control access.

Re: Red train signal set by circuit only has 1000 penalty?

Posted: Tue May 11, 2021 6:09 am
by Pi-C
Perhaps something like these waypoint stations may work for you as well?

Re: Red train signal set by circuit only has 1000 penalty?

Posted: Tue May 11, 2021 5:36 pm
by Trific
MEOWMI wrote: Mon May 10, 2021 7:35 pm I cannot simply disable stations with circuits to work around this. That was my initial approach actually, but it causes the problem that if all stops are disabled, the train will simply skip the station, effectively running around in circles pointlessly because no other stations exist to stop it.
Use a train limit of 0 instead of disabling the stops. Then the trains will wait with "Destination full" instead of skipping the stop.

Re: Red train signal set by circuit only has 1000 penalty?

Posted: Tue May 11, 2021 8:08 pm
by jape3
Was wondering why trains were avoiding an intersection where I built a circuit-network optimized traffic lights.. no wonder if there is a penalty like this :)

Re: Red train signal set by circuit only has 1000 penalty?

Posted: Tue May 11, 2021 8:22 pm
by NotRexButCaesar
jape3 wrote: Tue May 11, 2021 8:08 pm Was wondering why trains were avoiding an intersection where I built a circuit-network optimized traffic lights.. no wonder if there is a penalty like this :)
They don't like to be told what to do. :lol:

Re: Red train signal set by circuit only has 1000 penalty?

Posted: Wed May 12, 2021 11:59 am
by MEOWMI
Trific wrote: Tue May 11, 2021 5:36 pm
MEOWMI wrote: Mon May 10, 2021 7:35 pm I cannot simply disable stations with circuits to work around this. That was my initial approach actually, but it causes the problem that if all stops are disabled, the train will simply skip the station, effectively running around in circles pointlessly because no other stations exist to stop it.
Use a train limit of 0 instead of disabling the stops. Then the trains will wait with "Destination full" instead of skipping the stop.
This does sound like a much better solution! I will have to try it, thanks.