Friday Facts #375 - Quality

Posted by kovarex on 2023-09-08

Hello,
Today we are going to talk a little bit about a big feature in the expansion, Quality!


What is Quality?

Quality is everywhere. It is all around us. Even now, in this very room. You can see it when you look out your window or when you turn on your television. You can feel it when you go to work... when you go to church... when you pay your taxes. It is the world that has been pulled over your eyes to blind you from the truth.

What truth?

That you are a noob, Neo. Like everyone else you were born into normal quality. Into a prison that you cannot taste or see or touch. A prison for your factory.

You take the blue module, the story ends, you wake up in your factory and believe whatever you want to believe.
You take the white module, you stay in Wonderland, and I show you how deep the rabbit hole goes.


Horizontal versus Vertical growth

  • Horizontal growth is just using what I have to build more: More mining outposts, more production facilities etc.
  • Vertical growth is improving the efficiency in which I produce: Better assembling machines, better smelters, better modules, technology upgrades, and better setups.

In the mid-game you have to balance the vertical and horizontal growth, which is fun because you need to strategize more. In the endgame, you mainly scale horizontally and it is enjoyable too because you know you won't be changing the designs much, so you can attempt to have the "final version" and scale it up, while there are new challenges appearing at the larger scale.

I always wanted to extend the part of the game where you have to balance the vertical and horizontal growth, and quality seems like a nice general solution to do that.


So what is quality?

Every Item, Entity, and Equipment has 5 possible qualities now, and each quality tier gives an improved bonus value, used for most of the stuff:

  • Normal: Base quality for everything, no bonus
  • Uncommon: +30% bonus
  • Rare: +60% bonus
  • Epic: +90% bonus
  • Legendary: +150% bonus


Quality has various effects.

All higher quality entities have more health, but apart from that, they get unique bonuses based on their type:

  • Electric poles have larger supply area and wire reach. +1 tile per quality level.
  • Modules have improved primary bonuses.
  • Spidertrons and armor have larger equipment grids. +1 in each direction for each extra level.
  • Spidertrons have a bigger inventory and armors give a higher inventory size bonus.
  • Equipment is generally better in what it does.
  • Turrets and guns have more range.
  • Ammo does more damage.
  • Inserters move faster.
  • Mining drills deplete resources slower.
  • Assembling machines/furnaces/labs are faster.
  • Worker robots have larger battery capacity.
  • Roboports recharge robots faster.
  • Solar panels produce more energy.
  • Accumulators have larger battery capacity.
  • Nuclear reactors, boilers and steam engines have increased production.
  • Beacons have lower power consumption.
  • Radars have larger reveal ranges.
  • Repair packs have more durability.
There are a few entities which don't have any bonus apart from the health, which is belts, pipes, rails, chests, combinators, walls, and lamps.

When these bonuses are combined, things can get pretty wild pretty quickly:

  • 4 Legendary productivity modules in an an assembling machine 3 gives +100% productivity bonus (it was +40% before). Since this multiplies in multi-step production chains, the overall factory productivity gets quite a big boost.
  • High quality spidertrons and armors with high quality equipment get pretty powerful. There is actually a new achievement for having best legendary armor full of legendary equipment.
  • With the fast machines/modules and inserters, some of the setups can get quite extreme.

How do we get the higher quality?

We wanted to make a system for semi-automated higher tiers of everything without the need to multiply all the recipes.
Generally, just adding a huge amount of recipes isn't really adding to the game at this point, as we feel that the game already has enough, especially when we consider Space Age specific ones not yet revealed.

At the same time, we wanted to add some complexity, and also, make the related complications explicitly opt-in.
This is how we came up with the idea of the new type of module, the quality modules.

Quality module

The quality module has a special effect, which increases the probability of getting higher quality results when crafting in a machine.
So, for example the most basic quality module 1 (which has the same tier and availability as other tier 1 modules) adds +1% quality increase chance.
This means that when you insert the one module into an assembling machine and let it craft 1,000 iron gears from normal iron plates, you get 10 uncommon gear wheels on average. But when you insert more modules and increase their tier and quality (yes, quality of quality modules is a thing), this probability sharply increases.

This was all about increasing quality, but an important part of the mechanic is, that the quality of the ingredients is the base for the quality of the product, so getting higher quality intermediates is valuable too.
On top of that, the quality increase can be not only one level at a time, but you can get lucky and get more steps at a time, each additional step has 10 times lower chance of happening, so for our previous examples, out of the 1000 gears, 9 would be uncommon and 1 rare.


Example of the probabilities with 4 normal quality 3 modules.

Quality modules can't be inserted into beacons (for the same reasons you can't do it with productivity modules), but other than that, it is not limited.
Since productivity modules are usable only on intermediates, there are plenty of places where the extra quality items might be produced without any productivity penalty.

It is also notable that we created a quality penalty on speed modules, because haste makes waste, and we wanted to reduce the number of places where beacons full of speed modules is the best way to go.

The last piece of the puzzle

Ok, so we presented a way to get some higher quality stuff, but it would still be quite weird with the not-so-good items piling up somewhere. This is why we added a new machine, the Recycler.

Graphics are subject to change.

Not only it solves one of the biggest problems in Factorio of how to get rid of all the pistols Trupen made.
It also allows you to get rid of the item qualities which are no longer good enough with a chance to get something back. More specifically, for each crafted item, the recycler gives you 25% of the original ingredients back. You might wonder why only 25%, but when you take all the possible productivity bonuses into consideration, it needs to be this low to avoid a net positive recycling loop.

This is also why we created an overall machine limit on productivity to be +300% (modifiable by mods if needed), so even when some mods add machines with more module slots and/or better productivity modules, it will always be prevented from getting broken accidentally.

The actual cost

With the recycler in mind, we can produce legendary items in quite a simple way. We just create assembling machines filled with quality modules for each quality of ingredients, and recycle everything thats not perfect until you get the quality you want.

This build takes electronic circuits and recycles them. The normal ingredients are returned back to the main factory, while quality ones are processed into quality electronic circuits, with any better than Rare being stored in chests.

With this straightforward approach, if you want to produce items of legendary quality, and you already have enough legendary quality 3 modules (which is not an easy thing to get in the first place), the legendary items are 56 times more expensive than normal items.

But obviously, since items have a chain of steps to produce them, every step has the potential to increase the quality of the intermediate products. With different approaches, and possibly different machines or other ways to improve the productivity of the process (tease of some future FFF content), the cost can be brought lower, but it will always be pretty expensive to get the best stuff.

Unlocking quality tiers

Not all of the quality tiers will be available from the beginning, only uncommon and rare is unlocked with the quality module research, and the better ones are unlocked later. More specifically Epic is on one of the 3 earlier planets, and Legendary on the last planet.

Strategy implications

I'm happy with the strategy implications, because they add more important decisions throughout the game.

  1. You don't have the recycler soon in the game, so you can't really just recycle to get the best stuff, the most common way how to start with the quality is to just insert some quality modules into production of final products, which emits some higher quality products as a by product.
    This results in a stage of the game, where you pick the very limited number of higher quality modules, machines etc. made as a side effect, and you can decide what are the most important parts of the factory that need boosting.
  2. Later, especially once you unlock recycling, it can be a HUGE trap to try to get too high quality of too many things too early.
    The cost is just too high, and you can easily realize, that 90% of the production of your factory goes into trying to get the legendary cool thing you want.
    So prioritization of where and how many resources go is crucial. As well as deciding what items are the most important to get in higher quality. It plays a huge role in the speed in which you move forward.
    On the other hand, if someone wants to just slow-run the game and enjoy having everything semi-perfect and over-prepare before moving to another planet, the possibility is certainly there.
  3. When interplanetary logistics come into play, the quality plays a big role, as things change.
    With normal quality products, it might be easier and more productive to make the thing locally on the planet from the local resources rather than having to transfer it through rockets and space platforms. But once the standard goes up, and you start using high quality entities more, the relative cost of the item and the rocket to transport it changes a lot, and it starts to be better to make each item production in one place and just transport it everywhere.
  4. It plays nicely with the space platform building part, as the space on the platform is quite limited and expensive, it is very efficient to save the best stuff you have for the platform, at least in the beginning.
  5. In big numbers, the quality is basically statistics, but in small numbers the random aspect can be quite fun in a different way. Especially for personal armors and equipment, we always ended up having an assembling machine with the best quality modules in the center of the factory dedicated for people trying to gamble for the best possible equipment for their personal use. The excitement of getting directly a rare power armor from common ingredients when you are super lucky is the same as getting BAR-BAR-BAR in the slot machine, or the wanted item in the pay-to-win lootbox mechanics. But in Factorio you don't have to take another mortgage on your house to enjoy this aspect of the game!


Engine support and history

Quality is the most mature feature of the expansion, because I was developing its first versions internally before the 1.0 release, and it was kept in a separate branch the whole time.
We were considering just putting it into the 1.0 release, but since we were already so behind our plan (similar story as with the space platform), and this is the kind of feature that tends to create unexpected problems (delays), it was decided to just wait with it for the expansion.

There are many internal changes we had to do in order to make quality integrated into the core of the game. Just the GUI changes are touching quite a lot of places on their own. In some places, you just select quality, in others we had to allow the selection of a "quality condition", so for example, you can select to only upgrade assemblers with lower than uncommon quality, etc.

This is a brief list of the places that come to my mind:

  • When you specify filters of quickbar/inventory/deconstruction planner.
  • When you order things from the logistic network.
  • When you view statistics.
  • In circuit network signals.
  • In chat tags.
  • In assembler recipe selection.
  • In blueprint icon selection.
  • In the upgrade planner.
  • In the editor.
And more...


Here, for example, the logistic request allows setting either one specific quality, or a quality condition.
In this case, we are trashing all of the assemblers with lower than rare quality.
Requesting items must use the '=' condition, as using the other quality comparisons would be ambiguous and inefficient, hence the lower number is greyed out.

And this is just the GUI, it obviously affects many parts of the game including modding API etc.

This means, that I had to do many VERY complicated merges into the branch during 1.0 and 1.1 development, as many things were different in the branch, so almost anything that touched internal IDs, GUI, or tests, was almost guaranteed to have a merge conflict. I believe that fellow programmers will sympathize with my pain.

So once we started working on the expansion, this was the very first thing that was put there to finally escape this purgatory. This means that it is the most tested feature both technically, and also game-play wise. This explanation might also make it more understandable, why we don't plan to backport features we already have (like those from FFF-374) into the 1.1.

Expansion only

To make things clear, the quality content is exclusively part of the expansion. The non-expansion binary works the same internally, it just doesn't allow any mod to define anything other than the normal quality.

We have made it so that quality is 'invisible' in the game until quality modules are unlocked, so you won't see anything related to quality if you haven't researched quality module or are playing the base game. This includes all the GUIs and interactions as mentioned earlier.

It's also worth noting that while it's a lot of fun to play with quality, using it is completely optional. The expansion is balanced in a way that using quality can be beneficial, but it is reasonable to finish the game without touching quality at all. Typically, people who want to just finish the game are more likely to not touch quality much, while those who want to build a big factory will have very good reasons to use it.


Conclusion

There were at least 2 full LAN playthroughs with quality even before space-related stuff was developed, and more after with a lot of individual playthroughs on top of that.
Each of those helped to fix related bugs and tweak the functionality based on the feedback.
This means that I have enough evidence to be able to confidently say that the pain was worth it, and this feature is fun to play with and works seamlessly!

As always, let us know what you think at the usual places.