QualityPrototype extended

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3999
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

QualityPrototype extended

Post by boskid »

I am currently working on adding more values to the QualityPrototype to allow slightly more flexible bonus definitions.

This is the current QualityPrototype: https://lua-api.factorio.com/latest/pro ... otype.html

This is my "work in progress" state of QualityPrototype (not yet scheduled for release, may be missing proper description):
06-18-2025, 09-38-38.png
06-18-2025, 09-38-38.png (176.12 KiB) Viewed 908 times
06-18-2025, 09-39-14.png
06-18-2025, 09-39-14.png (93.54 KiB) Viewed 908 times
06-18-2025, 09-39-31.png
06-18-2025, 09-39-31.png (89.13 KiB) Viewed 908 times
Question
Question to modders working with quality: what other modifiers would you like to also have available? (modifiers are: bonuses for additivie, multipliers for multiplicative)
StephenB
Burner Inserter
Burner Inserter
Posts: 12
Joined: Fri Jul 19, 2024 10:12 am
Contact:

Re: QualityPrototype extended

Post by StephenB »

This looks great! I would like one of these two:

* `QualityPrototype.crafting_machine_power_usage_multiplier`
* `CraftingMachinePrototype.scale_energy_usage_with_quality` (boolean that makes crafting machine's power consumption scale in the same way as `QualityPrototype.crafting_machine_speed_multiplier`)

Example use cases:

* The mod Battery Powered https://mods.factorio.com/mod/battery-powered has a battery charger machine (type = "furnace") which turns an uncharged battery into a charged battery holding 5MJ. This recipe takes 10 seconds, and the machine consumes 500kW, so it consumes 5MJ to put 5MJ into the battery, which makes sense. But if you get a quality battery charger, now the crafting speed is higher, while the power consumption is still 500kW. So now you can get 5MJ in a battery using 500kW for less than 10 seconds, so you can get free infinite energy by charging and discharging batteries in a loop.
* My overhaul mod Legendary Space Age uses the same battery chargers, so I'm making a new prototype for each quality level, with the power consumption scaled, and then swapping buildings with the correct prototype in on_build events. I'm doing this for 8 different crafting machines - battery chargers, furnaces (which can produce char by burning any carbon-based fuel), gasifiers, and boilers (which I'm changing to use type = "assembling-machine" instead of type = "boiler"). I also have variants of these for planets with oxygen in the atmosphere, so this works out to around 44 extra prototypes that I need to prevent infinite free energy exploits.
MrSmoothieHuman
Fast Inserter
Fast Inserter
Posts: 111
Joined: Sat Aug 05, 2023 1:20 am
Contact:

Re: QualityPrototype extended

Post by MrSmoothieHuman »

reading over this i cant think of any values that I’d be dying to have, i think its been covered pretty well tbh - some values i know i’d like to have specifically are fuel_acceleration/fuel_top_speed multipliers?

(im not sure if with this change, prototype-specific quality modifiers still exist or they have all been moved into the quality prototype, so under the presumption they arent):
i would like to make the case to have these be prototype-specific, and not ‘generalised’ to the quality prototype if that’d be possible? I’d love to use my proposed values for my own mods and being able to make the acceleration-heavy fuel gain a higher acceleration multiplier, compared to a top-speed heavy fuel gaining a top-speed multiplier.

if i can think of any more ‘missing’ values, i’ll be sure to edit this message though :]
Last edited by MrSmoothieHuman on Wed Jun 18, 2025 8:13 am, edited 1 time in total.
coder? i hardly know her!
MrSmoothieHuman
Fast Inserter
Fast Inserter
Posts: 111
Joined: Sat Aug 05, 2023 1:20 am
Contact:

Re: QualityPrototype extended

Post by MrSmoothieHuman »

(moved this into a different message due to the difference in request)

i know this isnt a bonus or multiplier, but being able to turn off quality on a prototype completely would be a massive help - as due to some runtime scripting stuff, getting quality on some of my mods buildings actually makes them worse :lol:
coder? i hardly know her!
cackling.fiend
Inserter
Inserter
Posts: 22
Joined: Tue Jul 26, 2022 1:53 pm
Contact:

Re: QualityPrototype extended

Post by cackling.fiend »

  • Vehicle accelleration (one could argue that fuel bonus should be enough)
  • Agricultural tower radius bonus (with a flag on the AgriculturalTowerPrototype)
  • heating_energy would be cool to scale with quality (pun intended)
Personally I would've found it way better to only have a multiplyer on the `QualityPrototype` and instead use a table `quality_multipliers` on Prototypes that maps properties to multipliers for each entity separately. Each multiplier is then multiplied with the one from the `QualityPrototype` and with the base value of the corresponding property. But I get that that kind of flexibility is not happening.
Moterius
Inserter
Inserter
Posts: 21
Joined: Wed Jun 07, 2023 7:39 am
Contact:

Re: QualityPrototype extended

Post by Moterius »

Long story short? Ideally, manual access to everything in every prototype, or runtime-replacement for entities will simply stay a necessity. It is what I am doing for the quality rockets, but the problem with that is that it doesn't show up in the factoriopedia since it's not the same entity.

(Though, admittedly, that is much more a complaint about how I can't change what factoriopedia says than about how quality doesn't support changing this super-specific value that only exists in this prototype used once in the game)


More to the point, (since I am assuming quality boni are calculated during startup), I'd like to request all numerical values to be "number or expression" similar to the NoiseExpressions used for autoplace specifications with 'Level' as input. This would likely entirely remove the need for runtime-replaced entities unless it is a currently in quality unsupported value one wishes to affect. Totally didnt forget how quality works, there.

As for values I'd like to see:
- animation scaling / rocket raising speed
- module inventory size bonus (in double * level rounded down to int)
- module multipliers (energy cost included)
Last edited by Moterius on Wed Jun 18, 2025 12:43 pm, edited 1 time in total.
Bilka
Factorio Staff
Factorio Staff
Posts: 3398
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: QualityPrototype extended

Post by Bilka »

I request a property on qualityprototype for AsteroidCollectorPrototype::getCollectionRadius. Extra content for description: Performance warning: the navigation has to pre-calculate ranges for the highest tier collector possible, so you should keep this collection radius within reasonable values.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
Bilka
Factorio Staff
Factorio Staff
Posts: 3398
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: QualityPrototype extended

Post by Bilka »

I also add to your todo list to please use $optional($text("Value of `default_multiplier`")) as the documentation for properties that simply use the value of another, like the multipliers, thank you.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3999
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: QualityPrototype extended

Post by boskid »

StephenB wrote: Wed Jun 18, 2025 8:08 am * `QualityPrototype.crafting_machine_power_usage_multiplier`
* `CraftingMachinePrototype.scale_energy_usage_with_quality` (boolean that makes crafting machine's power consumption scale in the same way as `QualityPrototype.crafting_machine_speed_multiplier`)
Added QualityPrototype::crafting_machine_energy_usage_multiplier (defaults to "1" because that feels like a negative effect and quality usually is supposed to make stuff better).

Added CraftingMachinePrototype::quality_affects_energy_usage bool (defaults to false, has to be set to true for QualityPrototype::crafting_machine_energy_usage_multiplier to take effect).
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3999
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: QualityPrototype extended

Post by boskid »

MrSmoothieHuman wrote: Wed Jun 18, 2025 8:09 am reading over this i cant think of any values that I’d be dying to have, i think its been covered pretty well tbh - some values i know i’d like to have specifically are fuel_acceleration/fuel_top_speed multipliers?
I do not want to be doing this because there exists ItemPrototype::fuel_acceleration_multiplier_quality_bonus and fuel_top_speed_multiplier_quality_bonus, so that would be a values conflict.
MrSmoothieHuman wrote: Wed Jun 18, 2025 8:09 am i would like to make the case to have these be prototype-specific, and not ‘generalised’ to the quality prototype if that’d be possible?
A decision was that we do not want this level of precision in specifying quality effects. Reason is that this would make mod compatibility a lot more annoying (if one mod creates an entity and other creates a quality, who would be responsible of adding misssing values to the entity prototype?). This would also make defining every single entity more annoying. Quality was supposed to be a generic system where you do not need to go into each and every value to be specified. That was decided to be too much complexity.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3999
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: QualityPrototype extended

Post by boskid »

MrSmoothieHuman wrote: Wed Jun 18, 2025 8:13 am i know this isnt a bonus or multiplier, but being able to turn off quality on a prototype completely would be a massive help - as due to some runtime scripting stuff, getting quality on some of my mods buildings actually makes them worse :lol:
I am afraid i do not want to be doing that. Imagine having an ammo turret and a magazine. Would you expect the ammo to get quality buff to be disabled because of ammo opting out of quality, or because of turret opting out of quality? If a turret opts out of quality but ammo does not, why would turret deal extra damage based on quality of the ammo? This request is not well defined.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3999
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: QualityPrototype extended

Post by boskid »

cackling.fiend wrote: Wed Jun 18, 2025 8:27 am [*]Vehicle accelleration (one could argue that fuel bonus should be enough)
For now i have to reject this because vehicle is quite generic base type, there are locomotives, there are cars and there is spider vehicle, each one of them works differently and i cannot provide a value that works for some but not all of them.
cackling.fiend wrote: Wed Jun 18, 2025 8:27 am [*]Agricultural tower radius bonus (with a flag on the AgriculturalTowerPrototype)
For now i also have to reject this, thats is hard to explain without going into implementation details. Basically right now an agricultural tower prototype holds some precomputed values based on the tower radius: a vector of grow spot offsets. For radius to be affected by quality, the prototype would need to store multiple vectors of spot offsets, one for each quality. It is doable but it is a little bit more complex. First i want to focus on exposing values that are already affected by quality but are missing an entry point to adjust the modifier.
TsumikiMiniwa
Burner Inserter
Burner Inserter
Posts: 5
Joined: Sun Aug 09, 2020 12:15 am
Contact:

Re: QualityPrototype extended

Post by TsumikiMiniwa »

QualityPrototype.crafting_machine_extra_module_slots

Also possibly CraftingMachinePrototype.quality_affects_module_slots (this has some precedent; see CargoWagonPrototype.quality_affects_inventory_size and LabPrototype.uses_quality_drain_modifier)

Reason: QualityEffects is a mod that exists, and breaks nearly instantly with any intermod compatibility.

I made QualityEffectsFixed because I thought it was just the one intermod compat that broke, then more intermod compat broke and I simply gave up. (did try to make it easier for future maintainers though)

I believe there's also a QualityEffectsFixed 2 and QualityEffectsFixed With Furnace (that makes it apply to furnaces) out there too.

QualityEffectsFixed has nearly 1k downloads.

Outside of QEF, Cerys also uses the same trick for the Fulgoran Crushers.
curiosity
Filter Inserter
Filter Inserter
Posts: 663
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: QualityPrototype extended

Post by curiosity »

Ideally, each quality version of the affected prototypes should be adjustable separately. The above idea of supporting expressions would be a good start.
boskid wrote: Wed Jun 18, 2025 7:46 am range_multiplier
Range of what? Artillery turret? Regular turret? Radar? Rail support? Agricultural tower? Lightning attractor? Capsule? Ammo? Attack?
boskid wrote: Wed Jun 18, 2025 9:53 am I am afraid i do not want to be doing that. Imagine having an ammo turret and a magazine. Would you expect the ammo to get quality buff to be disabled because of ammo opting out of quality, or because of turret opting out of quality? If a turret opts out of quality but ammo does not, why would turret deal extra damage based on quality of the ammo? This request is not well defined.
So, what you are saying is that a turret can't use ammo of quality different from its own? Because otherwise it seems clear to me that it would work likewise.
Galdoc
Inserter
Inserter
Posts: 49
Joined: Wed May 11, 2016 9:43 pm
Contact:

Re: QualityPrototype extended

Post by Galdoc »

For Mining Drills (in particular, thematically non "mining" collectors, like the flower harvesting drone things from pY), a multiplier for mining_search_radius. :)
MrSmoothieHuman
Fast Inserter
Fast Inserter
Posts: 111
Joined: Sat Aug 05, 2023 1:20 am
Contact:

Re: QualityPrototype extended

Post by MrSmoothieHuman »

I do not want to be doing this because there exists ItemPrototype::fuel_acceleration_multiplier_quality_bonus and fuel_top_speed_multiplier_quality_bonus, so that would be a values conflict.
that seems to be already what i want, so no worries then - i must have just missed it :]
i've realised that i was actually wanting a fuel value quality multiplier/bonus (presumably multiplier, to fit in with the others) - my apologies, i got it the wrong way around
coder? i hardly know her!
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3999
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: QualityPrototype extended

Post by boskid »

Bilka wrote: Wed Jun 18, 2025 9:38 am I request a property on qualityprototype for AsteroidCollectorPrototype::getCollectionRadius. Extra content for description: Performance warning: the navigation has to pre-calculate ranges for the highest tier collector possible, so you should keep this collection radius within reasonable values.
Added QualityPrototype::asteroid_collector_collection_radius_bonus.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3999
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: QualityPrototype extended

Post by boskid »

TsumikiMiniwa wrote: Wed Jun 18, 2025 10:18 am Also possibly CraftingMachinePrototype.quality_affects_module_slots (this has some precedent; see CargoWagonPrototype.quality_affects_inventory_size and LabPrototype.uses_quality_drain_modifier)
This looks like an interesting use case, i will take a look at this. So far i see some risks related to upgrade planner having certain amount of slots based on the configured target entity so it may involve code cleanup to make it possible.
Galdoc wrote: Wed Jun 18, 2025 10:44 am For Mining Drills (in particular, thematically non "mining" collectors, like the flower harvesting drone things from pY), a multiplier for mining_search_radius. :)
Hm... this shares some limitation similar to agricultural tower, will have to take a look at radius visualization to render range larger than prototype.
thesixthroc
Fast Inserter
Fast Inserter
Posts: 105
Joined: Wed Apr 29, 2020 9:53 pm
Contact:

Re: QualityPrototype extended

Post by thesixthroc »

I appreciate that most of these entries are not capped at 1, because that would break the already working property for the Inverted Quality mod.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3999
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: QualityPrototype extended

Post by boskid »

thesixthroc wrote: Wed Jun 18, 2025 11:28 am I appreciate that most of these entries are not capped at 1, because that would break the already working property for the Inverted Quality mod.
How is that? So far a QualityPrototype::level is uint32, which means a default_multiplier = `1 + 0.3 * level` was never able to go below value of 1: even if i would keep the limits for multipliers to be >= 1, it would still not be able to break anything because all the values are carefully set to keep backward compatibility. By allowing values to go down to 0.01 i am effectiely extending what is possible.
Post Reply

Return to “Modding interface requests”