Jekyll2021-02-08T23:33:05-05:00http://localhost:4000/feed.xmlCalculatorioWhen does UPS matter?2019-01-10T21:00:00-05:002019-01-10T21:00:00-05:00http://localhost:4000/2019/01/10/when-does-ups-matter<p>UPS. The hidden resource in Factorio, or so I am told. Bane of megabases and new players’ games alike.</p>
<p>Wait, what? That makes no sense, but I see it on the forums and reddit on a regular basis. New players, have not even hit blue science yet on their first playthrough, agonizing over UPS because they read somewhere that UPS is a thing and everyone needs to be concerned about it.</p>
<p>What is UPS? For those who have not been introduced, it simply stands for “updates per second.” The game has 60 “ticks” each second, with each tick being one full update of the game state. This means that every second, Factorio updates the position of each inserter, each item on a belt, each train, each spec of pollution, etc. sixty times. That is, unless your UPS goes down.</p>
<p>If your computer cannot complete all of the processing for an individual tick in roughly 1/60th of a second, then you will not have 60 ticks, or updates, per second. There is likely some overhead and between-tick computing that must occur, but conceptually, that is how it works.</p>
<p>When this happens, the entire game slows down. If you have 30 UPS, that means the game simulation is running at half speed. This is different from FPS, or frames per second, which is strictly related to rendering. It is quite possible, and even probable, that if one of the numbers is under 60, the other does not match it exactly. If your GPU is awful but the CPU can keep up, you may have a choppy 30 FPS but the game runs at full speed. If you have a massive factory that stresses the CPU but your GPU can easily handle anything you throw at it, your game may look smooth as butter but run at a slow 30 UPS.</p>
<p>To measure your UPS, press F4 in-game and select the option “show-fps” at the top. This will show both the FPS and UPS in real-time.</p>
<p>That is an explanation of <em>what</em> UPS is. Now I am going to make the controversial stand that UPS largely does not matter.</p>
<p>I see a lot of posts on the <a href="https://forums.factorio.com/">official forums</a> and on <a href="https://www.reddit.com/r/factorio/">reddit</a> about players trying to be forward-thinking regarding UPS. Many of them are setting up fluid processing for the first time on their way to blue science and talking about optimal pipe layout so as not to harm their UPS.</p>
<p><em>Their starter bases will never run into UPS problems</em>. The real damage here is they are limiting their imagination because they read somewhere about how important UPS <em>to megabases</em>. Sure, when you are pushing 5,000 SPM (science per minute) then UPS is an issue. However, only around 0.1% of all Factorio players will <em>ever</em> reach that threshold.</p>
<p>Furthermore, Factorio 0.17 includes many improvements to fluid handling (a major source of UPS pain in large bases) and 0.16 already made massive improvements to belt UPS. I dare say that in 0.17, UPS will have even less of an impact even on smaller megabases. At some point there is simply too much going on for the CPU to do it all in 1/60th of a second, but Wube seems intent on optimizing the game as much as possible to appease the megabase builders. This is a good thing, because it makes this irrelevant topic even more irrelevant.</p>
<p>If you are worried about UPS, do not be. Let your imagination run wild and have fun with the game. If you ever get to the point that UPS matters, you are already planning a megabase and have the experience to know what to do. Until then, free your mind of worries and have fun!</p>UPS. The hidden resource in Factorio, or so I am told. Bane of megabases and new players’ games alike.On the purging of belt balancers2018-11-05T23:30:00-05:002018-11-05T23:30:00-05:00http://localhost:4000/2018/11/05/on-the-purging-of-belt-balancers<p>During the month of October 2018, the admin at the official Factorio wiki removed the belt balancer compendium. This caused quite a bit of panic on the internets, but ended up being one of those issues that looked larger than it really was.</p>
<p>For those who do not know: what is a belt balancer and why do people care about them?</p>
<p>A belt balancer is a group of belt entities - belts, underneathies, and splitters - that evenly distributes its inputs to its outputs. The wiki <a href="https://wiki.factorio.com/Balancer_mechanics">still has a good page on the topic</a> even if the balancer compendium itself was removed.</p>
<p>Great, that page explains what they do. Why should I care?</p>
<p>Until recently, there were three reasons to use them:</p>
<ol>
<li>
<p>They draw evenly from the inputs under lopsided load. For example: think of a train station where you have four cargo wagons, each producing one belt of items. To ensure that the wagons unload fairly evenly, use a belt balancer. Otherwise, you risk having some belts empty while others are backed up. This actually reduces overall throughput.</p>
</li>
<li>
<p>They can change the number of belts in a way that makes them even. For example: perhaps you have a mining outpost with six belts of ore, but they are all 2/3 full. You can use a six-to-four belt balancer to <em>reduce</em> the number of belts in a way that draws from all the inputs evenly. This makes the whole ore patch run out slightly sooner, but avoids the situation where ore is slowly trickling into the train’s buffer chests near the end of its life.</p>
</li>
<li>
<p>They redistribute items under less than full load. Imagine a <a href="https://wiki.factorio.com/Tutorial:Main_bus">main bus design</a>. Love it or hate it, it is a popular factory design. You tap into the bus and pull items to the side to do things with them: make science packs, gears, atomic bombs, whatever you need. Eventually, resources on the bus start to thin out. A balancer cannot make the belts full again, but it can prevent bus taps from receiving zero items as long as there are items to distribute.</p>
</li>
</ol>
<p>The third reason has been superseded by <a href="https://wiki.factorio.com/Version_history/0.16.0#0.16.17">priority splitters in version 0.16.17</a>. Priority splitting also allows one to reduce the number of belts, however, it does not do so evenly. Regardless, that removes one reason to use them.</p>
<p><img src="/assets/belt-taps-compared.png" alt="comparison of belt balancers and priority splitters on a main bus" class="center" /></p>
<p>The reason I do not care that the balancer compendium was removed is because <em>most of those balancers were awful</em>. Easily half of them are useless to begin with. Who needs a one-to-two or two-to-one? That is simply called “a splitter.” How many times have I ever used a two-to-seven or eight-to-three balancer? Exactly never.</p>
<p>Some of them are more useful. In the past, I have found myself reaching for a six-to-four quite often, and occasionally an N-to-(N-1) when I need to shave off a belt or two.</p>
<p>However, the real reason they were awful is even if you have a legitimate need for one, the vast majority of them are <em>throughput limited</em>. Go back and <a href="https://wiki.factorio.com/Balancer_mechanics">reread that first wiki link</a>. A throughput-limited balancer will underperform with uneven load, which happens often enough to matter. Thankfully, there is an easy solution.</p>
<p><strong>Use throughput-unlimited balancers of size 2<sup>N</sup> and simply leave some of the inputs and outputs unused.</strong> I only ever use these three balancers since the priority splitter change made me reevaluate balancers in general:</p>
<ul>
<li>The common four-to-four balancer that is throughput-unlimited, that is, it has splitters on the end.</li>
</ul>
<p><img src="/assets/balancer-4-4.png" alt="four-to-four belt balancer" class="center" /></p>
<ul>
<li>
<p>Any of the common eight-to-eight balancers. Note that most of the blueprints out there are throughput <em>limited</em>. There are three situations for dealing with this.</p>
<ul>
<li>If I absolutely need it to be throughput-unlimited, I duplicate it and feed the first into the second. I actually blueprint down the same blueprint minus the first row of splitters which are redundant in this situation.</li>
</ul>
</li>
</ul>
<p><img src="/assets/balancer-8-8-doubled.png" alt="eight-to-eight belt balancer" class="center" /></p>
<ul>
<li>Loop unused outputs back to the inputs. This usually works for situations where the inputs and outputs are equal in number, e.g. six of each.</li>
</ul>
<p><img src="/assets/balancer-8-8-loopback.png" alt="eight-to-eight belt balancer" class="center" /></p>
<ul>
<li>Do not use all of the inputs and outputs, but spread them out. Ensure that each input splitter is fed by at least one belt, and each output splitter has at least one belt coming from it.</li>
</ul>
<p><img src="/assets/balancer-8-8-spread.png" alt="eight-to-eight belt balancer" class="center" /></p>
<ul>
<li>One of the several sixteen-to-sixteen balancers. Some of them are throughput-unlimited, including most of the fractal designs. Those that are not are close enough. I deal with any shortcomings the same way as with the eight-to-eight above.</li>
</ul>
<p>That is it. I have yet to find a use for anything larger than sixteen-to-sixteen, and anything smaller can be handled quite easily by the previous methods with good results.</p>
<p>Another important point worth mentioning: by the time you reach endgame, balancing is less of an issue because you are building beaconed setups where all the belts are compressed anyway. If there are no gaps in the belts, there is no need to balance most of the time. Limit it to train loading and unloading.</p>
<h3 id="conclusion">Conclusion</h3>
<p>The more I thought about this, the more I realized that the balancers removed from the wiki are mostly garbage. The few worth salvaging exist on <a href="https://www.factorioprints.com/">Factorio Prints</a> already, and they cover any belt balancer use case I can think of. Ever since I rethought my use of belt balancers with the 0.16.17 priority splitter changes, I had already altered my usage enough that I was not using any but three of the balancers anyway.</p>
<p>Meh.</p>During the month of October 2018, the admin at the official Factorio wiki removed the belt balancer compendium. This caused quite a bit of panic on the internets, but ended up being one of those issues that looked larger than it really was.