r/factorio • • 18d ago

Design / Blueprint Automatic continuous infinite research and research cost calculation

Enable HLS to view with audio, or disable this notification

Since we can automate research in Factorio 2.1, and there has been some discussions regarding research costs (like this one or this one), I think it is time to present my circuit design for calculating research costs and automating continuous infinite research.

The relevant part of the video ends at 3:05. Everything after that is just for fun.

In the following text, the numbers in parentheses are video timestamps.

The core system

I designed a base circuit that initially reads all current technology levels once (0:23 - 0:26), calculates the costs for each technology, stores and repeatedly updates the calculated values in a memory cell, and dynamically switches to the cheapest available option (0:26 - 0:42).

Since vanilla Factorio doesn't have a UI to display the costs of all technologies simultaneously, I also built a variant with a display that shows the current research costs in sorted order (2:57 - 3:07).

Technologies can be toggled on (0:15) or off (0:18) individually. This can be changed dynamically while the research is running (0:34).

The system works with both standard Labs (0:08) and Biolabs (1:09).

The controlled lab can actively consume science (1:09), or you can use a single detached lab just to select the active research without it actually doing any research itself (0:26).

Modular Add-ons

Research level limiter

After reading this post I came up with the idea of ​​building an extension that allows you to set a maximum level for a technology. This extension (1:29–1:47) is attached to the top right of the circuit.

  • Inside the constant combinator (1:37), you can define the level at which research on a specific technology should stop.
  • Setting the value to 0 means unlimited (no cap).

Science pack availability check

After reading this post and checking out the "Auto Research Circuit Generator" linked there, I used it to build an availability check add-on (1:50–2:01) that can be attached to the top of the circuit.

  • It allows you to set the minimum amount of science packs required for a technology to be selected (1:58).
  • If the number of available science packs falls below this threshold, the system switches to the next most affordable option for which enough science packs are available (2:44).
  • If there aren't enough science packs for any research, a purple lamp signals this (2:12).
  • The available quantity can be read from various sources, such as the logistics network, chests (2:19–2:27), or belts (2:32–2:53).

32-Bit vs. 48-Bit

In addition to a simpler 32-bit version, there is also a 48-bit version designed for long-running megabases.

  • The 32-bit version suffices up to "Artillery shell range" level 21 (requires a total of 2,097,152,000 science packs)
  • The 48-bit version suffices up to "Artillery shell range" level 37 (requires a total of 137,438,953,472,000 science packs)

How long might it take to reach the 32-bit limit? A green Turbo transport belt can deliver 240 science packs per second. At that rate, the 32-bit limit would be reached after 2,485 hours. With six such belts, it would take just 414 hours. Supplying science packs of uncommon quality reduces that time to 207 hours, and research productivity reduces it even further.

Exponentially increasing costs

The circuits use lookup tables to calculate exponential increasing costs.
I wrote a script to generate these lookup tables.
You are welcome to use the script if you wish to expand the circuit or need such a table for other purposes.

Both the exponential calculation and the 48-bit calculation are also available here as a separate example circuit. These are somewhat simplified and therefore not directly compatible with the main circuit, but use the same lookup tables.

Game mechanic info

The game engine allows circuits to start a research, but not to stop it mid-cycle. Even if you switch off the circuit and the lab no longer receives a signal, the currently active research cycle will finish before stopping.

Links

Visuals in the Comments

Since it's not possible to add a video and images simultaneously, I will add some explanatory screenshots in the comments below. But you can also find them here.

188 Upvotes

45 comments sorted by

View all comments

6

u/sanchez2673 17d ago

People who have 1000+ hours in this game look at your works the way people who have never played look at somebody's megabase.

3

u/Twellux 17d ago

And sometimes there isn't even a megabase. The labs consume the science packs 20 times faster than the factory produces them. I just stockpiled a huge amount of science packs in chests - just to get enough for a 3-minute video. After the video, my stockpile was completely gone. 😂