UN & Free Religion

obsolete

Deity
Joined
Dec 17, 2005
Messages
6,201
Location
Planet Earth
I noticed the AI likes to hold votes for Free Religion. However, sometimes I have got everyone voting for it, and often half the world defys it. I'm not too sure on what causes an AI to go for it. I believe even when they were running under a religion, this didn't seem to change their mind one way or another that I saw.

I'm curious what anyone else has picked up on this matter. It would be nice to tell in advanced which way the majority will go, and WHO is most likely going to defy it, that way I don't have to defy it myself and get the penalty.
 
Have you noticed that AI flagged as "Zealots" (the ones that have high diplo modifiers for heathens/brothers of the faith -Izzy, Saladin, ect.) defying more than others?

Or maybe it's related to civs that control the religion wonders?
 
Just abstain then?

Abstaining is no good. If you want a resolution to fail, but don't want to get the happiness penalty for defying it it's good to know if someone else is going to defy it. In that case yes, you can abstain; but if you're getting a lot of benefits from religion and have no way to say if the resolution is gonna pass or not, then it's better to defy it yourself provided you can support the unhappiness.
 
hmm... I abstain on many votes that does not interest me... like peace resolutions and such...

BTW why does the AP and UN make civs vote again for resolutions that passed? if all vote for no, will it be absolete?
 
The civ running the AP or the UN can choose to vote again on resolutions, even if they passed before. (not sure if you can re-vote on all the resolutions that passed once) A known example is voting to ban nukes, then later voting to stop the ban.

And abstaining is ok if the resolution doesn't interest you. But if you want it to go one way or the other it's not good enough. Sometimes you'll want to stop a resolution but can't afford the unhappiness you incur by defying it, so you simply vote against. Free Religion is not usually a problem for me, but Environmentalism can be. I'm usually in either State Property (big empire, geared towards production) or Free Market (smaller empire with corporations). So being forced to adopt Environmentalism is quite a downer. And if someone's keen on it the problem is that you could see several votes in a row for that resolution. You'll have to have quite a lot of happiness in reserve to defy the resolution several times and not destroy your working population. In a game that was posted here (don't remember who did) Izzy had all her cities down to 1 population because she kept denying the Free Religion resolution I think. Whatever benefits you'd get for defying a resolution, they can't be compared with having only 1 population work in each city.
 
Forced civics and nuke bans really annoy me... I wish we could continue to build more nukes after the nuke ban, since this happens in real life :)

I didnt know that defiyng had negative effects, but I play on Noble and didnt notice because of the easiness of the game...
 
Well, if the resolution fails because there were enough votes against it it doesn't matter if someone defied it or voted against, there's no penalty for anyone. But by defying it you can force the resolution to fail even if there are enough votes to pass it; that's when you get unhappiness in your cities. Don't remember how much and for how long, but I'm pretty sure votes come up faster than the unhappiness fades. This is why I love having a big enough empire to block all resolutions by simply voting against them. Or to have enough votes to vote myself for leader of the UN, in which case I simply don't propose resolutions that I don't want to pass.
 
I noticed the AI likes to hold votes for Free Religion. However, sometimes I have got everyone voting for it, and often half the world defys it. I'm not too sure on what causes an AI to go for it. I believe even when they were running under a religion, this didn't seem to change their mind one way or another that I saw.

I'm curious what anyone else has picked up on this matter. It would be nice to tell in advanced which way the majority will go, and WHO is most likely going to defy it, that way I don't have to defy it myself and get the penalty.

My experiences with defied UN resolutions.
1) They don't want to leave their favourite civic.
2) They are too small. By that I mean a useless vassal/civ that happened to have one junk city on another continent, not making it worthwhile conquering altogether. That civ, for example, won't leave bureacracy, as its benefits outweigh free speech if you only have one city.
3) My experience with free religion has to do with the amount of religions present in the world and their distribution. An ai is less likely to enter free religion if they only have one religion present in their empire, and/or their fave civic is a religion one. However free religion I have found the most likely to pass (bar emancipation), given sufficient religion spread. Its quite a powerful civic with the potential +5:) if all religions present.

I found the most likely to defy Free Religion are the leaders that have Theocracy as their fave civic, mainly cos they have poor world religion spread.

These are a few of my experiences in those regards. Now someone who knows a bit about the code will answer and prove me all wrong:D
 
I remember seeing one of madscientist's role playing challenges where Isabella kept defying free religion so long that every one of her cities had starved down to 1 pop. (She may have built Globe so she had one decent city; I don't remember.)
 
Free Religion is not usually a problem for me, but Environmentalism can be. I'm usually in either State Property (big empire, geared towards production) or Free Market (smaller empire with corporations). So being forced to adopt Environmentalism is quite a downer.

This is how half of the population of the United States feels. ;)
 
Hmm, well I'm not so sure I buy that Theocracy bit. In my last game, only my vassals defied the free Religion vote. Now, one was Zara, who's favourite civic is theo, however... get this, my other vassal was Willem, who's favourite civic is.... FREE RELIGION! Tadahhhhh...

The only thing I can think of is, I capture the AP, and converted those 2 into full members. They were the only 2 full members as well.
 
And one last thing, it would be nice to solve why certain AI's defy free-speech too.
 
Hmm, well I'm not so sure I buy that Theocracy bit. In my last game, only my vassals defied the free Religion vote. Now, one was Zara, who's favourite civic is theo, however... get this, my other vassal was Willem, who's favourite civic is.... FREE RELIGION! Tadahhhhh...

The only thing I can think of is, I capture the AP, and converted those 2 into full members. They were the only 2 full members as well.

But how many religions did Willem have in his cities? If he only had one religion, then free religion brings no real benefits.
 
Good points, Single Malt -- I just looked at the code (CvPlayerAI::AI_diploVote()) and they all make sense!

It appears the AI will always vote with YES if
  • it is the Secretary General and has proposed the resolution
  • its team attitude towards the Secretary General is FRIENDLY
  • it has already adopted the proposed/new civic
Otherwise it will calculate the civic value of the best civic (BCV) of the respecitve civic category as well as the civic value of the new civic (NCV).

If BCV <= NCV * 120/100 it will also vote with YES (so the best civic is only 20% better than the new civic).

Else if BCV <= NCV * (140+RANDOM(120))/100 it will just vote with NO (the best civic is < 40% ... 160% better than the new civic).

Else it will vote with NEVER!!!!!
(The AIs don't abstain in these force-civic votes.)

The RANDOM(120) represents a very strong influence of the RNG and the code is even commented with "AI Erratic Defiance (Force Civic)", so reliable predictions of AI behaviour are almost impossible...

On average an AI can be expected to defy a resolution if it values its best civic twice as high as the new civic.
The calculation of the civic values is very complex and as Single Malt assumed the distribution of the religions and the favorite civics have their effects, take a look :p:
Spoiler :
Code:
[SIZE="3"]int CvPlayerAI::AI_civicValue(CivicTypes eCivic)
{
	PROFILE_FUNC();

	bool bWarPlan;
	int iConnectedForeignCities;
	int iTotalReligonCount;
	int iHighestReligionCount;
	int iWarmongerPercent;
	int iHappiness;
	int iValue;
	int iTempValue;
	int iI, iJ;

	bool bCultureVictory3 = AI_isDoStrategy(AI_STRATEGY_CULTURE3);
	bool bCultureVictory2 = AI_isDoStrategy(AI_STRATEGY_CULTURE2);

	FAssertMsg(eCivic < GC.getNumCivicInfos(), "eCivic is expected to be within maximum bounds (invalid Index)");
	FAssertMsg(eCivic >= 0, "eCivic is expected to be non-negative (invalid Index)");

	CvCivicInfo& kCivic = GC.getCivicInfo(eCivic);

	bWarPlan = (GET_TEAM(getTeam()).getAnyWarPlanCount(true) > 0);

	iConnectedForeignCities = countPotentialForeignTradeCitiesConnected();
	iTotalReligonCount = countTotalHasReligion();
    // Unofficial Patch Start
    // * Modified AI civic valuation to more accurately consider state religion preference.
	ReligionTypes eBestReligion = AI_bestReligion();
	if (eBestReligion == NO_RELIGION)
	{
		eBestReligion = getStateReligion();
	}
	iHighestReligionCount = ((eBestReligion == NO_RELIGION) ? 0 : getHasReligionCount(eBestReligion));
	// Unofficial Patch End
	iWarmongerPercent = 25000 / std::max(100, (100 + GC.getLeaderHeadInfo(getPersonalityType()).getMaxWarRand())); 

	iValue = (getNumCities() * 6);

	iValue += (GC.getCivicInfo(eCivic).getAIWeight() * getNumCities());

	iValue += (getCivicPercentAnger(eCivic) / 10);

	iValue += -(GC.getCivicInfo(eCivic).getAnarchyLength() * getNumCities());

	iValue += -(getSingleCivicUpkeep(eCivic, true));

	iValue += ((kCivic.getGreatPeopleRateModifier() * getNumCities()) / 10);
	iValue += ((kCivic.getGreatGeneralRateModifier() * getNumMilitaryUnits()) / 50);
	iValue += ((kCivic.getDomesticGreatGeneralRateModifier() * getNumMilitaryUnits()) / 100);
	iValue += -((kCivic.getDistanceMaintenanceModifier() * std::max(0, (getNumCities() - 3))) / 8);
	iValue += -((kCivic.getNumCitiesMaintenanceModifier() * std::max(0, (getNumCities() - 3))) / 8);
	iValue += (kCivic.getFreeExperience() * getNumCities() * (bWarPlan ? 8 : 5) * iWarmongerPercent) / 100; 
	iValue += ((kCivic.getWorkerSpeedModifier() * AI_getNumAIUnits(UNITAI_WORKER)) / 15);
	iValue += ((kCivic.getImprovementUpgradeRateModifier() * getNumCities()) / 50);
	iValue += (kCivic.getMilitaryProductionModifier() * getNumCities() * iWarmongerPercent) / (bWarPlan ? 300 : 500 ); 
	iValue += (kCivic.getBaseFreeUnits() / 2);
	iValue += (kCivic.getBaseFreeMilitaryUnits() / 3);
	iValue += ((kCivic.getFreeUnitsPopulationPercent() * getTotalPopulation()) / 200);
	iValue += ((kCivic.getFreeMilitaryUnitsPopulationPercent() * getTotalPopulation()) / 300);
	iValue += -(kCivic.getGoldPerUnit() * getNumUnits());
	iValue += -(kCivic.getGoldPerMilitaryUnit() * getNumMilitaryUnits() * iWarmongerPercent) / 200;

	//iValue += ((kCivic.isMilitaryFoodProduction()) ? 0 : 0);
	iValue += (getWorldSizeMaxConscript(eCivic) * ((bWarPlan) ? (20 + getNumCities()) : ((8 + getNumCities()) / 2)));
	iValue += ((kCivic.isNoUnhealthyPopulation()) ? (getTotalPopulation() / 3) : 0);
	if (bWarPlan)
	{
		iValue += ((kCivic.getExpInBorderModifier() * getNumMilitaryUnits()) / 200);
	}
	iValue += ((kCivic.isBuildingOnlyHealthy()) ? (getNumCities() * 3) : 0);
	iValue += -((kCivic.getWarWearinessModifier() * getNumCities()) / ((bWarPlan) ? 10 : 50));
	iValue += (kCivic.getFreeSpecialist() * getNumCities() * 12);
	iValue += ((kCivic.getTradeRoutes() * std::max(0, iConnectedForeignCities - getNumCities() * 3) * 6) + (getNumCities() * 2)); 
	iValue += -((kCivic.isNoForeignTrade()) ? (iConnectedForeignCities * 3) : 0);
	if (kCivic.isNoCorporations())
	{
		iValue -= countHeadquarters() * (40 + 3 * getNumCities());
	}
	if (kCivic.isNoForeignCorporations())
	{
		for (int iCorp = 0; iCorp < GC.getNumCorporationInfos(); ++iCorp)
		{
			if (!GET_TEAM(getTeam()).hasHeadquarters((CorporationTypes)iCorp))
			{
				iValue += countCorporations((CorporationTypes)iCorp) * 3;
			}
		}
	}
	if (kCivic.getCorporationMaintenanceModifier() != 0)
	{
		int iCorpCount = 0;
		int iHQCount = 0;
		for (int iCorp = 0; iCorp < GC.getNumCorporationInfos(); ++iCorp)
		{
			if (GET_TEAM(getTeam()).hasHeadquarters((CorporationTypes)iCorp))
			{
				iHQCount++;
			}
			iCorpCount += countCorporations((CorporationTypes)iCorp);
		}
		iValue += (-kCivic.getCorporationMaintenanceModifier() * (iHQCount * (25 + getNumCities() * 2) + iCorpCount * 7)) / 25;

	}

	if (kCivic.getCivicPercentAnger() != 0)
	{
		int iNumOtherCities = GC.getGameINLINE().getNumCities() - getNumCities();
		iValue += (30 * getNumCities() * getCivicPercentAnger(eCivic, true)) / kCivic.getCivicPercentAnger();
		
		int iTargetGameTurn = 2 * getNumCities() * GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getGrowthPercent();
		iTargetGameTurn /= GC.getGame().countCivPlayersEverAlive();
		iTargetGameTurn += GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getGrowthPercent() * 30;
		
		iTargetGameTurn /= 100;
		iTargetGameTurn = std::max(10, iTargetGameTurn);
		
		int iElapsedTurns = GC.getGame().getElapsedGameTurns();

		if (iElapsedTurns > iTargetGameTurn)
		{
			iValue += (std::min(iTargetGameTurn, iElapsedTurns - iTargetGameTurn) * (iNumOtherCities * kCivic.getCivicPercentAnger())) / (15 * iTargetGameTurn);
		}
	}

	if (kCivic.getExtraHealth() != 0)
	{
		iValue += (getNumCities() * 6 * AI_getHealthWeight(isCivic(eCivic) ? -kCivic.getExtraHealth() : kCivic.getExtraHealth(), 1)) / 100;
	}
			
	iTempValue = kCivic.getHappyPerMilitaryUnit() * 3;
	if (iTempValue != 0)
	{
		iValue += (getNumCities() * 9 * AI_getHappinessWeight(isCivic(eCivic) ? -iTempValue : iTempValue, 1)) / 100;
	}
		
	iTempValue = kCivic.getLargestCityHappiness();
	if (iTempValue != 0)
	{
		iValue += (12 * std::min(getNumCities(), GC.getWorldInfo(GC.getMapINLINE().getWorldSize()).getTargetNumCities()) * AI_getHappinessWeight(isCivic(eCivic) ? -iTempValue : iTempValue, 1)) / 100;
	}
	
	if (kCivic.getWarWearinessModifier() != 0)
	{
		int iAngerPercent = getWarWearinessPercentAnger();
		int iPopulation = 3 + (getTotalPopulation() / std::max(1, getNumCities()));

		int iTempValue = (-kCivic.getWarWearinessModifier() * iAngerPercent * iPopulation) / (GC.getPERCENT_ANGER_DIVISOR() * 100);
		if (iTempValue != 0)
		{
			iValue += (11 * getNumCities() * AI_getHappinessWeight(isCivic(eCivic) ? -iTempValue : iTempValue, 1)) / 100;
		}
	}
	
	iValue += (kCivic.getNonStateReligionHappiness() * (iTotalReligonCount - iHighestReligionCount) * 5);

	if (kCivic.isStateReligion())
	{
		if (iHighestReligionCount > 0)
		{
			iValue += iHighestReligionCount;

			iValue += ((kCivic.isNoNonStateReligionSpread()) ? ((getNumCities() - iHighestReligionCount) * 2) : 0);
			iValue += (kCivic.getStateReligionHappiness() * iHighestReligionCount * 4);
			iValue += ((kCivic.getStateReligionGreatPeopleRateModifier() * iHighestReligionCount) / 20);
			iValue += (kCivic.getStateReligionGreatPeopleRateModifier() / 4);
			iValue += ((kCivic.getStateReligionUnitProductionModifier() * iHighestReligionCount) / 4);
			iValue += ((kCivic.getStateReligionBuildingProductionModifier() * iHighestReligionCount) / 3);
			iValue += (kCivic.getStateReligionFreeExperience() * iHighestReligionCount * ((bWarPlan) ? 6 : 2));
		}
	}

	for (iI = 0; iI < NUM_YIELD_TYPES; iI++)
	{
		iTempValue = 0;

		iTempValue += ((kCivic.getYieldModifier(iI) * getNumCities()) / 2);
		iTempValue += ((kCivic.getCapitalYieldModifier(iI) * 3) / 4);
		CvCity* pCapital = getCapitalCity(); 
		if (pCapital) 
		{
			iTempValue += ((kCivic.getCapitalYieldModifier(iI) * pCapital->getBaseYieldRate((YieldTypes)iI)) / 80); 
		}
		iTempValue += ((kCivic.getTradeYieldModifier(iI) * getNumCities()) / 11);

		for (iJ = 0; iJ < GC.getNumImprovementInfos(); iJ++)
		{
			iTempValue += (AI_averageYieldMultiplier((YieldTypes)iI) * (kCivic.getImprovementYieldChanges(iJ, iI) * (getImprovementCount((ImprovementTypes)iJ) + getNumCities() * 2))) / 100;
		}

		if (iI == YIELD_FOOD) 
		{ 
			iTempValue *= 3; 
		} 
		else if (iI == YIELD_PRODUCTION) 
		{ 
			iTempValue *= ((AI_avoidScience()) ? 6 : 2); 
		} 
		else if (iI == YIELD_COMMERCE) 
		{ 
			iTempValue *= ((AI_avoidScience()) ? 1 : 2); 
		} 

		iValue += iTempValue;
	}

	for (iI = 0; iI < NUM_COMMERCE_TYPES; iI++)
	{
		iTempValue = 0;

		iTempValue += ((kCivic.getCommerceModifier(iI) * getNumCities()) / 3);
		iTempValue += (kCivic.getCapitalCommerceModifier(iI) / 2);
		if (iI == COMMERCE_ESPIONAGE)
		{
			iTempValue *= AI_getEspionageWeight();
			iTempValue /= 500;
		}
		iTempValue += ((kCivic.getSpecialistExtraCommerce(iI) * getTotalPopulation()) / 15);

		iTempValue *= AI_commerceWeight((CommerceTypes)iI);

		if ((iI == COMMERCE_CULTURE) && bCultureVictory2)
		{
		    iTempValue *= 2;
		    if (bCultureVictory3)
		    {
		        iTempValue *= 2;		        
		    }
		}
		iTempValue /= 100;

		iValue += iTempValue;
	}

	for (iI = 0; iI < GC.getNumBuildingClassInfos(); iI++)
	{
		if (kCivic.getBuildingHappinessChanges(iI) != 0)
		{
			iValue += (kCivic.getBuildingHappinessChanges(iI) * getBuildingClassCount((BuildingClassTypes)iI) * 3);
		}
	}

	for (iI = 0; iI < GC.getNumFeatureInfos(); iI++)
	{
		iHappiness = kCivic.getFeatureHappinessChanges(iI);

		if (iHappiness != 0)
		{
			iValue += (iHappiness * countCityFeatures((FeatureTypes)iI) * 5);
		}
	}

	for (iI = 0; iI < GC.getNumHurryInfos(); iI++)
	{
		if (kCivic.isHurry(iI))
		{
			iTempValue = 0;

			if (GC.getHurryInfo((HurryTypes)iI).getGoldPerProduction() > 0)
			{
				iTempValue += ((((AI_avoidScience()) ? 50 : 25) * getNumCities()) / GC.getHurryInfo((HurryTypes)iI).getGoldPerProduction());
			}
			iTempValue += (GC.getHurryInfo((HurryTypes)iI).getProductionPerPopulation() * getNumCities() * (bWarPlan ? 2 : 1)) / 5;
			iValue += iTempValue;
		}
	}

	for (iI = 0; iI < GC.getNumSpecialBuildingInfos(); iI++)
	{
		if (kCivic.isSpecialBuildingNotRequired(iI))
		{
			iValue += ((getNumCities() / 2) + 1); // XXX
		}
	}

	for (iI = 0; iI < GC.getNumSpecialistInfos(); iI++) 
	{ 
		iTempValue = 0; 
		if (kCivic.isSpecialistValid(iI)) 
		{ 
			iTempValue += ((getNumCities() *  (bCultureVictory3 ? 10 : 1)) + 6);
		} 
		iValue += (iTempValue / 2); 
	} 

	if (GC.getLeaderHeadInfo(getPersonalityType()).getFavoriteCivic() == eCivic)
	{
		if (!kCivic.isStateReligion() || iHighestReligionCount > 0)
		{
			iValue *= 5; 
			iValue /= 4; 
			iValue += 6 * getNumCities();
			iValue += 20; 
		}
	}

	if (AI_isDoStrategy(AI_STRATEGY_CULTURE2) && (GC.getCivicInfo(eCivic).isNoNonStateReligionSpread()))
	{
	    iValue /= 10;	    
	}

	return iValue;
}[/SIZE]
 
Damn, they just had to throw in so much randomness to prevent good players from getting a solid edge on this. I can only assume the free-speech votes works in pretty much the same, if not erratic pattern.
 
stop dan....you make my brain bleed. I am old and all that computer lingo voodoo scares me.
 
Top Bottom