Proactive and Mobilised AI

If you liked this item, please rate it up on Steam Workshop page.

Author: Carniak

Last revision: 16 Sep, 2020 at 07:10 UTC (1)

File size: 253.95 KB

On Steam Workshop

Description:
Compatibility Notes

This mod changes only "commondefines0_defines.txt"

Based on this, please note the following:

  • Glavius Ultimate AI: Currently, the Glavius Ultimate AI mod includes an unmodified "00_defines.txt" file. This will unfortunately break any mods that uses their own modified defines file (such as this mod) unless Glavius Ultimate AI is loaded before your other mods.

Overview

Have you ever seen insane border gore as the AI does a merry tour of your empire?

Have you ever been abandoned by your AI allies who happily sit in their space doing nothing?
Have you ever backdoored the AI and taken over their planets while they happily ignored your invasion fleet?

These behaviours are due to in-game limits that fundamentally the AI "Selfish". That is, the AI is designed to aggressively conquer enemy systems as a way of accomplishing its wargoals. The problem is that this AI behaviour ignores that the enemy often has wargoals on the AI.

For example, in a defensive war, the defender’s allied AI is only interested in taking its claims on the attacker. Unfortunately, this causes two problems:

  • Defenders and attackers enter a race to see who can take their claimed systems first. If they are different systems, the war stalemates until war exhaustion force ends the war.
  • Since the defender’s allied AI is only interested in its claims, it does not care about defending its ally’s systems. The defender is often stuck on its own. If the claimed systems are taken, both defender and its ally loses the war.

These behaviours will often create an AI that wins battles, but loses the wars. It also means that the attackers win most wars even against theoretically stronger opponents.

Therefore, this mod implements a few changes…

AI’s Defends against Enemy Wargoals

The AI now prioritises defending its systems to prevent losing the war due to war goals. If the AI is merely an ally of a defender, it prioritises defending the allies systems.

(The screenshots shows the Vag-Oross actively trying to retake its conquered systems. In Vanilla, the Vag-Oross fleet would just ignore everything to continue attacking the enemy empires.)

AI Attacks Along Neighbouring Systems

The AI priotises attacks along its existing border. This has three effects:

  • Border gore should be reduced.
  • Since claims tend to be on border systems, the AI will focus more on its wargoal rather than grand tours of the defending empire.
  • Combined with the AI defense prioritisations, this creates exciting battlelines where attackers and defenders fight back and forth.
Decrease Fleet Power Ratio For AI Responses

The AI is now more willing to launch attacks during a war.

This change encourages smaller members of a AI Federation or coalition to attack the economy and infrastructure of larger enemies. This also encourages the AI to actively try and take wargoals back even if they are outnumbered to prevent a wargoal victory from being forced on them.

(The screenshot above shows this with a 500 power fleet attacking a 1.3K station until it was reinforced with another 500 power fleet. In Vanilla, the 500 power fleet would have just turtled.)

Avoid Enemy Strongpoints

Thank you to Ajey for some interesting observations.

Assuming all other situations are equal, the AI will slightly favour attacking systems without upgraded stations.

For Other Modders: The Long… The Dull… The Speculatively Tested

The assumption of this mod is that the 2.7.2 AI is fundamentally weight driven. That is, at any moment, the AI considers as many choices as possible. It calculates their weights based on hard coded values and certain configurable values. The decision with the highest weight is the decision chosen by the AI. Hence, the Military AI of the game will always choose the highest weighted military decision.

Based on testing and examination of the 2.7.2 configurations, it appears that the game uses two types of weights:

  • Base Weight, or the importance of a decision assuming no other outside influences
  • Weight Multiplier, or a factor that prioritises certain decisions over others

I came to this conclusion as some weights are too small to have any meaningful influence on the AI’s decision unless they were a multiplier of other weights.

Further to the above, it appears that the weights are broken down as follows:

Name
Type
Screenshot Shorthand
WAR_OCCUPIED_BORDER_PRIO
Base
Attack – Frontline Borders
WAR_OWN_BORDER_PRIO
Base
Attack – Own Borders
WAR_ALLY_BORDER_PRIO
Base
Attack – Ally Borders
WAR_NO_BORDER_PRIO
Base
Attack – Deep Enemy Space
WAR_DEFENSE_OWN_PRIO
Base
Defend – Own Borders
WAR_DEFENSE_CONTROLLED_PRIO
Base
Defend – Frontline Borders
WAR_DEFENSE_ALLY_PRIO
Base
Defend – Ally Borders
WAR_NEUTRAL_SPACE_PRIO
Base
Attack – Neutral Space
WAR_ATTACK_CLAIM_PRIO
Multiplier
Claimed
WAR_DEFENSE_CLAIM_PRIO
Multiplier
Conquered
WAR_DEFENSE_OWN_PLANET_PRIO
Multiplier
Controlled
WAR_DEFENSE_OWN_PLANET_ENEMY_CONTROL_PRIO
Multiplier
Invaded
WAR_ATTACK_PLANET_PRIO
Multiplier (Special?)
Enemy Planet
WAR_ATTACK_PLANET_CONTROLLED_SYSTEM_PRIO
Multiplier (Special?)
Conquered System
WAR_ATTACK_STARBASE_PRIO
Multiplier (Special?)
Enemy Strongpoint
WAR_DEFEND_STARBASE_PRIO
Multiplier (Special?)
Own Strongpoint
WAR_ATTACK_MILITARY_FLEET_PRIO
Multiplier (Special?)
Enemy Fleet
WAR_ATTACK_JUMP_DRIVE_FLEET_PRIO
Multiplier (Special?)
Enemy Vulnerable Fleet

I believe that certain multiplier and base weight combinations are thrown out automatically by the AI. For example, the "Attack – Own Borders" decision can never be combined with the "Controlled" multiplier. Based on this, I have attached two new screenshots. One shows the default decision weights of the game AI. The second is the modded decision weights. Therefore, from my observations, the calculated values appear to line up with the in-game behaviour.

In addition, thanks to Ajey’s for pointing out some additional observed behaviours, it appears that there is a subcategory of multipliers that either further multiplies or increases a decision weight. These "Special Multipliers" appear to weight systems with special characteristics (such as enemy fleets or upgrade space stations).

Download
Revisions:

Old revisions of this mod are available below. Click the link to download.