Fifo chest

Post your ideas and suggestions how to improve the game.

Moderator: ickputzdirwech

Shadowhawk
Burner Inserter
Burner Inserter
Posts: 6
Joined: Mon Oct 06, 2025 7:17 am
Contact:

Fifo chest

Post by Shadowhawk »

Short:
I want a chest that takes stacks out the way they got in.

What:
When i put stuff in a chest i would like the option for the chest to put them in the slots in order and take them out in that same order.
So like a linked list in chest form, insert index, output index and they just loop around.

Why:
Currenty with spoilage you cannot store stuff in chest and then take it out that does not spoil the whole chest. So tech on gleba will all spoil premature and you cannot buffer a certain amount and let the rest be destroyed. Spoiled first just lets the whole chest spoil at the same time. Fresh first will have all but the last stack spoil.
Koub
Global Moderator
Global Moderator
Posts: 8018
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Fifo chest

Post by Koub »

I think the whole point of Gleba is to encourage experimenting with JIT manufacturing. I doubt anything trying to achieve the opposite will ever be implemented in vanilla.
Koub - Please consider English is not my native language.
eugenekay
Filter Inserter
Filter Inserter
Posts: 774
Joined: Tue May 15, 2018 2:14 am
Contact:

Re: Fifo chest

Post by eugenekay »

A long chain of Belts is an inherent "First In, First Out" buffer. It is not space-efficient, but it does look pretty when the items spoil in transit.
10-06-2025, 11-55-47.png
10-06-2025, 11-55-47.png (827.56 KiB) Viewed 389 times

Good Luck!
Last edited by eugenekay on Mon Oct 06, 2025 3:56 pm, edited 1 time in total.
User avatar
Nosferatu
Filter Inserter
Filter Inserter
Posts: 273
Joined: Fri Jan 20, 2017 4:48 pm
Contact:

Re: Fifo chest

Post by Nosferatu »

According to the wiki spoiling in a chest is done per stack.
So Spoiled first should be close to FIFO as long as you have decent throughput and quantitys.


https://wiki.factorio.com/Spoilage_mechanics
Freshness and stacking
When spoilable items form a stack (inserters picking up items, items being placed in containers, items being placed in a production machine, etc), the freshness of the resulting stack is determined by the average freshness of all items being combined. If you take a stack of 10 items with freshness 50% and add one item of freshness 100%, the result is a stack of 11 items with a freshness of 54.5%.

As such, all items in a stack will spoil at the same time. If spoiling spawns an entity, one entity will be spawned per item in the stack.
Green Cat
Long Handed Inserter
Long Handed Inserter
Posts: 92
Joined: Tue Nov 05, 2024 7:14 pm
Contact:

Re: Fifo chest

Post by Green Cat »

Koub wrote: Mon Oct 06, 2025 2:20 pm I think the whole point of Gleba is to encourage experimenting with JIT manufacturing. I doubt anything trying to achieve the opposite will ever be implemented in vanilla.
you mean force people to play in a certain way? people hate that planet because of how annoying it is.

If there was a research to increase the timer, freeze things (i mean, building can be frozen but not biological things?), a "end of gleba" research to remove the timer.... what? then how will bitters come out to destroy, you know, something only people with gambling addiction love, or how can we get ores since my ideea means we need a building to oh wait, a chopper bacteria ore put in the smelter = chopper plate... wow

Gleba would have been the most briliant planet if it was not for the devs forcing us to deal with biological waste, more waste managment, also risk of outbreak because putting a permanent stop was not included so everyone does the exact same copy paste set up, and of course, the trees and the seeds.

Did I mentioned that some of the devs have gambling addiction? this is why i mentioned the seeds. The people with gambling addiction don't get that people do NOT want to gamble, they want quality, not gambling for them. Every last non space age overhaul showed this over and over again. What we got? gambling gambling and even more gambling. People wanted a more challanging way to get quality, not to gamble. Especialy since you need to be end game for it to even be worth, since it's faster to unlock legendary and module 3 then to get rare for all the stuff you need.

So the seeds is: if gleba's seed would result in 100% same quality fruids: Gleba would be the planet that everyone build exactly to have access to quality products, because we wanted quality and not GAMBLING for quality.

So yeah, as i said, you wrote "devs force us their agenday and addiction" in a very wierd way. PS: we can turn off pollution, evolution, enemies, make milions of ores, no water, no trees, and so much more, but there is no way to disable spoilage (mods aready showed that it's possible), and no way to increase or similar the % for quality = yep, the devs forced on us certain issues they needed to deal with and not add it to factorio.

So yeah. OP's request is valid and the only reason why it's being pused aside is because to many people fail to understand, let alone accept, that most people don't want do to waste managment and gambling in factorio
User avatar
Nosferatu
Filter Inserter
Filter Inserter
Posts: 273
Joined: Fri Jan 20, 2017 4:48 pm
Contact:

Re: Fifo chest

Post by Nosferatu »

I have to take that back.
After watching my Bioflux Buffer chest in my Gleba Base for a while and some testing:

I have no clue how I can use the "Spoiled first" inserter functionality to keep a fresh buffer chest.

The problem is: At the beginning it looks like it would work.
Spoiled first will take from the most spoiled stack.

The problem starts if you want to refill your chest with fresh stuff:
Fresh stuff is inserted onto the first not full stack in the chest.
As my wiki quote above describes the fresh items freshness will be mixed with that stack and make it slightly fresher.
The "Spoiled first" inserter will soon pick a different stack that is less fresh. Again creating space for fresh stuff on that stack.

Result:
Instead of getting the buffer fresher - very fast all Stacks except for the last will average out - at that point the "Spoiled first" function gets useless.

Possible whacky ingame solution that I will try next:
Make sure that the "spoiled first" exerter removes a complete stack before the inserter is allowed to top up the chest again.

Maybe an idea for a dev side solution:
When inserting spoiled goods into a chest - don't choose the first available stack.
If the item in hand is fresher than all available stacks - start a new stack - else search for the stack with the closest match in freshness.
Of course that's not very performance friendly. Maybe only do it for inserters that have "Spoiled priority" checked by the player.

PS: To add to the discussion that sneaked in: Why would the devs have created the "Spoiled first" function which only works on chests if the intention was to force the player to not store spoileables into chests?
Tertius
Smart Inserter
Smart Inserter
Posts: 1439
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Fifo chest

Post by Tertius »

Shadowhawk wrote: Mon Oct 06, 2025 7:22 am Currenty with spoilage you cannot store stuff in chest and then take it out that does not spoil the whole chest. So tech on gleba will all spoil premature and you cannot buffer a certain amount and let the rest be destroyed. Spoiled first just lets the whole chest spoil at the same time. Fresh first will have all but the last stack spoil.
It seems you didn't fully understand the spoilage mechanics.

Each stack with some spoiling item spoils on its own. All items in one stack will spoil at the same time, but not all stacks will spoil at the same time.

If there is a partial stack and you're putting more items into the container, the first partial stack is being selected and merged with what is inserted, and the freshness of the combined stack is the weighted average of the existing stack and the added items.
Once a stack is full, it cannot be added more items, so it will spoil with whatever freshness it currently has.

If you add items over time, complete stacks are being created one by one, and these will have different time left depending on the freshness of the original items and the stack they were merged into. Overall you will see that stacks created first are spoiled most and stacks created later will spoil later.

If you extract items while you also add items, partial stacks will be created. But newly added items are added to the first partial stack in a container (or to an empty space if there is none), while items being extracted are extracted from the last stack in the container. So it's not always clear what stack gets refreshed by adding new fresh items and its spoiling time extended due to the weighted average.

If you use the inserter option to extract the most fresh or the most spoiled item, you overrule the "take from the last stack" rule and might pick from some stack in the middle. However, if you continue to add items, this now partial stack in the middle could be the target for newly added items, so its spoiling time gets modified, usually extended.

So it's a bit random what stack will actually spoil and when. But definitely wrong is that all items will spoil at the same time. This can only happen if you created these items all at the same time and added them all to the same container. But this usually doesn't happen, items are usually created one after the other.
Shadowhawk
Burner Inserter
Burner Inserter
Posts: 6
Joined: Mon Oct 06, 2025 7:17 am
Contact:

Re: Fifo chest

Post by Shadowhawk »

Nosferatu wrote: Mon Oct 06, 2025 3:51 pm According to the wiki spoiling in a chest is done per stack.
So Spoiled first should be close to FIFO as long as you have decent throughput and quantitys.


https://wiki.factorio.com/Spoilage_mechanics
Freshness and stacking
When spoilable items form a stack (inserters picking up items, items being placed in containers, items being placed in a production machine, etc), the freshness of the resulting stack is determined by the average freshness of all items being combined. If you take a stack of 10 items with freshness 50% and add one item of freshness 100%, the result is a stack of 11 items with a freshness of 54.5%.

As such, all items in a stack will spoil at the same time. If spoiling spawns an entity, one entity will be spawned per item in the stack.
It does not work that way, the inserter will always insert at the earliest point. So then that stack will be slightly less spoiled then the next stack.
I ran into the issue because quality and spoilage means JIT production cannot happen. So i had to buffer for like 1 min so % averages out.

All the stacks ran out at the same time so thats why it would be nice if spoilage worked. Just dont add items to stacks that are a 2 big gap in spoilage.
Tertius wrote: Mon Oct 06, 2025 6:18 pm
Shadowhawk wrote: Mon Oct 06, 2025 7:22 am Currenty with spoilage you cannot store stuff in chest and then take it out that does not spoil the whole chest. So tech on gleba will all spoil premature and you cannot buffer a certain amount and let the rest be destroyed. Spoiled first just lets the whole chest spoil at the same time. Fresh first will have all but the last stack spoil.
It seems you didn't fully understand the spoilage mechanics.

Each stack with some spoiling item spoils on its own. All items in one stack will spoil at the same time, but not all stacks will spoil at the same time.

If there is a partial stack and you're putting more items into the container, the first partial stack is being selected and merged with what is inserted, and the freshness of the combined stack is the weighted average of the existing stack and the added items.
Once a stack is full, it cannot be added more items, so it will spoil with whatever freshness it currently has.

If you add items over time, complete stacks are being created one by one, and these will have different time left depending on the freshness of the original items and the stack they were merged into. Overall you will see that stacks created first are spoiled most and stacks created later will spoil later.

If you extract items while you also add items, partial stacks will be created. But newly added items are added to the first partial stack in a container (or to an empty space if there is none), while items being extracted are extracted from the last stack in the container. So it's not always clear what stack gets refreshed by adding new fresh items and its spoiling time extended due to the weighted average.

If you use the inserter option to extract the most fresh or the most spoiled item, you overrule the "take from the last stack" rule and might pick from some stack in the middle. However, if you continue to add items, this now partial stack in the middle could be the target for newly added items, so its spoiling time gets modified, usually extended.

So it's a bit random what stack will actually spoil and when. But definitely wrong is that all items will spoil at the same time. This can only happen if you created these items all at the same time and added them all to the same container. But this usually doesn't happen, items are usually created one after the other.
Nice in theory, but it does not work that way. You take out the most spoiled item, then the first stack isnt full anymore so new stuff gets added.
Stop trying to explain how the game works, as it actually does not work that way. I saw this in the game happening.
Easy to reproduce, go to gleba and overproduce slightly on mash or jelly. You will see this behaviour in a chest you put on that belt between production and consumption.

The game does not make partial stacks, it always adds items on the first stack it can in the chest. Dont believe me just check it yourself.
Also the game does not merge the same items once they are in the chest. Quite funny having 100copper ore in a chest but the game telling you its full because all slots are taken. Yes that also happened in the game.

The work around of a big belt doesnt really work, quality does percentage 20% does not guarantee every 5th but on average every 5th so you have streaks of good and bad luck. If they dont happen on both machines at the same time you get temporaty overflows you have to compensate.
But the game does not really allow for this. Spoiled first for chests basically means spoil all at the same time
Tertius
Smart Inserter
Smart Inserter
Posts: 1439
Joined: Fri Mar 19, 2021 5:58 pm
Contact:

Re: Fifo chest

Post by Tertius »

Shadowhawk wrote: Mon Oct 06, 2025 7:24 pm The game does not make partial stacks, it always adds items on the first stack it can in the chest. Dont believe me just check it yourself.
Also the game does not merge the same items once they are in the chest. Quite funny having 100copper ore in a chest but the game telling you its full because all slots are taken. Yes that also happened in the game.
With "partial stacks", I simply mean a stack that is not yet full. I didn't talk about merging partial stacks in a chest, I explained what happens if you add new items to the chest: they will be added to the first partial stack of that item or to an empty stack, whatever comes first.

I don't understand why you want to put fast spoiling items into a chest in the first place when you want it for fast processing. For fastest processing, you either do direct insert into the next biochamber for production of the next item, for example mash directly into the biochambers for producing bioflux, or directly on a belt to transport to the next production stage. But chest buffering items you need fresh is something you don't do.

The only spoiling item you put into a chest is iron and copper bacteria, to purposely let them spoil to get iron and copper ore.
And of course you sooner or later need some nutrient supply for powering non essential biochambers or for producing yumako/jellynut soil, which is not time critical. I supply those via logistic network.
And you need spoilage for creating coal, so you have to purposely let some items spoil, usually nutrients or jelly because of their cheap recipes and fast spoiling time.

About chest full with 100 copper ore, this can happen if all slots are occupied with at least 1 item, each slot with just a single item or partial stack or full stacks. If you add a new item type not yet in the chest, it cannot be added to an existing partial stack, so it cannot be added as a whole. That's a core game mechanic since the beginning of the game, nothing special.

With a fifo chest, you're asking for a feature that already has existing solutions. Actually it's a challenge and it's your task to find a solution with the existing tools given by the game engine. One part of such a solution is a looping belt. Belts carrying spoiling items must never stall, they must be running all the time to pick spoilage off and keep just the intended items.
computeraddict
Filter Inserter
Filter Inserter
Posts: 395
Joined: Sat Oct 07, 2023 6:44 am
Contact:

Re: Fifo chest

Post by computeraddict »

If you're worried about stack averaging you can use two chests with spoiled-first inserters pulling out. Set up a latch to control which extractor and which inserter is active so that a chest is either filling or emptying. When the active chest is empty, flip the latch.
Shadowhawk
Burner Inserter
Burner Inserter
Posts: 6
Joined: Mon Oct 06, 2025 7:17 am
Contact:

Re: Fifo chest

Post by Shadowhawk »

Tertius wrote: Mon Oct 06, 2025 9:06 pm
Shadowhawk wrote: Mon Oct 06, 2025 7:24 pm
I don't understand why you want to put fast spoiling items into a chest in the first place when you want it for fast processing. For fastest processing, you either do direct insert into the next biochamber for production of the next item, for example mash directly into the biochambers for producing bioflux, or directly on a belt to transport to the next production stage. But chest buffering items you need fresh is something you don't do.
First science packs need to be stored somewhere.

Also quality does not guarantee. So 20% quality improvement gives not every 5th craft but on average. Sometimes you get 10in a row to proc.
So in order to balance that i want to have a chest on the belt to store temporary in case im lucky on 1 side of bioflux but not on the other.
So unless i get 100% quality and only 1 quality upgrade which currently is not in the game i have to account for fluxtuations in supply, and with 25biochambers making stuff thats either a verry verry long belt or a chest. And the later is not possible because of how chests work with spoilage.

The game should not consider 2 items that are more then 5% off in spoilage the same. They are different items.
But the game should also just always automerge the same items in chests even if they happen to be inside there already. So no more full chest with 100iron ore because the game makes stacks of 2.


Ofcourse you could argue i can just download someone else his blueprint for a ship but whats the fun in that.
User avatar
jodokus31
Smart Inserter
Smart Inserter
Posts: 1636
Joined: Sun Feb 26, 2017 4:13 pm
Contact:

Re: Fifo chest

Post by jodokus31 »

I was also wondering about this topic

I think, that's a good solution, but have to experiment. One chest of items is maybe a bit much, maybe rather limit the chests or switch chests more often.
computeraddict wrote: Mon Oct 06, 2025 10:20 pm If you're worried about stack averaging you can use two chests with spoiled-first inserters pulling out. Set up a latch to control which extractor and which inserter is active so that a chest is either filling or emptying. When the active chest is empty, flip the latch.
Shadowhawk
Burner Inserter
Burner Inserter
Posts: 6
Joined: Mon Oct 06, 2025 7:17 am
Contact:

Re: Fifo chest

Post by Shadowhawk »

computeraddict wrote: Mon Oct 06, 2025 10:20 pm If you're worried about stack averaging you can use two chests with spoiled-first inserters pulling out. Set up a latch to control which extractor and which inserter is active so that a chest is either filling or emptying. When the active chest is empty, flip the latch.
This would still back up the belt for a while causing issues down the line. The whole point of having a chest for a few stacks is to have a overflow buffer for a short while. I dont want to destroy the items ( easy just burn them ) because i will need them in the next minute.

Its not hard to fix for devs, make a chest that you can configure to act as a linked list, fill slots in the chest in order and dont fill slots that you filled before unless you have completed the whole chest. Regardless of if these slots get emptied in between.

Now the whole spoiled, fresh first thing had verry little use other then belts. And with correct ratios your inserters only have a pick of 1 stack so not much choice.
angramania
Fast Inserter
Fast Inserter
Posts: 112
Joined: Mon Oct 21, 2024 12:29 pm
Contact:

Re: Fifo chest

Post by angramania »

Green Cat wrote: Mon Oct 06, 2025 5:56 pm you mean force people to play in a certain way?
Lol, exactly opposite. Instead of just one choice - to buffer or not to buffer - Gleba pushes players to choose between plenty ways to handle it.
people hate that planet because of how annoying it is.
Some people hate it, others love it. Some begin with hate and end with love. Why? We love the puzzles we finally manage to solve—and despise the ones that defeat us.
h.q.droid
Fast Inserter
Fast Inserter
Posts: 185
Joined: Mon Nov 18, 2024 12:10 pm
Contact:

Re: Fifo chest

Post by h.q.droid »

Nosferatu wrote: Mon Oct 06, 2025 6:15 pm I have to take that back.
After watching my Bioflux Buffer chest in my Gleba Base for a while and some testing:

I have no clue how I can use the "Spoiled first" inserter functionality to keep a fresh buffer chest.

The problem is: At the beginning it looks like it would work.
Spoiled first will take from the most spoiled stack.

The problem starts if you want to refill your chest with fresh stuff:
Fresh stuff is inserted onto the first not full stack in the chest.
As my wiki quote above describes the fresh items freshness will be mixed with that stack and make it slightly fresher.
The "Spoiled first" inserter will soon pick a different stack that is less fresh. Again creating space for fresh stuff on that stack.

Result:
Instead of getting the buffer fresher - very fast all Stacks except for the last will average out - at that point the "Spoiled first" function gets useless.

Possible whacky ingame solution that I will try next:
Make sure that the "spoiled first" exerter removes a complete stack before the inserter is allowed to top up the chest again.

Maybe an idea for a dev side solution:
When inserting spoiled goods into a chest - don't choose the first available stack.
If the item in hand is fresher than all available stacks - start a new stack - else search for the stack with the closest match in freshness.
Of course that's not very performance friendly. Maybe only do it for inserters that have "Spoiled priority" checked by the player.

PS: To add to the discussion that sneaked in: Why would the devs have created the "Spoiled first" function which only works on chests if the intention was to force the player to not store spoileables into chests?
To maintain a fresh stock, you have to regularly empty your storage by:

- Using up all inputs of a biochamber
- Or shooting a rocket
- Or moving everything into a different chest before filling the old

Instead of continuously filling a rocket silo with fresh produces, you want to overbuild the production to fill a silo instantly, and wire it to move the more spoiled produces in whole-silo batches.
computeraddict
Filter Inserter
Filter Inserter
Posts: 395
Joined: Sat Oct 07, 2023 6:44 am
Contact:

Re: Fifo chest

Post by computeraddict »

Shadowhawk wrote: Wed Oct 08, 2025 10:21 pm This would still back up the belt for a while causing issues down the line. The whole point of having a chest for a few stacks is to have a overflow buffer for a short while. I dont want to destroy the items ( easy just burn them ) because i will need them in the next minute.
Belt will back up if you overproduce and underconsume. It doesn't matter how long or short the belt, or how much buffer there is on it.
Shadowhawk wrote: Wed Oct 08, 2025 10:21 pm Its not hard to fix for devs, make a chest that you can configure to act as a linked list, fill slots in the chest in order and dont fill slots that you filled before unless you have completed the whole chest. Regardless of if these slots get emptied in between.
Yeah... that's not actually an easy ask on the order of optimization that the Factorio engine has. Implementing the internal logic in a void would be easy, sure, but implementing it fast in the game is something else entirely.
Shadowhawk wrote: Wed Oct 08, 2025 10:21 pm Now the whole spoiled, fresh first thing had verry little use other then belts. And with correct ratios your inserters only have a pick of 1 stack so not much choice.
?
Post Reply

Return to “Ideas and Suggestions”