[MOD] How to change city growth threshold?

ADHansa

Warlord
Joined
Jan 26, 2006
Messages
154
Is there a simple way to just change it at standard settings from 200 to 250, without changing any other parameters. I managed to do it by changing iGrowthPercent in game Gamespeedinfo, but that changes so much else at the same time, so i hope there is a better way..

I am familiar with changing xml code to mod the game to my liking, but the dll i prefer to stay clear from.

The reason why i want to it is that with 5*5 cities, health, butchering, granaries, watermills i feel i want to slow down population increase and nerf food-cities a bit in my games without pacing down other things like immigration, education, construction.
 
The vanilla growth code (which I assume is unchanged in all mods)
PHP:
iThreshold = (GC.getDefineINT("BASE_CITY_GROWTH_THRESHOLD") + (iPopulation * GC.getDefineINT("CITY_GROWTH_MULTIPLIER")));
This means the base growth threshold is based on the following two variables from GlobalDefineALT:
PHP:
    <Define>
       <DefineName>BASE_CITY_GROWTH_THRESHOLD</DefineName>
       <iDefineIntVal>200</iDefineIntVal>
   </Define>
    <Define>
       <DefineName>CITY_GROWTH_MULTIPLIER</DefineName>
       <iDefineIntVal>0</iDefineIntVal>
   </Define>
The multiplier appears to be something, which has been left from civ4 and setting it to 0 is the quick way to disable it.

In short, change BASE_CITY_GROWTH_THRESHOLD and you change the number the game use before applying modifiers from items like game speed. Also it looks like it will only affect growth threshold, nothing else.
 
Worked like a charm, would never had figured that out on my own.
Found that first code line and guessed it would have something to do with it, but where to go from there was beyond my programming understanding capacity.
A big thank you.
 
One of the first things you should know about DLL source reading is that getDefineINT() looks up the string in XML and returns an int, which the xml file assigns to that string. Either this is globalDefines or it can be a Type, in which case the int is the index of the element with that type. In short numbers read with getDefineINT() should be changable from XML if you can find the place where the string is defined.

For most purposes modders can think of getDefineINT as reading directly from XML. What it is actually doing is caching all the ints in a hash table with the strings as lookup keys. You can look up hash tables if you like, but you don't really need to know this unless you want to do advanced DLL modding.
 
Top Bottom