World Congress votes needed for Diplo Victory

Joined
Sep 8, 2007
Messages
375
Location
Canada
In BNW, I've seen people saying various formulas for how many votes are needed for a diplo victory, and things like "killing a CS reduces the number of votes needed by 1", and that it is based on number of players to begin with.

I've looked in CIV5Resolutions.xml, and that has not given me a formula, but it must be coded somewhere, yes?

Does anyone know where exactly it can be found?


This is coming off the heels of me reading someone's post that said it is ~32 -1/CS killed, and I just had a MP game yesterday, and at the end there were 3 civs and 9 CS on the map, and it wanted 36 votes to win.

Thoughts anyone?
 
Be my guest:

Code:
/// Update diplo victory parameters, such as how many votes are needed to win
void CvGame::DoUpdateDiploVictory()
{
	int iVotesForHost = 1;
	int iVotesPerCiv = 1;
	int iVotesPerCityState = 1;
	for (int i = 0; i < GC.getNumLeagueSpecialSessionInfos(); i++)
	{
		LeagueSpecialSessionTypes e = (LeagueSpecialSessionTypes)i;
		CvLeagueSpecialSessionEntry* pInfo = GC.getLeagueSpecialSessionInfo(e);
		CvAssert(pInfo != NULL);
		if (pInfo != NULL)
		{
			if (pInfo->IsUnitedNations())
			{
				iVotesForHost = pInfo->GetHostDelegates();
				iVotesPerCiv = pInfo->GetCivDelegates();
				iVotesPerCityState = pInfo->GetCityStateDelegates();
			}
		}
	}

	float fCivsToCount = 0.0f;
	float fCityStatesToCount = 0.0f;
	for (uint i = 0; i < MAX_CIV_PLAYERS; i++)
	{
		PlayerTypes e = (PlayerTypes)i;
		CvPlayer* pPlayer = &GET_PLAYER(e);
		if (pPlayer != NULL && pPlayer->isEverAlive())
		{
			// Minor civ
			if (pPlayer->isMinorCiv())
			{
				// Bought out does not count (they are no longer in the pool of teams, cannot be liberated, etc.)
				if (!pPlayer->GetMinorCivAI()->IsBoughtOut())
				{
					if (pPlayer->isAlive())
					{
						fCityStatesToCount += 1.0f;
					}
					else
					{
						fCityStatesToCount += 0.5f;
					}
				}
			}
			// Major civ
			else
			{
				if (pPlayer->isAlive())
				{
					fCivsToCount += 1.0f;
				}
				else
				{
					fCivsToCount += 0.5f;
				}
			}
		}
	}

	// Number of delegates needed to win increases the more civs and city-states there are in the game,
	// but these two scale differently since civs' delegates are harder to secure. These functions 
	// are based on a logarithmic regression.
	float fCivVotesPortion = (GC.getDIPLO_VICTORY_CIV_DELEGATES_COEFFICIENT() * (float)log(fCivsToCount)) + GC.getDIPLO_VICTORY_CIV_DELEGATES_CONSTANT();
	if (fCivVotesPortion < 0.0f)
	{
		fCivVotesPortion = 0.0f;
	}
	float fCityStateVotesPortion = (GC.getDIPLO_VICTORY_CS_DELEGATES_COEFFICIENT() * (float)log(fCityStatesToCount)) + GC.getDIPLO_VICTORY_CS_DELEGATES_CONSTANT();
	if (fCityStateVotesPortion < 0.0f)
	{
		fCityStateVotesPortion = 0.0f;
	}

	int iVotesToWin = (int)floor(fCivVotesPortion + fCityStateVotesPortion);
	iVotesToWin = MAX(iVotesForHost + iVotesPerCiv + 1, iVotesToWin);
	iVotesToWin = MIN(iVotesForHost + (iVotesPerCiv * (int)fCivsToCount) + (iVotesPerCityState * (int)fCityStatesToCount), iVotesToWin);

	SetVotesNeededForDiploVictory(iVotesToWin);
	GC.GetEngineUserInterface()->setDirty(LeagueScreen_DIRTY_BIT, true);
}
 
Thanks for this, do you know where
GC.getDIPLO_VICTORY_CIV_DELEGATES_COEFFICIENT()
GC.getDIPLO_VICTORY_CIV_DELEGATES_CONSTANT()
GC.getDIPLO_VICTORY_CS_DELEGATES_COEFFICIENT()
GC.getDIPLO_VICTORY_CS_DELEGATES_CONSTANT()

are defined?

so formula basically is [ Civ_Coefficient * log (alive Civs + 1/2 dead Civs) + Civs Constant ] + [ CS_Coefficient * log (alive CS + 1/2 dead CS) + CS Constant ]

with a min and max parameter, since I'm here...

Min is the greater of that above formula and: (host_votes + votes_per_civ + 1) this will be in the range of 15 to 21 depending on wonders and other resolutions

Max is the lesser of the aforementioned formula and: [ Host_votes + ( votes_per_civ * [alive Civs + 0.5 * dead Civs) + (votes per CS * [alive CS + 0.5 * dead CS]
This formula for a standard game where half of everyone is dead would be in the area of 64, which is a pretty high boundary, and so mostly i think the base formula will get used for the needed votes.
 
Usually, those are values in the XMLs... take the "get" away and you should have the name of the XML variable... use something like Notepad+ to search through entire folders and find the keys somewhere in the XML files.

Example: first one, look for a key tag of DIPLO_VICTORY_CIV_DELEGATES_COEFFICIENT()
 
Many thanks again! I seem to struggle to find things in civ 5's architecture, which is annoying cause i was good at civ 4 modding :(

anyhoo, turns out those logs are natural logarithms, or ln, and the coefficients are 1.443, 7, 16.023, and 13.758 respectively, plug in and go.
 
Where in Canada is Morgan Industries now? ;)
 
++ for the SMAC recognition.

Alberta, come to think of it, theres an awful lot of industry here, maybe a Thermal Borehole or two up in the oil sands. We'll have to rename Ft. McMurray to Morgan Processing
 
A true civver cannot let that mention pass.

BC here, fed up with the heat... miss the cool and the rain. Seriously.
 
Top Bottom