r/technicalfactorio • u/double_checker • Jan 25 '22
r/technicalfactorio • u/Erichteia • Aug 02 '25
UPS Optimization The UPS optimal transportation method for every distance
Method:
Each method was scaled to ensure 960 items are transported per tick. This translates to
1-8-1 trains: 480 parallel rails, train completes a cycle every 16000 ticks.
1-4-1 trains: 480 parallel rails, train completes a cycle every 8000 ticks.
Chests, cargo wagons and bots: 480 parallel lines. The inserters work constantly
Belts: 720 parallel lines, inserters work constantly.
Legendary quality is used where useful. Bot speed is set to level 25 (around the max level that can be reached in a reasonable amount of time). Inserters were not controlled, since all inserters always work at max speed. Each transportation method is only tested in ranges where they can reasonably be used. 1-4-1 trains are not used for 5000 tile gaps because they are too slow to keep up.
Note that this is the best-case scenario for trains: no other trains, no complex pathing, no signals...
The results were gathered using the BELT
framework. Every test is repeated 5 times, only the best of 5 is kept (because UPS drops are usually caused by other, irrelevant processes). However, UPS deviations between runs were minimal. All set-ups without trains were run for 3600 ticks (1 minute). Set-ups with trains were run for 36000 ticks, since they are more discrete. All trains tests start when the train just arrived at the station.
Main results:
Chest chains and cargo wagon chains are very performant for short-distance logistics up to 25 tiles (4 cargo wagons). Always use cargo wagon chains if possible. Using additional inserters to avoid belt interactions is worth it for short range transportation.
Belts are always best for long-range logistics. Even in a best-case scenario, trains are worse for UPS.
As expected, bots are horrible for UPS. However, their cost can be reduced a bit by ensuring there is enough roboport coverage on the path between source and target. The UPS drop for the shortest distance is significant and caused because bots had to rerout away from their normal path to charge, since there isn't enough space for a roboport in a 7-tile gap (remember 4 of 7 tiles are covered by logistic chests and inserters)
Raw data
If you want to investigate the raw data or the saves used for testing, you can find all saves and data on my Google Drive https://drive.google.com/file/d/11TdlHiEoUkJvP2c-VW6MrZdC_UTneM9P/view?usp=drive_link
edit: repost because Reddit didn't show the image correctly
r/technicalfactorio • u/[deleted] • Aug 31 '20
More vector graphics, now with less flicker.
r/technicalfactorio • u/locally_simplicial • 12d ago
A LaTeX package that draws belt balancers from blueprint strings, and checks whether they balance
I've been writing notes about belt balancers and got tired of pasting screenshots into them, so I wrote **beltmap**, a LuaLaTeX package that draws belt layouts. You give it a blueprint string and it draws the belts, splitters, and undergrounds as a diagram.
What it reads:
- blueprint strings and blueprint books, from 1.1 and 2.0 (direction numbering, splitter priorities, filters with quality);
- Factorio-SAT output;
- a layout typed as text, like `> S> >`, for a quick sketch in a document.
What it does with them:
- **Balance check.** `mix=bands` stripes every belt by how much of each input it carries. The shares are exact fractions, and the verdict under each picture, computed from the amounts each output carries, says whether the layout balances, and if not, which output gets too much of which input. The colors and stripes only illustrate it: from 5 inputs up, an unbalanced mix can blend to exactly the same gray.
- **Throughput check.** It tries every choice of open inputs and outputs and looks for a bottleneck (a max-flow test). This can prove a layout is limited, but passing it doesn't prove the layout is throughput unlimited, because splitters don't route along a max flow.
- **Splitter graph.** `view=graph` redraws the layout as a network of splitters.
- **Blueprints back out.** Every picture gives you the blueprint string of what it drew, and can attach it to the PDF. I tested 53 strings in Factorio 2.1.24: the game imported them, built them, and read every entity back, and its exports read back the same.
- **Animations.** A script exports PNG, SVG, or a GIF of the flow, which is where most of these pictures came from.
Limits: LuaLaTeX only (the glyphs alone work with any engine). Only belts, undergrounds, and splitters are drawn; anything else in a blueprint is skipped. Side-loading onto undergrounds is handled like side-loading onto a belt, which I haven't checked against the game.
It's on CTAN as of this week, so it should show up in TeX Live and MiKTeX soon. The manual has every picture above and the keys that make them.
- CTAN: https://ctan.org/pkg/beltmap
- GitHub (bugs and requests welcome): https://github.com/landonfox00/beltmap
Right now I'm trying to get the splitter graphs to render more nicely and maybe add game icons. Any and all feedback is very appreciated!
r/technicalfactorio • u/uelisproof • Jan 15 '24
Belt Balancers VeriFactory: Automatically verifying belt balancers for various properties
r/technicalfactorio • u/Satisfactoro • Sep 13 '25
Question Why do these two identical setups behave differently?
This simple question requires a technical answer (technical answers only please).
Why do these two identical setups behave differently?
Bus Input = 4 green belts
Side output = 4 blue belts = 4x 0.75 green belts = 3.0 green belts
Bus output (right) = 1 green belt or slightly more (1.1875 in this screenshot)
The system has reached equilibrium (10+ minutes stable).
Blueprint: https://factoriobin.com/post/8pbvfs
Steps to reproduce: remove and replace a chest on the left.
r/technicalfactorio • u/CanaDavid1 • Oct 31 '22
My 20 IPS (instructions per second) pipelined MIPS CPU. 90% finished.
r/technicalfactorio • u/Gegellibu • Sep 12 '26
Reverse engineered and manipulating Factorios RNG entirely ingame
r/technicalfactorio • u/Stevetrov • Jan 01 '21
500 SPM Cell, Ore delivered by rails belts and bots used internally. (BP & save in comments)
r/technicalfactorio • u/Stevetrov • Oct 04 '20
Trains Building a 9 Tile Ribbon Megabase - Train Management
r/technicalfactorio • u/Stevetrov • Sep 21 '21
Trains Cursed 12 Beacon Train Smelter (built in editor, no mods) But HOW??
r/technicalfactorio • u/Erichteia • Aug 02 '25
Gaps between items have no noticeable UPS effect on belts
TLDR
The idea of belts needing to be 'compressed' for UPS optimality is a long standing myth remaining from long ago. It does not matter whether there are gaps between items on belts or not. There is no measurable UPS cost
Methods
Each experiment contains 720 belts that are each 200 tiles long. Each belt transports 15 items/s.
No gap transports these items on a yellow belt
RedGap transports them on a red belt (50% full)
BlueGap transports them on a blue belt (33% full)
GreenGap transports them on a green belt (25% full)
Results
Having gaps on the belt does not lead to a UPS drop. In fact, the opposite happens. This is probably because there are less entities on the belt at the same time. In either case, the differences are marginal
However, this does not necessarily mean that belt compression never matters. Green belts allow you to use 4x less belts, and thus 4x less transport line cost and it is cheaper for inserters to put items on a green belt. It only means that it is absolutely no problem to have gaps on belts where max throughput is not needed.
You can find the raw results, save files used in the test etc in the link below.
https://drive.google.com/file/d/1Jv2kI8FEMEiKyAqGb5-SRF7ZhQ7r4_xZ/view?usp=drive_link
r/technicalfactorio • u/flame_Sla • Oct 20 '21
The impact of nuclear power plants on UPS
1. Benchmark map and benchmark results
For the benchmark, I made a test map with a 363GW nuclear power plant. The map is based on mulark's test-17
This power is enough for 40k spm. There are only: nuclear reactors, turbines, heat pipes and boilers on the map. The energy consumer is electric-energy-interface.
You can download the map and make a benchmark here factoriobox
Benchmark results:
| v 0.18.47 | 17.379 ms | 57.54 UPS | factoriobox |
|---|---|---|---|
| v 1.0.0 | 18.014 ms | 55.51 UPS | factoriobox |
| v 1.1.42 | 17.834 ms | 56.07 UPS | factoriobox |
The benchmark shows that nuclear power plants have not received improvements in the new versions.
UPS drops are due to the fact that the file was created in version 0.18 and UPS drops during migration. This UPS drop should be neglected.
2. Why do nuclear power plants spend a lot of UPS? Who is to blame?
We'll find out who's to blame :-)
2.1. Open the file in Factorio, press "F5" and see:

Entity update = 14.928ms ( the mysterious "Entity update". About him further. )
Heat manager = 3.011ms ( heat pipes + probably reactors and boilers )
Electric network = 1.147 ms ( turbines ) It is impossible to estimate the impact of turbines on your base, since there will be other electricity consumers
Fluid manager = 0.020ms ( can be neglected )
2.2. The mysterious "Entity update"
Press "F4", tick "show-entity-time-usage" and you will see:

class Generator = 8.332 ms ( turbines )
class Boiler = 4.432 ms ( boilers )
The rest can be ignored.
Total:
Turbines = 9.479 ms
Boilers = 4.432 ms
Heat manager = 3.011 ms
The game is forced to make a calculation for each turbine and boiler. Since there are a lot of turbines and boilers, then there are high losses for UPS.
3. When to use nuclear power plants?
Suppose that with increasing power, FPS drops linearly, then:
| 100% = 16.67ms | |||
|---|---|---|---|
| 360GW | 40k spm | 17.834 ms | 106.90% |
| 180GW | 20k spm | 8.917 ms | 53.50% |
| 90GW | 10k spm | 4.459 ms | 26.75% |
| 45GW | 5k spm | 2.230 ms | 13.38% |
IMHO for bases larger than 10k spm it is better not to use nuclear power plants.
If the base is less than 10k spm and the UPS is less than 60, you need to assess the impact of nuclear power plants and find who is to blame. How to do this is described in section 2.
r/technicalfactorio • u/sankang2004 • May 29 '20
The Mandelbrot set in Factorio
r/technicalfactorio • u/Dymiaz • Jul 01 '26
Combinator Golf Craft Everything Machine with a single decider combinator (9000 conditions, 2000 outputs)
r/technicalfactorio • u/MadGenderScientist • Feb 08 '26
Combinator Golf Topological sort
Topological sort is just a fancy word for sorting ingredients to come before products in a list. It's a useful building block for computing schedules for automalls and such.
An easy algorithm for computing topological sort uses Depth-First Search (DFS), something like:
results = []
def visit(x):
for each child c of x:
if c not in results:
visit(c)
results += [x]
visit(root)This is a recursive algorithm, so we need a stack. Fortunately, since there are no cycles in the dependency graph, an item can't appear twice in the stack. Therefore we can use a multi-item memory cell to represent the stack, where the highest valued item is the top of the stack. We'll use the same strategy for the result list, using the item's value to represent its position in the list.
So, my implementation works like so:
1 On demand change: clear both the stack and result list, and start the clock.
2. Read the top of stack, check if an item is a "vitamin" (don't attempt to explore), and make recipe substitutions if necessary (I use this for solder in pY.)
3. Set recipe and read ingredients.
4. (a.) Pick any ingredient not already in the result list. We'll push this item to the stack, to explore it next. (b.) If no such ingredient exists, all dependencies have been explored. Add this item to the result list.
5. Stack pushes, pops, and additions to the result list are clocked to give time for signals to propagate.
6. Once the DFS stack is empty, we're done! The result list gives us a crafting order to follow.
Hope this is useful to someone! :D
r/technicalfactorio • u/[deleted] • Nov 01 '21
Belt Balancers are these balancers different in any way, and if so, why?
r/technicalfactorio • u/Kano96 • Mar 31 '20
Trains Circuitless single lane train compression
r/technicalfactorio • u/burner-miner • Mar 28 '26
Combinator Golf 64-bit multiplication and unsigned 32-bit division
TL;DR: Since I have not found 64-bit multiplication (signed or unsigned) or unsigned division/remainder circuits online, I thought I might share.
BP Book: https://factoriobin.com/post/n95djb
A little bit of background: I'm building a Risc-V computer, since I have done custom CPUs before and wanted to try implementing a real Instruction Set Architecture (ISA). That one guy from CCC also gave me the push to finally start doing it.
I also want to include the M extension, which includes some multiplication instructions:
mul,divandrem: these to the same thing the*,/and%operators do in Factorio: multiply, divide and get remainder or signed 32-bit integers.mulh,mulhsuandmulhu: these get the high 32 bits of a multiplication result, and they treat the operands as signed x signed, signed x unsigned and unsigned x unsigned, respectively.divuandremu: these divide and get remainder or 32-bit unsigned integers.
Multiplication
Multiplications of 2 N-bit numbers produces 1 2N-bit number, but Factorio cannot represent 64-bits in a signal, so it discards the high 32 bits.
That behavior is exactly what we want for the mul instruction, the low bits of a signed multiplication.
For the other instructions, we need to use long multiplication. For example, treating groups of 16 bits as "digits":
We want to do: 0x1234 5678 * 0x8765 4321 = 0x09A0 CD05 70B8 8D78
Operands:
A = 0x1234 5678
B = 0x8765 4321
"Digits":
AL = 0x5678
AH = 0x1234
BL = 0x4321
BH = 0x8765
Operation:
AHAL
* BHBL
----------
AL*BL
AH*BL 0
BH*AL 0
+ AH*BH 0 0
-----------
Result
Actual calculation:
0x5678 * 0x4321 = 0x16AC8D78
0x1234 * 0x4321 = 0x04C5F4B4
0x5678 * 0x8765 = 0x2DBB6558
0x1234 * 0x8765 = 0x09A09A84
Final sum:
09A0 9A84
2DBB 6558
04C5 F4B4
+ 16AC 8D78
-------------------
09A0 CD05 70B8 8D78
We can turn 32-bit integers into 16-bit ones with either bit-masking (A & 0xFFFF = AL) or bit shifting (A >> 16 = AH).
With some bit-masking we can keep those high 16-bits unsigned, so Factorio actually treats them as unsigned, or we can leave them to get signed multiplication. This is shown in the second image on the left, note that S1H and U1H only differ in that the former starts with FFFF.
Division
The main idea for unsigned division is to split the dividend into two parts: the sign bit and the rest, which is easily done with 2 bit masks. The same applies to unsigned remainder.
From there, there are some off by one errors and different special values depending on which operand is negative.
Division by 0 and signed overflow (-2.1G / -1) are implemented as Risc-V defines here.
How to use
These instructions are part of the OP opcode, which has two more fields to define the instruction used: F3 and F7. For these operations, F7 must be 1 (encoded in the 7-signal). F3 (encoded in the 3-signal) switches between the operations mul through remu with values 0-7.
The operands are in the 1-signal and 2-signal. The four signals are in the CCs in the top of the first image.
NOTE: I make heavy use of the Nixie Tubes mod to display unsigned hexadecimal numbers as the operands and results, and Text Plates to label components, but they are not needed for the computation and thus optional.
Performance
mul, div and rem take only 2 ticks, as they are built in.
mulh[s[u]] take 5 ticks.
divu takes 4 ticks.
remu takes 7 ticks.
Maybe this inspires some golfers to minimize these circuits or shorten the delay?
r/technicalfactorio • u/Stevetrov • Jul 24 '21
So I Built another Monolithic Megabase, this time its 20K SPM from scratch, benchmarked at 62 UPS.
r/technicalfactorio • u/Erichteia • Aug 02 '25
Follow-up: compressing belts with inserters may even be worse than just using more belts
Follow-up to this post:
https://www.reddit.com/r/technicalfactorio/comments/1mfqiwy/the_ups_optimal_transportation_method_for_every/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
Plenty of people asked me whether it was really fair to compare belts that were only 1/3th full to cargo wagon chains and trains. There were 2 leading arguments:
The belt has gaps, gaps were believed to be bad for UPS.
You are using more belts than necessary
The former is an ancient myth, that I disproved in another post: https://www.reddit.com/r/technicalfactorio/comments/1mfue8y/gaps_between_items_have_no_noticeable_ups_effect/?utm_source=share&utm_medium=web3x&utm_name=web3xcss&utm_term=1&utm_content=share_button
The latter is a fair criticism. So I tested it as well.
TLDR
The additional cost of compressing a belt seems to outweigh the benefit of using less belts, unless you use absurdly long belts. So surprisingly, if you need to compress belts with inserters, it is better to just not bother.
Method
The methodology is the same as in the earlier experiment. So I'll refer to the other post for brevity. I compared the following set-ups:
Belt: 720 belts each loaded and unloaded by a single inserter.
Compressed belt: 240 compressed belts loaded and unloaded with 4 inserters (2 at each side).
Only longer distances are considered, since compressing the belt would take about as much place as the travel distance on short distances. And the benefit of compressing the belt first would only matter on long distances.
Results
Although the transport line cost of compressed belts rises slower than the cost for normal belts, this benefit does not outweigh the cost of compressing the belt in the first place. Belts need to be extremely long before the cost outweighs the benefit.
For more detailed results of the compressed belts, see https://drive.google.com/file/d/1lP_zgWS_pS23OOPg8DfK93KQTk1Q_SPH/view?usp=drive_link
r/technicalfactorio • u/FlyingToasters86 • Sep 26 '26
Game of Life
I'm sorry if this is the 1000th Game of Life post in this subreddit but I have recently got into really trying to improve my fundamental combinator skills and I'm quite proud to have worked this problem out. My next project is to create the 'Snake' game in Factorio.
I'd be happy to post my BP book somewhere if anyone is interested. I'd really appreciate feedback.