City Size = Population ?

kiwitt

Road to War Modder
Joined
Jan 11, 2006
Messages
5,599
Location
Auckland, NZ (GMT+12)
I have been searching for ages for a formula that I can use to calculate city size, but can't find it.

Can anyone explain this ? as I would like to edit my map to reflect actual population sizes.
 
These are the values I have so far.

1- 1000
2- 6000
3- 21000
4- 48000
5- 90000
6- 150000
7- 232000
8- 337000
9- 469000
10- 630000
11- 823000
12- 1051000
 
There does not appear to be a discernable pattern
 
Given your starting population, take population^2.8 and round it down - remove everything after the decimal point. Multiply by 1000. That's your city size.
 
Thanks for that.
Code:
1	1000
2	6000
3	21000
4	48000
5	90000
6	150000
7	232000
8	337000
9	469000
10	630000
11	823000
12	1051000
13	1315000
14	1618000
15	1963000
16	2352000
17	2787000
18	3271000
19	3806000
20	4394000
21	5037000
22	5738000
23	6498000
24	7321000
25	8207000
26	9160000
27	10181000
28	11273000
29	12436000
30	13675000
31	14990000
33	17858000
32	16384000
34	19415000
35	21056000
36	22784000
37	24601000
38	26509000
39	28508000
40	30603000

Formula is Population = ( INT ( "City Size" ^ 2.8 ) x 1000)
 
I was looking in the API for a method of fetching the population value and found CyCity.visiblePopulation() - it returns a integer value. The question is what that value corresponds to?
 
Code:
int CvCity::visiblePopulation() const
{
	return (getPopulation() - angryPopulation() - getWorkingPopulation());
}
It returns the number of specialists (including citizen)
 
Which file are the Python extension function/methods defined in? Because it would be useful to be able to look these things up for oneself... (And maybe I could gain some insight into the C++ stuff while I'm at it.)
 
What I just pasted is from CvCity.cpp (SDK/CvGameCoreDLL) and that function is exposed to python in CyCity.cpp
 
Aha, so the CvCity.cpp file is what the C++ code uses, and CyCity.cpp is part of what is imported with:
Code:
import CvPythonExceptions
Right?

What are the .h files?
 
That actually makes sense. I'll revisit the whole C++ thing when I have the chance.
 
My city population is totally messed up. I have no idea what's going on. I'm toward the end of a game and one of my city's has a size over 40, with only a few million as the population.

I'm using the ROM new dawn mod and here is the code from that .cpp file. I can't see a problem in the formula:


void CvCity::changePopulation(int iChange)
{
setPopulation(getPopulation() + iChange);
}


long CvCity::getRealPopulation() const
{
return (((long)(pow((float)getPopulation(), 2.8f))) * 1000);
}

int CvCity::getHighestPopulation()
{
return m_iHighestPopulation;
}


void CvCity::setHighestPopulation(int iNewValue)
{
m_iHighestPopulation = iNewValue;
FAssert(getHighestPopulation() >= 0);
}


int CvCity::getWorkingPopulation()
{
return m_iWorkingPopulation;
}


void CvCity::changeWorkingPopulation(int iChange)
{
m_iWorkingPopulation = (m_iWorkingPopulation + iChange);
FAssert(getWorkingPopulation() >= 0);
}
 
Could you post examples of population points and corresponding real population?

A 40 pop city should be around 30 million people.
 
Top Bottom