Train 'Push' Priority

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

macdjord
Fast Inserter
Fast Inserter
Posts: 219
Joined: Fri Feb 22, 2013 4:26 am
Contact:

Train 'Push' Priority

Post by macdjord »

TL;DR
The current priority system lets us set 'pull' priority, i.e. when a train departs, if there are multiple open stations, which one it will head to. We also need a way to set 'push' priority, i.e. when a station opens up, if there are multiple waiting trains, which one will come to it.
What?
  • The current 'Priority' slider gets renamed to 'Pull priority' or 'Incoming priority'
  • A new slider just below it as added, labelled 'Push priority' or 'Outgoing priority'
  • The push priority can be set via circuit network, just like the existing one
  • When a station is enabled or a slot opens up in a stations train limit, if there are multiple trains waiting to path to that station, the one with the highest push priority goes first. In case of a tie, the closest one wins, same as now.
  • When a train is at a station, it records the station's push priority as of the moment it meets its departure conditions; this is the push priority is uses while trying to path to the next station on its schedule, or if it is on the way but considering repathing.
  • A train which is not departing from a station (either because it has just been constructed or because the player manually hit the 'go to this station' button on the schedule), or which loses its current destination while on the way and is forced to pick a new one (i.e. because the station it was heading to was destroyed or became unreachable), is assumed to have maximum priority, higher than any station. (This is because such trains are likely currently on the main line and thus getting them moving is critical.)
Why?
Currently, when using trains, you can prioritize where resources go, but not where they come from. For example, if you have some item which is produced in one part of your factory, but which is also created in smaller amounts as a by-product somewhere else, you want to 'byproduct' stuff to be used before the freshly-produced stuff. Currently there's no way to do that at the train-network level; you have to either route the byproduct to the main production area or else route both of them to a combined buffer area where you can prioritize consumption using splitters or circuit logic. This adds the additional complication that you now have two different trains carrying the same item but which need to be routed to different destinations, so they can't both use the same interrupt-driven schedule.

Allowing us to set a priority for which trains are dispatched first would solve this: just give the 'byproduct' station a higher priority than the main one, and it will automatically get used first when available.
eugenekay
Smart Inserter
Smart Inserter
Posts: 1258
Joined: Tue May 15, 2018 2:14 am
Contact:

Re: Train 'Push' Priority

Post by eugenekay »

Feature exists. The “Priority” slider already controls which Train gets dispatched first. The trick is that you need to synchronize all of them to try to leave in the same Tick, using a Circuit condition.

Good Luck!
macdjord
Fast Inserter
Fast Inserter
Posts: 219
Joined: Fri Feb 22, 2013 4:26 am
Contact:

Re: Train 'Push' Priority

Post by macdjord »

eugenekay wrote: Wed Aug 19, 2026 2:43 am Feature exists. The “Priority” slider already controls which Train gets dispatched first. The trick is that you need to synchronize all of them to try to leave in the same Tick, using a Circuit condition.

Good Luck!
  1. That feature clearly needs to be better advertised
  2. The fact that you cannot set the priorities for incoming and outgoing trains separately makes it much less useful
  3. The fact that it doesn't take into consideration all trains that are waiting for a given station makes it pretty much useless. Even if I do synchronize my train departures with a circuit condition, that only works once; I cannot un-depart whatever trains do not immediately leave, so there's no way to synchronize them with any other trains that are ready to depart later.
Tertius
Smart Inserter
Smart Inserter
Posts: 1739
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Train 'Push' Priority

Post by Tertius »

As far as I understand the mechanic, no circuit sync is required. It already works exactly as you requested, just no separate priorities:
macdjord wrote: Wed Aug 19, 2026 1:52 am The current priority system lets us set 'pull' priority, i.e. when a train departs, if there are multiple open stations, which one it will head to. We also need a way to set 'push' priority, i.e. when a station opens up, if there are multiple waiting trains, which one will come to it.
The sync takes place implicitly if there are multiple trains in "destination full" state and one station opens up. The one train at the station with the highest priority will be dispatched to this station.

It makes sense to have just 1 priority. If a station has high priority, it gets trains first so idle time is minimized. And if a train wants to leave, it leaves first so the station is open for the next train first. This ensures maximized throughput for stations with highest priority.

If a station has high "pull" priority but low "push" priority, the station can have trains sitting at the station and keep occupying it. It's not prioritized to free it from leaving trains, so the high "pull" priority becomes useless. And if it's the other way round, low "pull" priority and high "push" priority, the station will be kind of train starved because of the low "pull" priority, so any high "push" priority is useless because the station doesn't get many trains anyway.

Keep in mind priority is not a probability that a train gets dispatched more likely. Instead, as long as there is a station with higher priority (and trains eligible to leave), that station gets served in 100% of all cases and all stations with lower priority are ignored. This means the station with the lowest priority might never get a train going to it (if there are not enough trains) or a leaving train is actually not able to ever leave (if there are not enough open stations).
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 4812
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: Train 'Push' Priority

Post by boskid »

When a train leaves a train stop with a priority P, it borrows the priority of the train stop and uses it as the departure priority. There is no need to sync anything, whenever a train stop has an empty slot, a train stop limit logic will select highest priority train stop that is currently in "destination full" state and give it a chance to take that empty slot thus making that train to be the first to be dispatched. This feature requested already exists. Priorities can be observed in action using `show-train-priority` debug layer.

I am not a huge fan of splitting priority into arrival priority and depature priority for a train stop because it would increase amount of gui controls that are maybe only usable in some super rare situations, but overall i am not seeing any reasons to having this split because if those 2 priorities would be set different, its more likely to cause problems for a player that will be always attributed to the non equal priorities. If a player wants given train stop to be served first because it is important for items to flow there before other places (maybe that spot is producing ammo for gun turrets), if a departure priority was lower this will completly defeat the arrival priority because this train stop will not be able to easily get rid of empty trains that have to go away to empty a spot for another incoming train.

Focusing on departure priority aspect, this feature already exists. Focusing on the request for second slider, its not happening.
Post Reply

Return to “Ideas and Suggestions”