Factorio

Factorio

View Stats:
narf03 Nov 20, 2017 @ 1:25pm
How the game decide which inserter to use ?
Lets say i have a iron gear factory, it has 3 outputs, to a chest, a belt and another factory as input, how the game decide which inserter will be getting the next gear ? completely random ? or speed of the inserter or what ?
< >
Showing 1-10 of 10 comments
nicholas.sommer Nov 20, 2017 @ 1:33pm 
All inserters are chosen one after the other.
Warlord Nov 20, 2017 @ 2:24pm 
Originally posted by jkwong:
Lets say i have a iron gear factory, it has 3 outputs, to a chest, a belt and another factory as input, how the game decide which inserter will be getting the next gear ? completely random ? or speed of the inserter or what ?
I'm not sure. I've had a case where I had a circuit assembler feeding an inserter assembler and a chest. Sometimes it would load the chest first, sometimes it would load the nearby assembler, and sometimes it alternated.
Last edited by Warlord; Nov 20, 2017 @ 2:24pm
Overeagerdragon Nov 20, 2017 @ 3:15pm 
it's pretty much random; which is why the logic circuit exists
SeaBee Nov 20, 2017 @ 3:15pm 
I believe the inserters are prioritized by their location on the assembly machine every cycle; South, West, East, North - If the inserters are all the same type, there shouldn't be an issue if your output is enough to fill the request of all three inserters at once.
Killcreek2 Nov 21, 2017 @ 2:00am 
Originally posted by jkwong:
Lets say i have a iron gear factory, it has 3 outputs, to a chest, a belt and another factory as input, how the game decide which inserter will be getting the next gear ? completely random ? or speed of the inserter or what ?
It is absolutely not random ~ that would cause MP desyncs.

If two are activated simultaneously [eg, both trying to grab same item], the inserter that was placed first always gets priority.

This is due to the game cycling through a long list of all the entities in game each tick, as new entities are placed ingame they get added to that list, & dealt with in the same order.

Edit ~ source link: https://wiki.factorio.com/index.php?title=Inserters#Mechanics

Output inserters from an assembly machine take turns, if possible. You can build a test rig with 3 output boxes ~ all three should fill evenly.
Last edited by Killcreek2; Nov 21, 2017 @ 2:09am
nicholas.sommer Nov 21, 2017 @ 8:56am 
Originally posted by Killcreek2:
Edit ~ source link: https://wiki.factorio.com/index.php?title=Inserters#Mechanics

Output inserters from an assembly machine take turns, if possible. You can build a test rig with 3 output boxes ~ all three should fill evenly.

That’s what I said. (Or wanted to say)
AlexMBrennan Nov 21, 2017 @ 9:42am 
It is absolutely not random ~ that would cause MP desyncs.
Technically speaking this wrong - you can have "random" game elements governed by a pseudo random number generator (e.g. map generation) if you really wanted to randomize the order of inserter actions for some reason; they just chose not to.
Killcreek2 Nov 22, 2017 @ 4:48am 
Pseudo random does not = random . . .
BitterSwede Nov 22, 2017 @ 5:04am 
Originally posted by Killcreek2:
Pseudo random does not = random . . .
If we're gonna be that picky, it's impossible for a computer to use random numbers, so all computer generated randomness is pseudorandom. In fact, the concept of random, as we understand it, might not even exist in the real world.

But that's way off topic, so back to what OP asked for, here's what I have found (please, do correct me if I'm wrong):
Depending on what the inserters are attached to, they will either try to fill evenly, or go by order of when they were placed. The latter system is very deep in the Factorio code and can be seen in several places, most notably in logistic networks with how storage chests work, where the bots will always fill the storage chests within the network based on when they were placed, rather than distance to the chest. It's one of many UPS/FPS saving tricks they have implemented into the game.
This mechanic, when it comes to inserters, is only observed when picking up from the same tile though. Since an assembler is 3x3 tiles and the "access tile" is any of the 9 tiles, inserters trying to take from an assembly machine will act differently (even if both are attached to the same tile, eg. two long handed attached to the center or two regular attached to the same corner). In cases like these, they will take turns to get items out of the assembly machine.

I have not done any tests recently for mixed types of inserters, so I don't know what will happen if you put a fast inserter, a stack inserter and a regular inserter to take items from the same machine.
Hedning Nov 22, 2017 @ 7:44am 
What I have found is that if you attach two (or more) consumers to one producer with inserters, then the consumers will all get the supply items they can with 0 downtime no matter what (obvioulsy as long as there isn't an insterer bottleneck).

This is good enough to me. Any more detail is not needed. If I need some other control over my inserters (say I want to prioritize item A over item B) I use wire.
< >
Showing 1-10 of 10 comments
Per page: 1530 50

Date Posted: Nov 20, 2017 @ 1:25pm
Posts: 10