Resource Deficit Management System

This board is to show, discuss and archive useful combinator- and logic-creations.
Smart triggering, counters and sensors, useful circuitry, switching as an art :), computers.
Please provide if possible always a blueprint of your creation.
antecureuil
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue Feb 11, 2025 3:41 pm
Contact:

Resource Deficit Management System

Post by antecureuil »

I just wanted to share my findings and see if anyone is interested to discuss in more detail.

The problem statement

Consumption of final products during gameplay consists of defence, science, and expansion needs. Priority of those needs varies depending on the situation. Typical game cycles alternate emergencies, where one has urgent consumption needs and calm periods, when consumption is low. These ups and downs in consumption needs happen for defence, science, and expansion at different times. This means reserves should be created.

But in what sequence reserves should be restocked after usage? What if reserves are insufficient during an emergency? I.e in the case of a deficit, is the actual production sequence aligned with real priority? That proves to be typically hard to achieve.

Typical ways to manage production sequence are:
- Physically limit stockpile space to force production of an item to stop when filled up.
- Physically limit availability of ingredients to assemblers.
--- Hard-wire priority of ingredients distribution into mechanics: splitters, belts, inserters.
--- Manually temporarily tweak the ingredients distribution mechanics in urgent cases: cut the belt, turn the inserter, etc.
- Optimise the physical number of assemblers for each product and ensure ingredients are always available in sufficient quantities.
- Some situational circuit networks are used, which is usually not scalable as an approach with the size and complexity of the factory.

The problem is that
- The typical approach does not allow for differentiation of importance between urgent needs and reserves creation. I.e. assuming defence is generally more important, creating long-term reserves of ammo would be prioritised by the belts and chests over the urgent need for extra minig drills for a new outpost in case of a deficit.
- Prioritisation to manage deficit is inflexible: adjusting distribution mechanics of ingredients is tedious and prone to errors. Increasingly so the bigger the factory. Worse than that, the logistic network practically lacks prioritisation features.
- Completely avoiding deficit by always having excess production capacity is both suboptimal and requires meticulous advance planning skills.
--- When relied upon, the cost of being too late is high, because expansion of capacity is an expansion project itself that may be starved before it begins.

The solution

Idea
- Create a comprehensive, scalable, transparent, and simple circuit network control system for production management.
- Be inspired by market forces that drive production decisions in the real world and optimise resource allocations. We will use priority instead of market price.
- Do it in the vanilla game (no mods required, although some quality-of-life features are allowed).

In detail
- Let’s assign every item a priority level. Let’s make production decisions upon a priority differential of an item compared to the priority of its ingredients, the highest of them. One simple way to assign a priority is to do it based on stock (reserves). If an item is low on stock relative to the target, the priority is higher; if abundantly above target - lower.
- Supply and demand will automatically balance: when the priority goes up, some consumers stop (their relative priority goes negative), and some producers are started (their relative priority becomes positive). The opposite happens when the price goes down.
- The ingredients flow to consumers that sustain higher priorities.
- By defining target amounts of items, players can dynamically set goals that will propagate by affecting priorities. Increasing the target amount of a product (with unchanged reserve amount) immediately increases the priority. When the reserve target is fulfilled - the priority goes down, allowing less urgent consumers to resume working.
- Since the proposed approach is to directly control production machines, the only requirements for logistics are:
--- enough throughput to deliver from reserves to all consumers
--- enough throughput to deliver from all producers to reserves
- The above means the roboport logistics network is compatible!

Implementation
- Dedicated circuit network to compute expected relative priority for each recipe based on inputs of reserve amounts from the factory and target amounts from the player.
- Reserve storages for all ingredients and products embedded in delivery routes: logistic network, chests, belts, and tanks.
- Communication to deliver reserve amount readings to the input wire of the priorities computer.
- Communication to connect the relative priority output wire to production machines.
- Production machines should be configured to produce when a priority signal on their recipe is > 0.

Implementation Hints
- Reserve storages are ideally placed in between the exit from producing machines and the first consumer. Belt -> Insterters -> chests -> Inserters -> belt. With logistic network integration, a chest can be upgraded to a Passive Provider.
- In case of multiple production sites for the same item, it’s worthwhile adding redistribution channels. For instance, a requester chest -> Inserter -> belt right after storage. Enable it only when the storage is empty.
- The size of reserves for ingredients should be sufficient so that they sustain consumption at full speed for a minute with zero production. It will ensure moderate price volatility and the absence of feedback loops and oscillations.
- If a whole factory block is aimed at producing a single item, it can be configured to turn on/off based on priority differential of its aggregated recipe.

List of blueprints:
- Priority differential computer. Input wires: targets signal, storages signal, an orphan assembler machine. Output wire: priority differential, the orphan assembler machine. The computer is hard-wired to know recipes of everything except assembler. It needs to be connected to a real assembler machine to read recipe ingredients for it.
- Radar-based multichannel transmitter. Input wire: signal, config: channel number.
- Radar-based multichannel receiver. Output wire: signal, config: channel number.
- Bonus: assembler production block that produced top 3 priority items by requesting ingredients from logistics network.

Let me know if anyone is interested - I will prepare and upload blueprints.
Amarula
Filter Inserter
Filter Inserter
Posts: 590
Joined: Fri Apr 27, 2018 1:29 pm
Contact:

Re: Resource Deficit Management System

Post by Amarula »

Yes now that we have the radar network it is much more feasible to implement a base wide system.
I am not so much interested in the blueprints - at least not yet ;) but I would be interested to see a bit of an example such as balancing say iron between red science, ammo for defences, and inserters for expansion, and how you envision the priorities being set and changed from science, to defence, to expansion.
My own personal Factorio super-power - running out of power.
antecureuil
Burner Inserter
Burner Inserter
Posts: 6
Joined: Tue Feb 11, 2025 3:41 pm
Contact:

Re: Resource Deficit Management System

Post by antecureuil »

I already did and tested it. It works really well.

I have set all priorities except science to be linear function of available amount. At target priority = 100. 3 x above target priority = 0. At zero priority = 300.
And for science I have set priority to be = 100 if amount is below target, otherwise 0.

This produces the following sequence:
- first target amount levels for all items are built up, growing proportionately to each other. Like 10% everything, 50% everything, etc.. until 100%.
- when 100% target is exceeded, science priority becomes bigger and and science starts to be produced.
- if there are still some extra capacity, reserve amounts will start building up, until they reach 3x of target

I do not manage basic resource extraction, because when not used they will fill up and stop themselves.

The above works really well. In stable state, if I need something, I use reserves above 100% of target without interrupting science production.
If there is an urgent and sizable need, like an attack that have significantly reduces ammo storage, science will give way to items with priority above 100.

The only thing I adjust over gameplay is actually target amounts of items. Everything else happens automatically.
Post Reply

Return to “Combinator Creations”