UGO
Civilization Fanatics' Center  

Go Back   Civilization Fanatics' Center > Strategy

General

Civilization IV

Civilization IV: Colonization

Civilization Revolution

Civilization III

Civilization II

Civilization I

 
Royal Expeditionary Force Growth Mechanics
By dilandau at 2008-10-08 00:00
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
<iTrainPercent>
Quick/Normal/Epic/Marathon
75/100/150/300

Civ4EraInfos.xml
<iTrainPercent>
Discovery/Expansion/Colonial/Independence
100/100/100/100

Civ4HandicapInfo.xml
Pilgrim/Pioneer/Explorer/Conquistador/Governor/Patriot/Revolutionary
<iAITrainPercent>
160/110/100/90/75/60/50
<iAIKingUnitThresholdPercent>
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 updated 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(Y IELD_BELLS));
}

//update revolution unit bells
if (!isInRevolution())
{
changeBellsStored(iBellsRate);
if (getBellsStored() >= revolutionEuropeUnitThreshold() && iBellsRate > GC.getCivilizationInfo(getCivilizationType()).getF reeYields(YIELD_BELLS))
{
changeBellsStored(-revolutionEuropeUnitThreshold());
setRevolutionEuropeUnitThresholdMultiplier((getRev olutionEuropeUnitThresholdMultiplier() * (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<int> 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_MODIF IER"));
}
}
}

if (iNumFreeUnits > 0)
{
int iIndex = GC.getGameINLINE().getSorenRand().pickValue(aiUnit Weights, "Pick Expeditionary force unit");
int iUnitClass = kCivilizationInfo.getCivilizationFreeUnitsClass(iI ndex);
ProfessionTypes eUnitProfession = (ProfessionTypes) kCivilizationInfo.getCivilizationFreeUnitsProfessi on(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).getTextKeyWi de();
}
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_TE XT"));
}
}
}
}
}


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()).getF reeYields(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) RevolutionEuropeUnitThresholdMultiplier
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) revolutionEuropeUnitThreshold
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_THRESHOL D") * std::max(0, (getRevolutionEuropeUnitThresholdMultiplier()))) / 100);

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

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

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

if (!isHuman())
{
iThreshold *= GC.getHandicapInfo(GC.getGameINLINE().getHandicapT ype()).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
  • Pilgrim: 109.1
  • Pioneer: 75
  • Explorer: 68.2
  • Conquistador: 61.4
  • Governor: 51.1
  • Patriot: 40.9
  • Revolutionary: 34.1

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


Discuss this article on the forums

 
Who's online
There are currently 152 users and 453 guests online.

Advertisement

Marketplace

Miscellaneous

Hosted Sites

Affiliates

Hosted By

Share
Bookmark and Share



All times are GMT -6. The time now is 09:18 PM.


Powered by vBulletin®
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
This site is copyright © 2000 - 2009, Civilization Fanatics' Center.
Support CFC: Amazon.com | EB Games | Amazon UK | Amazon DE | Amazon CA | Amazon FR