I’ve been playing this game obsessively for months, and yet I haven’t mentioned it on the site or even the podcast. That’s strange. I guess it’s because Factorio has supplanted Minecraft as my “Zen” game. It’s the game I play when I need to relax and think. A lot of the analysis you see on this site is the result of me stepping away from the word processor and zoning out to a low-action game for a few hours.
Factorio is an indie game by the ten-person Wube software. As of this writing it’s still in Early Access on Steam. I don’t often cover Early Access games, but I wanted to talk about Factorio because:
- I’m mildly obsessed with it.
- It reminds me of software engineering.
In Factorio, you begin with your character – a nameless person with no particular story or identity – being dropped into the middle of an alien wilderness. You’ve got a pickaxe, and you can see there are deposits of coal and iron spread around, as well as trees to chop down. At this point you probably assume this is just another survival game. It might even feel like one for the first couple of minutes. But it isn’t. Your character doesn’t need to gather resources to survive and in fact your character is little more than a human-shaped camera / cursor.
Instead of gathering food, your goal is to launch a rocket into space.
After the first five minutes of the game, you’re done gathering resources manually. After that, you’ve got machines to gather the resources and conveyor belts to carry them to a refinery. After a few more steps up the tech tree you’ll have conveyor belts feeding those refined materials into assembly machines to make parts, which will go on to be assembled into a final product. From that point on you’re just adding additional layers of automation onto an increasingly convoluted industrial complex that sprawls across the landscape in every direction.
You’ll need power to keep this enterprise running, which means you’ll need to build thundering coal-fired generatorsEventually you can unlock solar panels, but those come with their own drawbacks. to generate electricity. These generators will belch sooty smoke into the sky, which will agitate the local population of alien beasts. These creatures will rush at your base like a swarm of Zerglings to assault your power plants, and anything else that gets in their way. This means you’ll need to build walls and turrets to keep the riff-raff outThere’s an option to play the game in peaceful mode, where the monsters never attack first..
The challenge in the game comes from solving the engineering challenges presented by your industrial needs and the shape of your environment. Resources spawn in different locations and in varying amounts, and you’ll need to place machines to harvest them, machines to refine them into raw materials, machines to turn those raw materials into parts, and other machines to turn those parts into final products. This will take the form of an ever-growing complex of conveyors, pipes, machines, robots, and power lines. There is no “one correct layout” for a base. Every game will be a little different and every one will require you to adapt to the landscape.
Maybe you’ll use an automated train to carry goods long distances. Or maybe a conveyor belt is the better solution. Or maybe a network of robots to carry stuff around. It all depends on the distances, your power supply, your available resources, and the layout of items relative to each other.
This is a strange game. All the overhead building from an isometric view makes it feel like an industrial-focused version of Sim City. The character has no personality or identity, and after a while he starts to feel like a needless burden, like a version of Sim City where you have to walk a builder around the map in order to make buildings appear. The large-scale nature of the project makes you want to zoom way out and build the thing from a high-level view, but you have to keep zooming in to walk your little guy around obstacles and get him from one side of your base to the other, because you need him to place objects.
It’s not necessarily bad, but it does feel like the game is trying to straddle two very different gameplay styles.
How Factorio is Like Software Engineering
Note that I didn’t say coding. It’s nothing like writing code. Games like Human Resource Machine and TIS-100 cover the moment-to-moment process of writing code. But by their nature they focus on the detail work. Factorio reminds me of the big-picture stuff.
Early in the project it feels a bit like playing The Incredible Machine or Infinifactory. You need to build a machine to accomplish a task. But as the game progresses the complexity quickly escalates. Late in the game, adding onto my base felt a lot like a programmer adding something onto a mature codebase. The challenge isn’t solving the problem, the challenge is solving the problem with all the other solutions in the way.
Maybe you need to make plastic. That takes oil and coal. By this point you already have different facilities producing both at a steady rate. The problem is that those facilities are some distance away from each other, and also far away from where the plastic is needed. There are probably a lot of other things between these points. The naive solution is to simply brute-force your way through: Lay some pipes and conveyor belts down to bring the raw materials to where they’re needed. The problem is that if you always solve problems this way, your base will quickly become an incomprehensible mass of crisscrossing supply lines. “Spaghetti code” is how programmers describe this problem. Later on you’ll need to re-route your flow of oil to make room for something else, only to find those pipes also feed into some other system, which will also need to be re-arranged and re-located. Sooner or later you’ll find yourself in the middle of a vast field of entangled nonsense, wondering where it all went wrong. It’s this exact predicament that leads programmers to want to throw everything out and start over.
In the early game it seems like your job is to build a lot of simple machines, but once all the resources are in play you realize that your real task is managing all the complexity.
In programming, lots of different programming approaches and practices have been invented to manage complexity. The ideal is that you’ll make one piece of code for doing one thing. You’ll shove all of its messy moving parts into a box, hiding them away from other programmers so they don’t have to worry about how the thing works. This is called encapsulation.
Terrible Car Analogy™
I know you’d never forgive me if I didn’t give you a Terrible Car Analogy™, so here it is:
It’s like the engine of your car. You don’t need to worry about firing the spark plugs, managing the air intake, regulating the fuel mixture, or lubricating the engine. All of those things are automated, and all of their fiendishly complex inner workings are hidden away under the hood. Your interface is only as complex as it needs to be: You press the accelerator to get more power from the engine. This means you can use the engine even if you don’t understand how it all works.
In Factorio, once you get a feel for thing you’ll probably start out trying to encapsulate parts of your base. All the systems needed to produce red science things (just go with it) go in one location and all the systems to create green science things go in another. But then you’ll notice that both locations have a lot of related parts. It seems like it would be more efficient to have them share some inner workings. After all, if one area has extra circuit boards and other area has too few, then maybe just running another conveyor to share the excess will result in smoother operation? And maybe it will, at the expense of breaking encapsulation. At the expense of making things just a little harder to understand when you come back to the game tomorrow.
It was actually really satisfying to finally reach the point where I could launch a rocket. And the moment I was done I looked around at what I’d built and thought, “Knowing what I know now, I could build all of this much better.” That’s a pretty common sensation for software engineers.
Here is one example of many: In the game, you have to build an oil refinery…
…to process crude oil. Crude oil is broken into three different liquids, each of which need their own pipes and storage tanks and which emerge in fixed ratios that won’t always match up with your current needs. You’ll also need water. So you need pipes and tanks for crude oil, petroleum gas, light oil, heavy oil, and water. Oh, and eventually you’ll be converting some of this into lubricant, which is another set of tanks and pipes. If you’ve got too much of one byproduct and a shortage of another, you can convert between them. All you need is yet another treatment plant and pipes and tanks and oh my gosh this is madness and I haven’t even run the power lines yet.
I’ve always wondered why real-world chemical plants looked like massive three-dimensional pipe mazes, but after playing Factorio it all makes sense. Halfway through engineering your way through this problem you’ll be wishing you could build in three dimensions.
Work in Progress
Factorio is still evolving. Is it for you? Well, do you find this developer post about how they’re dealing with rounding problems to be interesting? If so, this game is clearly your thing.
If not, then I suggest playing the free demo. (Remember those?) The problem with Factorio is that’s technical and complex. It doesn’t have the immediate appeal of a Sim game or the clarity of a traditional puzzle game. I’m not going to say it’s like Dwarf Fortress, but I will say it seems to have the Dwarf Fortress thing where you have to work at it to get the fun out. The game isn’t for everyone, but if you do like it, it will probably a kind of fun you can’t get anywhere else.
 Eventually you can unlock solar panels, but those come with their own drawbacks.
 There’s an option to play the game in peaceful mode, where the monsters never attack first.
Juvenile and Proud
Yes, this game is loud, crude, childish, and stupid. But it it knows what it wants to be and nails it. And that's admirable.
Starcraft 2: Rush Analysis
I write a program to simulate different strategies in Starcraft 2, to see how they compare.
A programming project where I set out to make a gigantic and complex world from simple data.
Batman: Arkham City
A look back at one of my favorite games. The gameplay was stellar, but the underlying story was clumsy and oddly constructed.
Push the Button!
Scenes from Half-Life 2:Episode 2, showing Gordon Freeman being a jerk.