Train wait condition 'No empty storage left' or something like that

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

StansTheMan
Inserter
Inserter
Posts: 20
Joined: Sat Mar 30, 2019 5:43 pm
Contact:

Train wait condition 'No empty storage left' or something like that

Post by StansTheMan »

TL;DR
Making trains able to wait for the condition of all storage slots (40 per cargo wagon) not being empty.
What?
Train wait condition, like 'Full Cargo', except it specifically checks all storage slots of all wagons for not being empty instead of all them filled strictly with full item stacks. This is in order to deal with mixed insertion problems... which is now a natural phenomenon if you do 'quality' production directly on into trains.
Why?
Quality drilling (-> quality smelting) -> train wagon (belt insertion/direct insertion, no storage insertion).
That train will deadlock. You probably already get what situation I'm talking about....
Example situation
I ran into this problem of parked trains deadlocking in train stations because their wait condition "Full cargo" never gets reached.

It turned out the inserters were deadlocked because they couldn't insert the item on the belt of a certain quality level since all stacks inside the wagon of this quality were filled, and only a different quality level of the item had an incomplete stack in the wagon. (I hope u get what i mean)
Intuitive solution, no hacks:
Trains should just be able to count filled storage slots, of any level.

That plus an inactivity wait condition would solve the situation adequately.
Better to have this than doing big spaghetti belts into trains, storage chest setups on every station, circuit magic or somehow modding Quality itself.
Tinyboss
Filter Inserter
Filter Inserter
Posts: 537
Joined: Sun Nov 16, 2014 12:11 pm
Contact:

Re: Train wait condition 'No empty storage left' or something like that

Post by Tinyboss »

Does a short inactivity condition alone, say two seconds, not work? As long as it's longer than an inserter swing, it won't fire unless nothing else can be added.

If it's because you expect inactivity without all slots being full, that would be due to a lack of supply. So you would probably want to handle that with "time passed", right?
StansTheMan
Inserter
Inserter
Posts: 20
Joined: Sat Mar 30, 2019 5:43 pm
Contact:

Re: Train wait condition 'No empty storage left' or something like that

Post by StansTheMan »

Hmm... *brain storms*

My problem with this is, that this would mean the train leaves the station just because the next (valid, insertable) item is en route and *somehow* it just decided to take a little longer that usual ...

This happens all the time in my outposts. Off the top of my head, direct inserting mining drills but suddenly low power; some biters doing shenanigans; that one last steel plate coming out of the furnace stack and somehow it just had to take the worst/longest belt splitter route in that spaghetti furnace stack to the train etc. etc.

I'd like to catch any exception automatically regarding varying supply, ideally set to [ 'No empty storage left' AND 'Inactivity'-time of exactly one inserter swing ]. Only other way would be 'time passed' for a very long fixed time ... where I'd somehow have to calculate the time for the total number of inserter swings beforehand, per use case/outpost/item stack sizes etc. .. plus, adding to that more time for any bad situations.

That suuucks. Awful to setup + Trains wait forever.

My priority is cramming the train as full as possible in situations of varying supply, in a simple way. No wasting time waiting, no wasting fuel doing empty train rides + Quality compatibility.

Edit:
The next problem is ... the target train station on the other end will very likely have condition 'Is empty'. That train could decide run in circles forever.
Last edited by StansTheMan on Sun Nov 10, 2024 11:18 pm, edited 1 time in total.
Tinyboss
Filter Inserter
Filter Inserter
Posts: 537
Joined: Sun Nov 16, 2014 12:11 pm
Contact:

Re: Train wait condition 'No empty storage left' or something like that

Post by Tinyboss »

StansTheMan wrote: Sun Nov 10, 2024 11:09 pm Hmm... *brain storms*

My problem with this is, that this would mean the train leaves the station just because the next (valid, insertable) item is en route and *somehow* it just decided to take a little longer that usual ...

This happens all the time in my outposts. Off the top of my head, direct inserting mining drills but suddenly low power; some biters doing shenanigans; that one last steel plate coming out of the furnace stack and somehow it just had to take the worst/longest belt splitter route in that spaghetti furnace stack to the train etc. etc.

I'd like to catch any exception automatically regarding varying supply, ideally set to [ 'No empty storage left' AND 'Inactivity'-time of exactly one inserter swing ]. Only other way would be 'time passed' for a very long fixed time ... where I'd somehow have to calculate the time for the total number inserter swings beforehand per use case/item stack sizes.. and add to that more time for any bad situations... that kinda suucks. Awful to setup + Trains wait forever.

My priority is cramming the train as full as possible in situations of varying supply, in a simple way. Don't waste time waiting, don't waste fuel with useless train rides.

Edit:
The next problem is ... the target train station on the other end will very likely have condition 'Is empty'. That train could decide run in circles forever.
How important is it to get that last iron plate? If your production is that thin, then your train is going to be waiting a LONG time anyway, so you may as well set "inactivity OR time passed", or "inactivity AND item count > N" where N is the smallest load you want the train to bother with.
Tinyboss
Filter Inserter
Filter Inserter
Posts: 537
Joined: Sun Nov 16, 2014 12:11 pm
Contact:

Re: Train wait condition 'No empty storage left' or something like that

Post by Tinyboss »

StansTheMan wrote: Sun Nov 10, 2024 11:09 pm My priority is cramming the train as full as possible in situations of varying supply, in a simple way. No wasting time waiting, no wasting fuel doing empty train rides + Quality compatibility.
In that case, an inactivity condition plus producing enough at the loading station that you can have a load ready to go (loaded from chests because that's way faster) when the train arrives.

If you can't produce enough to immediately fill the train every time it arrives, then you can be as smart as you like about the train departure, but it's not going to change the overall throughput. You'll deliver as much as you pick up, which is as much as you produce. Just pick reasonable values for "time passed AND inactivity" and be done with it, right?
StansTheMan
Inserter
Inserter
Posts: 20
Joined: Sat Mar 30, 2019 5:43 pm
Contact:

Re: Train wait condition 'No empty storage left' or something like that

Post by StansTheMan »

Tinyboss wrote: Sun Nov 10, 2024 11:17 pm
How important is it to get that last iron plate? If your production is that thin, then your train is going to be waiting a LONG time anyway, so you may as well set "inactivity OR time passed", or "inactivity AND item count > N" where N is the smallest load you want the train to bother with.
Okay that ones not very important... bad example. I still dislike how I'd need to setup fixed item counts beforehand. I know, It's a small nitpicking.

You are close though. "inactivity AND item count > N".

Now that I think about it ... what I actually need is a percentage based wagon fullness condition... 'Train is % filled' condition. That'd be great.
User avatar
BlueTemplar
Smart Inserter
Smart Inserter
Posts: 3234
Joined: Fri Jun 08, 2018 2:16 pm
Contact:

Re: Train wait condition 'No empty storage left' or something like that

Post by BlueTemplar »

The next problem is ... the target train station on the other end will very likely have condition 'Is empty'. That train could decide run in circles forever.
Yes, this became a problem, which I then fixed with an even simpler than «AND item count > N» :
«AND has cargo in inventory»
on the loading station.
BobDiggity (mod-scenario-pack)
Tinyboss
Filter Inserter
Filter Inserter
Posts: 537
Joined: Sun Nov 16, 2014 12:11 pm
Contact:

Re: Train wait condition 'No empty storage left' or something like that

Post by Tinyboss »

StansTheMan wrote: Sun Nov 10, 2024 11:30 pmNow that I think about it ... what I actually need is a percentage based wagon fullness condition... 'Train is % filled' condition. That'd be great.
So if the problem is mixed qualities of the same item, that's easy. The maximum cargo is 40 x stack size, so figure out what the number is for the percentage you want. Use a combinator hooked to the train stop to read the train contents.
Last edited by Tinyboss on Sun Nov 10, 2024 11:54 pm, edited 1 time in total.
Zaflis
Filter Inserter
Filter Inserter
Posts: 518
Joined: Sun Apr 24, 2016 12:51 am
Contact:

Re: Train wait condition 'No empty storage left' or something like that

Post by Zaflis »

I guess the condition could be called "All cargo slots used". That doesn't imply they are all full, just that each slot has something. Alternatively do it in a way of counting:
Cargo slots used >= 40
StansTheMan
Inserter
Inserter
Posts: 20
Joined: Sat Mar 30, 2019 5:43 pm
Contact:

Re: Train wait condition 'No empty storage left' or something like that

Post by StansTheMan »

That would fit however I just realized... this, full cargo, empty cargo, any cargo ... could all be replaced with a single % based cargo meter. Set to 95%, 100%, 0%, (>=) 1% respectively.

In effect exposing the status of the green progress bar of Full Cargo as a condition itself. Honestly all conditions should be arbitrary comparable, invertible etc. as far as possible (without circuits).

Probably way out of scope even assuming flawless migration of all train stations, probably not even as straight forward to implement to begin with, for other reasons.

This topic can probably be closed.
Fharkas
Burner Inserter
Burner Inserter
Posts: 17
Joined: Mon Nov 11, 2024 6:34 pm
Contact:

Re: Train wait condition 'No empty storage left' or something like that

Post by Fharkas »

I have the same issue. This would be a nice feature.

My current solution:
All mining outposts have a filter splitter line that redirects all the above common quality ores into a mini train station.
That station activates if enough ore gathered, a specific train comes and picks it all up, and leaves after 60 seconds (way more than necessary) or if gets a signal from the station that it is empty.

Only works on small scale and ores. Would be a hassle to setup for anything else.
StansTheMan
Inserter
Inserter
Posts: 20
Joined: Sat Mar 30, 2019 5:43 pm
Contact:

Re: Train wait condition 'No empty storage left' or something like that

Post by StansTheMan »

Reading your post I got this idea:
Same loading station, multiple unloading stations. The train normally does a schedule to check for, to load and to unload common quality, but an interrupt checks for higher quality in the train and sends the train to the other unloading station. The unloading stations unload with filter inserters.

Now, consider this situation: both conditions while loading are 99% satisfied, one gets triggered, gets delivered. Assuming both unloading stations are near each other ... that train would waste an entire trip for 1 percent, 1 stack, 1 single item or single second of being loaded, and head back again...

Correct me If I'm wrong.
Post Reply

Return to “Ideas and Suggestions”