Moddable scaling of module effects

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
half a cat
Burner Inserter
Burner Inserter
Posts: 13
Joined: Sun Jul 16, 2023 4:03 pm
Contact:

Moddable scaling of module effects

Post by half a cat »

TL;DR
Allow mods to define how module effects scale (instead of simply adding up all effects).
What ?
Provide the following modding interface for defining effect scaling curves and associating them to recipes.

An effect scaling curve is a one-input, one-output, side-effect-free function defined by a mod. Its meaning is that it transforms a raw module effect (e.g., 120% efficiency) into an effective module effect (e.g., you will actually get 76% efficiency). Mods would define effect scaling curves as prototypes.

Each recipe has an optional effect scaling curve for each of the moddable effects: speed, efficiency, productivity, pollution.

When the game engine calculates module effects, it first sums the input effects as usual, then applies the effect scaling curve, then applies the game engine's hard limits.

A variation on the idea, to give modders more flexibility, is to pass different bonus types (global bonuses, module effects, quality bonuses) as separate inputs to the effect scaling curve.
Why ?
Productivity bonuses and the extension's new quality modules motivated this suggestion.

Mods contend with productivity bonuses in different ways because of how productivity interacts with recipe design. When mods provide reverse recipes (like water-to-steam and steam-to-water) or alternative recipes with different numbers of steps (like plain smelting vs. pyroflux smelting), productivity benefits can stack, dramatically altering the benefit of switching between alternative recipes or allowing resources to be made from nothing.

There are a few tools for mods to control productivity now. Mods can disable productivity in individual recipes. Mods can customize the module/slot/beacon system to limit the achievable productivity. My favorite mod, Nullius, uses all these features to afford meaningful but not game-breaking productivity benefits.

A few scaling systems are desirable but not attainable in the current system, and would be attainable with scaling curves:

Productivity as resource-efficiency
When recipes represent some underlying conserved resource (like the steel content in barrels that can be recycled back to steel), it's useful to treat productivity as approaching 100% resource-efficiency. To model this, the scaling curve would asymptotically approach a maximum value, like f(x) = 1 - exp(-x), which approaches 100% as x increases.

Diminishing returns
A mod could introduce diminishing returns to encourage more balanced use of modules or to encourage building more powerful modules. For example, speed could use a scaling curve of f(x) = {sqrt(x+1)-1 if x > 0; x otherwise}, which yields diminishing benefits as more speed effects are stacked.

Retrofitting quality without rebalancing a mod
A mod could introduce a scaling curve with diminshing returns to support the new quality-boosted modules without breaking the existing game balance.

Koub
Global Moderator
Global Moderator
Posts: 7215
Joined: Fri May 30, 2014 8:54 am
Contact:

Re: Moddable scaling of module effects

Post by Koub »

[Koub] Moved to modding interface requests
Koub - Please consider English is not my native language.

Post Reply

Return to “Modding interface requests”