Calculating Score

royal62184

Prince
Joined
Aug 22, 2007
Messages
312
Location
Oak Ridge, TN
I got bored recently and decided to try and figure out how to calculate my score and to determine what I could do to improve my score. I tried doing it myself using this as a reference so I take no credit for these formulas:

http://forums.civfanatics.com/showpost.php?p=3354736&postcount=82

This is the score I was trying to reproduce:



This next section below is copied from the referenced link so it is all here in one post.

Parameters to determine final score all from the referenced link
initial score - based on the possible score at the end of the first turn with the units/techs supplied. For ancient era:
pop=1
land=21
tech=6
wonders=0

rawScore: is the first number in the set of parenthesis shown in the above picture (ex: 1216 for population).

maxScore: the theoretical maximum rawScore for the map. The second number in the set of parenthesis shown in the above picture (ex: 945 for pop).

factor: a weighting for the individual score components. These factors by default are:
pop=5000
land=2000
tech=2000
wonders=1000

currentTurn: the current turn number.

maxTurn: The turn limit for the game.

The following are the formulas for calculating the score components.

For unfinished or losing games:


For pop/land/tech/components on the turn you win where initialScore is not 0:


For the wonders component of winning game, or for pop/land/tech components for the turn you win the game where initialScore is 0:


My attempted calculations
The attached save is of the turn I won if you need it for any additional information for whatever reason. On the victory screen it said 665 turns left and this is marathon speed, standard map, on emperor on BTS. Therefore current turn is 1500-665=835

The calculation for the base raw score (9792 on screenshot)
Pop = 5000*(1216/945) = 6433.86
Land = 2000*(756/1254) = 1205.74
Tech = 2000*(236/334) = 1413.17
Wonders = 1000*(230/310) = 741.935

6433.86+1205.74+1413.17+741.935=9794.71 (which is incorrect)

I figured Civ IV BTS probably truncates the decimal place, so using the floor command of excel to test this:

6433+1205+1413+741 = 9792

So that part is pretty easy to get to agree with the screen shot. The winning score is the one I can't seem to verify. Here goes my attempt at the math

Population = FLOOR[5000 * 1216 / (1 * (945/1)^(835/1500))] = 134146

Land = FLOOR[2000 * 756 / (21 * (1254/21)^(835/1500))] = 7390

Tech = FLOOR[2000 * 236 / (6 * (334/6)^(835/1500))] = 8396

Wonders = FLOOR[1000 * 230 / (0 + (835/1500)*(310 - 0))] = 1332

Pop+Land+Tech+Wonders = 134146 + 7390 + 8396 +1332 = 151264

In the referenced link someone states there is a difficulty modifier:
Settler = .4
Chieftan = .6
Warlord = .8
Noble = 1
Prince = 1.2
Monarch = 1.4
Emperor = 1.6
Immortal = 1.8
Deity = 2

Therefore 151264 * 1.6 = 242022

As you can see from my screen shot my score was 242193.

I only have one idea why I'm not completing agreeing and that is initialScore. The referenced link said it was the possible score at the end of the first turn. The next picture is of my first turn after I built my first town.



The initialscores in the reference link were 1, 21, 6, 0. Should it be 1,0,2, and 5? I tried with those numbers and still couldn't to get it to agree. If the initialscore for land is 0 then I have to use the other equation to calculating raw score for a winning game.

I have a few other questions if somebody out there knows the answer:

1) How are raw scores determined? These are my guesses
Pop = 1 point per population for all your cities
Land = no idea
Tech = I think i read somewhere its 1 per tech in ancient and goes up by 1 per era
Wonders = 5 per wonder

2) I can't seem to figure what part of the score is dependent on the size of the map. The difficulty is of course handled in the multiplier at the end but where does the map size come into play. My only guess is the theoretical maxScore but I have no idea.

In the end harder difficulty, bigger map, and fast wins all attribute to the highest score attainable as i've read in other threads. It is just annoying me to no end because I can't get the numbers to agree. If anyone has done this before, which i'm assuming some hall of famers have, please help me out.
 

Attachments

  • Standard_Emperor_Darius_Dom_1816AD.CivBeyondSwordSave
    484.5 KB · Views: 50
  • First Turn_After City Build.bmp
    82.1 KB · Views: 332
  • Test.bmp
    106.9 KB · Views: 290
For what it is worth here is some python code snippets that show the calculation:

CvGameUtils.py
Code:
	def calculateScore(self,argsList):
		ePlayer = argsList[0]
		bFinal = argsList[1]
		bVictory = argsList[2]
		
		iPopulationScore = CvUtil.getScoreComponent(gc.getPlayer(ePlayer).getPopScore(), gc.getGame().getInitPopulation(), gc.getGame().getMaxPopulation(), gc.getDefineINT("SCORE_POPULATION_FACTOR"), True, bFinal, bVictory)
		iLandScore = CvUtil.getScoreComponent(gc.getPlayer(ePlayer).getLandScore(), gc.getGame().getInitLand(), gc.getGame().getMaxLand(), gc.getDefineINT("SCORE_LAND_FACTOR"), True, bFinal, bVictory)
		iTechScore = CvUtil.getScoreComponent(gc.getPlayer(ePlayer).getTechScore(), gc.getGame().getInitTech(), gc.getGame().getMaxTech(), gc.getDefineINT("SCORE_TECH_FACTOR"), True, bFinal, bVictory)
		iWondersScore = CvUtil.getScoreComponent(gc.getPlayer(ePlayer).getWondersScore(), gc.getGame().getInitWonders(), gc.getGame().getMaxWonders(), gc.getDefineINT("SCORE_WONDER_FACTOR"), False, bFinal, bVictory)
		return int(iPopulationScore + iLandScore + iWondersScore + iTechScore)

CvUtil.py
Code:
def getScoreComponent(iRawScore, iInitial, iMax, iFactor, bExponential, bFinal, bVictory):

	if gc.getGame().getEstimateEndTurn() == 0:
		return 0

	if bFinal and bVictory:
		fTurnRatio = float(gc.getGame().getGameTurn()) / float(gc.getGame().getEstimateEndTurn())
		if bExponential and (iInitial != 0):
			fRatio = iMax / iInitial
			iMax = iInitial * pow(fRatio, fTurnRatio)
		else:
			iMax = iInitial + fTurnRatio * (iMax - iInitial)

	iFree = (gc.getDefineINT("SCORE_FREE_PERCENT") * iMax) / 100
	if (iFree + iMax) != 0:
		iScore = (iFactor * (iRawScore + iFree)) / (iFree + iMax)
	else:
		iScore = iFactor
		
	if bVictory:
		iScore = ((100 + gc.getDefineINT("SCORE_VICTORY_PERCENT")) * iScore) / 100

	if bFinal:
		iScore = ((100 + gc.getDefineINT("SCORE_HANDICAP_PERCENT_OFFSET") + (gc.getGame().getHandicapType() * gc.getDefineINT("SCORE_HANDICAP_PERCENT_PER"))) * iScore) / 100

	return int(iScore)
 
Top Bottom