historix69
Oct 01, 2008, 03:04 PM
Hi,
I found following variables in file "CIV4UnitInfos.xml".
- iImmigrationWeight
- iImmigrationWeightDecay
Does anybody know the meaning of these values?
GVBN
Oct 01, 2008, 05:35 PM
Both are used here. I don't know C++ but to me it seems that iImmigrationWeight is the initial iWeight for the unit and iImmigrationWeightDecay lowers the value for every same type of unit already immigrated
UnitTypes CvPlayer::pickBestImmigrant()
{
std::vector<int> aiWeights(GC.getNumUnitInfos(), 0);
for (int iUnitClass = 0; iUnitClass < GC.getNumUnitClassInfos(); ++iUnitClass)
{
UnitTypes eUnit = (UnitTypes) GC.getCivilizationInfo(getCivilizationType()).getC ivilizationUnits(iUnitClass);
if (NO_UNIT != eUnit)
{
int iWeight = GC.getUnitInfo(eUnit).getImmigrationWeight();
for (int i = 0; i < getUnitClassImmigrated((UnitClassTypes) iUnitClass); ++i)
{
iWeight *= std::max(0, 100 - GC.getUnitInfo(eUnit).getImmigrationWeightDecay()) ;
iWeight /= 100;
}
aiWeights[eUnit] += iWeight;
}
}
UnitTypes eBestUnit = (UnitTypes) GC.getGameINLINE().getSorenRand().pickValue(aiWeig hts, "pick immigrant");
FAssert(NO_UNIT != eBestUnit);
if (eBestUnit != NO_UNIT)
{
changeUnitClassImmigrated((UnitClassTypes) GC.getUnitInfo(eBestUnit).getUnitClassType(), 1);
}
return eBestUnit;
}
Polobo
Oct 02, 2008, 12:30 AM
Not quite sure on the exact mechanics but it seems to use the two numbers in concert to affect when (and how long) a particular unit will appear on the selection area. Scouts, which have a high initial and a high decay will appear early and will be rare later in the game. Similar, but lesser degree, for preachers - which are less useful as cross requirements increase. The non-professions and core professions seem to be setup to remain constant throughout the game and they remain useful throughout.
We would need to see the changeUnitClassImmigrated(UnitClassTypes, Integer(+1)) to see what influence having an immigrant of a specific types has on getting a second one of the same type to immigrate.