Many people say Factorio is a must-play game for software engineers. Shopify even lets employees expense it as a personal purchase. Here are some lessons I picked up after playing.
Shopify lets people expense factorio. This idea is spreading đ https://t.co/lTnDKDDrmO â tobi lutke (@tobi) February 13, 2022
Thereâs an interesting quote I found on a blog about this Shopify perk:
âŚShopifyâs decision to let employees expense the game a very clever one indeed: itâs quirky perk, partly a way for leisure time to build better habitsâand partly a way to give more people a shared vocabulary for which business problems can be solved, and how to solve them.
What Kind of Game is Factorio, Anyway?
The premise is simple: youâre stranded on an uninhabited planet. Your rocket is wrecked. Your job is to build a new rocket and launch it into space. To get there, you need to research and build everything from scratch, from smelting raw iron and copper ore all the way up to crafting low density structures.
Why does Factorio resonate with software engineers? Because at its core, the game is about problem solving and automation. These two things are daily bread for engineers, so the problems you encounter in the game often map directly to work.
Imagine a Website
Before we go further, letâs pretend weâre a full-stack engineer managing a website. To align the terminology, think of this website as a factory. Every factory has input, processing, and output. In manufacturing, input is raw material, output is finished goods.
Translated to website terms: input comes from users, whether itâs visits, adding items to a shopping cart, or something else. The website processes that input. The output is data back to the user, maybe an invoice or just a news article.
In the following sections, Iâll draw parallels like this and translate them into Factorio terms, and vice versa.
Learning to Scale Up
In Factorio, youâll face all sorts of problems. Thereâs no right or wrong way as long as you solve them. And just like in the real world, every solution has its pros and cons. The first problem youâll encounter is âhow do I produce X?â
Take a look at this illustration:
FIG1: A simple Steel Smelter
This is a basic steel factory. One steel bar is made from 5 iron plates. An iron plate is made from one iron ore. And you need coal to fuel the furnace.
Thatâs a simple solution for âhow do I make a steel bar.â But it produces one bar every 16 seconds. Itâs like your website can only handle 10 requests per minute. How do you increase the output? Horizontal and vertical scaling, very familiar to software engineers.
Hereâs an example of horizontal scaling. Basically, you add more furnaces. But those furnaces need coal and iron ore, so the materials are delivered via conveyor belts. In software engineering, this means adding more servers. The furnaces are your servers. User traffic needs to be distributed across them, so the conveyor belt is essentially your load balancer.
FIG2: A Steel Smelter setup thatâs easy to scale
You can build a production line like the one above, but thereâs no fixed blueprint in Factorio. Players are free to design their factories however they want. Thatâs why creativity is constantly tested in Factorio, and it can train your creativity as a software engineer to see beyond just one solution.
One advantage of this production line is how easy it is to expand. I just copy two rows of furnaces like below to provision the next line. Kind of like deploying servers đ.
FIG3: Copy & paste a similar pattern
The problem that emerges from this production line is the shrinking raw material input, because there are now more processors consuming it. Output > Input. That means the input channel needs to be widened. One way is to upgrade to faster conveyor belts (FIG4). In software engineering, this could mean ordering more bandwidth from your hosting provider. For cloud hosting, this is usually baked into the usage cost đ¸.
FIG4: Low bandwidth problem, upgrade Yellow Belt -> Red Belt
Overengineering
Relevant XKCD
Imagine one day the marketing team asks a software engineer for help building a landing page (not a true story). After finishing, the engineer takes the initiative to build a Content Management System for landing pages. The hope is that next time, marketing can build them on their own without engineering support.
As it turns out, marketing never requests another landing page. After looking into it, the first test didnât meet expectations (again, not a true story). The CMS ends up unused. Youâll run into this in Factorio too. Take these 5 iron chests:
FIG5: An Iron Chest requires 8 Iron Plates
Making one chest takes only half a second. Hoping that chests will be needed in bulk, you could set up a dedicated production line for them. But materials in Factorio are finite, so you borrow from an existing production line. With so little iron plate supply going to the chest line, production stalls. Just like in real life, weâre borrowing time to work on the CMS project. Look at the calculation diagram below:


FIG6: Iron Plate output isnât enough, time wasted
In Factorio, youâll frequently see conveyor belts with gaps because of material shortages. Itâs not uncommon for players to manually calculate a production lineâs output. In the diagram above, I calculated that weâre short 15 iron plates per second. That means the chest production line wonât get the materials it needs. Itâs faster to hand-craft chests than to wait for materials from this production line.
The lesson here: overengineering shows up when utilization is low. Building automation for something that doesnât add value or isnât better than the existing system. It creates unnecessary cost.
Underengineering
The opposite of the previous case. Here, the software engineer becomes the bottleneck.
Imagine a similar request (landing pages), but marketing asks for help every single week. Utilization is guaranteed to be high. As a result, every week thereâs landing page work. What started as an occasional request becomes a recurring task. Time for other project development shrinks. In this case, a CMS would actually be a huge help. Being slow to recognize this situation wastes the engineerâs time. Same thing in Factorio, for example with Utility science pack production:
FIG7: A component you could craft by hand
The diagram above shows the recipe for a science component. In Factorio, science components are the currency for researching technology. Players can craft them by hand without an assembler. In one minute, a player can produce 0.62 of this component. The problem is, the game needs you to produce hundreds of these đ. You could make them manually, but it would take dozens of real-world hours.
Compare that with this optimized production line using speed modules. Now we can produce 19.2 components per minute. Over ten times faster than hand-crafting.
FIG8: The same component, built with automation
From this, we learn the importance of digging deeper into stakeholder needs. Making the effort to understand the domain of the work helps us create better estimates and solution designs.
Do it Right, then Do it Fast
Related to scaling up, in Factorio itâs important to design efficient production lines. A messy, cramped layout takes up a lot of space. Space that could be used for another production line. So itâs important to get the design right before expanding further.
Same thing when adding servers. As much as possible, the servers you provision should be built from a clean operating system without extra software. Besides saving storage, it also saves bandwidth when containers pull images you frequently use.
From the illustration below, with limited space we managed to fit 14 assemblers, increasing output to 268.8 per minute.
FIG9: A scalable production line
The Importance of Monitoring and Observability
Monitoring in Factorio is critical. A moment of inattention and youâll run into problems like this:
FIG10: Low on power, happens all the time
In Factorio, you can see the energy output alongside demand. If demand exceeds supply, some areas will show red indicators like above. But if your energy supply depends on solar panels, power can go completely dark once the battery reserves are drained:
FIG11: âBlackoutâ
In cloud hosting, monitoring usually comes built-in. CPU, memory, and I/O metrics are standard. Itâs also common knowledge that these metrics alone arenât enough to explain why a website suddenly goes down. Additional metrics like error monitoring with Sentry or custom dashboards with Grafana make a big difference.
In Factorio, you can add extra instrumentation to improve observability. In this case, we can monitor whatâs on the conveyor belt using a Display Panel:
FIG12: Monitoring the uranium count on the conveyor belt
You can set up logic to display messages based on certain conditions. For example, showing âLow uraniumâ when the content on the belt drops below 4.
Software engineers often act like detectives. This investigative skill gets a lot of practice in Factorio. In this example, the cause of the uranium shortage turned out to be a train jam đ. After tracing the issue, there was a train blocking the route, causing the signal to show red âno-go.â I could explain the train system in a separate article, but to simplify, I just manually ran the train to free up the uranium route. Problem solved!
FIG13: The uranium train is stuck because something is blocking the path. Root cause: the rail network canât accommodate bidirectional traffic
Conclusion
Factorio is a game deeply connected to the software engineering profession. From the outside it looks like a typical resource management game, but inside itâs a repeating cycle of problem solving that gives players the freedom to be creative. Thereâs no single correct solution, everything can be measured, monitored, and automated. Itâs an incredibly fun game if problem solving is something you enjoy.
I also created a YouTube series on how to play Factorio from scratch, perfect for beginners who want to get a productivity boost from the game. Enjoy!
