Appendix II: Other Algorithms


In this section...
Ruler attributes
Loyalty algorithms
Hero recruitment
Mercenary recruitment
Dungeon algorithms
Espionage algorithms
Taxes & Happiness
Population growth
Healing
Experience
Rebels
Random Events
Rating Algorithm


Ruler Attributes

There are four types of rulers. The type assigned to each nation is determined by the scenario designer at the time of scenario creation.

LeadershipMeleeStealthHealthSpotting
Conquering Herobrilliantgoodaverage63
Craven Survivorgoodaveragebrilliant65
Ruthless Thuggoodbrilliantgood83
Crafty Weaselexceptionalgoodexceptional63


Remember at all times that your ruler piece isn't just another leader, it is you. All of your work towards global domination means nothing if you find yourself on the wrong end of a spear on a battlefield.

Loyalty Checks

Check for all heroes and legends each turn (they tend to be a slimy lot):

CHECK=RND(100) - LOYALTY

If CHECK <= 0 then the leader is loyal. Otherwise:

ACTION=RND(100) + ((100 - LOYALTY)/5)

Action Table:

01-30Petty act of disloyalty. Further -1 reduction in loyalty.
31-50Embezzle 1-3 credits from treasury. Further -1 reduction in loyalty.
51-70 Offer info to enemy in return for 5 credits. Further -2 reduction in loyalty.
71-80Offer to throw battle to ruler of nearest enemy unit in return for 5 credits (negates leadership bonus for one turn). Further -3 reduction in loyalty.
81-90Hero absconds in the middle of the night with treasury gold. Player loses 5-20 credits and the hero is placed on the "legends" list.
91-99Hero offers his services to a rival player in return for initial cost of hero. Hero brings a full status report on his former ruler to his new employer. Treat as a successful Spy On Ruler mission (#8 on the Espionage menu)
100+ Lead rebellion: leader + 2-5 nearest units switch allegiance to nearest enemy. New owner gets units & leader for free.

If a leader switches sides, or disappears, his loyalty rating is adjusted to its original value. A notation is also made of his previous ruler. That hero will never work for that ruler again.

If a hero has already worked for all players in the game, then he cannot switch sides. Treat all rolls higher than 80 as if they were 80.

Calculation of hero loyalty

Each turn, a hero's loyalty is modified based on his pay, experience, and previous loyalty.

First, get three modifiers:

PayMod = PAY / UPKEEP
ExpMod = 1 / (1+(EXPERIENCE/80))
LoyMod = 0.75 + (LOYALTY/400)

To calculate new loyalty:

LOYALTY=LOYALTY + NATIONLOYALTY - 10 + (10*PayMod*ExpMod*LoyaltyMod)

Nation Loyalty is assigned to each nation type. They range from -2 (Roman) to +1 (German).

The initial loyalty modifier

Some events can cause a hero to lose loyalty. We've added a modifier based on a hero's initial loyalty so that some heroes lose loyalty faster than others. This modifier is calculated as follows:

LOYALTY MODIFIER = 1 + (((100 - INITIAL LOYALTY) * 3) / 100)

Example: for a hero with an initial loyalty of 60, the modifier is 2.2

This modifer is applied for most events that cause a loss of loyalty. For example, if the hero in the example above offers to sell information (loss of 2 loyalty) the hero would actually lose 4.4 loyalty, rounded to 4 (fractions are always dropped).

The modifier is used in the following places:

  1. Successful bribe hero missions
  2. Unsuccessful spy on hero missions
  3. All actions on the hero disloyalty table
  4. The penalty for executing heroes

The modifier is not used in the regular, turn-by-turn adjustment of loyalty listed at the beginning of this section.

Hero recruitment

There is a percentage chance each turn that a hero or legend will arrive and offer service.

CHANCE%=10 + FAME - NUMBER OF HIRED HEROES2

If the roll succeeds, and if the player has a fame above 10, there is a 20% chance the leader is randomly selected from the Legends list, if any legends are available. Otherwise, randomly select from the heroes associated with the nation in question.

If no heroes or legends are available, then the roll is a failure.

Mercenary recruitment

Each turn, mercenaries may offer their services. The chance of this occuring is:

MERCENARY%=10 + (FAME/5)

Mercenaries have a variable initial experience level. 30% of them are regular (2x initial cost), 50% of them are veteran (3x initial cost), and 20% are elite (4x initial cost). They will have the minimum number of experience points needed for each level.

The types of units which offer their services as mercenaries are given in the mercenaries section under Nations and Units.

Hired mercenaries are placed in your capital. If your capital is landlocked and you hire a mercenary ship, it will be placed in your nearest port hex.

Dungeon algorithms

Initial interrogation

SUCCESS% = 140 - LOYALTY - (0.5*EXPERIENCE) - (5*LEADERSHIP) - (2*MELEE)

Example: A hero with 80% loyalty, 30 experience, 3 leadership and 2 melee has a 26% chance of being successfully interrogated.

Release

First, check to see if leader converts:

CONVERT% = 80 - LOYALTY

If leader does not convert, check to see if he returns to his employer.

RETURN% = LOYALTY

If hero does not return, place him on freelance list.

Entice

Costs 3 gold per attempt. First, see if hero converts.

CONVERT% = 80 - LOYALTY - (EXPERIENCE/5)

If the hero does not convert, check to see if he escapes.

ESCAPE% = MELEE + (2*STEALTH) + (EXPERIENCE/10)

If a hero escapes, check to see if he returns to his ruler.

RETURN% = LOYALTY

If the hero does not return, place him on the freelance list.

Example: Caesar attempts to entice the Celtic hero Brennus. Brennus has a current loyalty of 60%, 30 experience, 4 melee, and 2 stealth. There is a 14% chance that Brennus will convert. If Brennus does not convert, there is an 11% chance that he will escape.

Send to games

First, calculate the profit from the games.

PROFIT = -4 + RND(BASE + (2*MELEE) + (EXPERIENCE/10))

Base depends on the leader type.

Hero: BASE=2
Legend: BASE=3
Ruler: BASE=5

Next, check to see if the leader dies.

DEATH% = 50 - (5*MELEE)

If hero survives, give him 2 experience points and check to see if he escapes.

ESCAPE% = STEALTH + (EXPERIENCE/10)

If a hero or legend escapes, he is automatically returned to the service of his former ruler (he has good reason to want to continue the war against his imprisoner). If a ruler escapes he is removed from the game.

If the leader does not escape, he is returned to the dungeon list for the player's further pleasure.

Example: Quintus Fabius (hero: base=2, melee=3, stealth=4, experience=30) is sent to the games. He will generate -3 to 4 gold profit (-4 + rnd(8)). There is a 35% chance he will die. If he does not die, there is a 7% chance he will escape.

Games will also improve the happiness of the nation.

HAPPINESS = HAPPINESS + BASE

Base is the same as in the profit algorithm (hero=2, legend=3, sovereign=5)

Execution

Executing a captive hero or legend causes all heroes and legends in your employ to decrease in loyalty.

LOYALTY = LOYALTY - 5

Espionage algorithms

There are four variables which appear in the following list of missions.

Success

This is the percentage chance that your mission will succeed. It usually increases with the number of agents assigned to a particular operation.

Nation Espionage variable: Each nation has a variable assigned to it to signify its prowess at covert operations. This variable is added to the success probability of each mission.

Detection

Each mission also has a "detection" roll, which is the percentage chance that the mission will be detected and the target player will get a message stating which player did the nasty deed. Note that while increasing the number of agents assigned to a task increases its chance of success, it also increases the chance of detection. With the exceptions of missions 3 & 8, detection and success are independent of each other. That is, there are four possible results:

1. Mission succeeds and spies are not detected.
2. Mission fails and spies are not detected.
3. Mission succeeds and spies are detected
4. Mission fails and spies are detected.

Frame

If an agent is not detected and if the mission succeeds, then for some missions there is an additional percentage chance that the player will be able to frame a random player for the act, resulting in the target player getting a message saying that the framed player did it. You may not select the "framed" player.

Loss

If a mission is detected, there is also a chance that some of the agents on that mission will be "liquidated". The number lost is expressed as the loss variable.

1. Assassinate agents

"AGENTS" for this mission and all others refers to the number of agents assigned to the mission.

"KILLS" is the number of enemy agents assassinated.

KILLS=RND(0.4*AGENTS)
DETECTION=20+2*AGENTS

If detected, then LOSS=RND(0.5*AGENTS)

FRAME=30-2*AGENTS

2. Aid saboteurs

FUNDS LOST=RND(AGENTS)
DETECT = 10 + (2 * AGENTS)

If detection, then LOSS=RND(AGENTS)

FRAME = 20 - (2 * AGENTS)

3. Bribe leaders

Check detection first for this mission. Detection in this case means the hero refused the bribe. Each agent carries one offer, so assigning multiple agents means that this mission is executed multiple times, finding a random hero for each offer.

Note: this missions costs 2 gold per attempt.

DETECTION=30+0.5*HERO LOYALTY

If detected, LOSS=1; i.e. the agent is slain by the insulted leader

If successful,

LOYALTY LOSS=RND(3)

4. Intercept messages

There is no detection or frame roll for this mission. SUCCESS is a percentage chance.

SUCCESS=10%+RND(AGENTS)

5. Scout garrison

SUCCESS=30+AGENTS*5
DETECTION=10+AGENTS*2

If detected, then LOSS=AGENTS (people don’t take kindly to spying on military units during wartime)

6. Locate cities

SUCCESS=10 + (3*AGENTS)
DETECTION=5 + (5*AGENTS)

If detection, LOSS=RND(AGENTS)

7. Slander a ruler

HAPPINESS LOSS=RND(AGENTS / 2)
DETECTION=20+3*AGENTS

If detection, then LOSS=AGENTS (rulers really object to people slandering them, but the slander is already made and the damage done)

8. Watch hero

As in mission 3. Bribe heroes, check for detection first. If the spies are detected, the loyalty rating is not reported.

DETECTION=20+AGENTS*2

If detection, then LOSS=RND(AGENTS); the hero kills all of the agents he can catch. Also, HERO LOYALTY=HERO LOYALTY - 3

SUCCESS=20+AGENTS*5

9. Gather state secrets

SUCCESS=15+5*AGENTS
DETECTION=20+2*AGENTS

If detection, LOSS=RND(0.5*AGENTS)

If the mission succeeds, there are the following chances (rolled separately) that the given stat will be reported.

Happiness:70%
Tax rate:70%
Population:60%
Names of leaders:40%
Funds in treasury:30%
Number of legions20%

Taxes & Happiness

Players may set their tax rate in the espionage window.

Each turn taxes will be collected as follows:

INCOME=TAX RATE*TOTAL POPULATION*.00004

Example: A ruler with a total population of 150,000 with a 20% tax rate will receive 120 gold per turn.

Each Tax Collection phase will also adjust the player's base happiness level.

BASE HAPPINESS=110 - TAX - (0.5((TAX/10)2))

Examples: A tax rate of 30% would result in a 75.5 base happiness. A tax rate of 100% would result in a -40 base happiness.

Base happiness is further modified by battle results and city captures or losses.

Each battle won raises base happiness by 1%. Each battle lost lowers happiness by 1%. The maximum range for this effect is 10% in either direction per turn.

After the battle modifications are computed, base happiness is further adjusted by 10% upward for each city captured, and 5% downward for each city lost.

After the final base happiness level is computed, actual happiness is adjusted. If the base happiness is lower than the current happiness, then happiness equals the base happiness. If the base happiness is higher than the current happiness, then happiness is adjusted upwards to a maximum of 5%. Thus, your happiness can lower by any amount in a given turn, but may only increase by a maximum of 5% per turn.

Population Growth

Each city gains population each turn.

GROWTH=POPULATION*(0.95+HAPPINESS/1000)+(NATION GROWTH/100)

That is, a maximum happiness of 100% will result in a 5% growth rate per turn, plus nation growth modifiers.

Healing

All armies and leaders have a 50% chance of healing one point of health each turn.

Experience

Armies and leaders gain experience in combat. They also gain one experience each turn simply for surviving. Experience can count for quite a bit, as well-blooded legions fight much better than green troops, and they do it for the same pay.

Experience also has a dramatic effect on leaders, but with a price: ambition. To avoid complications, it's best to keep the palms of your elite generals well-greased.

Experience levels for armies

ExperienceCombat modifier
Green00
Regular101
Veteran252
Elite403

The experience modifier is applied in army vs. army combat. See the Appendix, legion vs. legion combat.

Armies get 5 experience for each battle they win, and 3 experience for each battle they lose.

Levels for leaders

Experience Leadership
& Stealth
Melee
Tyro0
Adventurer10+1
Warlord25+1
Champion40+2
Superhero60+2
Demigod90+3+3

Bonuses to attributes are applied to the hero's base values. For example, if a hero has a starting melee of 3 and has earned 50 experience points, his melee is now 5.

Leaders get experience as follows

Commanding a winning army: 2 points
Commanding a losing army: 1 point
Engaging in leader vs. army combat: 3 points
Engaging in leader vs. leader combat: 3 points
Killing another leader: 2 points
Fighting in the colosseum: 2 points

Rebels

You may have citizens with philosophical objections to your rule. After all, separatists have arisen in far better countries than yours.

Roll for each town, city, and capital in the player's empire every turn.

REBELLION% = 0.5*(100 - HAPPINESS)

Example:A happiness rating of 60% means that each city in your empire has a 20% chance of producing rebels each turn.

If a city rebels, it ceases to be part of your empire until it is recaptured. Each turn, a rebel city will produce an army based on the size of the city.

Town:Angry Mob
City:Patriots

When a coastal city is fully garrisoned, it will begin producing pirate ships.

Each turn rebel units move based on the following priorities:

  1. Attacking loyalist units within rebel cities
  2. Occupying rebel cities (filling all hexes)
  3. Attacking loyalist cities
  4. Attacking weaker loyalist units
  5. Fleeing from stronger loyalist units
  6. Moving randomly

Rebels calculate threat levels to decide who is weaker or stronger.

THREAT = (ATTACK + EXPERIENCE MODIFER) * (0.5 + (0.5*(CURRENT HEALTH / MAX HEALTH)))

Random Events

Each turn, roll on the following table:

01-60 Nothing unusual happens.
61-70Fire sweeps a random city .
Population decreases by 10%
You lose double the cities income in gold
71-75Plague! Affects a random city.
Population decreases by 50%
76-80Birth of a royal child. Peasants party in celebration.
HAPPINESS=HAPPINESS+30
81-85Great writer emerges
Fame increases by five
86-90 Desertion of a random military unit. Unit is removed from the game.
91-95Prophecy of victory pronounced by oracle. Affects all heroes, but not legends.
Loyalty increases by five
96-100Assassination attempt! Espionage options are not available next turn, as all agents are waiting to see if you survive (you do).

Global Rating Algorithm

New players begin with a rating of 500.

After each game, a player's performance is assigned rankings. That is, who finished 1st, 2nd, and so on. This ranking is determined by adding together two numbers. The first is based on the order of elimination of rulers, the second is based on the maximum percentage of the score that the player achieved at any point in the game. In the case of ties, order of elimination takes precedence over maximum score percentage.

This rank is used to determine whether a player won or lost in respect to each player in the game. For example, if a player places fourth out of nine players, he won against five players and lost to three.

Next, we modify each player's rating according to the following formula, which is applied against each other player in the game. Thus, you will get mulitple adjustments in each game which are all added together to produce a final modified global rating.

delta R = (Opponent's rating) - (Player's rating)
NewRating = (Current rating) + 32 * (WIN - (1/(10^(delta R / 400) + 1)))

WIN is a boolean variable; that is, it has a value of one if the player has won, and 0 if the player has lost.

Examples

John has a rating of 1000. Jane's rating is 900.

If John wins, his rating goes up to 1012, while Jane's drops to 888. Since John is a higher rated player and was expected to win, only 12 points are "up for grabs".

But suppose that Jane defeated John. Her rating would go up to 920, while John's would drop to 980. Since her victory was an upset, 20 points exchange hands.

The minimum that a person can win or lose is 1.

Next section: Appendix III -- Creating scenarios