# A new change (1.09) for cost calculations

Just highlighting something coming in the next update:

1. Support for equations to control how costs and income from policies/situations are calculated instead of a simple linear ramp.

An explanation:
I introduced a new policy on nuclear fission (for those countries who have the pre-requisite tech)… Because I wanted this policy to go all the way from ‘decommission now’ (presuming that the costs are already set aside) right up to 'huge subsidies for new fission reactors, I realized that what I needed was a cost for this policy that was non linear.

In other words at value 0 (all the way to the left) I wanted a zero cost, and at the mid value I wanted a very low cost too, but I wanted it to ratchet up to huge costs on the far right slider maximum. Currently, the game does not allow you to do this. It just has a minimum and maximum cost/benefit and interpolates in a linear way between them.

So to fix this I have added a new column for cost and income for situations and policies. This means that you can have an exponential function like 250*(x^4), for costs, where the cost is skewed massively to the right. This is whats set for nuclear fission.

By default the function is 0+(1.0*x), which basically means the cost of the policy is scaled exactly by the slider position from min to max. Any other function will get applied to the slider position to work out the cost (or income) of the policy.

Note that this does not affect, or conflict with the existing lists of cost/income multipliers, which still work, but act as a general multiplier for the final calculated value. This change does not alter that system, it just allows you to have more control over the curve.

I expect modders will appreciate the change, and I should at some point revisit all the policies and situations to see if there is some benefit to adjusting them. I think this could be a good thing, as it would allow us to have a bit of an ‘inefficiency curve’ at the far end of a slider, which likely mirrors real life, in that spending \$X on a government project gets you Y results, but does spending \$2X get 2Y? maybe not, as inefficiencies creep in. I think this will make all those slider decisions a bit more interesting

3 Likes

Space and Mars program could use it too.

2 Likes

Nitpick: That’s not technically exponential. That’s merely polynomial.
And on that note, I’d suggest a lot of values ought to probably change exponentially (i.e. more like 4^x, although exponents are crazy and you might wanna be more subtle with that) because they cover so many ranges and because that’s gonna be accurate to diminishing returns. You’d have to commit a heck of a lot more resources before people actually take note, just psychologically speaking, and in many cases, policy effects ought to similarly be affected.

If you have specific (positive) target values for the cost end points in mind, and wish to vary them exponentially, one simple thing to do is to linearly interpolate in the exponent:

A^(1-x) * B^x

This formula will be A at x=0, B at x=1, and vary exponentially in between.

1 Like

Would it be possible to get a column like this, but for sim values? I was thinking it’d be neat for a while now but figured there was a lot on the backburner already.

I.e. all inputs sum up as normal to some variable y, then y is fed through the equation in the column, like 1/y or something, to get the actual sim value. Presumably a lot of sim values would just be 1*y, but the option would be handy.

1 Like

This is specifically just for cost and income calcs, we are looking at normalization of other variables today.

Sure, didn’t mean to put any pressure on.

I think we are talking at cross purposes. This is unrelated to any scaling or normalization of data, just a different slope for interpolating between costs or incomes for policies and situations. Sim values do not have any actual costs associated with them, so we dont need it here.

FWIW The fancy normalizing stuff is now in and being tested.

Yeah, I understood. I was just kinda asking about the specific implementation of the other thing, having a new column and all. Dont mind me lol