How to change the number of population displayed?

Ploeperpengel

academic precarity
Joined
Feb 2, 2006
Messages
4,748
Location
Berlin
In medieval or fantasy setting having millions of citizens just doesn't meet the flavor. So how can I change the number of population displayed(let's say divided by 10) whereever it occurs(demographics, cityscreen, sid's notification of reached population) without changing any mechanics dependend on the population count?
 
I not exactly sure what you are wanting to accomplish.

Are you wanting to change all the places it has the city's game population from 1, 2, 9, 13, ect to a more realistic number?

Or are you wanting to change the text in the flying help popup in the City Screen that, when you put your cursor over it, it tells a "real" population number?
 
I not exactly sure what you are wanting to accomplish.

Are you wanting to change all the places it has the city's game population from 1, 2, 9, 13, ect to a more realistic number?

Or are you wanting to change the text in the flying help popup in the City Screen that, when you put your cursor over it, it tells a "real" population number?

I think he means to change whatever number the "population number" (the one attached to a city) is multiplied by to get the "actual population" (the number displayed when you get a milestone pop up or in the demographics screen).

Sorry to butt in by the way, but I have a vested interest in doing the same (or rather, the opposite) for futuristic cities.
 
Ok, I did some research, I hadn't realized there were population milestone popups in Civ4, but it turns out that they are turned off in MP and that is really all I've ever played.

I'm basing this all on BtS v3.13 files, but it should be the same in all versions to date.

Alright, the population popups is pretty easy.

Open /Assets/Python/CvAdvisorUtils.py

Find
Code:
def endTurnFeats(iPlayer):

	lRealPopulation = gc.getPlayer(iPlayer).getRealPopulation()

	if (lRealPopulation > 500000):
		populationFeat(iPlayer, FeatTypes.FEAT_POPULATION_HALF_MILLION, "TXT_KEY_FEAT_HALF_MILLION")
	if (lRealPopulation > 1000000):
		populationFeat(iPlayer, FeatTypes.FEAT_POPULATION_1_MILLION, "TXT_KEY_FEAT_1_MILLION")
	if (lRealPopulation > 2000000):
		populationFeat(iPlayer, FeatTypes.FEAT_POPULATION_2_MILLION, "TXT_KEY_FEAT_2_MILLION")
	if (lRealPopulation > 5000000):
		populationFeat(iPlayer, FeatTypes.FEAT_POPULATION_5_MILLION, "TXT_KEY_FEAT_5_MILLION")
	if (lRealPopulation > 10000000):
		populationFeat(iPlayer, FeatTypes.FEAT_POPULATION_10_MILLION, "TXT_KEY_FEAT_10_MILLION")
	if (lRealPopulation > 20000000):
		populationFeat(iPlayer, FeatTypes.FEAT_POPULATION_20_MILLION, "TXT_KEY_FEAT_20_MILLION")
	if (lRealPopulation > 50000000):
		populationFeat(iPlayer, FeatTypes.FEAT_POPULATION_50_MILLION, "TXT_KEY_FEAT_50_MILLION")
	if (lRealPopulation > 100000000):
		populationFeat(iPlayer, FeatTypes.FEAT_POPULATION_100_MILLION, "TXT_KEY_FEAT_100_MILLION")
	if (lRealPopulation > 200000000):
		populationFeat(iPlayer, FeatTypes.FEAT_POPULATION_200_MILLION, "TXT_KEY_FEAT_200_MILLION")
	if (lRealPopulation > 500000000):
		populationFeat(iPlayer, FeatTypes.FEAT_POPULATION_500_MILLION, "TXT_KEY_FEAT_500_MILLION")
	if (lRealPopulation > 1000000000):
		populationFeat(iPlayer, FeatTypes.FEAT_POPULATION_1_BILLION, "TXT_KEY_FEAT_1_BILLION")
	if (lRealPopulation > 2000000000):
		populationFeat(iPlayer, FeatTypes.FEAT_POPULATION_2_BILLION, "TXT_KEY_FEAT_2_BILLION")

If you mess with the numbers in the if statements, do your math to gc.getPlayer(iPlayer).getRealPopulation(), and change the TXT_KEYs it is passed, you should be able to do what you are suggesting.

The one thing I see is that this calls the CyPlayer getRealPopulation method which I am assuming gets your total pop of all cities. You may have to do a loop through all the player's cities and do your math to each of their getRealPopulations.


Um, next was the demographics tab in the Info Screen.

Open /Assets/Python/Screens/CvInfoScreen.py

Find the drawTextChart method and find the two places that call getRealPopulation. Again this is calling a player's getRealPopulation, so you may have to replace the single line with a for loop that cycles the player's cities.


Last that leaves the flying help test when you hold your cursor over the name of a city in the City Screen. Bad news I pretty sure this widget is made in SDK and we can't change it in python.


Now forget that number we are replacing. What we are going to start with is CyCity.getPopulation(). This will give us the number of citizens in a city you have to use for specialists and to work tiles. This is the number that you see on the billboard attached to the city graphic on the main game screen.

If you want each game person to be 10 "real" people, then
Code:
cityRealPop = pCity.getPopulation() * 10

That help?
 
Thx Jeckel. That helped me finding the entrypoint (I believe). getRealPopulation seems to be calculated in cvCity.cpp:
Code:
long CvCity::getRealPopulation() const
{
	return (((long)(pow((float)getPopulation(), 2.8f))) * [B]1000[/B]);
}
I guess by changing the last number that would affect all places this is called? Or are there functions in python which don't get this number from SDK?

Edit: also thank you very much for finding the functions to change in the screens I was totally clueless about that
 
Yep, if your using a modded DLL then changing that one function in the SDK should fix it in all the places it is called and you won't have to do anything in python except change the population feat popups. :)
 
steady growth is exponential. the exponent they used is pretty realistic. a size 20 city is about 4 million. 24 is 7 mil (say NYC). 10 is 600k.

so it depends on your target population. if you want a size 20 city to be 1 million, then instead of *1000 , you use *250.
 
steady growth is exponential. the exponent they used is pretty realistic. a size 20 city is about 4 million. 24 is 7 mil (say NYC). 10 is 600k.

so it depends on your target population. if you want a size 20 city to be 1 million, then instead of *1000 , you use *250.
No real target here but I'm happy with *100 it's a fantasymod no need for absolute realism;)
 
Back
Top Bottom