Page 1 of 2

Train station priority!

Posted: Thu Aug 08, 2019 10:14 am
by Helveg
It would be nice if instead of roundtrip mode (visiting all stations in a fixed order) there was a way to set priority on a train station through the circuit network, allowing you to broadcast to trains with this station as a stop to prefer it over stops with a lower priority, or to skip certain stops if their priority isn't high enough. This is usefull also as a wait condition: stay at the depot unless a stop has a priority of above X. This is already quite possible by disabling the station, but it doesn't allow for relative importance to other stations only absolute binary decisionmaking.

Re: Train station priority!

Posted: Thu Aug 08, 2019 11:36 am
by conn11
Helveg wrote:
Thu Aug 08, 2019 10:14 am
It would be nice if instead of roundtrip mode (visiting all stations in a fixed order) there was a way to set priority on a train station through the circuit network, allowing you to broadcast to trains with this station as a stop to prefer it over stops with a lower priority, or to skip certain stops if their priority isn't high enough. This is usefull also as a wait condition: stay at the depot unless a stop has a priority of above X. This is already quite possible by disabling the station, but it doesn't allow for relative importance to other stations only absolute binary decisionmaking.
That depends. It is already absolutely possible to achieve your proposal through the circuit network. If you have an amount of stations, wich are activated/ deactivated for example by a certain item/ resource count, you could compare the absolute values of each item count with the rest and therefore create a ranking by deactivating lower ranking stations. This would require some decider combinators to fully implement, but is definitely possible. furthermore in a actual setup (e.g. outpost maintenance) a more compact Setup, where not all possibilities must be compared with another, could certainly be designed.

Re: Train station priority!

Posted: Thu Aug 08, 2019 2:10 pm
by Tekky
Related threads:

viewtopic.php?f=6&t=64362 Dynamic train schedule
viewtopic.php?f=6&t=63837 Selective Station Enabling

These two threads contain links to further threads which are also related.

Also, in the following threads, some ideas about tieing trains and the circuit network more closely together have been discussed:

viewtopic.php?f=6&t=70935 Improved Access to Train ID
viewtopic.php?f=6&t=71817 Add extra reservation factor to locomotives

If the ideas in the threads mentioned above were implemented, then it should be possible to implement what you suggest.

For example, if this sub-suggestion of a global wireless circuit network were implemented and if conditional train orders were implemented in such a way that the condition can be tested against a value of this global circuit network, then it should be possible for the player to implement station priorities himself.

Re: Train station priority!

Posted: Thu Aug 08, 2019 6:10 pm
by urza99814
conn11 wrote:
Thu Aug 08, 2019 11:36 am
Helveg wrote:
Thu Aug 08, 2019 10:14 am
It would be nice if instead of roundtrip mode (visiting all stations in a fixed order) there was a way to set priority on a train station through the circuit network, allowing you to broadcast to trains with this station as a stop to prefer it over stops with a lower priority, or to skip certain stops if their priority isn't high enough. This is usefull also as a wait condition: stay at the depot unless a stop has a priority of above X. This is already quite possible by disabling the station, but it doesn't allow for relative importance to other stations only absolute binary decisionmaking.
That depends. It is already absolutely possible to achieve your proposal through the circuit network. If you have an amount of stations, wich are activated/ deactivated for example by a certain item/ resource count, you could compare the absolute values of each item count with the rest and therefore create a ranking by deactivating lower ranking stations. This would require some decider combinators to fully implement, but is definitely possible. furthermore in a actual setup (e.g. outpost maintenance) a more compact Setup, where not all possibilities must be compared with another, could certainly be designed.
I think you can *mostly* achieve this idea with circuits, but not entirely. Consider a case where you have multiple trains with the same stop but different priority conditions. For example, one train that always stops at "secondary iron smelting" while another one goes to "primary iron smelting" unless "secondary iron smelting" has high priority. You can't just redirect the second train by enabling/disabling the secondary stop without also affecting the first. Instead you'd need to build a whole new station and direct the two trains to the two different stops.

I suppose you *can* still do that and achieve a very similar effect... But it's massively more effort. But I'm not sure if that's a useful enough use case to be worth adding the additional complication to avoid it. A more generalized solution would probably be preferable.

There is one other cool option if you "abuse" the priority system a bit...or just call it "mode" instead. Then you can have a defense outpost buffer stop where low priority (or "mode = 1") will mean that your outpost supply trains come to get supplies, while high priority (or " mode = 2") means the buffer is empty so a resupply train will come restock it. I have a few places where I stack multiple stations directly beside each other in order to do something like this, but that can make it hard to align the inserters properly without also unloading fuel or something. But again, there's more general solutions to that like trains reading from the circuit network or stops that change names or something like that.

Re: Train station priority!

Posted: Thu Aug 08, 2019 11:47 pm
by conn11
urza99814 wrote:
Thu Aug 08, 2019 6:10 pm
conn11 wrote:
Thu Aug 08, 2019 11:36 am
Helveg wrote:
Thu Aug 08, 2019 10:14 am
It would be nice if instead of roundtrip mode (visiting all stations in a fixed order) there was a way to set priority on a train station through the circuit network, allowing you to broadcast to trains with this station as a stop to prefer it over stops with a lower priority, or to skip certain stops if their priority isn't high enough. This is usefull also as a wait condition: stay at the depot unless a stop has a priority of above X. This is already quite possible by disabling the station, but it doesn't allow for relative importance to other stations only absolute binary decisionmaking.
That depends. It is already absolutely possible to achieve your proposal through the circuit network. If you have an amount of stations, wich are activated/ deactivated for example by a certain item/ resource count, you could compare the absolute values of each item count with the rest and therefore create a ranking by deactivating lower ranking stations. This would require some decider combinators to fully implement, but is definitely possible. furthermore in a actual setup (e.g. outpost maintenance) a more compact Setup, where not all possibilities must be compared with another, could certainly be designed.
I think you can *mostly* achieve this idea with circuits, but not entirely. Consider a case where you have multiple trains with the same stop but different priority conditions. For example, one train that always stops at "secondary iron smelting" while another one goes to "primary iron smelting" unless "secondary iron smelting" has high priority. You can't just redirect the second train by enabling/disabling the secondary stop without also affecting the first. Instead you'd need to build a whole new station and direct the two trains to the two different stops.

I suppose you *can* still do that and achieve a very similar effect... But it's massively more effort. But I'm not sure if that's a useful enough use case to be worth adding the additional complication to avoid it. A more generalized solution would probably be preferable.

There is one other cool option if you "abuse" the priority system a bit...or just call it "mode" instead. Then you can have a defense outpost buffer stop where low priority (or "mode = 1") will mean that your outpost supply trains come to get supplies, while high priority (or " mode = 2") means the buffer is empty so a resupply train will come restock it. I have a few places where I stack multiple stations directly beside each other in order to do something like this, but that can make it hard to align the inserters properly without also unloading fuel or something. But again, there's more general solutions to that like trains reading from the circuit network or stops that change names or something like that.
Your example: 2 Trains, Smelters a and b with the requirement of supplying a if desired conditions are met.

Possible Solution:
You could measure the raw ore arraiving in the smelting stations. The corresponding train stations A and B are activated by virtual Signal A and B both =1, if a desired item count is present (for convineance sake let’s say <1k).

Train a is only supplying Station A so no problem there (if mandatory scheduling of Station A is wished, then there is no need to use circuits st all)
train b has Station A and B in it’s list, with the Circuit wait condition A=1 or B=1. Now a decider compares the raw ore count currently present at station A and B, if A>B a B=1 goes to station B and therefore the total value of B=2, so the wait condition isn’t met. Any present train b would leave or use Station B as waypoints to A. Not really skipping station B in any circumstance, but from a pratical standpoint the same result.
Sadly I‘ve currently no game access, so I couldn’t try it out.
As for the consideration of easiness of use: you have a point. But IMO I‘m not sure if it’s relevant enough to qualify as QoL.

Re: Train station priority!

Posted: Fri Aug 09, 2019 2:21 pm
by Darinth
Technically possibly to implement with a lot of very complex circuits spanning the entire map. This is one of those things that I feel a *more* intuitive solution should be available. Being able to limit (ideally with circuits, but I'll be pretty happy to just be able to specify the number in the UI) the number of trains a station can handle (number pathing to it and parked at it) combined with a circuit controlled station priority.

Re: Train station priority!

Posted: Tue Aug 13, 2019 11:05 pm
by slippycheeze
Honestly, once you get to "circuit control of trains" you are so far into the realm of "there is more than one way to do it" that you should be reaching for mods, not updates to vanilla. There are ... five, I think, at my last count, different mods that implement what y'all talking about here. Each does it differently, sometimes very differently, and none is inherently better than the others.

Given that, baking any one of them into core is probably an error: it'll at best strongly discourage the rest, if not just kill them, but it also will bring pain. Everyone who wants what LTN, or TSM, or stringy train stops, or the Fat Controller, or another mod strategy for this -- and doesn't get it from the core stuff -- will be up in arms, asking to improve the smart trains.

Re: Train station priority!

Posted: Tue Aug 13, 2019 11:27 pm
by Adamo
Darinth wrote:
Fri Aug 09, 2019 2:21 pm
Technically possibly to implement with a lot of very complex circuits spanning the entire map.
This sort of encompasses why I think it's probably not a good idea to go forward with an integrated thing. Keep It Simple Stupid.

Maybe a useful thing would be to let us transfer circuit signals along a rail path, or something to that effect.

Personally, I use a radio signals mod whenever I have to do something like this, rather than a fully-fledged train mod.

Re: Train station priority!

Posted: Wed Aug 14, 2019 1:09 pm
by Lubricus
It's not that hard to achieve an priority system in vanilla. 1. Name the station the same. 2. Wire up train-signals. Trainsignals set to red by wires ad an cost to the trains pathfinding algoritm. Note that trains only re-path in certain conditions, that makes it hard to make several trains path to different stations at the same time.

What I feel is lacking in vanilla Factorio is some way to send a trains to different station's depending on some conditions. There is no reasonable not overly complex and convoluted way to have several trains pathing to several stations at the same time set by conditions.

Re: Train station priority!

Posted: Tue Aug 20, 2019 10:20 pm
by doxsroxs
Helveg wrote:
Thu Aug 08, 2019 10:14 am
It would be nice if instead of roundtrip mode (visiting all stations in a fixed order) there was a way to set priority on a train station through the circuit network, allowing you to broadcast to trains with this station as a stop to prefer it over stops with a lower priority, or to skip certain stops if their priority isn't high enough. This is usefull also as a wait condition: stay at the depot unless a stop has a priority of above X. This is already quite possible by disabling the station, but it doesn't allow for relative importance to other stations only absolute binary decisionmaking.
I have been arguing for years for a simple way to control the trains.
If it was possible to send a train directly to a train stop via combinator (using station ID just like train ID exists today) all sorts of solutions could be implemented to automate train control. Priority becomes a simple thing with just a few combinators in this case. A fully automated train network is quite possible as well, even a more efficient one then the mods available. Many of which suffer from throughput issues once you go large.

Check my thread on this under suggestions, its quite short and the changes should be minor, especially if they already plan to implement temporary stations in the scheduler. The more people that support it the higher the chance that they might listen:
viewtopic.php?f=6&t=74663

Re: Train station priority!

Posted: Tue Aug 20, 2019 11:12 pm
by Adamo
doxsroxs wrote:
Tue Aug 20, 2019 10:20 pm
The more people that support it the higher the chance that they might listen:
Oh, you sweet, sweet optimist.

Re: Train station priority!

Posted: Tue Aug 20, 2019 11:33 pm
by doxsroxs
Adamo wrote:
Tue Aug 20, 2019 11:12 pm
doxsroxs wrote:
Tue Aug 20, 2019 10:20 pm
The more people that support it the higher the chance that they might listen:
Oh, you sweet, sweet optimist.
Makes no sense though, I mean. Everything can be automated except trains that are stuck in a horribly half automated state.
Especially after reading through that they plan to implement temporary stations so you can hijack any train and press on map to have the train drive you there.
Game is about automation and they prioritize stuff like that above something that would automate trains and would probably be easier to implement.

Re: Train station priority!

Posted: Wed Aug 21, 2019 5:17 am
by Koub
doxsroxs wrote:
Tue Aug 20, 2019 11:33 pm
they plan to implement temporary stations so you can hijack any train and press on map to have the train drive you there.
It's not really planning any more, as it's in the experimental 0.17 since its release in ... February ?

Re: Train station priority!

Posted: Wed Aug 21, 2019 1:58 pm
by doxsroxs
Koub wrote:
Wed Aug 21, 2019 5:17 am
doxsroxs wrote:
Tue Aug 20, 2019 11:33 pm
they plan to implement temporary stations so you can hijack any train and press on map to have the train drive you there.
It's not really planning any more, as it's in the experimental 0.17 since its release in ... February ?
Ok, I missed that. Makes even less sense.
In my mind it should be easier to implement sending to station using ID signal vs all the map management and stuff they would need to handle with that feature.

I really dont understand why they are so against automation of trains, this should have been a basic feature implemented years ago. :cry:

Then again, looking at the glass as half full, that feature might contain code useful for implementing sending to station ID.

Re: Train station priority!

Posted: Wed Aug 21, 2019 3:59 pm
by BlueTemplar
Lubricus wrote:
Wed Aug 14, 2019 1:09 pm
It's not that hard to achieve an priority system in vanilla. 1. Name the station the same. 2. Wire up train-signals. Trainsignals set to red by wires ad an cost to the trains pathfinding algoritm. Note that trains only re-path in certain conditions, that makes it hard to make several trains path to different stations at the same time.

What I feel is lacking in vanilla Factorio is some way to send a trains to different station's depending on some conditions. There is no reasonable not overly complex and convoluted way to have several trains pathing to several stations at the same time set by conditions.
Hmm, I now have 3 (iron ore) trains going into 3 receiving stations, except the receiving station with the most ore in its chests is always disabled -
and I don't remember having any issues so far - but I guess that probelems would start with more trains/stations ? (Or if I use a similar system for outgoing stations too?)

Re: Train station priority!

Posted: Wed Aug 21, 2019 4:19 pm
by Adamo
BlueTemplar wrote:
Wed Aug 21, 2019 3:59 pm
How far apart are your iron receiving stations? I have the impression this is only an issue if we're talking about receiving stations at separate, distant outposts. I also don't find it to be an issue in my practical factorio life, just something that is theoretically an issue at some future point.

Re: Train station priority!

Posted: Wed Aug 21, 2019 9:34 pm
by Lubricus
BlueTemplar wrote:
Wed Aug 21, 2019 3:59 pm
Lubricus wrote:
Wed Aug 14, 2019 1:09 pm
It's not that hard to achieve an priority system in vanilla. 1. Name the station the same. 2. Wire up train-signals. Trainsignals set to red by wires ad an cost to the trains pathfinding algoritm. Note that trains only re-path in certain conditions, that makes it hard to make several trains path to different stations at the same time.

What I feel is lacking in vanilla Factorio is some way to send a trains to different station's depending on some conditions. There is no reasonable not overly complex and convoluted way to have several trains pathing to several stations at the same time set by conditions.
Hmm, I now have 3 (iron ore) trains going into 3 receiving stations, except the receiving station with the most ore in its chests is always disabled -
and I don't remember having any issues so far - but I guess that probelems would start with more trains/stations ? (Or if I use a similar system for outgoing stations too?)
It's a problem in a 1k science factory with 1:2 trains I built long ago. So you need way more than 3 trains for one resource before you get serious issues with trains hunting in packs for the same stations.

Re: Train station priority!

Posted: Wed Aug 21, 2019 9:56 pm
by Oktokolo
doxsroxs wrote:
Tue Aug 20, 2019 11:33 pm
Everything can be automated except trains that are stuck in a horribly half automated state.
It is a bit like with early bots:
They know, that they want it but not how to do it properly.
As has been written, there are multiple smart train mods wich use different incompatible approaches and have all different flaws (complexity / steep learning curve counts as a flaw for Wube).
doxsroxs wrote:
Tue Aug 20, 2019 11:33 pm
Especially after reading through that they plan to implement temporary stations so you can hijack any train and press on map to have the train drive you there.
Since they integrated that feature into the game i never drove a train by hand again. That is the best vanilla QoL feature since blueprints and construction bots.
I love trains and railworld maps.
But i really hated driving manually through my networks since switching to roundabouts for crosses and forks - always had to slowdown before one to be able to press the direction buttons at the exact right moment for anything but right-turns (right-hand-side drive).
Now with self-driving trains i love to just hop into any train and ride it to whatever destination i want to go. Then i hop off and it just continues doing what it was actually sheduled to do.
That feature is integrated so well and works so smooth and hassle-free - literally nothing else in the game is as polished and thought-through (and there is a lot of good content in the game).
That feature is a flawless masterpiece!

Re: Train station priority!

Posted: Thu Aug 22, 2019 6:03 pm
by slippycheeze
Adamo wrote:
Tue Aug 20, 2019 11:12 pm
doxsroxs wrote:
Tue Aug 20, 2019 10:20 pm
The more people that support it the higher the chance that they might listen:
Oh, you sweet, sweet optimist.
I think they are foolishly mistaking "listen" for "obey the dictat", but otherwise, they are entirely correct. The developers absolutely do listen to what people say, and they do pay attention to what people want, how popular things are, etc.

They just don't have, or feel, any obligation to do something even if it is very popular. Which people routinely mistake for "don't listen" rather than "don't agree".

Re: Train station priority!

Posted: Thu Aug 22, 2019 6:25 pm
by slippycheeze
Adamo wrote:
Wed Aug 21, 2019 4:19 pm
BlueTemplar wrote:
Wed Aug 21, 2019 3:59 pm
How far apart are your iron receiving stations? I have the impression this is only an issue if we're talking about receiving stations at separate, distant outposts. I also don't find it to be an issue in my practical factorio life, just something that is theoretically an issue at some future point.
I suspect that the root cause is more that people do a terrible job of network design, but don't realise it: a network with lots of trains running between every source and every sink looks like it'll be efficient, if only the trains were a tiny bit smarter. Every step toward smarter isn't enough, though, and eventually you end up with LTN or TSM, and still don't have the absolute peak of efficiency because...

...well, if we apply real world lessons, we learn that isn't how you build an efficient shipping network. You don't have lots of trains from many sources, and to many destinations, using "YOLO" style scheduling, and each doing the entire route. Instead you use smaller, faster shipping between source or sink and a transshipping location, and then fewer, larger trains between transshipping stations. That takes advantage of the efficiencies each type of vehicle and station design gives you, and radically simplifies all the logic too. In the real world, due to game engine differences as it were, that turns out to be (a) bulk source to bulk destination with rail only, or (b) source to truck to rail to truck to sink, or (c) containerization to improve the efficiency of b.

Some amount of flexibility is useful, but ... generally speaking, too general a shipping network design means less efficiency. So unless you are optimizing for minimizing "number of trains" as a resource, or for "completely general, unpredictable demand" item shipping, you are likely to do better building for purpose.

Plus if you have dedicated trains handling each component of the shipping process you gain one other benefit: no crossings. Everything runs a simple route, so you don't have to deal with "where now" questions except at the leaf points -- and you can eliminate them entirely for the transhsipping components, for maximum train speed.


PS: all that said, I use LTN a bunch, so I clearly value flexibility over absolute throughput -- which is an accurate reflection of my priorities, no surprises.

Lubricus wrote:
Wed Aug 21, 2019 9:34 pm
BlueTemplar wrote:
Wed Aug 21, 2019 3:59 pm
Hmm, I now have 3 (iron ore) trains going into 3 receiving stations, except the receiving station with the most ore in its chests is always disabled -
and I don't remember having any issues so far - but I guess that probelems would start with more trains/stations ? (Or if I use a similar system for outgoing stations too?)
It's a problem in a 1k science factory with 1:2 trains I built long ago. So you need way more than 3 trains for one resource before you get serious issues with trains hunting in packs for the same stations.
Should have designed those consumers to require smaller input rates, or changed the train design to reduce the throughput needed, then. Getting 1K out of a single input factory is going to be much, much harder than getting it out of 10 x 100 factories, even accounting for the extra infrastructure and ground space required because of it. :)