Logo Platform
logo amplifiers simplified

Dev question: How does the game's math work?

Reply
Copied to clipboard!
2 years ago
May 30, 2022, 2:07:54 PM

Something I'd been wondering since I first played the game:

How does the math work in terms of the Percentage based bonuses?

Take p.e. the Big Ben wonder. 

It gives +10% science on the capital.

How is this being calculated?

Is is being calculated ONCE at the time of completing the wonder?

Or is it dynamic and adjusts instantly (at the beginning or at the end of each turn?) to whatever the city's new science value is from fixed amounts?

Is this consistent across all such percentage based bonuses, like the fertilizer plant, customs agency, etc?



0Send private message
2 years ago
May 30, 2022, 2:15:41 PM

From plating the bolivar beta, i think it is a dynamic calculation which happens depending on changes to any relevant variable

0Send private message
2 years ago
May 30, 2022, 3:59:18 PM

I've also noticed it's dynamic. You can see this on a non-% based one like Angkor Wat which gives food per faith. When you gain faith, the food also inceases on it (since you can see the actual yield, you can verify this without looking into the code or something).


What I would like to know, in addition to OPs question, is what happens when there are multiple percentages? Is it similar to Paradox games where all percentages are added up and then calculated? Or are they multiplied? So it would be the difference between 1*(1.25+0.3+.05) or 1.25*1.3*1.05?

0Send private message
2 years ago
May 30, 2022, 4:43:59 PM
Dayvit78 wrote:

I've also noticed it's dynamic. You can see this on a non-% based one like Angkor Wat which gives food per faith. When you gain faith, the food also inceases on it (since you can see the actual yield, you can verify this without looking into the code or something).


What I would like to know, in addition to OPs question, is what happens when there are multiple percentages? Is it similar to Paradox games where all percentages are added up and then calculated? Or are they multiplied? So it would be the difference between 1*(1.25+0.3+.05) or 1.25*1.3*1.05?

Games like this tend to have a hell of a time deciding which percentages are additive and which are multiplicative. It was a frequently asked question in ES2. If I had to guess, and this is just going off what games often do, buffs applied to an entity are additive, buffs applied to a parent group are additive, and those two groups combine multiplicatively. ie 20% + 20% on a city would be +40%, and then an empire-wide +20% would bring that up to +68%

Don't think too hard about how proportionally insignificant these buffs get if the game awards too many of them.

0Send private message
2 years ago
May 31, 2022, 8:29:31 AM

As you mentioned, is dynamic. Now you can see it more clearly with the Yield Preview (if you go to Completed construction you can see how it evolves)

0Send private message
2 years ago
May 31, 2022, 8:48:45 AM
SpacesuitSpiff wrote:
Dayvit78 wrote:

I've also noticed it's dynamic. You can see this on a non-% based one like Angkor Wat which gives food per faith. When you gain faith, the food also inceases on it (since you can see the actual yield, you can verify this without looking into the code or something).


What I would like to know, in addition to OPs question, is what happens when there are multiple percentages? Is it similar to Paradox games where all percentages are added up and then calculated? Or are they multiplied? So it would be the difference between 1*(1.25+0.3+.05) or 1.25*1.3*1.05?

Games like this tend to have a hell of a time deciding which percentages are additive and which are multiplicative. It was a frequently asked question in ES2. If I had to guess, and this is just going off what games often do, buffs applied to an entity are additive, buffs applied to a parent group are additive, and those two groups combine multiplicatively. ie 20% + 20% on a city would be +40%, and then an empire-wide +20% would bring that up to +68%

Don't think too hard about how proportionally insignificant these buffs get if the game awards too many of them.

I'm not sure I completely understand your example but it works similarly to ES2 from what I remember.


Given a target entity, percentage bonuses are indeed additive. First we compute a raw value based off the flat gains. Then we apply the percentage-based one. Let say you have these bonuses: +3, +5, +2, +10%, +20%. That gives you (3 + 5 + 2) * (1 + (0.1 + 0.2)) = 10 * (1 + 0.3) = 13.


Now, let say we talk about Science production. City production is first computed. Then the Empire sums the production of all its Cities to compute its own. Percentage bonuses applied on the Empire applies to that sum. Let say I have City_A and City_B and a 10% bonus, that would be the result: (Science[City_A] + Science[City_B]) * (1 + 0.1).


I hope that helps and that I don't simply repeat an obvious fact.

Alex.

0Send private message
2 years ago
Jan 11, 2023, 2:31:04 PM

That is, as far as I understand it correctly, the percentages just add up, not add up. For example, we have a bonus of +5 and first it's +10% and then +15%. We would get (5 * (1 + 0.1) * (1 + 0.15) = 6.325, but this way we get 5 * (1 + (0.1 + 0.15) = 6.25. In the end, the bigger the initial number, the bigger their number and the percentage of the first option would be much bigger than the second. I'm not particularly good at calculus and math, back when I was studying I was looking for answers on resources like https://plainmath.net/741/determine-whether-the-congruence-is-true-or-false-100equiv-20-mod-8 to solve complex men problems. But as far as I understand your system is so called simple percentages, which is not bad and easier to calculate.

Updated 2 years ago.
0Send private message
?

Click here to login

Reply
Comment