Technology Price Multiplier

by Jobus

Precisely tweak technology costs with decimal multipliers (0.5x, 1.2x, etc.), offering fine-tuned control beyond the vanilla game's integer-only setting. Also includes advanced options for infinite tech and tier-based cost scaling.

Tweaks
2 days ago
2.0
2.05K
Cheats

i [✅Implemented] Research tree depth scaling

2 months ago

Hey, I was looking at this to use for my next playthrough. I've been wanting to try a 1000x science cost run, but combining it with the ability to reduce the exponential growth on infinite techs, so it doesn't get way too out of hand. This mod fits that perfectly!

However, I'd like to request an option to scale the tech cost additionally, based on the depth in the tech tree. In other words, when playing with 1000x multiplier it would be nice if it could start out with 1x and slowly ramp up to 1000x nearing the end of the tech tree. Since it's not that fun starting out with your first couple of techs costing 50k red science :D

There's something like this: https://mods.factorio.com/mod/lesspainfulstart
but it doesn't really do what I want, in that it just disables the scaling on certain things, which wouldn't work with other mods that change early game anyway.

2 months ago
(updated 2 months ago)

That's a neat idea.

Regarding how to decide the "depth" of a technology, should I count all prerequisite science pack-based technologies, or only the essential ones? (Essential as in the ones you see when you toggle "Show only essential technologies" in the top-right of the research panel.)

Going with the "essential" way would effectively make the scaling tier-based by what science pack they require.

For example, with a 5x scaling factor:
- All technologies that only require Automation (Red) Science Pack scale 1x.
- All technologies that also require Logistic (Green) Science Pack scale 5x.
- All technologies that also require Chemical (Blue) Science Pack or Military (Grey) Science Pack scale 25x.
And so on.

Alternatively, if we count all prerequisites instead of just the essential ones, it would look more like:

With a 1.5x scaling factor:
- Advanced Circuit scales 7.6x (1.5^5), because it follows a chain of 5 research prerequisites.
- Chemical (Blue) science pack scales 11.4x (1.5^6), because it comes right after so it has a chain of 6 prerequisites.
- However, Military (Grey) science pack scales 2.2x (1.5^2), because it only has a chain of 2 research prerequisites.

So even though Chemical and Military science packs are within the same tier of research (both being a step after Logistic (green) science pack), their prices will differ drastically, whereas with the "Essential depth" method, they would both be 5x.

So while this way would scale more gradually, instead of big tier-based jumps, it might create some unexpectedly uneven prices as I demonstrated above.

I personally feel the Essential-based method is the neater and more predictable solution, but perhaps you would disagree? I'm not interested in playing this way myself, so I'll let you "1000x" maniac decide. :P

2 months ago

Seems like a good way, though how does it handle mods that add more researches and/or science packs, or perhaps changes progression order?

I think it should work fairly well by reading the depth of the research by counting prerequisites, to sorta get a "distance from top to bottom" formula. Knowing the value of the longest chain in advance would mean you'd know how much to scale it.

For example, knowing the longest chain to be 100 (or just counting from the final vanilla science depth as a baseline max?), you'd look at a tech that's 10 depth, then you know the scale at that point is 10/100 so 10% of the scaling applied. I hope that makes sense :)

Of course you probably have a better idea than me.

2 months ago

Perhaps there's a possibility to just add a depth scaling setting? So I could for example say 1000x multiplier, but scale from 1x until depth setting? So anything thats added by a mod or something that builds on previous tech will just cap at 100 still. Mods that add tech that doesnt have prerequisites, will scale from 1x until it hits max.

2 months ago
(updated 2 months ago)

Perhaps there's a possibility to just add a depth scaling setting? So I could for example say 1000x multiplier, but scale from 1x until depth setting? So anything thats added by a mod or something that builds on previous tech will just cap at 100 still. Mods that add tech that doesnt have prerequisites, will scale from 1x until it hits max.

Honestly no idea if that makes sense, but in my head it does lol.

Edit: didn't mean to post separate, just somehow didnt click edit button.

2 months ago
(updated 2 months ago)

All mods should be compatible with this solution. The "essential" thing is a flag in the API that modders can use too, so a mod that adds new science packs should also flag those science pack technologies as essential. So even with the essential-based method, it would be dynamically counted, and work even if a modder replaced all the vanilla science packs—assuming they at least flagged some of their new replacement technologies as 'essential'.

I think it should work fairly well by reading the depth of the research by counting prerequisites, to sorta get a "distance from top to bottom" formula. Knowing the value of the longest chain in advance would mean you'd know how much to scale it.

Sure, that would work too, and would make the configuration easier since you can go "technologies should gradually become more expensive up to exactly 1000x at the final one" and let the in-between prices be calculated under the hood. However, it comes with a caveat:
- If the user ever installed a mod that adds a new final technology, then suddenly every single technology before it would get cheaper. And vice versa if you removed a final technology.

I don't like that kind of unintended wide-sweeping adjustment when we can simply avoid it by using a growth factor instead. Going the "essential" way makes it easier to intuit the price growth, like "Okay, for every new tier of science packs, I want the following technologies to be multiplied by another 5x", instead of having all prices hinge on the single, potentially variable cost of the final technology.

2 months ago
(updated 2 months ago)
  • If the user ever installed a mod that adds a new final technology, then suddenly every single technology before it would get cheaper. And vice versa if you removed a final technology.

If you instead were to have an option to specify the maximum depth to cap out at, it should theoretically not matter? Unless of course you add a new mod that adds intermediate techs where you've already researched or something. I get what you mean by not being that great, but usually you'd not change mods mid game, but of course I also see the point in making sure it just works.

"Okay, for every new tier of science packs, I want the following technologies to be multiplied by another 5x"

This sounds like what I was just thinking about. So if it's like what I'm thinking it scales based on how many science packs that is required for the tech. So something that just takes red science, would be 1x, red + green = 5x, red + green + blue = 10x, and so on. You could have any combination of modded packs and it would just sum them together and apply the scaling. You got red + orange + rainbow? thats 3 so 15x. and so on. Is that correct?

The caveat here though is what to do about multiple mods adding science packs. Should it cap at x amount of packs, for example 12 science packs (equivalent to vanilla+dlc) or some other way? What I'm worried about is some mod pack that adds some pre-steam tech with 10 new packs (example), then by the time you hit the vanilla red science, you're already on the 11th pack. That's likely overestimating by a lot, but it's worth a thought.

Edit: or you'd just scale costs based only on the vanilla+dlc science packs, so any additional ones would just keep it at the same multiplier. I think that might work just fine.

2 months ago
(updated 2 months ago)

This sounds like what I was just thinking about. So if it's like what I'm thinking it scales based on how many science packs that is required for the tech. So something that just takes red science, would be 1x, red + green = 5x, red + green + blue = 10x, and so on. You could have any combination of modded packs and it would just sum them together and apply the scaling. You got red + orange + rainbow? thats 3 so 15x. and so on. Is that correct?

Yes, that's pretty much in line with my thinking, except I was thinking of making it exponential. And we wouldn't increase the price if the technology requires 3 different same-tier science like Electromagnetic + Agricultural + Metallurgic.

Let's say we do 4x per tier:
[Tier 0] Red: 1x
[Tier 1] Red + Green: 4x
[Tier 2] Red + Green + Blue: 16x
[Tier 2] Red + Green + Blue + Military: 16x (Blue and Military is same tier)
[Tier 3] Red + Green + Blue + White: 64x
[Tier 3] Red + Green + Blue + Purple: 64x
[Tier 3] Red + Green + Blue + White + Purple: 64x (White and Purple is same tier)
[Tier 4] Red + Green + Blue + White + Gleba/Agricultural: 256x

This way, the technology Planet discovery Aquilo which requires 9 different science packs would still be counted as a "Tier 4", and thus be: 256x

So all the research on Fulgora, Gleba, and Vulcanus, would all be 256x. While the Aquilo technologies would be 1024x.

2 months ago

That sounds good. Would it just ignore modded planets science packs in that case and just calculate based on how many vanilla packs is required in those researches? So if something required Red + Green + Modded it would just count Red + Green?

2 months ago

No, it would count Red + Green + Modded, unless the author forgot to flag his modded science pack as Essential.

2 months ago

See, I'm not hardcoding anything. You could replace every single item and technology in the whole game, and this solution would still work, as long as the Essential flag is used correctly by the other mod authors.

2 months ago

Gotcha, sounds like this might be the way to go! It'll be fun trying out for my next playthrough.

BTW have you considered how the infinite techs scale? I'd assume they will be scaled based on both the amount of packs required for the base value, and then scaled based on the exponential growth setting as well like usual.

2 months ago

Gotcha, sounds like this might be the way to go! It'll be fun trying out for my next playthrough.

Alright! I'll most likely have it out within 24 hours.

BTW have you considered how the infinite techs scale? I'd assume they will be scaled based on both the amount of packs required for the base value, and then scaled based on the exponential growth setting as well like usual.

Yep, that's correct. It will all work together.

2 months ago

Fantastic :)

2 months ago

Update is ready.

If you find any issues regarding the tier scaling, please report it in this thread.

Enjoy your crazy 1000x playthrough!

2 months ago

So it seems to not work properly I think? Using a combination of 1000x cost, 0.5x infinite, and 2x tier scaling factor, some tech gets scaled, but things like "Automation" still costs 10k science no matter what I set the tier scaling factor to. At at quick glance, it might be anything that only requires 1 science pack that's incorrectly scaled.

2 months ago

Yes, that is intended. You wanted the initial researches to be 1x, right?

If we look at the table I wrote yesterday:

Let's say we do 4x per tier:
[Tier 0] Red: 1x
[Tier 1] Red + Green: 4x
[Tier 2] Red + Green + Blue: 16x
[Tier 2] Red + Green + Blue + Military: 16x (Blue and Military is same tier)
[Tier 3] Red + Green + Blue + White: 64x
[Tier 3] Red + Green + Blue + Purple: 64x
[Tier 3] Red + Green + Blue + White + Purple: 64x (White and Purple is same tier)
[Tier 4] Red + Green + Blue + White + Gleba/Agricultural: 256x

See the Tier 0 (Red pack only) is 1x.

2 months ago

So the technologies that have the Green Science Pack as requisite should be 2x on top of the base 1000x for you.

2 months ago

For tier 0 it should be costing the original 1x value of 50 science, not 50k though. Unless I'm misunderstanding something here, that's incorrect.

2 months ago

The 50k instead of 50 is because of the 1000x base cost you put. It has nothing to do with the tier scaling.

What you are getting with those settings is:

Original Cost * 1000 * 2^Tier. Let's say Original Cost = 50:
[Tier 0] Red: 50 * 1000 * 2^0 = 50,000
[Tier 1] Red + Green: 50 * 1000 * 2^1 = 100,000
[Tier 2] Red + Green + Blue: 50 * 1000 * 2^2 = 200,000
[Tier 3] Red + Green + Blue + White: 50 * 1000 * 2^3 = 400,000

If you want Tier 0 to start at the vanilla prices, and scale up exponentially so that the Aquilo technologies cost 1024x, then use:

1x Price Factor, 0.5x Infinite, 4x Tier Scaling Factor

Or if you want only the final research to be 1000x instead of all Aquilo stuff, use Tier Scaling Factor of 3.162. Aquilo tech would then be ~316x.

2 months ago

Ahhh, so it's adding the 1000x as a base, and then additionally scaling by tier on top of that. I see now!

Does this look right to you? With a tier scaling factor of 2x I am unsure whether or not it's counting this as 8x or 16x multiplier due to the nuclear science pack (added from (https://mods.factorio.com/mod/atan-nuclear-science)

https://i.imgur.com/f0WIqwe.png

Just wanna be sure it's working as intended :)

2 months ago

That is considered Tier 3 (8x), and the reason for that is that the Nuclear Science Pack technology is unlocked by crafting a Uranium-235 instead of doing Science Lab research. I implemented the tier system in such a way that it only counts Science Lab-based essentials—not item-based unlocks. You can see why I opted for that if you toggle the "Show only essential technologies" in the technology tree window—there are sometimes 2 or 3 essential steps to unlock a new Science Pack, so the prices would get crazy if I included those.

2 months ago

Ahh ok that makes sense :) Well I'll be messing around with this some more when I prep for my next playthrough, which will include a bunch of planet mods, so we'll see how it's gonna scale haha. I'll let you know if I come across some issues.

Thank you so much for the help :)

2 months ago

Alright, cool!

You're very welcome. Have fun! =)

2 months ago

While setting up mods, I came across this one crazy research cost haha :D
I wonder what the calculations are for this! It's a post Prometheum research. This is using 4x price tier scaling factor.

https://i.imgur.com/VOMhOlR.png

Other than this one, most sciences seem to hit around the 10-50million mark, with a few occasional ones going past 100-200 million.

2 months ago

Oh noo, it seems my game freezes on load now after installing a few extra mods like Lignumis and Muluna.

The factorio log ends with this mod and then crashes.

https://puu.sh/Ky3eG/fbb0a3080c.log

I'm not sure where it goes wrong. Possible with muluna, since it reworks the early game to start on that planet?

2 months ago

Oh no!

Annoying that the log doesn't contain any error, just ends with the normal "Loading mod".

It just hard crashes without any error?

2 months ago

I am able to reproduce the problem by installing Muluna. Trying to figure out what's wrong.

2 months ago

Okay, I pushed an update that should fix the issue.

Muluna seems to (probably accidentally) do circular prerequisites for one of the technologies, which put my code into an infinite loop.

I assumed circular prerequisites would be impossible, but I guess not. So I added protection against it.

Also, that image with the "1.6G" science packs, lmao that's insane!

2 months ago
(updated 2 months ago)

Great, thanks it now loads :)

I was wondering how this interacts with Castra's own research? In the mod description it is stated that the enemies on this planet can also research their own tech tree, including infinite tech. I'm wondering if this includes the price cost multipliers for them as well, and may inadvertently nerf or break the intended mechanics?
https://mods.factorio.com/mod/castra

Edit: Also adding these extra mods have further increased the science cost from 1.6G to 419G LOL
https://i.imgur.com/OrAtmv3.png
So this happens because planet Rubia has the default science cost set to 100k, (which used to be 1million before a recent patch lol.)

I may need to either reduce the scaling a bit, or request a way to cap the scaling :D It really starts breaking once you add Muluna and the reworked early game science packs quickly accelerates the scaling.

2 months ago

Sweet!

Peeking at Castra's source code for a minute, it looks like their research time will not scale with my multiplier, but I'm not certain.


Regarding the edit:

Lol, yeah you got too many mods, man. :D

I'll cook something up for you, hang tight.

2 months ago
(updated 2 months ago)

That's good! I wouldn't want Castra to become broken by having their "evolution" scale massively increased by cost multipliers. But who knows, I've yet to try it out :)

Yeah I think it all comes down to Muluna's early science? I'm fine with having 1G's at endgame since most of these mods add some form of increased productivity, so it adds up balance wise, but 100G+ is way overkill lol. Maybe you could add an option to specifically ignore Muluna's sciences, so that it will scale as if red science is still the first science pack or something?

Edit: Sorry I keep getting Muluna and Lignumis confused. Lignumis is the one that changes starting planet, so I think that's the one needing some scaling bypass.

2 months ago
(updated 2 months ago)

I'd rather not add any other-mod-specific options. My plan is to add a curve adjustment option of the tier-based scaling, so that you can make the scaling be 4x in the beginning, but taper off with higher tiers.

So for example, with a 4x tier-based scaling, instead of:
- Tier 1 having a (4^1) 4x multiplier
- Tier 3 having a (4^3) 64x multiplier
- Tier 8 having a (4^8) 65536x multiplier

We add a 0.9 curve adjustment:
- Tier 1 having a (4^1^0.9) 4x multiplier (same as before)
- Tier 3 having a (4^3^0.9) 42x multiplier (2/3 as much as before)
- Tier 8 having a (4^8^0.9) 8170x multiplier (1/8 as much as before)

So you see the lower tiers aren't affected too much from the curve adjustment, while the higher tiers are drastically adjusted.

Of course you can use something like 0.95 or so if my example here is too big of a change.

2 months ago

That'll work nicely! Maybe also a setting to set a hard limit? Say I use the above scaling, but also can cap it to a max of 1000x.

2 months ago

Update with the curve adjustment is up!

I'm being a bit finicky now, but I don't really like the idea of adding a flat cap like that. I'd rather motivate users to play with the existing settings (including the new curve adjustment) to get a nice growth curve instead.

2 months ago

In your case, I recommend you stay with the 4x scaling factor, and then try lowering the scaling curve in small steps (like start with 0.95), until those super expensive technologies hit a price that you are happy with.

2 months ago
(updated 2 months ago)

That's fine :) Problem is that it can be a bit hard to figure out which technologies are out of hand, since they aren't sorted completely by cost in the research list. So it's a case of clicking around until you spot some oddities. Maybe you could add some debugging log that spits out the full list of tech costs in a vanilla+modified form with the applied cost multiplier, for easier testing?

And thank you again for the awesome help :)

2 months ago

Oh, sure, that's annoying.

How about I add a command that prints the top 5 most expensive technologies? Would that be enough? Cause the API doesn't have access to the original values after the loading screen. I guess I could cache the values before modifying them and then re-use that, but I figure just seeing the price of the most expensive ones might be enough?

2 months ago

Yeah that's fine!

2 months ago

Okay, update again and try /top-expensive-techs in the console while in-game.

2 months ago

Thank you! Using this I discovered a research even more costly haha :D
https://i.imgur.com/HnScLNk.png

With a curve of 0.9 we get this:
https://i.imgur.com/13NCkaB.png

Gonna be messing around with the values now till I get something that feels good!

2 months ago

Haha, holy crap!

And you're welcome! =)

a month ago
(updated a month ago)

Small progress update on my new playthrough with the scaling costs, I am currently working on unlocking rocket fuel tech! Sitting at a measly 22k science research cost (300 in vanilla), so it'll be done in about 2-3 more hours :D Gotta scale up further to speed it up a little.

I am really enjoying it so far! Very happy with the implementation!

a month ago

Love to hear you're happy with it!

I'm curious what your endgame bases will look like. :P

a month ago

It's gonna take a while before I get there haha.

a month ago
(updated a month ago)

Couple weeks later with a new update!
And I will say it's been clear that there needs to be some kind of grace period, before scaling starts kicking in. This is made very clear by having modded science packs that predate the vanilla automation science, causing crazy scaling too early.

What I mean specifically in my case is Lignumis adding two new science packs before you even get to Nauvis. This in itself is fine, but it means that once you land at Nauvis you're already looking at multiple stacked scaling just for the first vanilla science, which only keeps getting out of hand from here on. I was gonna write a longer explanation, but the short version is that I'm at the point of running out of resources for research and I'm so far behind compared to evolution that it makes is near impossible to expand out (also using mods that add higher tier enemies, and gives them chance at quality.) And ofcourse I decided it was a good idea to play on default preset lol.

So I was rethinking how to go about the tech cost scaling, and while I wouldn't want to just flat out reduce the scaling, because that would mean endgame also gets easier. The problem is in early game where your megabasing potential is extremely limited, meaning you really can't afford science to already be costing roughly 45x as much. Atleast playing on default preset.

So how exactly would I go about reducing early game scaling, but still having it scale more late game, but without it going too out of hand? I think there might need an extra setting or two to accomodate this.

Currently I'm using a 2x scaling factor, and a 0.95x tier scaling factor. This looks somewhat similar to this: https://i.imgur.com/pDvM7ga.png
But what I'd like to have is something like this: https://i.imgur.com/KbS8l3E.png
(Credits to easings.net for the curves)

Would this be possible to implement?

Edit: Well I forgot I can just click show essential only ingame lol, and I can see there's 4 listed for Lignumis, which explains why getting to nauvis sets such a high starting point. Honestly it would be amazing if you could just have an option to enable a starting offset, like if I set it to 4 it would not count the first 4 essential techs (so it starts like in vanilla at red science.) I think that's maybe the best way to do it? It opens up the option to also allow setting a later science, if say you dont want scaling on until you start on space science, which is pretty cool :)

a month ago

If you want the early game cheaper, but keep the endgame expensive, you can lower the scaling factor and increase the scaling curve.

For example, let's say you currently (with 2.0 factor and 0.95 curve) have:

  • Tier 6 tech: 45x price
  • Tier 15 tech: 8,783x price

Then, with a 1.25 factor and 1.37 curve, you will instead get:

  • Tier 6 tech: 14x price
  • Tier 15 tech: 9,105x price

Here, use this tool to play with the curve yourself: https://www.desmos.com/calculator/dl4hgazqiy

Horizontal: Tech tier
Vertical: Final cost multiplier

Play with these variables:
f: scaling factor
c: scaling curve

The blue, green, and red entries are just sample points to compare with after making adjustments. For example, (11, 866) means that at tier 11, the price multiplier is 866x.

Just hold left mouse button anywhere in the graph to sample the values at the cursor.


Would this suffice? I would prefer to avoid adding more mod options, as it would make this even more complicated.

a month ago

Oh, saw your edit now. A starting offset is obviously super simple to wrap your head around, so I wouldn't mind adding that.

a month ago

Yeah I was just messing around with that, and that does get me a cheaper start, but more expensive endgame. I somewhat came up with the same numbers myself, using 1.25x and 1.50x. The only issue is how modded endgame will proceed to scale further, which may or may not be desireable depending on how many essentials that get added. I think I will try this out though, since I think having an easier start and a harder endgame is more fun, due to having more options for megabasing (especially with mods that add even more productivity overall.)

If you do add the starting offset that would be awesome as well, and I'll have to mess around a bit more with the curve with that in mind as well then.

a month ago

Alright, I added the starting offset option.

I also added logging of the highest tech tier, so you can quickly check what the highest tier is with your current mod loadout by checking your factorio-current.log file (%appdata%\Factorio\factorio-current.log on Windows). Useful in combination with that desmos graph link to know what tier to target as the final endgame tier.

a month ago
(updated a month ago)

Thanks! It says tier 12 is the highest for me.

So I'm a bit confused at the description of the new option. I tried setting it to 3 as the example description says, if I look at the tech "military" originally this is 10 red, but now it's 19 red with a scaling of 1.25x and curve of 1.50x. Since military only takes red and not wood/steam science from Lignumis, why does it end up at 19 rather than being 10 or 12?

Edit: Oh ofcourse a tier means essential tech right. So I should be doing 4 to skip all of Lignumis, or 5 if I want red to start as 1x as well, If I understand correctly.

a month ago
(updated a month ago)

Is the wood/steam stuff a prerequisite for unlocking Red? If so, you have to count the wood/steam tier too for that technology, even if it doesn't consume those early items during research.

Edit: Yes, "Tier" is completely based on the "depth" of the prerequisite essential technologies. Your edit sounds correct.

a month ago

Yeah setting it to 5 matches exactly what I'd expect. Red science research is now 1x, and green becomes the first scaling. It's also worth noting that trigger techs don't count towards tier, even if they are essential. That is by design, yes?

a month ago

Ah, yeah forgot to mention that—triggered techs are indeed excluded by design. At least in vanilla, triggered techs always lead directly to just new science packs instead of giving new things to research, so it would often feel like the cost scaling would "double-dip" and jump unexpectedly high suddenly.

a month ago

Alright, so it all looks correct then :) This will indeed make the early game much less painful, not starting with an 8x multiplier from the beginning lol. It was getting quite ridiculous waiting ~5 hours for a military upgrade, that by the time you get it, is invalidated by how much evolution has increased! Not to mention running completely out of ore patches.

As always, thanks for the help!

a month ago

Yeah, that sounds unplayable, haha.

You're very welcome!

New response