Questions about Revolution mechanic

Hafenguy

Warlord
Joined
Feb 7, 2021
Messages
286
Dear folks,

I have some questions about the revolution feature.
1. What does the Red icon in picture number one mean?

2. Picture number two "financial trouble" how can I handle this? Does it help to lower the slider to Gold and not to science? Does it has an effect whether the maintenance of a city is higher than the production of Gold?

3. Picture number three: nearly everything is good but the rev Index is going worster. I did not understand this.

4. Picture number four: what does "local" mean?
The lower or more negative a number is the better. Am I right?
 
And here are the pictures
 

Attachments

  • IMG_20240926_213146782~2.jpg
    IMG_20240926_213146782~2.jpg
    5.3 MB · Views: 10
  • IMG_20240926_213156913.jpg
    IMG_20240926_213156913.jpg
    3.3 MB · Views: 8
  • IMG_20240926_213215990.jpg
    IMG_20240926_213215990.jpg
    4.7 MB · Views: 8
  • IMG_20240926_213246184~2.jpg
    IMG_20240926_213246184~2.jpg
    5.1 MB · Views: 7
In another thread I found this Code which should be able to explained the "financial trouble" thing.
May anyone be able to read it?

bool CvPlayerAI::AI_isFinancialTrouble() const
{
/************************************************************************************************/
/* BETTER_BTS_AI_MOD 06/12/09 jdog5000 */
/* */
/* Barbarian AI */
/************************************************************************************************/

if( isBarbarian() )
{
return false;
}
/************************************************************************************************/
/* BETTER_BTS_AI_MOD END */
/************************************************************************************************/


//if (getCommercePercent(COMMERCE_GOLD) > 50)
{
int iNetCommerce = 1 + getCommerceRate(COMMERCE_GOLD) + getCommerceRate(COMMERCE_RESEARCH) + std::max(0, getGoldPerTurn());
/************************************************************************************************/
/* UNOFFICIAL_PATCH 06/11/09 jdog5000 & DanF5771 */
/* */
/* Bugfix */
/************************************************************************************************/
/* original BTS code
int iNetExpenses = calculateInflatedCosts() + std::min(0, getGoldPerTurn());
*/

int iNetExpenses = calculateInflatedCosts() + std::max(0, -getGoldPerTurn());
/************************************************************************************************/
/* UNOFFICIAL_PATCH END */
/************************************************************************************************/


int iFundedPercent = (100 * (iNetCommerce - iNetExpenses)) / std::max(1, iNetCommerce);

int iSafePercent = 40;
if (AI_avoidScience())
{
iSafePercent -= 8;
}

if (GET_TEAM(getTeam()).getAnyWarPlanCount(true))
{
iSafePercent -= 12;
}

if (isCurrentResearchRepeat())
{
iSafePercent -= 10;
}

if (iFundedPercent < iSafePercent)
{
return true;
}
}

return false;
}
 
That's AI code from BtS. The Revolutions mod could've perhaps given it another purpose, but, as some backwards searching (starting with the string "Financial Trouble" in the game text files) reveals, its creator(s) merely took inspiration from the AI function. Copied from updateCivStability in Revolution.py:
Spoiler :
Code:
		# Finances
		iGoldRate = pPlayer.calculateGoldRate()
		iGold = pPlayer.getGold()

		goldPerc = pPlayer.getCommercePercent( CommerceTypes.COMMERCE_GOLD )
		sciPerc = pPlayer.getCommercePercent( CommerceTypes.COMMERCE_RESEARCH )
		# This is calculation AI does to figure out if it's in financial trouble
		iNetCommerce = 1 + pPlayer.getCommerceRate(CommerceTypes.COMMERCE_GOLD) + pPlayer.getCommerceRate(CommerceTypes.COMMERCE_RESEARCH) + max([0, pPlayer.getGoldPerTurn()])
		iNetExpenses = pPlayer.calculateInflatedCosts() + max([0, -pPlayer.getGoldPerTurn()])
		iFundedPercent = (100 * (iNetCommerce - iNetExpenses)) / max([1, iNetCommerce])

		iThresholdPercent = 75

		iNumWars = pTeam.getAtWarCount(True)
		if( iNumWars > 0 ) :
			iThresholdPercent -= 10 + 2*min([iNumWars, 5])

		if( pPlayer.isCurrentResearchRepeat() ) :
			# Have all techs, research no longer important
			iThresholdPercent *= 2
			iThresholdPercent /= 3
		if( cultPerc > 70 ) :
			# Going for cultural victory, research no longer important
			iThresholdPercent *= 2
			iThresholdPercent /= 3

		if( pPlayer.hasTrait(gc.getInfoTypeForString("TRAIT_ORGANIZED")) ):
			iThresholdPercent *= 10
			iThresholdPercent /= 11

		if( self.LOG_DEBUG and (bVerbose or iGameTurn%25 == 0) ) : CvUtil.pyPrint("  Revolt - The %s financial status: commerce %d, expenses %d, funded %d, thresh = %d, num wars %d,   gold %d, rate %d, gold perc %.2f"%(pPlayer.getCivilizationDescription(0), iNetCommerce, iNetExpenses, iFundedPercent, iThresholdPercent, iNumWars, iGold, iGoldRate,goldPerc))

		taxesIdx = 0
		finIdx = 0
		if( iNetCommerce > 20 and iFundedPercent > iThresholdPercent + 5 and not pPlayer.isMinorCiv() and not pPlayer.isAnarchy() ) :
			# Great long-term financial situation
			finIdx = min([((iFundedPercent - iThresholdPercent)/4 + cultPerc/5),4 + iEra])
			if( bIsRevWatch ) :
				posList.append( (finIdx, localText.getText("TXT_KEY_REV_WATCH_FINANCIAL_POS",())) )
			if( self.LOG_DEBUG and (bVerbose or iGameTurn%25 == 0) ) : CvUtil.pyPrint("  Revolt - The %s is in a good long-term financial situation")

		elif( iFundedPercent < iThresholdPercent ) :
			iPercentShort = iThresholdPercent - iFundedPercent
			finIdx = -min([20, 1+ iPercentShort/3])

			if( iGoldRate > 2 + 5*iEra ) :
				# Civ is making money
				finIdx /=2
			elif( iGold > 100 + 100*iEra ) :
				# Civ has plenty of reserves
				finIdx /=2
			elif( goldPerc > 50 and iGold < (35 + 10*iEra) and iGoldRate < 0 ) :
				# Civ in danger of running out of gold soon
				finIdx *=2
				if( self.LOG_DEBUG and (bVerbose or iGameTurn%25 == 0) ) : CvUtil.pyPrint("  Revolt - The %s is in serious financial trouble")

			if( bIsRevWatch ) :
				if(finIdx < 0):
					negList.append( (finIdx, localText.getText("TXT_KEY_REV_WATCH_FINANCIAL_NEG",())) )

			revIdxHistEvents += finIdx

		civRevIdx -= finIdx
		civStabilityIdx += finIdx
Sheesh, hasn't someone documented this before .... Searching the forum turns up nothing specific. To provide a reliable description, one really would have to look at the log output (and possibly add some more logging). Just from reading the code (and having looked at the corresponding AI function before): iFundedPercent is, I believe, fundamentally a pretty simple concept: Where would our research slider sit if we'd balance it for 0 income/deficit to the treasury. The true current slider position shouldn't matter for this calculation – or only to the extent that it affects the impact of Markets, Libraries etc. So 70% funded should mean that, at 100% gold, 30% of our income gets eaten by expenses, i.e. 70% is available for research (and culture and espionage) in the long term.

If iFundedPercent drops below iThresholdPercent, there is a penalty to stability explained as "Financial Trouble". The threshold is normally 75%. The threshold is less strict if the player is at war: -10 for one war, another -5 for a 2nd and 3rd war each. It's also relaxed a little (taken times 10/11) for leaders with the Organized trait. And it gets relaxed (factor 2/3), for the sake of the end game, when running more than 70% culture and/or when researching a repeatable Future Tech. I'll skip over the conditions for great finances since that's not really the question.

If funding is subpar, the penalty to stability depends on how far short iFundedPercent falls of iThresholdPercent. It's one plus one third of the difference between iThresholdPercent and iFundedPercent, up to a maximum of 20. That should be e.g. -12 stability at 40% funded and fighting no wars.

This penalty gets halved if the player currently has a solidly positive per-turn income. So, for this condition, if I'm not mistaken, the current slider position does matter. This would also be consistent with some posts I've found recommending not to alternate between extreme slider positions when playing with Revolutions. Solidly positive meaning more than 2 GPT plus 5 per era beyond Ancient. Alternatively, the penalty is also halved when there is much gold stored in the treasury. This, in turn, should actually accommodate stashing up and then spending recklessly, but maybe not in the early game – because reserves of 100 gold are required, plus another 100 for every era past Ancient.

The penalty is doubled if the player is running more than 50% gold slider and still having a deficit and also short on reserves (less than 35 + 10 gold per era after Ancient). There is an explanation text "Serious Financial Trouble" in the game text file for this situation, but it seems that the mod doesn't actually display it.
 
Thanks very much for thet detailed explanation. That was more than I expected.
Just one question: threshold of 75% means 25% income should pay all the expenses. 75% should be free for science, culture or espionage. Right?
 
That sounds correct. If you're able to run 20% gold with only a small deficit or even none at all and still get a penalty for Fin. Trouble, then I may have misinterpreted something essential.
It's also kind of more than I expected – for just one aspect of the stability/ revolution calculation. Dubious game design to me to make these rules so complex. Well, I guess, if the player at least realizes that they need to either actually make more gold or just make more commerce in general without further increasing their expenses, the player can lower the penalty as much as needed through trial and error.
 
Top Bottom