// HACKER NEWS — CYBERSECURITY
Solving Factorio Quality
I play Factorio the normal way: by writing matrix math code to plan the factory.
But we’ll get to that.
Or, TL;DR, go to my new online calculator tool.
Factorio pretty much founded the factory video game genre:
you play a character who harvests resources and combines them to craft increasingly complex items,
which in turn enable more sophisticated crafting.
So far this sounds a lot like Minecraft and many other survival games,
but what sets factory games apart is the focus on automation:
soon enough, most of the crafting is done not “by hand” by the character
but by increasingly many machines,
with various forms of logistics like conveyor belts to move items between machines
or wherever they need to go.
Some factory game go further and remove the player character altogether.
As “technologies” are unlocked in-game, Factorio offers many mechanisms to improve production.
One of them is modules: crafting machines have a (limited) number of slots
to accept different kinds of modules that affect their stats:
speed modules make the machine run faster at the cost of more energy consumption,
productivity modules increase yield from the same ingredients at the cost of speed and energy,
etc.
Released in 2024, the Space Age extension adds new game mechanics including Quality:
every item and recipe now come in five quality tiers:
⚀ normal, ⚁ uncommon, ⚂ rare, ⚃ epic, and ⚄ legendary.
Depending on the item, each tier improves stats such as making crafting machines faster
or making productivity modules more productive.
High-quality items can be crafted directly from ingredients of the same quality,
but the only way to increase quality is through the new quality modules.
Modules affect the probability QQ of any quality increase.
For a given craft, each quality tier increase after the first is another 10% chance.
We can build a table of the probabilities of output quality depending on input quality:
For example, the maximum possible quality chance in a machine with four module slots is 24.8%:
Some players dislike the introduction of randomness
to a game that was mostly deterministic, but
with enough repetitions probabilities become ratios.
The probabilities are balanced so that
even with multiple crafting steps (each a potential quality jumps),
getting high-quality items unavoidably involves also crafting many unwanted low-quality ones.
To avoid the factory grinding to a halt when storage eventually gets full,
Space Age also introduces the recycler:
a new machine that destroys any item and (usually) returns 25% of its ingredients.
This enables players to design “upcycling” contraptions
that craft and recycle in a loop with quality modules
until items reach the desired quality, at the cost of consuming many more ingredients: