FANDOM


Hello and welcome to the Merveilles du Monde Rules Page! Any question you may have can be answered on this page. Anything from basic game rules to war algorithms will be laid out in their totality. If you have a question that can't be answered on this page, please consult a moderator for assistance. By playing this game, you agree to follow all rules. Your enjoyment as well as others' enjoyment of the game is contingent on these rules. Fortunately, these rules are lax and there mostly to maximize smoothness in moderation and gameplay.

Basic Rules

  1. Original Clause: You must be plausible to your best ability. Not everyone is perfect, but we strive for the events of the game to make sense so we can keep the game interesting and fun for everyone. Lack of plausibility creates silly butterfly effects at best and very frustrating situations for many players at worst.
  2. Homework Clause: Do a bit of research for your nation. Especially since we're starting in a time period not everyone is familiar with, a bit of research into your nation is essential. Go ahead and get familiar with how your nation is run, their beliefs, their climate, and what they're good/bad at. Don't feel like you have to go overboard with this; while meticulous research can teach you some new stuff, not everyone has the time to do this. Use your own discretion.
    1. Heraldry Subclause: ATL heraldry (flags, coats of arms, banners, etc) must be introduced and mentioned in the game. Implying the heraldry was used prior to the 1295 PoD is especially not allowed.
  3. Playability Clause: You can play any nation, city-state, or culture group you wish, within reason. If it's on the map, you can play it! If you want to play something that isn't on the map (especially in the case of city-states or culture groups), ask a mod and provide a source ‘and' a map (if the latter is applicable.) Do not just send me a map.
  4. Don't Switch Your Nation All the Time Clause: You are allowed one free switch at any point. After this, you may only switch your nation once every hundred in-game years. If you are vassalized or taken over, you may switch at any time.
  5. Don't Be an Asshole Clause: If you have a problem with another player, you are expected to settle it by yourselves. Instigating drawn-out arguments, metagaming, and otherwise throwing a temper tantrum will not be tolerated. If a compromise between players can't be reached in a timely manner, a compromise will be made for them.
    1. Don't Let it Become a Thing Subclause: Players that develop OOC feuds over MdM will be banned for one week. Repeat offenders are subject to further action, up to and including removal from the game.
  6. Backhand of God Clause: Negative mod events are going to happen to you and you're going to have to roll with them. They keep the game fun and interesting. There will be no official appeals to mod events. You may complain about them on Discord and a moderator may or may not do something about it, depending on the circumstance. Excessive complaints fall under clause 5.1.
  7. Metagaming Clause: Metagaming, that is using real-life knowledge to influence your actions in game when your nation has no way of knowing about it, is prohibited. This includes working with a nation simply because the nation is run by your friend rather than any in-universe reason.
    1. Meatpuppeting Clause: Recruiting IRL friends is allowed and encouraged. However, recruiting them to give you some sort of advantage is not. Players found to be meatpuppeting will be warned or asked to switch nations.
  8. And the Rest is History Clause: Do not ask mods for events that would give you some advantage or another person a disadvantage. Do not ask them to ‘even out' a side in a war or give someone a revolt when you want.

Era-Dependent Rules

  1. Vassal states (or client-states, protectorates, puppets, etc) are separate nations that are beholden to another country. Players may post as both host nation and the vassal state in the case of an NPC vassal.
    1. A player may play as a client state of another nation, even if that nation is NPCed. The host nation is responsible for the actions of the client state and may elect to reign the vassal state in the vassal acts outside the host nation's interests.
    2. A vassal state may only be achieved through diplomacy or through warfare. ‘X vassalizes Y' turns are not acceptable. The forms of diplomacy and means of securing the state as a vassal must be roleplayed.
    3. A powerful-enough state will more than likely not accept attempts at peaceful vassalization and likely can't be held in check. Vassals that grow too powerful or otherwise ambitious may grow rebellious.
    4. Vassals, under certain circumstances, may be annexed entirely. Appropriate reasons would include extreme cultural similarities/ties, too much dependency on the host nation, being defenseless against their liege, and otherwise being unable or unwilling to stop annexation. ‘X annexes Y' turns are not acceptable. If a large number of your vassals in the same area or culture are unhappy, do not expect a peaceful annexation.
  2. In the case of a personal union, a merger between the two nations may be possible given sufficient time and plausibility. Mergers will be approved on a case-by-case basis.
    1. Vassal rules 1.1 through 1.3 apply to personal unions.
  3. Culture groups/tribes existing outside the definition of ‘states' or conventional countries can be played. Rather than the territory being filled in on the map, only its borders will be colored. These borders can overlap.
    1. Cultures/tribes can migrate to new lands or leave old lands behind. In this case, the map will play against you. Migration into another culture group's land may require an algorithm. If one is needed, a moderator will contact you or do one for you.
    2. Nomadic or stateless groups can settle down and form a state, in which case they will be treated as any stated entity. Forming a state may result in initial rebellions, minor fragmentation near your borders, and border disputes with other nations.

Colonial Rules

  1. A colony can't be secured through direct warfare with its host nation and vice-versa.
  2. In general, avoid all-out colonial wars, given that these ‘Old World Wars' were fairly rare. In the event of colonial warfare, an algorithm for each theater will be needed.
  3. A nation without access to a coastline can't colonize. Owning an enclave port to circumvent this is prohibited.
  4. Colonies can only grow via ships from the Old World until 1550.
  5. Expansion of colonies should follow the coastline or a river inland.
  6. Areas can be claimed for colonization and a tentative border will be drawn. Claims can overlap. Wars over claims are allowed, though only in the case of claim violation.
    1. Claims can be approved or rejected by the Pope or other powerful figures.
  7. A list of colonizers will be made available as time progresses. Nations can be added to this list given enough time, progress, or need to colonize. They can also be removed. Attempting to colonize without being on this list will result in a warning. If you do secure a colony through warfare while you are not a colonizer, you still need mod approval to be a colonizer.
  8. The creation of a large amount of colonies for the purposes of algo spam is prohibited.
  9. In the event of a colony expanding into lands occupied by a tribal player, their borders will overlap. Over time, the tribal player's borders may shrink until the overlap is eliminated. Warfare may be needed to maintain these tribal borders. However, these tribes will never completely leave the area without warfare from the colonizer.

Moderator Rules

  1. A mod's primary job is to 'play the game' against the players. That isn't to say 'make the game unreasonably difficult' or 'punish players,' but rather have the world interact with players much more than in previous map games. Everything a player does will have consequences, from a peaceful marriage between two powerful families to a war. Especially in the case of players located in regions where there aren't many other players, we need to keep the game engaging.
  2. A moderator may not give himself/herself a 'good' event or something that directly benefits themselves without the approval of another. The mod in question must make a case with specific evidence from in-game turns.
  3. A moderator is expected to respond to all NPC diplomacy requests, assassination RNGs, or similar turn requests.
  4. Plausibility checks need to be assertive but less heavy-handed than in the past. Crossing out implausible text and writing something snippy or just going 'no' is not only rude, it's extremely unhelpful. Explain why the turn was crossed out.




Algo Revolution Phase 1: Occupation and Stability

An algorithm is a report on the talk page that is made as a result of two player posts contradicting each other. If nation A wants to annex nation B, and nation B disagrees (either by a player or mod response) then that requires an algorithm (algo for short) to settle the dispute. The player must specify all the actions and information that contributes to the battle, alert a mod to respond to their request. You must specify the request by saying (algo request) or (algo needed) in your turn in bold. If you do not, you forfeit the battle. 

The mod will take these factors and run them through a computer program that will calculate the exact result of the battle, which is posted on the Talk Page of the game pageThe algo is a secondary, not primary result on battles. If you and the player (or mod in the case of an NPC) agree on how the war will go, you do not need an algo

This is the first phase in radically changing the algo to be more automated and unbiased. Some details are excluded from this explanation to keep things on a high level of detail and low level of complexity.

Overview

The core of the algorithm is a main loop, where each iteration of the loop represents one day of combat. Each day, both the morale and the military size are reduced by exponential decay. Once the morale of one side goes to zero, the opposite side becomes the winner. In addition, occupation and stability scores are also calculated by exponential decay, as explained later.

These four values (military, morale, occupation, and stability) forms the four output values that defines the algo. For each value, the exponential decay is calculated by two values: power and attrition. Attrition is a measurement of how much that value would naturally decay over time, irregardless of actual fighting. (E.g., crossing a desert gives attrition on morale even if you aren't fighting anyone). Power is a measurement of how much one side affects the decay of the other side (e.g., vastly advanced tech).

Below is a table to summarize the variables:

Variable name Range Affects Power Affects Attrition Description
Military Positive integers Battle score, Siege, Infrastructure, Geography, Tactics Supply, Geography Raw military size
Morale 0-20 per soldier (0-2000 per ship) Battle score, Siege, Infrastructure, Geography, Tactics Supply, Geography, Morale, Tactics Morale of military
Occupation Positive reals (logarithmic) Population, Economy, Morale, Supply, Infrastructure, Siege Population, Economy, Morale, Density, Geography Status of victory
Stability 0-200 per nation Population, Economy, Morale Population, Economy, Morale, Density Status of the nation


All relevant values gathered from the input are multiplied together, however big or small that ends up being. For instance, Stability power = population * economy * morale. Then, each value is rescaled to ensure the result is proportionally contained between 0 and 1, using this formula:

Scaled value = 1 - (1 / ((unscaled value / K) - 1))

The value of K is determined by experimentation.

The main loop is set to a maximum of 365 days, after which point the algo would roll over to the next turn, and declared inconclusive. The morale is additionally reduced each day by the fraction of remaining military, to ensure that zero military will result in zero morale. Because the exponential decay might never equal zero, comparison is made between each morale to and some arbitrarily small value, called eta. The pseudocode of the algo is given here:

While battle length < 365 days:

  • Military change = -(military attrition + random value) * military - (military power + random value) * military
  • Morale change = -(morale attrition + random value) * morale - (morale power + random value) * morale
  • Military = military + military change
  • Morale = (morale + morale change) * (military / original military)
  • if (morale < eta):
    • Opposite side wins
  • Battle length increments one day

Where the random value can be between 0 and 0.05.

  

Values kept from the old algo

In this first phase, the input to the algo is largely unchanged. The following values of input are all still significant, but their contribution to the algo is not shown as that is too complicated to be shown here.

Numeric values

These values are a literal integer, which are rescaled behind the scenes.

Economy base:

+1 for every turn spent developing the economy in the last 15 turns. This is meant to act as an incentive to regularly post. 

Battle score:

Each player will be expected to detail their plan of attack on the talk page. Moderators may not tell you what to do, but they may tell you if what you are doing is completely impossible, metagamey, or otherwise unacceptable. During the scoring of the algorithm, the moderators will compare your battle plan against that of your enemy and judge it on a scale of 1-20.

Siege:

The number of years the defender is being sieged by the attacker.

Single Selection values

For these values, the player will only be allowed to select one from the list, whichever applies best. All are listed from best-to-worst. Government and Motive are also single-selection, which are addressed later.

Population:

Similar populations (<10%) are counted as equal. NOTE: Always consult a mod to confirm your population. Self-calculated populations are only taken after critical examination.

  • 10 times less than that of enemy
  • Half or less than half of enemy
  • Less than that of enemy
  • Similar populations
  • Greater than that of enemy
  • 2 or more times that of enemy
  • More than 10 times that of enemy

Population density:

The following is the average number of your country's people per square kilometer in a 300 km distance or shorter from the battlefield. As these numbers are hard to come by, especially for some time periods, use your best guess if you can't find a source. For the attacker, these values are listed best-to-worst, but for the defender it is reversed.

  • >2 people per sq km (Wasteland)
  • 2-5 people per sq km (Very Rural)
  • 5 - 10 people per sq km (Rural)
  • 11 - 30 people per sq km (Somewhat Urban)
  • 31 - 50 people per sq km (Urban)
  • 51 people - 70 people per sq km (Metropolis)

Supply:

  • Disconnected from Supply
  • Distantly supplied
  • Shortage in one or more basic materials (usable iron, wood, food, etc)
  • Shortage in one basic material (usable iron, wood, food, etc)
  • Supplied with major roads
  • Near major city/supply depot

Multi-selection values

These values are picked from a list. In most cases, the player can choose as many from each list as what applies. The mods may also add factors not mentioned by the player if they apply, such as penalties due to economic mod events, or strains in supplies due to large military.

Infrastructure:

  • Nearby allied light infrastructure
  • Heavy infrastructure near border (Nearby fortifications, some towns and cities)
  • Blockade established
  • Captured light infrastructure
  • Siege weapons (requires a turn to build) attacker only
  • Captured fortress attacker only
  • Basic Infrastructure defender only
  • Natural defenses (Mountains, rivers, etc) defender only
  • General Infrastructure (Minor fortifications, some towns) defender only
  • Fortress defender only

Geography:

  • Crossing mountains to get to location
  • Crossing desert to get to location (ignored by Hordes)
  • Pinned against coastline or mountain
  • Landscape has been battlefield for longer than 3 years
  • Countryside burned ahead of invasion
  • Pinned against river
  • Naval invasion
  • Bad winter
  • Steppe
  • Arable landscape
  • Attacking through forest
  • Has the high ground
  • Defending in forest
  • Holding mountain pass

Economy:

  • Embargoing major power
  • Currency debasement
  • Paying tribute
  • Economic disruption nearby (war, plague, etc)
  • Economic disruption within home nation (plague, ransacking, drought, guild infighting)
  • Severe currency debasement
  • Destruction or crippling of a nearby powerful nation
  • Embargo by major power
  • Severe damage to major city
  • Naval blockade of major port
  • Loss of major city
  • Loss of capital city
  • Gift from other nation
  • Tribute from tributary
  • Prosperous trade with nearby nations
  • Pillaging another country
  • Prosperous long-distance trade route
  • Gold rush
  • Plundering important enemy city
  • Plundering enemy capital

Morale:

  • Army in desertion
  • Vassals unhappy
  • Recent defeat
  • Recent victory
  • Recent pillage attacker only
  • Last stand

Tactics:

  • Peasant or inexperienced leader
  • Vastly superior battle technology
  • Savage leadership
  • Flanking bonus
  • Enemy is surrounded

Naval algo inputs

Single selection values

Currents:

  • Attacking against current
  • Attacking in calm seas
  • Turbulent seas
  • Attacking with weak current
  • Attacking with strong current

Navy condition:

  • At sea for some time and taken heavy damage
  • At sea for some time or taken heavy damage
  • Taken light damage
  • Newly-constructed ships

Navy construction:

  • Inferior building materials
  • Adequate condition
  • Superior building materials

Supply:

  • Cut off from supply by distance or enemy interception
  • Severe shortage of supplies
  • Minor shortage of supplies
  • Access to supplies from other ships
  • Access to supplies from nearby city or supply depot on land

Multi selection values

Location:

  • Pinned against coast
  • Attacking isthmus
  • In an iceberg-prone region
  • Under fire from land forces
  • Blockading a peninsula
  • Nearby fortress
  • Blockading a naval pass (Gibraltar, Kattegat, etc)
  • Blockading a bay

Military

The military is the literal number of troops you send into battle, blindlessly sacrificing their lives for your glory. As this is always an integer, it is possible to suffer no casualties if the power of the enemy is small enough. In a naval algo, this value is replaced with the number of ships.

NOTE: For maximum size of military, historical sources always takes precedence first. The following table is used as a guide ONLY, and can be overwritten by mod intervention at any point.

NOTE: If you use more than 30,000 troops at any single battle, you WILL incur major logistic issues except in special circumstances.

NOTE: If you use more than 20% of your total military offensively, you will incur a penalty in stability

  • Feudal Nations: 0.0075 times population
  • Democracies: 0.05 (until 1870) 1.5% Post 1870 (Peacetime)
  • Dictatorships: 0.04 (until 1870) 2.0 % post 1870 (Peacetime)
  • Absolute Feudal Monarchies: 0.01 times population
  • Absolute Monarchies: 0.024 times population (can't be achieved until at least 1620)
  • Parliamentary Monarchies: 0.015 times population.
  • Revolutionary Republic: 0.12 times population (not achievable until the mods allow for the enlightenment to take hold enough for these)
  • Enlightenment Empire 0.10 (same as above)
  • Parliamentary English Empire 0.10 (same as above)
  • (most of these are soon to be replaced with conscription laws)
  • Nomadic Hordes: 0.01 times population
  • Non-feudal Nations: 0.015 times population
  • Naval-concentrated, non-feudal nations: 0.01 times population

Morale

The morale is a measurment of how willing each soldier in your military is to keep fighting, before giving up and going back home. Each individual soldier has a morale healthbar of 20, so the total health of your military is always equal to military * 20 at the start of the battle. Every soldier of a morale equal to zero (or less than arbitrarily small value) deserts from the battlefield. Additionally, the morale of a dead soldier is zero. In a naval algo, the morale of each ship starts out as 2,000.

Whichever side runs out of morale first loses, allowing the opposite side to win. If both sides still has positive morale after 365 days, then neither side wins. Depite morale always starting out as larger than military, it will also always deplete faster. Morale depletes slower for naval algos.

Occupation

Now that you won the battle, then what? The morale and military only gives you a binary result, i.e. either you win or lose. The occupation score is a measurement of what you can take after you win the battle. You can't just annex everything after defeating the military, you know. There will always be issues of logistics, hazardous geography, and native, possibly guerrilla resistance that still stands in your way. The occupation phase of the algo takes place after the main phase, where the winning side spends time occupying the region after the battle, which calculates the occupation score.

Just like the main phase, the occupation phase has a loop, where each iteration represents one day of occupation. The region the battle takes place starts with its own healthbar, called the environmental morale, starting at 2.0. The environmental morale will decrease in exponential decay, based entirely on the power of your nation's occupation. At the same time, your own morale is being depleted in exponential decay, based on the attrition of the region.

You start the occupation phase with the same amount of morale you had left over after the main phase. This means that if you only barely managed to win the main phase, then your occupation score will be pretty low.

There are three possible outcomes from the occupation phase:

  1. The occupation takes more than 365 days (the occupation takes longer than a single turn)
  2. The player's morale runs out
  3. The change of the environmental morale becomes zero or close to zero (reaching an asymptote)

In either case, the loop will terminate and the occupation score is calculated. The pseudocode for the occupation phase goes like this:

While occupation time < 365 days:

  • Environmental morale change = -(occupation power + random value) * environmental morale
  • Player morale change = -(occupation attrition + random value) * player morale
  • Environmental morale = environmental morale + environmental morale change
  • Player morale = player morale + player morale change
  • If player morale < eta or environmental morale change < eta:
    • Terminate loop
  • Increment occupation time by one day

Once the loop is terminated, whatever environmental morale is left is used to calculate the occupation score, which is determined by this formula:

Occupation score = log((1 / environmental morale) + (remaining player military / original player military) - 1) + 1

Note that the score is calculated by a logarithm base 10. Once this occupation score is calculated, it is interpreted based on a possible table of values:

Occupation score Result Details
0 Repulsed Unable to be occupied due to guerrilla warfare, etc.
1 Tactical victory Military victory without permanent occupation
2 Sacked Wealth, resources on hand stolen
3 Tributary The region is forced to pay money or become a tributary
4 Deposed Local rulers are replaced by puppet rulers
5 Vassalized The region is made a vassal.
If its part of a larger nation, then it breaks off as independent
6 Annexed The region is annexed by the victor
7 or more Culturally extinct Any indigenous culture or ethnicity are heavily suppressed or nonexistent


Stability

So you won the battle and you got an occupation score. What's up with this stability thing? The stability score is an existing heatlhbar for the nation itself. Stability starts at 200, and is depleted by exponential decay once per algo. The attrition of stability refers to how much stability is depleted naturally, even while not being at war. The power of stability refers to how much your military is able to distabalize the enemy nation. No matter how much you win the battle, you will always lose some amount of stability. However, the more you lose in a battle, the worse the stability will be. Stability score can also be changed via mod event, good or bad. NOTE: your stability will only go back up via mod approval. If you are unsure, ask.

As the stability is calculated once per algo, it is not in a loop. It is calculated using this formula:

Stability = stability - (stability attrition * stability) - (enemy stability power * stability) - 25 * (1 - (remaining military / original military))

Just like with the occupation score, the stability score is interpreted by a table. However, it is calculated linearly instead of logarithmically.

Stability score Result Details
200 Fully stable Everything operating normally
175-199 Recession Minor economic/financial issue
150-174 Depression Major economic/financial issue
125-149 Unpopular War / government is unpopular
100-124 Unrest Most places experience non violent unrest
75-99 Uprising Violent revolts are frequent
50-74 Instability Government control is tenuous
25-49 Decentralized Government has little control over internal vassals
0-24 Anarchy Government is powerless or nonexistent



Government and Motive

You may notice that the government and motive (which are both single-selection) are absent from the list of inputs mentioned earlier. Let me ask you a question: why should different forms of government be "ranked"? Who are we to judge that one form of government is objectively better than another one? Obviously, some governments work better in some contexts, and worse in others. If you are a feudal government, then attacking with wreckless agression is a detriment to your reputation. But if you are a horde, then it's actually expected.

In the new algo, the combination of a form of government with the right motive or other factors will get you a bonus in the algo. Specifically, it will give you a bonus on the power and attrition of your stability, and to your occupation power. In addition, other combinations will give you a penalty on these things. If you have an "unhappy" government with a bonus, then it will be significantly less of a penalty than you would normally get. 

These combinations can make a massive difference on your occupation score. Without any special bonuses, you can't expect much higher than a 3. With the right number of combinations, however, its possible to get a score as high as 12!!

Below is a table of bonuses you can expect per government choice:

Government Interpretation Gives bonus Gives penalty
Scattared tribal Hunter-gatherer, bedoin, aboriginal None - always negative
Organized tribal Confederacy, nomadic kingdom Geography: Steppe, desert, scorched earth, defending forest
Density: rural, wasteland
Geography: Naval invasion
Infrastructure: Siege weapons, fortress, blockading
Tactics: vastly advanced
Motive: defending mandate
Feudal Western feudal, Hindu feudal, Iqta, Daimyo Geography: Attacking forest
Economy: paying tribute
Motive: Holy war, religious dispute, dynastic dispute
Geography: Steppe, desert
Density: wasteland
Morale: vassals unhappy
Motive: aggression
Republic Merchant republic, elective monarchy, military order Geography: Naval invasion
Economy: prosperous nearby/distant trade
Infrastructure: blockading
Density: urban Motive: hegemony
Geography: Mountains
Economy: embargoed
Motive: dynastic dispute, defending mandate
Empire Roman or Chinese successor, despotate, native empire Economy: Tribute
Motive: defending mandate
Economy: Paying tribute
Motive: Holy war, religious dispute
Horde Khanate, Khaganate, Amirate Geography: Steppe
Density: wasteland
Economy: plundering, pillaging
Morale: recent pillage
Motive: aggression
Geography: Mountains, bad winter
Density: urban


In addition, the following motives are strictly heirarchal and are not affected by bonus or penalties:

  • Defending against existential threat
  • Reclaiming recently lost territory
  • Defending core territories
  • Defending border
  • Reclaiming long lost territory



Algo Revolution Phase 2: Tactics

After a long period of testing and revising the first version of the algo, this second phase completely overhauls the mathematical model used to calculate the casualties, tactical score, occupation, and stability. I would like to perfusely thank everyone who contributed ideas, criticism, and requests to make this algo work better and more accurate. Seriously, I cannot thank people enough for calling out issues and concerns that help make the algo run vastly better in this second phase. 

The programming language for this algo has changed from C++ to Java. There are several reasons why this change was necessary:

  • Drastically increase speed and performance
  • Greater usability across all operating systems and platforms
  • Greater flexibility to allow more useful features
  • Requires far less effort to install

Overview

In this second phase, which is mostly just a rework of the first phase, most features of the previous build are largely the same. The features of the previous phase used here are:

  • All rules related to requesting an algo, assessing population, and assessing military
  • All inputs and hierarchy of inputs
  • Bonuses and penalties from government types
  • Inputs are mapped to variables that describe the state of the battle
  • A main loop that iterates once per day
  • Reducing morale and personnel by a single calculation once per loop
  • Output results of occupation and stability scores

All these aspects of the algo are preserved and are not going to be covered in this phase. 

An additional input to the algo in this phase is tactics, or the initiale positions of each flank / military unit used per side in the conflict. Each round of the main loop, the flanks react to each other autonomously, either to advance, retreat, or attack. The attack function will reduce the morale and personnel of each other for those specific flanks, and if the flank is reduced to 30% morale, it is rounted. Once all the flanks of one side are routed, that belligerant has lost. 

The attack function, as well as calculation of occupation and stability, utilizes eight different variables that the input paramaters map to, describing different aspects of the battle. Every time the attack function is called, only a portion of military from each side is used to calculate the resulting casualties and morale loss, which is called a battalion. 

Tactics

The tactics are the initial positions of military units, or flanks, that are set up in a two dimensional space. The interface for this input system will look something like this:

Setup of interface autoalgo









The entire field is 420x420 pixels. By default, both sides are allowed a minimum of three flanks, which represent the left, center, and right flank, respectively. Either side can freely increase the number of units on the board as much as they want, but the total size of the military remains the same. Thus, both the size and morale of the total military is evenly divided among the number of flanks. Each flank has a default speed of 45 pixels per round, and a range of 45 pixels. In theory, the total range of the area is intended to be 100,000 square km, but in reality it can be scaled however necessary for the situation.

Each flank acts as an autonomous agent. Each day of the algo, each of the flanks will first identify the nearest active (not routed) enemy flank. Then, it will determine what to do based on a simple heuristic:

  • if not routed and enemy is in range:
    • stop and attack enemy (call attack function)
    • update morale of both sides
  • else if routed:
    • retreat away from enemy
  • else:
    • advance towards enemy


The algo continues to loop, one iteration representing a day, until all flanks of one side have been routed (represented by a darker color on the interface). The side that still has some units left on the board is therefore the winner, and their final morale and personnel is equal to the sum of the respective health of all the remaining flanks. It is at that point that the values of occupation and stability are then calculated, as explained later.

Once a flank has dipped below 30%, it enters a "routing" state. In a routing state, the unit can still be attacked (with far less casualties), but is unable to fight back or retreat. This continues until the flank's morale reachs 0%, at which point it is fully routed and can no longer be attacked. 

Tactics

The attack function used by each flank in the algo is calculated using the function described in this section. All the appropriate inputs for this function, after being multiplied together appropriately, are mapped to eight different variables that are used to describe the state of the battle at any given point. Each of these variables has a unique meaning and purpose, which makes it clear what the inputs are supposed to be contributing towards. 

List of Variables

Below is the table that summarizes all eight variables:

Variable name Definition Range Relevant inputs Use Normalization method
Effectiveness Average number of people that one soldier can kill in one round, in ideal conditions 1-5 Siege, Infrastructure, Geography, Tactics Casualties, morale decay (1-1/(x+1))*5 [0.5 for navies]
Efficiency Rate at which one soldier is able to achieve his ideal effectiveness 0-1 Density, Supply, Battle score, Geography, Tactics Casualties, morale decay, occupation 1-1/(x+1)
Limitation Percentage of available military capable of attacking this round 0-1 Supply, Battle score, Siege, Geography, Morale, Tactics Size of battalion, occupation x/6
Attrition Rate at which friendly soldiers die as a result of the environment itself 0-1 Density, Supply, Siege, Geography Casualties, morale decay, occupation 1-1/(x*0.01+1)
Psychology How much more effective the military is at decaying morale instead of inflicting casualties 0-1 Economy, Morale, Tactics Morale decay 1-1/(x*0.001+1)
Morale bonus How much morale is artificially increased due to circumstances 0-1 Battle score, Morale, Tactics Morale decay 1-1/(x*0.01+1)
Occupation base How effective (or sophisticated) the civilization is at occupying the enemy 0-Infinity Population, Density, Government, Motive, Economic base, Economy, Infrastructure, Geography, Morale Occupation None
Economic Strength of the nation's economy during wartime 0-1 Population, Economic base, Economy, Infrastructure, Morale Stability 1-1/(x*0.001+1)


The value of each variable is calculated by first multiplying the relevant inputs together, then putting the result through the normalization function given. For example, limitation is first calculated by Supply * Battle score * Siege * Geography * Morale * Tactics, then dividing the result by 6. 

Battalions

For the attack function itself, the algo first determines the size of each battalion that actually fights. This is because not everyone in the military is able to shoot all at once, but rather one portion of each side attacks while the rest exist as a pool of reserves. The limitation factor encapsulates further hinderence to the military, such as difficult terrain (in Geography), lack of resources (in Supply) or a lack of discipline (in Battle score).

As the Battle Score is a rating of how well-disciplined the army is, it has a major impact on how much of the battalion is able to engage this round. The possible results are:

  • Battle Score less than 5: Limitation is 10% (worst)
  • Battle Score between 5 and 10: Limitation is 25%
  • Battle Score between 10 and 15: Limitation is 50%
  • Battle Score between 15 and 18: Limitation is 80%
  • Battle Score greater than 18: Limitation is 100% (best)

For a very small military (less than 500), the battalion is set to the whole army by default. For a regular military (between 500 and 50,000), the battalion is 20% of the entire military. For any larger armies, the battalion is capped at 10,000 troops. The limitation factor is then applied to the size of the battalion. 

However, if enemy army is smaller than the size of the battalion, then the battalion is reduced to keep both sides the same. Effectively, the size of total militaries do not determine the result of the attack, but act as a pool of resources to help the army fight another round.

Final calculation

After this preparation, then the formula for casualties is given as:

casualties = battalion * effectiveness * (efficiency + random factor) * M + enemy battalion * (attrition + random factor) * M

And morale decay is calculated as:

morale loss = battalion * effectiveness * (1+(number of flanks being used)/10) * (efficiency * (1 + psychology) + random factor) + enemy battalion * (attrition * (1 + psychology) + random factor)

Where the random factor can range from 0 to 5%. The constant M is set to 1 by default, but is set to 0.1 if the unit is in a routing state. You can call this the "mercy factor". 


Occupation and Stability update

Occupation is calculated completely differently in this phase. First, the general occupation base is calculated by dividing the winner's occupation base by the loser's. (After determining the winner and loser in the battle phase). Because the value of occupation base is calculated multiplicatively, then any bonuses that both belligerents have in common will cancel out.   general occupation base = winner's occupation base / loser's occupation base

Each day of the occupation, the occupation base is increased by exponential growth, using the current power the occupier's military has:

occupation change = occupation base * (efficiency + random factor) * limitation * 3

At the same time, the morale of the occupiers are still etched away by the attrition of the environment:

morale loss = morale * (attrition + random factor)

As time goes on, the military becomes more tired, causing efficiency to also decrease exponentially:

efficiency = efficiency * (current morale / starting morale) * 0.85

The occupation continues until either 1) the occupier's morale runs out, or 2) the occupation score reaches an asymptote and cannot grow any farther (which is caused by the decay of efficiency). That maximum value of occupation is then used as the final occupation score, which is interpreted the same way as in the previous phase. 

The stability loss calculation is also completely changed, using this formula for the winner of the battle phase:

stability loss = (casualties / total military) * (1 - economic) * 10

And the loser's stability loss is given as:

stability loss = (casualties / total military) * (1 - economic) * log(occupation score) * 10

As you can see, stability is only ever affected by three things: casualties, economy, and occupation score. In this instance, the total military refers to the entire military the nation itself is capable of raising, not just in this battle. This total military is calculated using a combination of government type and population (as described in the previous phase). 

Algo Revolution Phase 3: Input Database

Up until this point, entering inputs for repeated algos in the same war or similar wars is still less convenient than doing an algo by hand. This is because previous builds required all the inputs to be entered from scratch, as opposed to an algo by hand which can be copy and pasted from a template. 

This third phase of development will put an end to that, by making use of a separate database of historical inputs. Inputs for each algo are entered in a database supported by Google Sheets, which is then read into the algo remotely, essentially acting like a client server.

At first, this system may seem to be no more convenient than before, as the user still has to enter all the same information, now on a different platform. But the benefit of this phase is cumulative, as eventually the database has a heatlhy collection of data that is reused instead of re-entered. In addition, this phase drastically reduces the complexity of the GUI, as all the algo inputs are boiled down to a couple of dropdown menus.

This phase also introduces the use of a military leader, whose stats are used to give extra bonuses in the algo that have tangible effects.

Overview

All the inputs to the algo are separated into three different groups: belligerent, military, and location. Each of these groups of inputs are treated as a single entity in the algo, or in other words an object in Java's Object-Oriented Programming (OOP). Each war has two belligerents (attacker and defender), and one location. Each belligerent can have a variety of different militaries for different circumstances, of which only one is used for the algo. 

The inputs for the algo are stored in the database on Google Sheets, called the War score database . Follow the link to view the actual sheet as it currently exists, but you cannot edit it.

NOTE: Only the mods can edit the database, but it is your responsibility to ensure that all information is up to date and accurate. Whenever making an algo, the mod is supposed to verify that all information in the database is accurate and complete. After giving this consent, you cannot retroactively say that the database was incorrect for your algo, as that consent is considered binding. 

On the GUI itself, dropdown menus are pre-populated with values pulled from the database in alphabetical order. Once a belligerent is selected, the remaining menus are filtered to only show the militaries or leaders for that nation. Once the algo is run, all relevant data is directly pulled from the Google Sheets and used to populate the algo objects. You do not need to download anything from Google, the data is pulled remotely.

NOTE: You are able to change the database while the GUI is running, and this will be updated automatically. However, if you delete an entry and attempt to use it in the algo, then the GUI will crash. 

The objects in the database are summarized in this table:

Object name Definition Composed inputs Composed parameters
Belligerent Nation fighting in the war Population, Economic base, Economy, Government, Motive Occupation base, Economic
Military Military used by the nation Battle score, Tactics, Morale, Supply Infrastructure (attacker), Geography Effectiveness, Efficiency, Limitation, Psychology, Morale bonus
Location Location where fighting takes place Density, Infrastructure (defending), Siege Attrition


Update to requesting an algo

In order to further streamline the process of making algos, the mods have put together a Google Form that is freely available to players. You are not required to use the Google Form, but using it will ensure that the mods get all the information necessary for completing your algo in a timely manner. Furthermore, if your algo includes very specific tactics that you don't want the enemy to know about, or if you just don't want to publicly disclose your troop count, the form will ensure that your information is kept confidential to the mods. If you do not use the Google Form, then all the rules about requesting an algo as described in phase one then still apply.

You can find the Google Form here.

Belligerent

The belligerent represents a single nation. The algo always has two belligerents, an attacker and a defender. Inputs and parameters for this object refer to the nation itself as a whole, and should not vary much at all in different kinds of wars or different kinds of militaries. If multiple nations are fighting together in a coalition, usually only the largest nation or leader is represented in the algo. However, an alternative is to add a new entry to the database to represent the coalition as a single entity. In this case, the populations of the nations would be combined, but the other stats would only be taken by the largest member.  The total population and the stability score are also recorded in the database, which are carried over from one war to another. Rules on managing both population and stability are the same as in phase one. Stability can alternatively be written to the database directly from the algo, which is the only value allowed to do so. Some values in the database are labeled as "default". These are pre-prepared inputs for different circumstances, representing a generic nation of average qualities. If the algo being done is very routine and doesn't require much special changes, this default value can be selected as a substitute.  For rebellions, the rebel faction is treated as a separate nation in the database, similar to CKII.

Military

This object represents a single military organization that works for a given nation. Each nation can have as many different armies as they want, within the limitations of their total military size. Each army is given a name, which doesn't have to be unique, but can greatly aid in organizing and sifting algos. The troop size is also recorded in the database, for which the same rules apply as in phase one.

One army can be jointly used by multiple nations, such as in a coalition. In the database, the nation column has multiple nations listed in the same entry, separated by either commas, slashes, semicolons, or any other special deliminator. The "years at war" column can be left blank if it is non-applicable.

Some militaries are given with a nation name as "default". In the GUI, these default armies are always available, no matter what nation you have selected. These are pre-prepared inputs with generic or average values. If an algo is being made quickly and there isn't enough information to fill out all the military, then a default army can be used instead, where some values are changed in the database where appropriate. 

After total morale of the military is calculated in the algo, both it and the troop size are divided between the number of flanks, as described in phase two. Once the algo is completed, this is recombined to give the total number of casualties and morale depletion.  

Location

This object describes the general location where the battle takes place. Ideally, this location should be fairly broad, as much as 100,000 square km. In fact, ideally the database should have all possible locations in the world already prepared in the database, which would be approximately 200 locations on land. 

In reality, the locations are entered in the database as they are first used, and remain in the spreadsheet for later reuse. As such, the more algos that are made, the more useful the database becomes. The number of years being sieged can be left as blank if non applicable. 

Unlike the military, the location object is disconnected from either belligerent. As such, the location is symmetric: except in certain circumstances, it is applied equally to both the attacker and defender. It is for this reason that the location object has relatively few member values.

Leader

The leader is a single historical individual placed in charge of the entire military campaign of one belligerent. In many wars historically, the leader himself can make a very big impact on the result: Alexander, Caesar, Khalid ibn Walid, etc. Similar to the military database, one leader can be used by multiple different nations, which is represented by listing all the nations names separated by some deliminator. 

Each leader is defined by seven stats, which can range from 0-10. These stats are mostly initialized by RNG, but are also dependent on the leader's own experience and specialty.

NOTE: In order to request a leader, you must fill out the following form and send it to any mod:

Name:

Age:

Experience:

The seven stats that define the leader is summarized in this table:

Stat name Definition Use
Attack Extra ability to fight offensively Increase effectiveness (for attacker)
Defense Extra ability to fight defensively Increase effectiveness (for defender)
Siege Extra effective while seiging Increase bonuses from seiging
Authority Command of troop discipline Increase limitation
Cunning Tactical/strategic genius Increase efficiency
Zeal Dominate personality/charisma Increase initial morale
Martial Personal combat/strength Increase psychology, leader survival

Just like with nations and militaries, there is a "default" leader where all seven stats are set to zero. A default leader is treated as a generic NPC, which is both ahistorical and inconsequential to the algo result. Alternatively, there is an entry called "default average", where all the stats are set to the average value of 5. 

The birth year of the leader is also given in the database, which is used to calculate the leader's current age. If the birth year is left blank, the default age is set as 30 years old.  Each time the algo is run, and the leader is not set to default, a calculation is made to determine if the leader is killed in battle or not. In order to calculate this result, first a criteria is calculated using this formula:


criteria = (random number - martial + (battle score / 2) + (age / 10)) * (original military size / current military size) * 0.01

The ratio of military size is to ensure that, the more casualties are taken during the battle, the more likely that one of the casualties happens to be the leader. This criteria is then compared to a random number between 0 and 1. If the random number is greater than the criteria, then the leader is dead, and in all other circumstances he survives. 


Community content is available under CC-BY-SA unless otherwise noted.