Implement priority signals for trains

Post your ideas and suggestions how to improve the game.
psihius
Fast Inserter
Fast Inserter
Posts: 188
Joined: Mon Dec 15, 2014 12:47 am
Contact:

Implement priority signals for trains

Post by psihius » Wed Jan 09, 2019 6:40 pm

Basically, a signal that gives train on the line where it is placed right before the intersection priority so it can continue at full speed and not break for the merging train that happened to be a few secons ahead.

Main use case - signalling main lines, so train merging does not slow down trunk line traffic.

Sad_Brother
Fast Inserter
Fast Inserter
Posts: 118
Joined: Mon Jan 08, 2018 4:54 pm
Contact:

Re: Implement priority signals for trains

Post by Sad_Brother » Wed Jan 09, 2019 9:28 pm

Close signals on the other lines when main line is busy.

psihius
Fast Inserter
Fast Inserter
Posts: 188
Joined: Mon Dec 15, 2014 12:47 am
Contact:

Re: Implement priority signals for trains

Post by psihius » Thu Jan 10, 2019 9:31 am

It's not as simple as it sounds - the amount of wiring that needs to happen if done via the circuit network is pretty huge and different trains have different stop lengths and so the calculations are not as straight forward and lead distances that have to be taken into account are pretty huge. So it gets impractical fast. And then there is the additional layer when two merges are close enough to fit a train in between, but close enough for the stopping distance being bigger than the space between crossings, so it needs a look-ahead logic.

Basically, rudimentary and limited priority signal - yes, I can do it with circuits now. But to do it properly, like chain signals, it needs to hook into train pathing and manager to handle high traffic situations and dense builds. There is also the performance aspect of it. I'd consider this late to end-game feature, cause most of the time we need something like this is when we go big. Sure, you can plan ahead, space everything out and separate rail systems as much as possible, but that should not be the only way and organically growing factories are also a nice thing, they just need a bit of help to prioritize the traffic. Working with a 200MB world just because you need to ridiculously space things out so your trains work better does not seem to me as a good solution :)

I know it might not be simple to implement or even not feasible, but in my humble opinion it is at least worth a feasibility study and will greatly help with traffic prioritization. It might even just be an option on a chain signal to make it a priority signal (though a nice distinctive priority signal graphic would be nice to avoid confusion :) ).

Tairon96
Inserter
Inserter
Posts: 39
Joined: Sun Nov 18, 2018 6:38 am
Contact:

Re: Implement priority signals for trains

Post by Tairon96 » Thu Jan 10, 2019 10:17 am

I don't know how this could be integrated into the game in a way that is handy for the players regarding UI.

You are asking for a train signal that ...

... is looking into the future.

(or other way around)

... is changing its decision to give free way even if there is already a train in the signal's section.
__

Without a strategic thinking human control as an overwatch, there might be too many aspects to be considered for a simple specialized signal.
Radar : Damnit, we are surrounded! :o
Artillery : Great, now I can attack in every direction! :D
_
languages

psihius
Fast Inserter
Fast Inserter
Posts: 188
Joined: Mon Dec 15, 2014 12:47 am
Contact:

Re: Implement priority signals for trains

Post by psihius » Thu Jan 10, 2019 10:47 am

Well, trains already do a look-ahead with chain signals and trigger signal change. This is something similar, the difference being that priority signal has to block other signals from allowing trains to pass that will pass under no priority situation. Basically trains already calculate when they need to slow down, this adds additional check or penalty if a priority signal is on the trains path to block signals a bit more ahead

Zavian
Smart Inserter
Smart Inserter
Posts: 1437
Joined: Thu Mar 02, 2017 2:57 am
Contact:

Re: Implement priority signals for trains

Post by Zavian » Thu Jan 10, 2019 11:53 am

psihius wrote:
Thu Jan 10, 2019 10:47 am
Well, trains already do a look-ahead with chain signals and trigger signal change. This is something similar, the difference being that priority signal has to block other signals from allowing trains to pass that will pass under no priority situation. Basically trains already calculate when they need to slow down, this adds additional check or penalty if a priority signal is on the trains path to block signals a bit more ahead
I'm pretty sure that they simply track their stopping point, (if they were to apply the brakes now), then reserve any ordinary signals as that stopping point passes them. If the stopping point passes a chain signal, then they attempt to reserve that chain signal, plus enough additional signals (on their route) until they have reserved a normal signal. (Typically the exit signal from the junction they have just reserved their route through).

If they can't reserve one of those signals, then they apply the brakes and stop, (or at least slow down. They might be able to reserve the signal in a few ticks, in which case they can stop braking). There is no look ahead to see whether any other train is about to attempt to reserve the same signals. To implement your proposal a train would probably need to look ahead a lot more signals, and if there is a priority signal, and the priority favours the train to then reserve the priority signal as well.

Whilst this is probably technically possible I'm far from convinced that making meagbases easier is a good idea. They should be challenging to get functioning well. Removing too much challenge would just makes building megabases an uninteresting exercise.

Sad_Brother
Fast Inserter
Fast Inserter
Posts: 118
Joined: Mon Jan 08, 2018 4:54 pm
Contact:

Re: Implement priority signals for trains

Post by Sad_Brother » Thu Jan 10, 2019 3:46 pm

psihius wrote:
Thu Jan 10, 2019 9:31 am
It's not as simple as it sounds ... :) ).
I describe probably simplest way to implement line priority.
You can ask for a system to lock some priority path ahead of train stop-point. But look at my suggestion again. By closing other lines earlier you give main line priority of some length. Only if logical length gap between trains on the main line more than signal line, other lines can be used. This sysmet is soft enough and not too complex.

psihius
Fast Inserter
Fast Inserter
Posts: 188
Joined: Mon Dec 15, 2014 12:47 am
Contact:

Re: Implement priority signals for trains

Post by psihius » Mon Jan 14, 2019 4:02 pm

Sad_Brother wrote:
Thu Jan 10, 2019 3:46 pm
psihius wrote:
Thu Jan 10, 2019 9:31 am
It's not as simple as it sounds ... :) ).
I describe probably simplest way to implement line priority.
You can ask for a system to lock some priority path ahead of train stop-point. But look at my suggestion again. By closing other lines earlier you give main line priority of some length. Only if logical length gap between trains on the main line more than signal line, other lines can be used. This sysmet is soft enough and not too complex.
I'm looking on this as more of a general solution that improves train experience in general for the game as a whole. Circuits can do properly on a subset and require laser precision. Also, circuits tend to break from time to time - especially when people are involved in multiplayer - using circuits in that environment is a sure way for someone to break it with a 99.99% chance (4k+ hour experience speaking :D )

Sad_Brother
Fast Inserter
Fast Inserter
Posts: 118
Joined: Mon Jan 08, 2018 4:54 pm
Contact:

Re: Implement priority signals for trains

Post by Sad_Brother » Mon Jan 14, 2019 4:29 pm

psihius wrote:
Wed Jan 09, 2019 6:40 pm
Basically, a signal that gives train on the line where it is placed right before the intersection priority so it can continue at full speed and not break for the merging train that happened to be a few secons ahead.

Main use case - signalling main lines, so train merging does not slow down trunk line traffic.
psihius wrote:
Mon Jan 14, 2019 4:02 pm
I'm looking on this as more of a general solution
So, when some block become free, you want trains on adjacent lines to be checked with some priority. It may be possible, but may be not possible without major reorganisation. I think it does not worth much efforts.
I can think of such possible system: each signal can have delay value, so it opens after guarded block is free for that value of ticks.
I do not need it.

ikarikeiji
Long Handed Inserter
Long Handed Inserter
Posts: 92
Joined: Sun Jul 12, 2015 6:28 pm
Contact:

Re: Implement priority signals for trains

Post by ikarikeiji » Fri Jan 18, 2019 1:13 pm

There is a very simple implementation of priority signal that the devs could use:

- When reserved by a train, also reserve the next signal, like a chain signal
- In all other aspects, behave identically to a regular signal

You would use this signal not at the very entrance to a merging block, but on one or more signals leading up to that entrance signal. Then, trains on the mainline would be allowed to run all the way up to the merge point, but trains on the side line would need to wait once a train had reserved the first priority signal in the sequence.

If the devs expose partial behaviours of signals like the above to the modding API then the priority signal described above would become possible to add via a mod, so this could equivalently be a modding API request.

Thinking about it, my description above also gives a simple way to implement it via circuit network alone: if not all priority signals are green (# green signal < # total signals connected) then set side entrance signals to red. So this can be done with a single decider combinator per merge block, no matter how complex your train network.

Bimme
Manual Inserter
Manual Inserter
Posts: 4
Joined: Tue Dec 20, 2016 4:10 pm
Contact:

Re: Implement priority signals for trains

Post by Bimme » Mon Aug 12, 2019 2:13 pm

Most megabases I've seen has multiple train lines running same direction parallel.
Sometimes implemented so trains can change to another parallel line if first choice is occupied, that way allowing new trains to enter from a substation.

If trains on main line now has a priority they may reserve the lane on right side, thereby blocking the train from the substation coming from the right side. and you have a long line of substations coming from right side, so all will attempt to reserve right lane ahead leaving lane 2 or 3 empty or almost empty
Whereas if the train from substation get passage to the mainline, trains already on mainline will have to recalculate route and will go with option two, which is the second or third mainline running same direction.

If the idea could be implemented as well as Factorio Team usually do, I would certainly want it. But I think they will have a hard time coming up with a good solution.

A thought I had while reading is that it's not as much a question of mainline train looking ahead as it's a question of substation train looking back.
As driving a car in traffic:
In an intersection wanting to turn right, can I make my turn and do I still have enough space for me to accelerate to normal speed, without the next car having to use his break or even lifting his feet from speeder pedal.
Only know the rules in Denmark, we have to wait for a big enough gap in traffic before making our turn and accelerate to travel speed, so next vehicle doesn't have to slow down. (And then sometimes we've waited so long that we just make a decision ;-) )

mrvn
Smart Inserter
Smart Inserter
Posts: 3503
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Implement priority signals for trains

Post by mrvn » Mon Aug 12, 2019 2:28 pm

ikarikeiji wrote:
Fri Jan 18, 2019 1:13 pm
There is a very simple implementation of priority signal that the devs could use:

- When reserved by a train, also reserve the next signal, like a chain signal
- In all other aspects, behave identically to a regular signal

You would use this signal not at the very entrance to a merging block, but on one or more signals leading up to that entrance signal. Then, trains on the mainline would be allowed to run all the way up to the merge point, but trains on the side line would need to wait once a train had reserved the first priority signal in the sequence.

If the devs expose partial behaviours of signals like the above to the modding API then the priority signal described above would become possible to add via a mod, so this could equivalently be a modding API request.

Thinking about it, my description above also gives a simple way to implement it via circuit network alone: if not all priority signals are green (# green signal < # total signals connected) then set side entrance signals to red. So this can be done with a single decider combinator per merge block, no matter how complex your train network.
That is exactly what I suggested in another thread. If the signals are correctly set reserving the next block ahead of time would prevent other trains from cutting in line if there isn't enough space for the train to clear the intersection before the priority train arrives.

I also suggested an alternative (or parallel mechanism) where priority is decided by the locomotive instead of having extra signals.

Like the breaking point the locomotive also gets a reservation point. The prototype gives a factor how much the reservation point should lead the breaking point. Train acceleration should also factor into this (heavy trains have priority since getting them back up to speed takes longer). Trains would then reserve a segment when the reservation point enters said segment. But they would only break when the breaking point hits a signal that couldn't be reserved.

csduff
Long Handed Inserter
Long Handed Inserter
Posts: 76
Joined: Thu Nov 22, 2018 3:42 pm
Contact:

Re: Implement priority signals for trains

Post by csduff » Mon Aug 12, 2019 2:30 pm

What about having a modifier in place (either vanilla or as a mod) that can allow a train a "priority" status which can enlarge its reserved area ahead?

E.g., a train that has a priority toggled off reserves 25 tiles ahead (based on weight, speed and braking force), while the same train that has priority toggled on reserves 50 or 75 tiles ahead.

This would not allow prioritizing of a specific rail line (e.g., express line), but it would allow high priority trains first crack at intersections.

I haven't done much modding (or any in Factorio), so I'm not sure if this is possible with the current system.

Tekky
Smart Inserter
Smart Inserter
Posts: 1015
Joined: Sun Jul 31, 2016 10:53 am
Contact:

Re: Implement priority signals for trains

Post by Tekky » Mon Aug 12, 2019 3:11 pm

Related thread:

viewtopic.php?f=6&t=71817 Add extra reservation factor to locomotives

User avatar
Lubricus
Fast Inserter
Fast Inserter
Posts: 223
Joined: Sun Jun 04, 2017 12:13 pm
Contact:

Re: Implement priority signals for trains

Post by Lubricus » Fri Aug 16, 2019 4:01 pm

I think it rarely will help anything. You can't solve to little throughput with priorities. Timing trains at intersections could help throughput, I don't see how priorities can?
I know you are an more experienced and smarter Factorio player than me so I could have missed something. Is throughput decreasing with more trains, so it get worse when congested? so let trains waiting on sidings won't make a bad case worse?
If trains move slower the stop distance is decreasing and they travel closer to each other so i don't think that is the case, I wagely remember someone calculated that slow trains have better throughput?

slippycheeze
Filter Inserter
Filter Inserter
Posts: 436
Joined: Sun Jun 09, 2019 10:40 pm
Contact:

Re: Implement priority signals for trains

Post by slippycheeze » Fri Aug 16, 2019 8:23 pm

Lubricus wrote:
Fri Aug 16, 2019 4:01 pm
I think it rarely will help anything. You can't solve to little throughput with priorities. Timing trains at intersections could help throughput, I don't see how priorities can?
I assumed it was to make a "fast long distance" pair of lines in the center of a 4-line track, and then dedicate the outer two to "turning off the line" trains which have to slow down to reach their station, etc. This is a technique that is used, with good effect, to improve throughput. Also, can be used in Factorio, not just real world traffic management. ;)

...but seriously, you absolutely can improve throughput by moving through traffic and local / turning traffic into separate lanes, and it works just as well in Factorio as it does on the local freeway / highway system you have driven on. You normally make it happen in Factorio by placing something -- a station named " " (yes, one space character) on the outer lanes, and never scheduling anything to it. That'll make them undesirable compared to the inner lanes, so only trains that have to enter them, will, and even then, only when they are forced to in order to hit their turnout to the station or whatever.

User avatar
Lubricus
Fast Inserter
Fast Inserter
Posts: 223
Joined: Sun Jun 04, 2017 12:13 pm
Contact:

Re: Implement priority signals for trains

Post by Lubricus » Sat Aug 17, 2019 8:37 am

slippycheeze wrote:
Fri Aug 16, 2019 8:23 pm
Lubricus wrote:
Fri Aug 16, 2019 4:01 pm
I think it rarely will help anything. You can't solve to little throughput with priorities. Timing trains at intersections could help throughput, I don't see how priorities can?
I assumed it was to make a "fast long distance" pair of lines in the center of a 4-line track, and then dedicate the outer two to "turning off the line" trains which have to slow down to reach their station, etc. This is a technique that is used, with good effect, to improve throughput. Also, can be used in Factorio, not just real world traffic management. ;)

...but seriously, you absolutely can improve throughput by moving through traffic and local / turning traffic into separate lanes, and it works just as well in Factorio as it does on the local freeway / highway system you have driven on. You normally make it happen in Factorio by placing something -- a station named " " (yes, one space character) on the outer lanes, and never scheduling anything to it. That'll make them undesirable compared to the inner lanes, so only trains that have to enter them, will, and even then, only when they are forced to in order to hit their turnout to the station or whatever.
Trains don't slow down for turns in factorio. It's crossings that is the problem. I you can get the trains to switch to outer lane (without stopping traffic) before the turn would decrease the number of crossings, don't know how priority signals would help for that.
I have been thinking a little bit more about throughput, and it should be an optimal train speed for maximizing throughput in Factorio. In factorio trains is reserving a distance in front of them equal the breaking distance and an good approximation for real breaking distance is speed squared so i think Wube use that then the formula for throughput should be something like throughput = speed/(train_length+speed^2) to get the maximum/minimum you have to set derivative of the function to 0.

User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 1447
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Implement priority signals for trains

Post by BlueTemplar » Sat Aug 17, 2019 8:39 am

Lubricus wrote:
Sat Aug 17, 2019 8:37 am
Trains don't slow down for turns in factorio.
Wait, not even a little bit ?
So that's why hardly anyone uses diagonal rails...

Adamo
Filter Inserter
Filter Inserter
Posts: 274
Joined: Sat May 24, 2014 7:00 am
Contact:

Re: Implement priority signals for trains

Post by Adamo » Sat Aug 17, 2019 8:52 am

BlueTemplar wrote:
Sat Aug 17, 2019 8:39 am
So that's why hardly anyone uses diagonal rails...
Yeah. Whereas when running, diagonal is always a sqrt(2) increase in speed. We're fairly certain that if you make your diagonal rails a constant back-and-forth squiggly line, though, it slightly decreases the total distance traveled (and thus the time). :P It can also make you dizzy.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 10498
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Implement priority signals for trains

Post by ssilk » Sat Aug 17, 2019 9:10 am

Most effective solution: use short trains. I use LCC only and only 1 track in each direction, on a map with about 200 trains and most times they are up and running. No problems as described here. There are points that need more attention. But my main problem are deadlocks, that cannot be prevented, cause LTN mod is sometimes too stupid. :) 8-)
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

Post Reply

Return to “Ideas and Suggestions”

Who is online

Users browsing this forum: Google [Bot]