More than one percentage population bonus?
Posted: Sat May 23, 2020 3:34 pm
THE CONTEXT
(Geoff, you can skip this part and go to THE PROBLEM)
Stemming from this post.
I am tinkering with population bonuses, with the aim of making environments (and terraforming) more relevant mid-to-late game.
Vezzra, don't worry, I will not say "pleeeease, merge this into release!" .
I'd like to have two kinds of pop-boost techs: some than improve the "habitable space" (currently Sub. Hab, Orb. Hab. and N-Dim. Str) and some that increase species "population density" by improving tolerance to environments (Sym. Bio., Xeno. Gen.. Xeno. Hyb. and Cyborgs). The idea is that the former increase population in already habitable planets and that the later unlocks habitability in inhospitable environments. Tall empires would focus (first) on the former and wide empires on the latter.
An option could be to have dedicated techs to unlock environments in a hard way. That is, techs that are mandatory to have in order to live in worse environments. This could work like "Planetarey Ecology is required to apply other bonuses in adequate planets; Xeno. Gen. to unlock poor planets; Xeno. Hyb. to unlock hostile planets". This would make that even being self-sustaining (or having three specials) would not let such species to live in a poor planet until they get Xeno. Gen., but then they would get relatively great pop. stats in poor planets. I don't like this approach because (well balanced) it is nice to offer the player different ways to get to those environments.
The option I like is about using percentage population bonuses. This would make that the "habitable space" techs would give a +X% population boost, which would not help in environments that are not yet habitable, and would have a greater impact of planets with greater population. I like this much more than making (e.g.) Orb. Hab. give +3 to good, +2 to adeq. and +1 to the rest, which is the other way to achieve what I am looking for.
Before I put in some tables with maths for argumentation of why I think this is better and to discuss it, I need to solve the inherent problem with percentage boosts and FOCS, which is the objective of this thread.
THE PROBLEM
There is a single percentage boost to population, the species population trait. I think there is a reason for that: effects in FOCS are applied sequentially, following the order imposed by the set priorities, and applying more than one multiplicative effect complicates calculations a bit and quickly gets into lots of decimals.
I bet players like to be able to forecast the results of getting a new tech. FreeOrion does that pretty well in most cases:
(+1 +2) +1 +1 +2 = 7 is rather simple.
(+1 +2)*1.25 +1 +2 = 6.75 is not so simple but tolerable (although UI will show us 6.7 or 6..
Now, if one wants to apply more than one multiplicative effect:
(+1 +2)*1.25*1.25 +2 = 6.6875 is not simple, and I dislike so many decimals (and it will be shown as 6.7).
A way to avoid such decimals and keep calculations simple and readily understood is to not concatenate multiplications, make them apply to the "base" value, simultaneously instead of sequentially:
3 + 3*0.25 + 3*0.25 +2 = 6.5
Say the first 0.25 is from Good Population trait, and the second one is from Subterranean Habitation. If you set two different effects, one for each, with different priorities, when the first one is applied the first "3*0.25" is added to Value and the second one will operate over 3.75 instead of 3. Thus the decimals explode and the calculations are harder to do in your head.
If you do some FOCS hacking to include all the multiplicative effects in the same effect, so you do 3 + 3*0.5 + 2 to get the desired 6.5, the problem is then you can only set a single accounting label. Sighs...
AFAICT, there is no way to do this without changing backend to add new capabilities to meters' calculation.
The way I imagine is having an intermediate temporal value (meter?) that gets all the updates from the BEFORE_SCALING_PRIORITY effects (the "3" in the examples above), like this:
IntermediateValue = Value // starting value, usually 0.
IntermediateValue = Value +1
IntermediateValue = Value +2 // Now we got the 3 we need.
Value = IntermediateValue // Update Value and keep IntermediateValue to apply over it the multiplicative effects.
Value = Value + IntermediateValue*0.25 // Good Population
Value = Value + IntermediateValue*0.25 // Sub. Hab.
Value = Value +2 // Value is 6.5 as desired.
Can this be done in a different way without messing with backend?
If not, would this kind of change be acceptable for master?
(Geoff, you can skip this part and go to THE PROBLEM)
Stemming from this post.
I am tinkering with population bonuses, with the aim of making environments (and terraforming) more relevant mid-to-late game.
Vezzra, don't worry, I will not say "pleeeease, merge this into release!" .
I'd like to have two kinds of pop-boost techs: some than improve the "habitable space" (currently Sub. Hab, Orb. Hab. and N-Dim. Str) and some that increase species "population density" by improving tolerance to environments (Sym. Bio., Xeno. Gen.. Xeno. Hyb. and Cyborgs). The idea is that the former increase population in already habitable planets and that the later unlocks habitability in inhospitable environments. Tall empires would focus (first) on the former and wide empires on the latter.
An option could be to have dedicated techs to unlock environments in a hard way. That is, techs that are mandatory to have in order to live in worse environments. This could work like "Planetarey Ecology is required to apply other bonuses in adequate planets; Xeno. Gen. to unlock poor planets; Xeno. Hyb. to unlock hostile planets". This would make that even being self-sustaining (or having three specials) would not let such species to live in a poor planet until they get Xeno. Gen., but then they would get relatively great pop. stats in poor planets. I don't like this approach because (well balanced) it is nice to offer the player different ways to get to those environments.
The option I like is about using percentage population bonuses. This would make that the "habitable space" techs would give a +X% population boost, which would not help in environments that are not yet habitable, and would have a greater impact of planets with greater population. I like this much more than making (e.g.) Orb. Hab. give +3 to good, +2 to adeq. and +1 to the rest, which is the other way to achieve what I am looking for.
Before I put in some tables with maths for argumentation of why I think this is better and to discuss it, I need to solve the inherent problem with percentage boosts and FOCS, which is the objective of this thread.
THE PROBLEM
There is a single percentage boost to population, the species population trait. I think there is a reason for that: effects in FOCS are applied sequentially, following the order imposed by the set priorities, and applying more than one multiplicative effect complicates calculations a bit and quickly gets into lots of decimals.
I bet players like to be able to forecast the results of getting a new tech. FreeOrion does that pretty well in most cases:
(+1 +2) +1 +1 +2 = 7 is rather simple.
(+1 +2)*1.25 +1 +2 = 6.75 is not so simple but tolerable (although UI will show us 6.7 or 6..
Now, if one wants to apply more than one multiplicative effect:
(+1 +2)*1.25*1.25 +2 = 6.6875 is not simple, and I dislike so many decimals (and it will be shown as 6.7).
A way to avoid such decimals and keep calculations simple and readily understood is to not concatenate multiplications, make them apply to the "base" value, simultaneously instead of sequentially:
3 + 3*0.25 + 3*0.25 +2 = 6.5
Say the first 0.25 is from Good Population trait, and the second one is from Subterranean Habitation. If you set two different effects, one for each, with different priorities, when the first one is applied the first "3*0.25" is added to Value and the second one will operate over 3.75 instead of 3. Thus the decimals explode and the calculations are harder to do in your head.
If you do some FOCS hacking to include all the multiplicative effects in the same effect, so you do 3 + 3*0.5 + 2 to get the desired 6.5, the problem is then you can only set a single accounting label. Sighs...
AFAICT, there is no way to do this without changing backend to add new capabilities to meters' calculation.
The way I imagine is having an intermediate temporal value (meter?) that gets all the updates from the BEFORE_SCALING_PRIORITY effects (the "3" in the examples above), like this:
IntermediateValue = Value // starting value, usually 0.
IntermediateValue = Value +1
IntermediateValue = Value +2 // Now we got the 3 we need.
Value = IntermediateValue // Update Value and keep IntermediateValue to apply over it the multiplicative effects.
Value = Value + IntermediateValue*0.25 // Good Population
Value = Value + IntermediateValue*0.25 // Sub. Hab.
Value = Value +2 // Value is 6.5 as desired.
Can this be done in a different way without messing with backend?
If not, would this kind of change be acceptable for master?