Royal Expeditionary Force Growth Mechanics

Spoiler for XML,Tag,Value
GlobalDefines.xml
REVOLUTION_EUROPE_UNIT_THRESHOLD 75
REVOLUTION_EUROPE_UNIT_THRESHOLD_INCREASE 10
REVOLUTION_EUROPE_UNIT_SHIP_MODIFIER -50

Civ4GameSpeedInfo.xml

Quick/Normal/Epic/Marathon
75/100/150/300

Civ4EraInfos.xml

Discovery/Expansion/Colonial/Independence
100/100/100/100

Civ4HandicapInfo.xml
Pilgrim/Pioneer/Explorer/Conquistador/Governor/Patriot/Revolutionary

160/110/100/90/75/60/50

200/200/200/200/200/200/200

1. Initial size of REF
Regulars * 8
Regular Dragoons * 4
Artillery * 4
Man-o-War * 4

2. REF growth
The growth of REF is depending on the amount of accumulated Liberty Bells.
At the beginning of each colonial player’s turn, the King will add some units to REF, if the following conditions are satisfied.
a. not in Revolution
b. the amount of accumulated Liberty Bells >= revolutionEuropeUnitThreshold
c. one of cities of this player yields at least 1 Liberty Bell

When the King is alarmed at the Rebel Sentiment in the colony, he will add some units to REF, i.e. the following actions will be executed one by one.
a. deduct revolutionEuropeUnitThreshold Liberty Bells from accumulated Liberty Bells
b. update RevolutionEuropeUnitThresholdMultiplier
c. determine the unitclass of the units added by the King
d. use the [highlight]updated[/highlight] RevolutionEuropeUnitThresholdMultiplier to determine the number of the units added by the King
e. add units to REF

Spoiler for SDK CvPlayer::doBells()

void CvPlayer::doBells()
{
if (getParent() == NO_PLAYER)
{
return;
}

int iBellsRate = getYieldRate(YIELD_BELLS);
if (iBellsRate == 0)
{
return;
}
//add bells to political points
for (int i = 0; i < GC.getNumFatherPointInfos(); ++i) { FatherPointTypes ePointType = (FatherPointTypes) i; changeFatherPoints(ePointType, iBellsRate * GC.getFatherPointInfo(ePointType).getYieldPoints(YIELD_BELLS)); } //update revolution unit bells if (!isInRevolution()) { changeBellsStored(iBellsRate); if (getBellsStored() >= revolutionEuropeUnitThreshold() && iBellsRate > GC.getCivilizationInfo(getCivilizationType()).getFreeYields(YIELD_BELLS))
{
changeBellsStored(-revolutionEuropeUnitThreshold());
setRevolutionEuropeUnitThresholdMultiplier((getRevolutionEuropeUnitThresholdMultiplier() * (100 + GC.getDefineINT(“REVOLUTION_EUROPE_UNIT_THRESHOLD_INCREASE”))) / 100);

if (NO_PLAYER != getParent())
{
CvPlayer& kParent = GET_PLAYER(getParent());
FAssert(kParent.isEurope());

CvCivilizationInfo& kCivilizationInfo = GC.getCivilizationInfo(kParent.getCivilizationType());
int iNumFreeUnits = kCivilizationInfo.getNumCivilizationFreeUnits();
std::vector aiUnitWeights(iNumFreeUnits, 100);
for (int i = 0; i < iNumFreeUnits; ++i) { int iUnitClass = kCivilizationInfo.getCivilizationFreeUnitsClass(i); UnitTypes eUnit = (UnitTypes) kCivilizationInfo.getCivilizationUnits(iUnitClass); if (eUnit == NO_UNIT) { aiUnitWeights[i] = 0; } else { if (GC.getUnitInfo(eUnit).getDomainType() == DOMAIN_SEA) { aiUnitWeights[i] += std::max(-100, GC.getDefineINT("REVOLUTION_EUROPE_UNIT_SHIP_MODIFIER")); } } } if (iNumFreeUnits > 0)
{
int iIndex = GC.getGameINLINE().getSorenRand().pickValue(aiUnitWeights, “Pick Expeditionary force unit”);
int iUnitClass = kCivilizationInfo.getCivilizationFreeUnitsClass(iIndex);
ProfessionTypes eUnitProfession = (ProfessionTypes) kCivilizationInfo.getCivilizationFreeUnitsProfession(iIndex);
UnitTypes eUnit = (UnitTypes)kCivilizationInfo.getCivilizationUnits(iUnitClass);
FAssert(eUnit != NO_UNIT);
int iNumUnits = std::max(1, getRevolutionEuropeUnitThresholdMultiplier() / 100);
for (int i = 0; i < iNumUnits; ++i) { addRevolutionEuropeUnit(eUnit, eUnitProfession); } const wchar* szUnitName; if (eUnitProfession != NO_PROFESSION) { szUnitName = GC.getProfessionInfo(eUnitProfession).getTextKeyWide(); } else { szUnitName = GC.getUnitInfo(eUnit).getTextKeyWide(); } CvWString szBuffer = gDLL->getText(“TXT_KEY_NEW_EUROPE_ARMY”, kParent.getCivilizationShortDescriptionKey(), getCivilizationShortDescriptionKey(), szUnitName, kParent.getCivilizationAdjectiveKey());
gDLL->getInterfaceIFace()->addMessage(getID(), true, GC.getEVENT_MESSAGE_TIME(), szBuffer, “AS2D_UNIT_GREATPEOPLE”, MESSAGE_TYPE_INFO, GC.getUnitInfo(eUnit).getButton(), (ColorTypes)GC.getInfoTypeForString(“COLOR_UNIT_TEXT”));
}
}
}
}
}

3. Sources of accumulated Liberty Bells
There are two ways to accumulate Liberty Bells
a. Liberty Bells yielded by your cities

Spoiler for SDK CvPlayer::getYieldRate(YieldTypes eIndex)

int CvPlayer::getYieldRate(YieldTypes eIndex) const
{
FAssertMsg(eIndex >= 0, “eIndex is expected to be non-negative (invalid Index)”);
FAssertMsg(eIndex < NUM_YIELD_TYPES, "eIndex is expected to be within maximum bounds (invalid Index)"); if (getNumCities() == 0) { return 0; } int iTotalRate = GC.getCivilizationInfo(getCivilizationType()).getFreeYields(eIndex); int iLoop; for (CvCity* pLoopCity = firstCity(&iLoop); pLoopCity != NULL; pLoopCity = nextCity(&iLoop)) { iTotalRate += pLoopCity->calculateNetYield(eIndex);
}

return iTotalRate;
}

b. the gold you paid for purchasing Veteran Soldiers or Cannons from the King

Spoiler for SDK CvPlayer::buyUnitsFromKing()

void CvPlayer::buyUnitsFromKing()
{
PlayerTypes eParent = getParent();
if (eParent == NO_PLAYER)
{
return;
}

CvPlayer& kParent = GET_PLAYER(eParent);

int iNumUnits;
UnitTypes eUnit;
ProfessionTypes eProfession;
int iPrice = kParent.AI_militaryHelp(getID(), iNumUnits, eUnit, eProfession);

int iPriceModifier = GC.getDefineINT(“KING_BUY_UNIT_PRICE_MODIFIER”);
for (int i = 0; i < iNumUnits; ++i) { CvUnit* pUnit = buyEuropeUnit(eUnit, iPriceModifier); if (pUnit != NULL) { pUnit->setProfession(eProfession);
}
}

if (iNumUnits > 0)
{
changeBellsStored(iNumUnits * getEuropeUnitBuyPrice(eUnit) * iPriceModifier / 100);
}
}


Both exchange rates are 1:1.
For example, you paid 750 gold for the first Veteran Soldier from the King, then the amount of accumulated Liberty Bells increased 750.

4. Explanation on revolutionEuropeUnitThreshold and RevolutionEuropeUnitThresholdMultiplier
(1) [highlight]RevolutionEuropeUnitThresholdMultiplier[/highlight]
The initial value of RevolutionEuropeUnitThresholdMultiplier is 100.
The game updates your RevolutionEuropeUnitThresholdMultiplier when and only when the King adds units to REF.
The formula is:
(new RevolutionEuropeUnitThresholdMultiplier) = (old RevolutionEuropeUnitThresholdMultiplier) * 110%

(2) [highlight]revolutionEuropeUnitThreshold[/highlight]
revolutionEuropeUnitThreshold = 75 * RevolutionEuropeUnitThresholdMultiplier / 100 * (Speed)iTrainPercent / 100 * (Era)iTrainPercent / 100 * iAITrainPercent / 100 ((for computer player) * iAIKingUnitThresholdPercent / 100)

Suppose GameSpeed = Normal and player = Human, the formula can be simplified to
revolutionEuropeUnitThreshold = 75 * RevolutionEuropeUnitThresholdMultiplier / 100 * iAITrainPercent / 100

Spoiler for SDK CvPlayer::revolutionEuropeUnitThreshold()

int CvPlayer::revolutionEuropeUnitThreshold() const
{
int iThreshold = ((GC.getDefineINT(“REVOLUTION_EUROPE_UNIT_THRESHOLD”) * std::max(0, (getRevolutionEuropeUnitThresholdMultiplier()))) / 100);

iThreshold *= GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getTrainPercent();
iThreshold /= 100;

iThreshold *= GC.getEraInfo(GC.getGameINLINE().getStartEra()).getTrainPercent();
iThreshold /= 100;

iThreshold *= GC.getHandicapInfo(getHandicapType()).getAITrainPercent();
iThreshold /= 100;

if (!isHuman())
{
iThreshold *= GC.getHandicapInfo(GC.getGameINLINE().getHandicapType()).getAIKingUnitThresholdPercent();
iThreshold /= 100;
}

return std::max(1, iThreshold);
}

5. The number and unitclass of incremental REF
(1) The number of the units added by the King = [(updated RevolutionEuropeUnitThresholdMultiplier) / 100]

(2) The unitclass of the units added by the King is randomly chosen from Regulars, Regular Dragoons, Artillery and Man-o-War. Each unitclass’ weight is equal to its initial REF unit number. Moreover, navy unitclass suffers -50% penalties.
Therefore, the probability w.r.t. Regulars, Regular Dragoons, Artillery and Man-o-War is 4/9, 2/9, 2/9 and 1/9.

6. Exchange rate between accumulated Liberty Bells and REF units
We still assume GameSpeed = Normal and player = Human.
For convenience, we ignore the rounding in calculation.

(RevolutionEuropeUnitThresholdMultiplier * 110% / 100) REF units = (75 * RevolutionEuropeUnitThresholdMultiplier / 100 * iAITrainPercent / 100) accumulated Liberty Bells

-> (RevolutionEuropeUnitThresholdMultiplier * 110% / 100) REF units = (75 * RevolutionEuropeUnitThresholdMultiplier / 100 * iAITrainPercent / 100) accumulated Liberty Bells

-> 1 REF units = iAITrainPercent * 75% / 110%

Therefore, the exchange rate between accumulated Liberty Bells and REF units is approximate equal to
[list]
[*]Pilgrim: 109.1
[*]Pioneer: 75
[*]Explorer: 68.2
[*]Conquistador: 61.4
[*]Governor: 51.1
[*]Patriot: 40.9
[*]Revolutionary: 34.1
[/list]

Corollary: It is harmful to purchase units from Kings, though they are much cheaper.

Appendix: REF growth reference table
Multiplier = updated RevolutionEuropeUnitThresholdMultiplier
Units = the number of the units added by the King
Total Units = size of REF
Difficulty = revolutionEuropeUnitThreshold = Liberty Bells needed to make REF grow

Spoiler for REF growth

#1__Multiplier=110___Units=1___Total Units=21___Pilgrim=120___Pioneer=82____Explorer=75____Conquistador=67____Governor=56____Patriot=45____Revolutionary=37
#2__Multiplier=121___Units=1___Total Units=22___Pilgrim=131___Pioneer=90____Explorer=82____Conquistador=73____Governor=61____Patriot=49____Revolutionary=41
#3__Multiplier=133___Units=1___Total Units=23___Pilgrim=144___Pioneer=99____Explorer=90____Conquistador=81____Governor=67____Patriot=54____Revolutionary=45
#4__Multiplier=146___Units=1___Total Units=24___Pilgrim=158___Pioneer=108___Explorer=99____Conquistador=89____Governor=74____Patriot=59____Revolutionary=49
#5__Multiplier=160___Units=1___Total Units=25___Pilgrim=174___Pioneer=119___Explorer=109___Conquistador=98____Governor=81____Patriot=65____Revolutionary=54
#6__Multiplier=176___Units=1___Total Units=26___Pilgrim=192___Pioneer=132___Explorer=120___Conquistador=108___Governor=90____Patriot=72____Revolutionary=60
#7__Multiplier=193___Units=1___Total Units=27___Pilgrim=211___Pioneer=145___Explorer=132___Conquistador=118___Governor=99____Patriot=79____Revolutionary=66
#8__Multiplier=212___Units=2___Total Units=29___Pilgrim=230___Pioneer=158___Explorer=144___Conquistador=129___Governor=108___Patriot=86____Revolutionary=72
#9__Multiplier=233___Units=2___Total Units=31___Pilgrim=254___Pioneer=174___Explorer=159___Conquistador=143___Governor=119___Patriot=95____Revolutionary=79
#10_Multiplier=256___Units=2___Total Units=33___Pilgrim=278___Pioneer=191___Explorer=174___Conquistador=156___Governor=130___Patriot=104___Revolutionary=87
#11_Multiplier=281___Units=2___Total Units=35___Pilgrim=307___Pioneer=211___Explorer=192___Conquistador=172___Governor=144___Patriot=115___Revolutionary=96
#12_Multiplier=309___Units=3___Total Units=38___Pilgrim=336___Pioneer=231___Explorer=210___Conquistador=189___Governor=157___Patriot=126___Revolutionary=105
#13_Multiplier=339___Units=3___Total Units=41___Pilgrim=369___Pioneer=254___Explorer=231___Conquistador=207___Governor=173___Patriot=138___Revolutionary=115
#14_Multiplier=372___Units=3___Total Units=44___Pilgrim=406___Pioneer=279___Explorer=254___Conquistador=228___Governor=190___Patriot=152___Revolutionary=127
#15_Multiplier=409___Units=4___Total Units=48___Pilgrim=446___Pioneer=306___Explorer=279___Conquistador=251___Governor=209___Patriot=167___Revolutionary=139
#16_Multiplier=449___Units=4___Total Units=52___Pilgrim=489___Pioneer=336___Explorer=306___Conquistador=275___Governor=229___Patriot=183___Revolutionary=153
#17_Multiplier=493___Units=4___Total Units=56___Pilgrim=537___Pioneer=369___Explorer=336___Conquistador=302___Governor=252___Patriot=201___Revolutionary=168
#18_Multiplier=542___Units=5___Total Units=61___Pilgrim=590___Pioneer=405___Explorer=369___Conquistador=332___Governor=276___Patriot=221___Revolutionary=184
#19_Multiplier=596___Units=5___Total Units=66___Pilgrim=649___Pioneer=446___Explorer=406___Conquistador=365___Governor=304___Patriot=243___Revolutionary=203
#20_Multiplier=655___Units=6___Total Units=72___Pilgrim=715___Pioneer=491___Explorer=447___Conquistador=402___Governor=335___Patriot=268___Revolutionary=223
#21_Multiplier=720___Units=7___Total Units=79___Pilgrim=785___Pioneer=540___Explorer=491___Conquistador=441___Governor=368___Patriot=294___Revolutionary=245
#22_Multiplier=792___Units=7___Total Units=86___Pilgrim=864___Pioneer=594___Explorer=540___Conquistador=486___Governor=405___Patriot=324___Revolutionary=270
#23_Multiplier=871___Units=8___Total Units=94___Pilgrim=950___Pioneer=653___Explorer=594___Conquistador=534___Governor=445___Patriot=356___Revolutionary=297
#24_Multiplier=958___Units=9___Total Units=103__Pilgrim=1044__Pioneer=718___Explorer=653___Conquistador=587___Governor=489___Patriot=391___Revolutionary=326
#25_Multiplier=1053__Units=10__Total Units=113__Pilgrim=1148__Pioneer=789___Explorer=718___Conquistador=646___Governor=538___Patriot=430___Revolutionary=359
#26_Multiplier=1158__Units=11__Total Units=124__Pilgrim=1262__Pioneer=867___Explorer=789___Conquistador=710___Governor=591___Patriot=473___Revolutionary=394
#27_Multiplier=1273__Units=12__Total Units=136__Pilgrim=1388__Pioneer=954___Explorer=868___Conquistador=781___Governor=651___Patriot=520___Revolutionary=434
#28_Multiplier=1400__Units=14__Total Units=150__Pilgrim=1526__Pioneer=1049__Explorer=954___Conquistador=858___Governor=715___Patriot=572___Revolutionary=477
#29_Multiplier=1540__Units=15__Total Units=165__Pilgrim=1680__Pioneer=1155__Explorer=1050__Conquistador=945___Governor=787___Patriot=630___Revolutionary=525
#30_Multiplier=1694__Units=16__Total Units=181__Pilgrim=1848__Pioneer=1270__Explorer=1155__Conquistador=1039__Governor=866___Patriot=693___Revolutionary=577
#31_Multiplier=1863__Units=18__Total Units=199__Pilgrim=2032__Pioneer=1397__Explorer=1270__Conquistador=1143__Governor=952___Patriot=762___Revolutionary=635
#32_Multiplier=2049__Units=20__Total Units=219__Pilgrim=2235__Pioneer=1536__Explorer=1397__Conquistador=1257__Governor=1047__Patriot=838___Revolutionary=698
#33_Multiplier=2253__Units=22__Total Units=241__Pilgrim=2457__Pioneer=1689__Explorer=1536__Conquistador=1382__Governor=1152__Patriot=921___Revolutionary=768
#34_Multiplier=2478__Units=24__Total Units=265__Pilgrim=2702__Pioneer=1857__Explorer=1689__Conquistador=1520__Governor=1266__Patriot=1013__Revolutionary=844
#35_Multiplier=2725__Units=27__Total Units=292__Pilgrim=2972__Pioneer=2043__Explorer=1858__Conquistador=1672__Governor=1393__Patriot=1114__Revolutionary=929
#36_Multiplier=2997__Units=29__Total Units=321__Pilgrim=3268__Pioneer=2247__Explorer=2043__Conquistador=1838__Governor=1532__Patriot=1225__Revolutionary=1021
#37_Multiplier=3296__Units=32__Total Units=353__Pilgrim=3595__Pioneer=2471__Explorer=2247__Conquistador=2022__Governor=1685__Patriot=1348__Revolutionary=1123
#38_Multiplier=3625__Units=36__Total Units=389__Pilgrim=3955__Pioneer=2719__Explorer=2472__Conquistador=2224__Governor=1854__Patriot=1483__Revolutionary=1236
#39_Multiplier=3987__Units=39__Total Units=428__Pilgrim=4348__Pioneer=2989__Explorer=2718__Conquistador=2446__Governor=2038__Patriot=1630__Revolutionary=1359
#40_Multiplier=4385__Units=43__Total Units=471__Pilgrim=4784__Pioneer=3289__Explorer=2990__Conquistador=2691__Governor=2242__Patriot=1794__Revolutionary=1495
Discuss this article on the forums