I’ve just gotten the SDK for BtS and so I want to make some use of it both for me and the community.
I’ll post the base code in spoiler tags so people without C++ knowledge don’t have to read it and people with it can correct my analysis.
By “You” and “We” I refer to your player.
By the “Enemy” or “Owner” I refer to owner of the city.
if (NO_CIVIC == eCivic)
{
for (int iCivic = 0; iCivic < GC.getNumCivicInfos(); ++iCivic)
{
if (canForceCivics(eTargetPlayer, (CivicTypes)iCivic))
{
eCivic = (CivicTypes)iCivic;
break;
}
}
}
if (NO_CIVIC != eCivic)
{
if (canForceCivics(eTargetPlayer, eCivic))
{
iMissionCost = iBaseMissionCost + (kMission.getSwitchCivicCostFactor() * GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getAnarchyPercent()) / 10000;
}
}
}[/SPOILER]
[B]7. Influence religion[/B]
Mission Cost = iCost + (iSwitchReligionCostFactor* iAnarchyPercent (from CIV4GameSpeedInfo.xml) / 10000
[B]Note: [/b]iCost is normally defined as 0 and iSwitchReligionCostFactor as 60000
[SPOILER]
else if (kMission.getSwitchReligionCostFactor() > 0)
{
// Switch Religions
ReligionTypes eReligion = (ReligionTypes)iExtraData;
if (NO_RELIGION == eReligion)
{
for (int iReligion = 0; iReligion < GC.getNumReligionInfos(); ++iReligion)
{
if (canForceReligion(eTargetPlayer, (ReligionTypes)iReligion))
{
eReligion = (ReligionTypes)iReligion;
break;
}
}
}
if (NO_RELIGION != eReligion)
{
if (canForceReligion(eTargetPlayer, eReligion))
{
iMissionCost = iBaseMissionCost + (kMission.getSwitchReligionCostFactor() * GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getAnarchyPercent()) / 10000;
}
}
}
[/SPOILER]
[B]8. Destroy Improvement[/B]
Mission Cost = iCost * iBuildPercent (from CIV4GameSpeedInfo.xml) * 0.01
[B]Note: [/B] iCost is normally defined as 75
[SPOILER]
else if (kMission.isDestroyImprovement())
{
if (NULL != pPlot && !pPlot->isCity())
{
if (pPlot->getImprovementType() != NO_IMPROVEMENT || pPlot->getRouteType() != NO_ROUTE)
{
iMissionCost = (iBaseMissionCost * GC.getGameSpeedInfo(GC.getGameINLINE().getGameSpeedType()).getBuildPercent()) / 100;
}
}
}
Mission Cost Modifier
[LIST=1]
[*]We start off with the coefficient equal to 100%
[*]We add ESPIONAGE_CITY_POP_EACH_MOD * (CityPop – 1)
[*]We add ESPIONAGE_CITY_TRADE_ROUTE_MOD if the city has trade routes with us
[*]We add ESPIONAGE_CITY_RELIGION_STATE_MOD if the city has our state religion (and the enemy DOESN’T) but we don’t have holy city, and ESPIONAGE_CITY_HOLY_CITY_MOD if we have the founding location
[*]We multiply by 1 – (YourCultureInTheCity * ESPIONAGE_CULTURE_MULTIPLIER_MOD) / max(1,OwnersCulture + YourCulture)
[*]We add the distance modifier
[*]We subtract ESPIONAGE_EACH_TURN_UNIT_COST_DECREASE * NumOfStationaryTurns (atm capped at 50)
[*]We add (ESPIONAGE_SPENDING_MULTIPLIER * (2 * targetPoints + ourPoints) / max(1,targetPoints + 2 * ourPoints)
[*]If the enemy has an active counterespionage mission against us we add 100%
[/LIST]
Then we round the value down cutting off all further decimal places.
max(x,y) means the greater of x and y
min(x,y) means the lesser of x and y
ReligionTypes eReligion = getStateReligion();
if (NO_RELIGION != eReligion)
{
int iReligionModifier = 0;
// City has Your State Religion
if (pCity->isHasReligion(eReligion))
{
if (GET_PLAYER(eTargetPlayer).getStateReligion() != eReligion)
{
iReligionModifier += GC.getDefineINT(“ESPIONAGE_CITY_RELIGION_STATE_MOD”);
}
if (hasHolyCity(eReligion))
{
iReligionModifier += GC.getDefineINT(“ESPIONAGE_CITY_HOLY_CITY_MOD”);;
}
}
This is exactly related to tech stealing costs, so I’ll make a comparison.
Before we start, I must say that while research (at a healthy rate) is possible both by cottages and specialists, espionage can’t have unlimited spies assigned and as such is forced to be generated by cottages.
It also wouldn’t hurt the guide if I posted a list of buildings enhancing both (Multiplier buildings):
Note: UB are not taken into account
1.Comparison of multplier buildings
Summary: Science Wins
Science:
[LIST]
[*]Academy (+50%) – Can only be built by a Great Scientist
[*]Monasteries (+10% each) (Meditation) – Requires religion, so I’ll count only one per city
[*]Laboratory (+25%) (Superconductors)
[*]Library (+25%) (Writing)
[*]Observatory (+25%) (Astronomy)
[*]University (+25%) (Education)
[*]Oxford University (+100%) (Education) – Requires 3 Universities, National Wonder
[/LIST]
Sums up to 260%, but with all religions can be made 300%, 2.6 :science: per 1 :commerce: is not bad.
Espionage:
[LIST]
[*]Castle (25%) (Engineering)
[*]Intelligence Agency (+50%) (Communism)
[*]Scotland Yard (+100%) – Can only be built by a great spy
[*]Jail (+50%) (Constitution)
[/LIST]
Sums up to 225%, still not so bad even when compared to science’s 260%.
Given these values, we can make a simple simulation, here shown results for numbers 1 – 30.
This can easily lead to a conclusion that SCE is more powerful as it generates more :science: from :commerce: than ECE :espionage:.
I, however, want to make sure it’s as optimal as it seems.
2. Comparison of usage Science:
While bonuses that apply to research seem quite straightforward (according to this thread.
These are (+30% * numberOfPlayersThatKnowTheTech/numbersOfPlayersWhoStartedTheMap), so max 30%, and +20% per each additional prerequisite met (max 40%). This is multiplicative with beakers, so it adds a coefficient of 1.7 (note that this is the VERY BEST possible one) in front of raw :science:.
This means that the minimal time of completion is:
t = baseTechCost / (4.42 * baseCommerce)
This is a total of 442% boost, this is huge. :goodjob:
They don’t apply to base tech cost, and so are not beneficial for EE.
Espionage:
We also assume the very best possible circumstances, still they are much easier to encounter than the science ones.
I’ll assume a near city, with 20% distance penalty.
We have trade routes with it, it has our state religion we founded, our spy’s been standing there for 5 turns. I don’t consider the espionage spending bonus, however.
100% + 20% – 20% – 25% – 50% = 25%
25% = 1/4
Therefore, we get 1/1/4 percentage bonus, which is equal to 400%.
The time needed to generate the points therefore is
t = baseTechCost / (9 * baseCommerce)
Seems good? Hell yeah! 😀
The time is 2.0362 times shorter than if we wanted to research it manually.
3.Example and conclusion
Say we want to research (or steal) advanced flight. Our city (either research or espionage) produces 30 raw :commerce: per turn. The numbers are of course not realistic but I want to show the concept.
researchTime = 5000 / (4.42 * 30) = 37.70, which in civ terms is 38 turns
espionageTime = 5000 / (9 * 30) = 18.51 => 19 turns
Our gain by stealing the tech is immense. We also have to remember that the expionage points can get +25% civic boost (nationhood), while research only +10% (free religion).
This however is not as great as it seems (slightly less :D). It is very problematic for techs you have to be the first to research in order to get additional benefits (religious techs,physics,economics,liberalism,fission,…) as tech can only be stolen when it’s arleady complete and partial progress can’t be acquired with espionage economy. It also yields problems with techs out of AI’s research path. Additionally, a super science city can easily be transformed from a specialist economy to cottage one (well, 50 turns), while the espionage one has to start cottaged.
It is, however synergistic with intensive tech brokering. And last, but not least, there is deficit espionage, which is more optimal than the deficit research, as average science boost per a building is 37.14%, while average espionage booster is as much as 56.25%. Unfortunately, the very first EE building (except courthouse which I don’t take in account as it’s not a multiplier) comes in the medieval era.
I hope that this analysis has provided you enough insight in espionage vs research that you at least try to play using it and post your results.