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.

I would like to hear your comments.

**Spoiler:**

**General Formula:**

Mission Cost = BaseMissionCost * MissionCostModifier * Number Of Players In Your Team * 0.01

**Spoiler:**

**Base mission cost:**

All the variables are taken from file CIV4EspionageMissionInfo.xml (as it is in BtS 3.13):

**1.**Stealing gold:

The amount of gold stolen is = (Target’sTotalGold * iStealTreasuryTypes / 100) * CityPopulation / Target’sTotalPopulation

**Note: ** iStealTreasuryTypes is normally defined as 100

The mission cost is then = iCost * amountOfGoldStolen / 100

**Note: **iCost is normally defined as 300

**Spoiler:**

**2. Steal Tech**

Mission Cost = iCost + ((100 + iBuyTechCostFactor) * TechBaseCost) / 100

**Note: **iCost is normally defined as 0 and iBuyTechCostFactor as 25

**Spoiler:**

**6. Influence civics**

Mission Cost = iCost + (iSwitchCivicCostFactor * iAnarchyPercent (from CIV4GameSpeedInfo.xml) / 10000

**Note: [/b]iCost is normally defined as 0 and iSwitchCivicCostFactor as 60000**

**
Mission Cost Modifier**

**Spoiler:**

[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

**NOTES:**

Default defines:

ESPIONAGE_CITY_POP_EACH_MOD = 0

ESPIONAGE_CITY_TRADE_ROUTE_MOD = -20

ESPIONAGE_CITY_RELIGION_STATE_MOD = -15

ESPIONAGE_CITY_HOLY_CITY_MOD = -25

ESPIONAGE_CULTURE_MULTIPLIER_MOD = 50

ESPIONAGE_SPENDING_MULTIPLIER = 100

ESPIONAGE_EACH_TURN_UNIT_COST_DECREASE = 10

**Spoiler:**

**City Infiltration Mission**

The thing is extremely simple and is CONSTANT for all civilizations on any given map. It only depends on speed.

PointsGenerated = iEspionagePoints * iUnitGreatWorkPercent * 0.01

iEspionagePoints from CIV4UnitInfos.xml is 3000 by default

iUnitGreatWorkPercent is from CIV4GameSpeedInfo.xml

This yields us following results for game speeds:

Quick: 0.67 * 3000 = 2010

Normal: 1.0 * 3000 = 3000

Epic: 1.5 * 3000 = 4500

Marathon: 3.0 * 3000 = 9000

**Steal Tech vs Research**

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.

**Spoiler:**

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.

Discuss this article on the forum