Give train stations weighted priority based on time since last train

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Post Reply
User avatar
ThePiachu
Inserter
Inserter
Posts: 32
Joined: Sat Aug 22, 2015 8:54 pm
Contact:

Give train stations weighted priority based on time since last train

Post by ThePiachu »

TL;DR
Train stops of the same name should increase in priority the longer it was since the last train left it to help balance train network resource allocation.

What ?
If you have multiple train stations with the same name (say, iron ore mines or oil fields) the trains should prioritise them based not only on distance, but also on time since last train visited the station. The weighted priority could be a product of those two, say: `/(time since last train) / (distance)`. This would ensure all stations get serviced semi-regularly rather than trains always defaulting to the closest station.
Why ?
When you have multiple train stations of the same namecurrently from what I can tell the trains always pick the closest station to go to. This is not an ideal solution if the item availability in those stations is limited - trains will tend to drain the same providers over and over, and deliver to the same destinations over and over. For example here:

https://imgur.com/a/06yslP5

Iron 1 is closer to my smelters, so it gets visited over and over until it is empty. Iron 2 on the other hand hasn't seen a train in real life days since it is a bit further out. But since both of those stations are running a bit dry on iron ore, you will have a train wait at Iron 1 for an hour getting filled, while Iron 2 has entire chest full of iron ore waiting to be loaded.

Currently the only way to ensure all stations get serviced you need to have precisely (N+M-1) trains on the network, where N is the number of slots in the loading stations, and M is the number of slots in unloading stations. Only then will all the stops get serviced since the trains will always pick the only other available station.

It would be better if all the stops got visited at least once in a while. With correct buffer chests / tanks this would ensure way better load / unload times, and if you go heavily on city block train stations like I did, that you won't have one part of your factory stall because you didn't add that one extra train.

The problem is especially pronounced with oil fields running dry and slowing down their production (you still want to visit all of them, but if you service the same one over and over you will just have trains waiting there doing nothing until full).

With this change you will need fewer trains to service your train network, and rail city block design bases won't stall due to some materials not being delivered to a part of the base due to proximity and insufficient number of trains.

Nidan
Fast Inserter
Fast Inserter
Posts: 229
Joined: Sat Nov 21, 2015 1:40 am
Contact:

Re: Give train stations weighted priority based on time since last train

Post by Nidan »

Adjust the train limit according to what's available. In particular, if a station can't fill/empty a complete train, set the limit to zero to keep trains from coming and waiting for a long time.

User avatar
ThePiachu
Inserter
Inserter
Posts: 32
Joined: Sat Aug 22, 2015 8:54 pm
Contact:

Re: Give train stations weighted priority based on time since last train

Post by ThePiachu »

You could potentially solve it with circuits, yeah, but Wube doesn't seem to force people to use circuit networks ot make their base work well (I think they mentioned that vis a vis the DLC and not wanting to go down the Space Exploration route of requiring the use of signals to steer your spaceships).

Plus this doesn't solve the issue of distributing resources down the chain. Like if I have iron smelters making Iron Plates, and I need Iron Plates for both Steel Smelting and Green Circuits, but my Steel is always getting the Iron Plates because it eats it all and Green Circuits are further away, it's not an ideal situation. It also can't be solved with logic network since the only stop that would turn off would be the Iron Plate loading one. In this situation you need 2 trains to service the 3 stops exactly. And then if you would turn the Iron Plate loading stop with logic, you could still have Steel eating everything since the train servicing Steel would be closer and always get it.

Kyralessa
Filter Inserter
Filter Inserter
Posts: 451
Joined: Thu Sep 29, 2016 5:58 pm
Contact:

Re: Give train stations weighted priority based on time since last train

Post by Kyralessa »

ThePiachu wrote:
Fri Oct 13, 2023 7:03 pm
You could potentially solve it with circuits, yeah...
You should. It's not that difficult. You don't need to circuit-wire all your stations together or anything. Just use an arithmetic combinator to divide your current ore or oil count at the station by the total amount each train can hold (e.g. for oil, 25k per car) and make that number your train limit (L by default).

Then no trains stop at that station unless there's a full load to pick up. The train limit is 0 for no full load, 1 for one full load, etc.

You can easily blueprint the combinator setup.

Post Reply

Return to “Ideas and Suggestions”