{"id":34466,"date":"2016-11-01T06:00:06","date_gmt":"2016-11-01T10:00:06","guid":{"rendered":"http:\/\/www.shamusyoung.com\/twentysidedtale\/?p=34466"},"modified":"2016-11-01T03:05:51","modified_gmt":"2016-11-01T07:05:51","slug":"factorio","status":"publish","type":"post","link":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=34466","title":{"rendered":"Factorio"},"content":{"rendered":"<p>I&#8217;ve been playing this game obsessively for months, and yet I haven&#8217;t mentioned it on the site or even <a href=\"?cat=287\">the podcast<\/a>. That&#8217;s strange. I guess it&#8217;s because Factorio has supplanted Minecraft as my &#8220;Zen&#8221; game. It&#8217;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. <\/p>\n<p>Factorio is an indie game by the <a href=\"https:\/\/www.factorio.com\/team\">ten-person Wube software<\/a>. As of this writing it&#8217;s still in Early Access on Steam. I don&#8217;t often cover Early Access games, but I wanted to talk about Factorio because:<\/p>\n<ol>\n<li>I&#8217;m mildly obsessed with it.\n<li>It reminds me of software engineering.\n<\/ol>\n<p>In Factorio, you begin with your character &#8211; a nameless person with no particular story or identity &#8211; being dropped into the middle of an alien wilderness. You&#8217;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&#8217;t. Your character doesn&#8217;t need to gather resources to survive and in fact your character is little more than a human-shaped camera \/ cursor. <\/p>\n<p>Instead of gathering food, your goal is to launch a rocket into space.<\/p>\n<p>After the first five minutes of the game, you&#8217;re done gathering resources manually. After that, you&#8217;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&#8217;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&#8217;re just adding additional layers of automation onto an increasingly convoluted industrial complex that sprawls across the landscape in every direction.<\/p>\n<p>You&#8217;ll need power to keep this enterprise running, which means you&#8217;ll need to build thundering coal-fired generators<span class='snote' title='1'>Eventually you can unlock solar panels, but those come with their own drawbacks.<\/span> 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 <a href=\"http:\/\/starcraft.wikia.com\/wiki\/Zergling\">Zerglings<\/a> to assault your power plants, and anything else that gets in their way. This means you&#8217;ll need to build walls and turrets to keep the riff-raff out<span class='snote' title='2'>There&#8217;s an option to play the game in peaceful mode, where the monsters never attack first.<\/span>. <\/p>\n<p><!--more--><\/p>\n<h3>Emergent Puzzles<\/h3>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/factorio5.jpg' width=100% alt='The little dark circles are part of my swarm of logistics robots that carry items around. They&apos;re good for transporting rare items, or things that are produced slowly. It beats adding another conveyor to the spaghetti network.' title='The little dark circles are part of my swarm of logistics robots that carry items around. They&apos;re good for transporting rare items, or things that are produced slowly. It beats adding another conveyor to the spaghetti network.'\/><\/div><div class='mouseover-alt'>The little dark circles are part of my swarm of logistics robots that carry items around. They&apos;re good for transporting rare items, or things that are produced slowly. It beats adding another conveyor to the spaghetti network.<\/div><\/p>\n<p>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&#8217;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 &#8220;one correct layout&#8221; for a base. Every game will be a little different and every one will require you to adapt to the landscape. <\/p>\n<p>Maybe you&#8217;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.<\/p>\n<p>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. <\/p>\n<p>It&#8217;s not necessarily bad, but it does feel like the game is trying to straddle two very different gameplay styles.<\/p>\n<h3>How Factorio is Like Software Engineering<\/h3>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/factorio2.jpg' width=100% alt='This entire area is one part of the system to create blue science bottles. Raw copper is used to make copper wire, which is used in making green circuit boards, which are one ingredient in making red circuit boards, which are one of four ingredients of blue science.' title='This entire area is one part of the system to create blue science bottles. Raw copper is used to make copper wire, which is used in making green circuit boards, which are one ingredient in making red circuit boards, which are one of four ingredients of blue science.'\/><\/div><div class='mouseover-alt'>This entire area is one part of the system to create blue science bottles. Raw copper is used to make copper wire, which is used in making green circuit boards, which are one ingredient in making red circuit boards, which are one of four ingredients of blue science.<\/div><\/p>\n<p>Note that I didn&#8217;t say <strong>coding<\/strong>. It&#8217;s nothing like writing code. Games like <a href=\"https:\/\/www.youtube.com\/watch?v=428R_oEjGGI\">Human Resource Machine<\/a> and <a href=\"https:\/\/www.youtube.com\/watch?v=HSg1qT2aNnw\">TIS-100<\/a> 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. <\/p>\n<p>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&#8217;t solving the problem, the challenge is solving the problem with all the other solutions in the way.<\/p>\n<p>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&#8217;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. &#8220;Spaghetti code&#8221; is how programmers describe this problem. Later on you&#8217;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&#8217;ll find yourself in the middle of a vast field of entangled nonsense, wondering where it all went wrong. It&#8217;s this exact predicament that leads programmers to want to <a href=\"http:\/\/www.joelonsoftware.com\/articles\/fog0000000069.html\">throw everything out and start over<\/a>.<\/p>\n<p>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. <\/p>\n<p>In programming, lots of different programming approaches and practices have been invented to manage complexity. The ideal is that you&#8217;ll make one piece of code for doing one thing. You&#8217;ll shove all of its messy moving parts into a box, hiding them away from other programmers so they don&#8217;t have to worry about how the thing works. This is called <em>encapsulation<\/em>. <\/p>\n<h3>Terrible Car Analogy&trade;<\/h3>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/factorio3.jpg' width=100% alt='Here is the end of the game. You might think this is a spoiler, but after a couple of hours with the game you&apos;ll realize the image of the rocket taking off isn&apos;t a spoiler, it&apos;s the images of everything ELSE that might spoil you. And those aren&apos;t spoilers until you know enough to understand them.' title='Here is the end of the game. You might think this is a spoiler, but after a couple of hours with the game you&apos;ll realize the image of the rocket taking off isn&apos;t a spoiler, it&apos;s the images of everything ELSE that might spoil you. And those aren&apos;t spoilers until you know enough to understand them.'\/><\/div><div class='mouseover-alt'>Here is the end of the game. You might think this is a spoiler, but after a couple of hours with the game you'll realize the image of the rocket taking off isn't a spoiler, it's the images of everything ELSE that might spoil you. And those aren't spoilers until you know enough to understand them.<\/div><\/p>\n<p>I know you&#8217;d never forgive me if I didn&#8217;t give you a Terrible Car Analogy&trade;, so here it is: <\/p>\n<p>It&#8217;s like the engine of your car. You don&#8217;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&#8217;t understand how it all works. <\/p>\n<p>In Factorio, once you get a feel for thing you&#8217;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&#8217;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.<\/p>\n<p>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&#8217;d built and thought, &#8220;Knowing what I know now, I could build all of this much better.&#8221; That&#8217;s a pretty common sensation for software engineers.<\/p>\n<h3>Oil<\/h3>\n<p><div class='imagefull'><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/factorio1.jpg' width=100% alt='The pipes need to carry crude oil, heavy oil, light oil, petroleum, lubricant, and water. They all need to go different places for different purposes, and they can&apos;t mix.' title='The pipes need to carry crude oil, heavy oil, light oil, petroleum, lubricant, and water. They all need to go different places for different purposes, and they can&apos;t mix.'\/><\/div><div class='mouseover-alt'>The pipes need to carry crude oil, heavy oil, light oil, petroleum, lubricant, and water. They all need to go different places for different purposes, and they can&apos;t mix.<\/div><\/p>\n<p>Here is one example of many: In the game, you have to build an oil refinery&#8230;<\/p>\n<div class=\"dmnotes\">As an aside, I hope you&#8217;re not squeamish about pollution. In Factorio you clear-cut the forest, dig up the coal and burn it, suck up the oil and burn that too, and pave over whatever might be left. Once you&#8217;re done with that, you&#8217;ll need to go out and massacre some indigenous wildlife. In this game you&#8217;re basically a supervillain for Captain Planet. Personally, I kind of like it. Anyway&#8230;<\/div>\n<p>&#8230;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&#8217;t always match up with your current needs. You&#8217;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&#8217;ll be converting some of this into lubricant, which is another set of tanks and pipes. If you&#8217;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 <em>oh my gosh this is madness and I haven&#8217;t even run the power lines yet<\/em>. <\/p>\n<p>I&#8217;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&#8217;ll be wishing you could build in three dimensions.<\/p>\n<h3>Work in Progress<\/h3>\n<p><table class='nomargin' cellspacing='0' width='100%' cellpadding='0' align='center' border='0'><tr><td><iframe loading=\"lazy\" width=\"1024\" height=\"576\" src=\"https:\/\/www.youtube.com\/embed\/DR01YdFtWFI\" frameborder=\"0\" allowfullscreen class=\"embed\"><\/iframe><br\/><small><a href='http:\/\/www.youtube.com\/watch?v=DR01YdFtWFI'>Link (YouTube)<\/a><\/small><\/td><\/tr><\/table><\/p>\n<p>Factorio is still evolving. Is it for you? Well, do you find <a href=\"http:\/\/steamcommunity.com\/games\/427520\/announcements\/detail\/781765761842695341\">this developer post<\/a> about how they&#8217;re dealing with rounding problems to be interesting? If so, this game is clearly your thing.<\/p>\n<p>If not, then I suggest playing the <a href=\"https:\/\/www.factorio.com\/\">free demo<\/a>. (Remember those?) The problem with Factorio is that&#8217;s technical and complex. It doesn&#8217;t have the immediate appeal of a Sim game or the clarity of a traditional puzzle game. I&#8217;m not going to say it&#8217;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&#8217;t for everyone, but if you do like it, it will probably a kind of fun you can&#8217;t get anywhere else.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been playing this game obsessively for months, and yet I haven&#8217;t mentioned it on the site or even the podcast. That&#8217;s strange. I guess it&#8217;s because Factorio has supplanted Minecraft as my &#8220;Zen&#8221; game. It&#8217;s the game I play when I need to relax and think. A lot of the analysis you see on [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[],"class_list":["post-34466","post","type-post","status-publish","format-standard","hentry","category-reviews"],"_links":{"self":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/34466","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=34466"}],"version-history":[{"count":0,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/34466\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=34466"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=34466"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=34466"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}