Inflation and corporations

Yes, I noticed that the formula for inflation must have changed. It starts with the normal rise in inflation according to the formula, but at some time, the rate increases. With enough figures (turn number vs inflation rate), the formula can be derived. It is easier when the difficulty level modifier is not a factor.

It seems to be close to a doubling of the inflation rate increase after 240 turns. Close, but not exact. Someone who could take a look at the new inflation formula in the code could also be helpful.

Yes, I started out with the presumption that I could tweak the numbers in the XMLs to get the inflation rate to were it should be according to the Warlords/Vanilla formula, but it seems (Turn - Offset) is not being multiplied by a fixed number, but rather a steadily growing one.

How many reference points would you need to figure out the new formula? With some worldbuilder magic, it's quite easy to set up a game where you can just keep clicking "next turn" without delays.

Using this method, the inflation rate at any given turn checks out with the various savegames from my "proper" BtS playthroughs, so we can at least conclude that the calculation is still independent from what's going on in the game.
 
I present to you that Firaxis has either intentionally changed the formula that calculates inflation rate or, most likely, there is a bug that causes a fault in the calculation.
There was an intentional rise in inflation. (I don't know details.) Check out the middle of the "Huge Inflation" thread.
 
There was an intentional rise in inflation. (I don't know details.) Check out the middle of the "Huge Inflation" thread.

Yeah its this one:

The higher inflation in BTS is intended to slow down the late-game tech rate, but if anyone has a save showing negative maintenance from number of cities, please post it.
Thanks!

And I just did some code crunching - don't like what I see (careful long spoilers ahead ;) )

Spoiler BtS Inflation :

Code:
int CvPlayer::calculateInflationRate() const 
 { 
 	int iTurns = ((GC.getGameINLINE().getGameTurn() + GC.getGameINLINE().getElapsedGameTurns()) / 2); 
 	iTurns += GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getInflationOffset(); 
  
 	if (iTurns <= 0) 
 	{ 
 		return 0; 
 	} 
  
 	int iInflationPerTurnTimes10000 = GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getInflationPercent(); 
 	iInflationPerTurnTimes10000 *= GC.getHandicapInfo(getHandicapType()).getInflationPercent(); 
 	iInflationPerTurnTimes10000 /= 100; 
  
 	int iModifier = m_iInflationModifier; 
 	if (!isHuman() && !isBarbarian()) 
 	{ 
 		int iAIModifier = GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIInflationPercent(); 
 		iAIModifier *= max(0, ((GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIPerEraModifier() * getCurrentEra()) + 100)); 
 		iAIModifier /= 100; 
  
 		iModifier += iAIModifier - 100; 
 	} 
  
 	iInflationPerTurnTimes10000 *= max(0, 100 + iModifier); 
 	iInflationPerTurnTimes10000 /= 100; 
  
 	// Keep up to second order terms in binomial series 
 	int iRatePercent = (iTurns * iInflationPerTurnTimes10000) / 100; 
 	iRatePercent += (iTurns * (iTurns - 1) * iInflationPerTurnTimes10000 * iInflationPerTurnTimes10000) / 2000000; 
  
 	FAssert(iRatePercent >= 0); 
  
 	return iRatePercent; 
 } 
  
  
 int CvPlayer::calculateInflatedCosts() const 
 { 
 	int iCosts; 
  
 	iCosts = calculatePreInflatedCosts(); 
  
 	iCosts *= max(0, (calculateInflationRate() + 100)); 
 	iCosts /= 100; 
  
 	return iCosts; 
 }


Spoiler Warlords Inflation :

Code:
int CvPlayer::calculateInflationRate() 
 { 
 	int iTurns; 
 	int iRate; 
  
 	iTurns = ((GC.getGameINLINE().getGameTurn() + GC.getGameINLINE().getElapsedGameTurns()) / 2); 
 	iTurns += GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getInflationOffset(); 
  
 	if (iTurns < 0) 
 	{ 
 		return 0; 
 	} 
  
 	iRate = iTurns; 
  
 	iRate *= GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getInflationPercent(); 
 	iRate /= 100; 
  
 	iRate *= GC.getHandicapInfo(getHandicapType()).getInflationPercent(); 
 	iRate /= 100; 
  
 	if (!isHuman() && !isBarbarian()) 
 	{ 
 		iRate *= GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIInflationPercent(); 
 		iRate /= 100; 
  
 		iRate *= max(0, ((GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIPerEraModifier() * getCurrentEra()) + 100)); 
 		iRate /= 100; 
 	} 
  
 	FAssert(iRate >= 0); 
  
 	return iRate; 
 } 
  
  
 int CvPlayer::calculateInflatedCosts() 
 { 
 	int iCosts; 
  
 	iCosts = calculatePreInflatedCosts(); 
  
 	iCosts *= max(0, (calculateInflationRate() + 100)); 
 	iCosts /= 100; 
  
 	return iCosts; 
 }


From looking at the code:
  1. they changed the calculation extremely
  2. For the calculations I take the following values:
    a) InflationPercent from Gamespeed (Normal): 45 (BtS) 30 (Warlords)
    b) InflationPercent from Handicap (Noble): 90 (both)
    c) InflationOffset from Gamespeed (Normal): -120 (both)
    d) AIInflationPercent from Handicap (Noble): 80 (BtS) 70 (Warlords)
    e) Turn (25%, 50%, 75%, 100% of turns): 125/250/375/500 (BtS) 115/230/345/460 (Warlords) all start on Ancient start

So now lets get started ;)


Spoiler Warlords calculation :



Code:
iTurns = ((GC.getGameINLINE().getGameTurn() + GC.getGameINLINE().getElapsedGameTurns()) / 2);
iTurns= 115/230/345/460


Code:
iTurns += GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getInflationOffset();
iTurns= -5/110/225/340


Code:
iRate = iTurns; 
  
 	iRate *= GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getInflationPercent(); 
 	iRate /= 100; 
  
 	iRate *= GC.getHandicapInfo(getHandicapType()).getInflationPercent(); 
 	iRate /= 100;


so iRate= 0/29/60/91
I ignore AI Inflation ;)



Spoiler BtS calculation :



iTurns (after Offset, since this is the same for both) = 5/130/255/380


Code:
 	int iInflationPerTurnTimes10000 = GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getInflationPercent(); 
 	iInflationPerTurnTimes10000 *= GC.getHandicapInfo(getHandicapType()).getInflationPercent(); 
 	iInflationPerTurnTimes10000 /= 100;


iInflationPerTurnTimes10000= 36


Code:
 	int iModifier = m_iInflationModifier;
does not seem to be 0 for Human players... I ignore AI stuff


Code:
 iInflationPerTurnTimes10000 *= max(0, 100 + iModifier); 
 	iInflationPerTurnTimes10000 /= 100;


iInflationPerTurnTimes10000= 36


Code:
 	int iRatePercent = (iTurns * iInflationPerTurnTimes10000) / 100;


iRatePercent= 1/46/91/136


Code:
	iRatePercent += (iTurns * (iTurns - 1) * iInflationPerTurnTimes10000 * iInflationPerTurnTimes10000) / 2000000;


iRatePercent= 1/56/132/473



Thus at each quarter of turns played inflation on Noble/Normal is:


0/29/60/91 Percent for Warlords
1/56/132/473 Percent for BtS


So inflation is really increased :eek:
 
Yes, I also read the inflation formula on another thread. I hadn't realized that they had changed it when I started this thread. Now inflation does not have a linear relation to game turn, but a quadratic one. This is not something that I like, but I don't like the strange cost increasing factor called inflation at all because it is based on game turn.

However, this is actually a different issue (although related) to the one in this thread. I also can't really call it a bug. It's more a game mechanic that I don't like. I'm sure to mod it for myself, but I'm not going to report it as a bug.
 
Yes, I also read the inflation formula on another thread. I hadn't realized that they had changed it when I started this thread. Now inflation does not have a linear relation to game turn, but a quadratic one. This is not something that I like, but I don't like the strange cost increasing factor called inflation at all because it is based on game turn.

However, this is actually a different issue (although related) to the one in this thread. I also can't really call it a bug. It's more a game mechanic that I don't like. I'm sure to mod it for myself, but I'm not going to report it as a bug.

I think it's a bug. That much inflation is such a terrible design change that I give Firaxis the benefit of the doubt and consider it a mistake.
 
I've been trying to work out what exactly was intended by this section of code:

Code:
// Keep up to second order terms in binomial series 
 	int iRatePercent = (iTurns * iInflationPerTurnTimes10000) / 100; 
 	iRatePercent += (iTurns * (iTurns - 1) * iInflationPerTurnTimes10000 * iInflationPerTurnTimes10000) / 2000000;

It's pretty clear what this code does, however I'm curious about what formula it was derived from (a Binomial series is an approximation of...actually, a Google search will turn up an explanation faster if you aren't familiar with the term). I'm reasonably sure whoever wrote this code was actually referring to a Taylor series - a special case of the Binomial series.

The problem I'm having is that I don't think any Binomial series would generate those two terms. What I'm wondering, therefore, is if it's possible that a zero was dropped or added to one of the terms. For example, taking away two zeros in the second term would give us:

Code:
]// Keep up to second order terms in binomial series 
 	int iRatePercent = (iTurns * iInflationPerTurnTimes10000) / 100; 
 	iRatePercent += (iTurns * (iTurns - 1) * iInflationPerTurnTimes10000 * iInflationPerTurnTimes10000) / 20000;

The code would then be a Taylor series approximation of (1 + iInflationPerTurnTimes10000/100)^iTurns.

If, however, the programmer forgot to add a zero we would then end up with:

Code:
]// Keep up to second order terms in binomial series 
 	int iRatePercent = (iTurns * iInflationPerTurnTimes10000) / 1000; 
 	iRatePercent += (iTurns * (iTurns - 1) * iInflationPerTurnTimes10000 * iInflationPerTurnTimes10000) / 2000000;

The code would then be a Taylor series approximation of (1 + iInflationPerTurnTimes10000/1000)^iTurns.

A third possibility exists, of course, which is that although the code may have began as a tailor series approximation of one of the two above, it was decided at some time during the development cycle to modify it to its present state. I'm guessing, given how vast a disparity there is between Warlords and BtS in this regard that (1 + iInflationPerTurnTimes10000/1000)^iTurns was what was intended. Using this we would get the following numbers (using the same test data as in ori's post):

0/29/60/91 Percent for Warlords
0/15/51/107 Percent for BtS

It seems, at least to me, that the above is much more likely what was intended - slower inflation at first, faster inflation later on.
 
Using this we would get the following numbers (using the same test data as in ori's post):

0/29/60/91 Percent for Warlords
0/15/51/107 Percent for BtS

It seems, at least to me, that the above is much more likely what was intended - slower inflation at first, faster inflation later on.

While that is some excellent and persuasive thinking, Alexman has already stated that inflation has been intentionally increased. Your model would lead to a final inflation rate only modestly higher than Warlords, and for a large portion of the game it would actually be lower.
 
Well I think, particularly with respect to Corporations, it has been increased too much. If the high level of inflation (good for making Civic/city/unit maintenance important late game) is desired then perhaps get Corporate Maintenance and Seperate it (probably give a flat *2 or *3 to current values since it would no longer be subject to Inflation.) If Possible to get it to still be affected by Courthouses that would be good.

Have it add in after Inflation (before Foreign expenses)

because otherwise the benefit/cost ratio rapidly changes, due to the rapidly changing Inflation

(also it would be good to have a cap on Inflation for those who like to keep playing way past the time limit)
 
I used your numbers verbatim so I hope they’re right because I can’t for the life of me determine how you arrived at the final set of numbers (for Beyond the Sword, your Warlords numbers seem fine).

I’ll be assuming these are correct:
From looking at the code:
  1. they changed the calculation extremely
  2. For the calculations I take the following values:
    a) InflationPercent from Gamespeed (Normal): 45 (BtS) 30 (Warlords)
    b) InflationPercent from Handicap (Noble): 90 (both)
    c) InflationOffset from Gamespeed (Normal): -120 (both)
    d) AIInflationPercent from Handicap (Noble): 80 (BtS) 70 (Warlords)
    e) Turn (25%, 50%, 75%, 100% of turns): 125/250/375/500 (BtS) 115/230/345/460 (Warlords) all start on Ancient start

And these are very, very wrong =)
iTurns (after Offset, since this is the same for both) = 5/130/255/380


Code:
 	int iInflationPerTurnTimes10000 = GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getInflationPercent(); 
 	iInflationPerTurnTimes10000 *= GC.getHandicapInfo(getHandicapType()).getInflationPercent(); 
 	iInflationPerTurnTimes10000 /= 100;


iInflationPerTurnTimes10000= 36


Code:
 	int iModifier = m_iInflationModifier;
does not seem to be 0 for Human players... I ignore AI stuff


Code:
 iInflationPerTurnTimes10000 *= max(0, 100 + iModifier); 
 	iInflationPerTurnTimes10000 /= 100;


iInflationPerTurnTimes10000= 36


Code:
 	int iRatePercent = (iTurns * iInflationPerTurnTimes10000) / 100;


iRatePercent= 1/46/91/136


Code:
	iRatePercent += (iTurns * (iTurns - 1) * iInflationPerTurnTimes10000 * iInflationPerTurnTimes10000) / 2000000;


iRatePercent= 1/56/132/473

iTurns = 5/130/255/380 (correct)
iInflationPerTurnTimes10000 = 45 * 90 / 100 = 40
iRatePercent = 2/65/153/267

Now, using the correct iInflationPerTurnTimes10000 this time in my previous post’s calculations:
(1 + iInflationPerTurnTimes10000/1000)^iTurns: 0/18/61/130

So, to summarize:
0/29/60/91 inflation in Warlords
2/65/153/267 inflation in Beyond the Sword
0/18/61/130 inflation with (1 + iInflationPerTurnTimes10000/1000)^iTurns
 
While that is some excellent and persuasive thinking, Alexman has already stated that inflation has been intentionally increased. Your model would lead to a final inflation rate only modestly higher than Warlords, and for a large portion of the game it would actually be lower.

Take a look at my above post (assuming the numbers are all correct now :blush: )

I cannot fathom why, if the developers decided to pull away from their original design for this function (as a Binomial series - very, very likely one of the two I posted above) and yet continue to use a slightly butchered Taylor series. To me, it appears that some designer came up with a curve they thought would work well for inflation [(1 + iInflationPerTurnTimes10000/1000)^iTurns] and at some point during the implementation of that curve in the function CvPlayer::calculateInflationRate() someone screwed up and dropped a zero. In fact, that part of the function makes so much more sense to me with that modification that I would be astonished if that was not the intended implementation.

Edit:
I took a look at what I posted again, and while I was correct in that the function appeared to be setup to use the first two terms of a Taylor approximation of [(1 + iInflationPerTurnTimes10000/1000)^iTurns] I'm not quite sure why I assumed it would make a good approximation of that function, especially at higher turn levels :eek:. This effectively makes my above post look rather silly.

While it still seems, to me at least, that the hypothetical numbers posted above for inflation under a the two-term [(1 + iInflationPerTurnTimes10000/1000)^iTurns] approximation I posted above are a better 'fit' than the Vanilla method I have to admit that my argument is significantly weaker after putting a bit of coherent thought into what I said. The function was clearly never intended to closely approximate [(1 + iInflationPerTurnTimes10000/1000)^iTurns]. Whether or not that means that the code was an intentionally botched Binomial series remains to be seen.
 
Take a look at my above post (assuming the numbers are all correct now :blush: )

I cannot fathom why, if the developers decided to pull away from their original design for this function (as a Binomial series - very, very likely one of the two I posted above) and yet continue to use a slightly butchered Taylor series. To me, it appears that some designer came up with a curve they thought would work well for inflation [(1 + iInflationPerTurnTimes10000/1000)^iTurns] and at some point during the implementation of that curve in the function CvPlayer::calculateInflationRate() someone screwed up and dropped a zero. In fact, that part of the function makes so much more sense to me with that modification that I would be astonished if that was not the intended implementation.

Actually I was just about to comment how the numbers looked much more reasonable in your last post. Would this be possible to mod into the game?
 
Please please fix that. I need a quick fix for normal BTS and rhye's that fixes that. I can't stand playing past 1900 with 100+ inflation. If everyone of my cities has courthouses and full econ buildings why must I run at 20% even without corporations? Broken.
 
Actually I was just about to comment how the numbers looked much more reasonable in your last post. Would this be possible to mod into the game?

Certainly - as it happens I'd just compiling this change to give it a shot myself. Bear in mind this has not been play tested, but given how minor the change was I don't foresee any problems. Anyway, here's the rapid share link:

http://rapidshare.com/files/45230982/FixedInflation.zip.html
 
Certainly - as it happens I'd just compiling this change to give it a shot myself. Bear in mind this has not been play tested, but given how minor the change was I don't foresee any problems. Anyway, here's the rapid share link:

http://rapidshare.com/files/45230982/FixedInflation.zip.html

Thank you :) Seeing how this plays out is the main idea for me too.. As it is I have no problem with the new ramped up inflation in my games, even when it's surpassing 200% I can run a corporation in a handful of cities with all the resources I can get my hands on, and still get + >100 gold per turn at 10-20% taxation. (Indeed I just tried spamming corn in worldbuiler to see how my Standard Ethanol cities would fare.) I'd be curious to see how your change will affect balance.
 
I used your numbers verbatim so I hope they’re right because I can’t for the life of me determine how you arrived at the final set of numbers (for Beyond the Sword, your Warlords numbers seem fine).

I’ll be assuming these are correct:
they are for sure ;)

And these are very, very wrong =)


iTurns = 5/130/255/380 (correct)
iInflationPerTurnTimes10000 = 45 * 90 / 100 = 40
:blush: I accidentally typed 40*90 into my calculator - not 45*90 :blush:

iRatePercent = 2/65/153/267
sounds much better :D
 
Okay, I'll admit it! I only read all the replies in this thread up to page two. I don't have BTS either. :( But, from reading this thread, I think I have a pretty idea of how corporations work and I've come to a conclusion: Basically you're "investing" some money into a bank account and as time goes on, you lose money out of that bank account. It's like compound interest, except that you lose money instead of gain money.
 
@Macsbug

I wonder why the developers would choose an exponential function as the basis for the inflation cost (which is just a factor to increase maintenance). The wealth of your empire doesn't grow exponentially. Cottages grow slower over time and stop at some point and there are only a very limited number of buildings that can improve gold (market, grocer, bank). Cities are also very limited in size and don't grow forever. At some point, the growth of the economy in civ4 actually slows down when cottages have fully developed, banks, markets and grocers have been constructed and cities reach their maximum size. So why would the balancing factor called inflation have an exponential formula. From a game developers point of view, it doesn't make sense.

As a mathematician, I must say that you're maybe right about their goal to use a Taylor approximation on a more complicated formula. It's probably much quicker to calculate the Taylor series approximation than the original formula.
 
@ Macsbug:
I've played around with your modified formula a bit, and while it seems to be a godsend for those spam-happy corporate AIs, I myself am making way to much money before the inflation rate starts exceeding 100%.

This whole setup seems all backwards in terms of gameplay and balance. The inflation rate should rise rapidly at first and then start stagnating - just as the player's income :crazyeye: (That's a criticism of Firaxis' choice of implementation, and not your commendable attempt at improving it, just so you know.)
 
Will this be backward-compatible with current save games?

If not, I'll just have to start a new game, I suppose.

Count me in on the Beta test team! :goodjob:
 
Top Bottom