As for the costs as they are now? Looks like I have to research the variables here further.
Well, this proves to be quite complex and tied to other factors in the game intrinsically.
Code:
int iPopulation = GC.getDefineINT("INITIAL_CITY_POPULATION") + GC.getEraInfo(GC.getGameINLINE().getStartEra()).getFreePopulation();
for (int i = 1; i <= iPopulation; ++i)
{
iValue += (getGrowthThreshold(i) * GC.getDefineINT("ADVANCED_START_POPULATION_COST")) / 100;
}
Looking at the global INITIAL_CITY_POPULATION, it comes up as '1', which I figured it would. Usually the game would start at Prehistoric so with anything before Renaissance being set to a default of 0, then this formula only loops once.
ADVANCED_START_POPULATION_COST is 100, as suspected, so this equation really only is then determined by getGrowthThreshold(1).
The following is edited for simplicity of delivery:
Code:
int iThreshold;
iThreshold = (GC.getDefineINT("BASE_CITY_GROWTH_THRESHOLD") + (iPopulation * GC.getDefineINT("CITY_GROWTH_MULTIPLIER")));
iThreshold *= GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getGrowthPercent();
iThreshold /= 100;
iThreshold *= GC.getEraInfo(getCurrentEra()).getGrowthPercent();
iThreshold /= 100;
if (!isHuman() && !isNPC())
{
iThreshold *= GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIGrowthPercent();
iThreshold /= 100;
iThreshold *= std::max(0, ((GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIPerEraModifier() * getCurrentEra()) + 100));
iThreshold /= 100;
}
if (isGoldenAge())
{
iThreshold *= (100 + GC.getDefineINT("GOlDEN_AGE_PERCENT_LESS_FOOD_FOR_GROWTH"));
iThreshold /= 100;
}
return std::max(1, iThreshold);
This all ties into not only the settler cost but also the actual growth of cities, so that very interestingly, growth of tall vs wide national expansion development is interconnected and tied to the same balance factors. I never realized that being in a golden age doesn't only make it much faster to grow population in a city if you can reach the next pop during the golden age, but also that it makes it much faster to train the next settler unit. Hmm... that's a strategy note for sure right there.
I guess all this means, yes, the cost of settlers is intentionally much higher than that of other units around them and is calculated from the same factors that control the growth of a new population. I don't see any clean way to adjust this without messing up population growth rates as well. Maybe its best they ARE so expensive. Certainly helps to make the race to expand a bit tougher and enhances the value of those traits that slash the cost of settler units.
Another interesting observation in all this. Rax said they react stronger to gamespeed... that's because gamespeed affects BOTH the production cost modifier for training AND the growth rate modifier for determining the base value of the initial population they give as it factors into the automatic determination of base cost for the unit.
Note that if a settler unit HAS an iCost, it just adds that amount to the base cost in the production cost formula so just means 'extra base cost' in such a case. A unit that can settle is defined by the tag bFound.
The bFood just means that regardless of the civics the player is on (some of which make ALL units count as if bFood is 1), food is made extra production when this unit is trained, but is rerouted in that city away from growth while the unit is being trained.