Originally posted by _BuRjaCi_
Can anyone dig up the source code which deals with inflation?
I would realy apreciate that, sice I like to understan the "guts" of the games I play.
Can anyone dig up the source code which deals with inflation?
I would realy apreciate that, sice I like to understan the "guts" of the games I play.
InfPct = (N + InflationOffset) * (SpeedInflationPercent/100) * (HandicapInflationPercent/100)
For instance, for Epic speed, the offset is -160 and the percent is 20. So, at Monarch+ (HandicapInflationPercent=100), you'll have zero inflation through turn 164 (thanks to integer math), then it'll increase 1% every five turns thereafter (to 100% at the end of the game).
Note that the AI gets a substantial discount on this rate, also specified in the XML for handicap levels.
The source (from the WL SDK, CvPlayer.cpp:5604):
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; }
Comment