• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

EU4 - Development Diary - 16th of October 2018

Welcome all to today’s dev diary, my name is Michael, and I've been on the EU4 team as a programmer for a bit more than a year now.

Many of you have noted that the AI has been showing some undesirable behavior after recent updates, especially when it comes to defending their homeland and when choosing which forts to siege. So for the upcoming "Spain" update we spent some time on improving those aspects of the army AI. In this dev diary I will be explaining some of the changes we made. In addition to the improved hard-coded AI behavior, with the upcoming update modders will be able to influence some parts of the army AI with scripts. I'll end this dev diary with a short explanation/tutorial of this.


First I'll go over the changes and improvements made so far. Since we are still working on this update all of this is of course subject to change.

- The selection of armies to go on invasions (overseas) does now consider potential threats to the homeland and will be smaller if necessary. There still is the option that the AI will decide to invade with the full force if it thinks it cannot win otherwise. The calculation of the required strength has been overhauled and should be better in determining how many troops are actually needed.

- Region assignment of armies used to be done about once per year. There was a random factor involved so in some cases it could take even longer. In addition to the random reassignments it is now recalculated whenever the threat to the homeland changes considerably, i.e. there are sieges, large amounts of hostile troops moving towards homeland, etc..

- If there is a threat to the homeland these regions will have a much higher priority when assigning AI agents to regions. Even if not threatened, the homeland has higher priority in region assignment, if enough armies are available. On the province level (Within the assigned region) provinces close to the own country are now preferred when looking at what to siege/where to defend and what war goals to go for first.

- Armies running away from a superior force will still try to find a safe place, but provinces that require using military access or long walks will have lower priority, and if reasonably safe, the homeland receives much higher priority. AI armies are more likely to stand their ground, especially if they are clearly inferior and there is no real chance of winning the ongoing war anymore. Previously the player was often forced to chase them around the world thanks to easily available military access.


Scriptable army AI
A central part of the EU4 army AI is the evaluation of provinces, which determines where and when armies move to. There are already many defines you can change to tweak the outcome of this evaluation, but starting with the coming update you will also be able to change or even overwrite the evaluation score by using any trigger you like.
You will find new script files that have some basic functionality in commmon/ai_army, but you can add as many of your own as you like.

Let's look at a simple example:

Code:
province = {
    war = {
        active = {
            is_at_war = yes
        }
        eval_multiply = {
            modifier = {
                factor = 0.1
                is_in_capital_area = yes
            }
        }
    }
}

For now the top-level scope is always "province". We might add different options later. The second level is just a name you can choose freely and it serves to separate different modifications you want to apply. Just like event probabilities the starting value for these is 1. The interesting scopes are "active", "eval_multiply" and (not shown) "eval_add" and "eval_overwrite". With those you can control the modifications that will be applied to the evaluated province score. In this case it will be applied whenever the country is at war.
It is important to note that the evaluation of provinces happens very frequently for all armies in the game, so this "active" trigger will not be checked every time a province is evaluated (Which might happen hundreds of times per daily tick).
It will be evaluated when any of the following happens:
- Whenever you gain or lose ownership or control of a province
- Whenever a war starts or ends
There are three ways to modify the score, you can multiply it, add to it or overwrite it. The factor can be negative and < 1.0 as well so the inverse operations are also possible.
Note that armies prefer the province with the lowest score.

While you can influence armies a lot with this, there are still some hard-coded things that will always take precedence and obviously armies will still always adhere to the rules of the game (e.g. shattered retreat). It is a nice option to have however and I'm looking forward to seeing if and how it will be used in mods. Of course it is also possible to break AI behavior with this, so I'd recommend being careful, especially with "eval_overwrite".

To debug your script you can use the AI mapmode. In this mapmode you can see the evaluation scores for every province if you select an army. You can enable this mapmode by running this command in the console:

Code:
mapmode aieval

Capture.PNG


That’s all for today! Next week we will be looking at new features of the upcoming immersion pack. In the meantime, I’ll be watching this thread, so feel free to ask any questions you might have.
 
Last edited:

mikesc

Programmer - EU4
3 Badges
Aug 4, 2013
32
0
  • Stellaris
  • Hearts of Iron IV Sign-up
Scriptable AI sounds really cool! Is there any functionality on how AI will divvy up/organize its forces, or is it mainly a siege/movement/positioning thing?

For now it is just for movement/positioning, we might add more things in the future where it makes sense.

Shouldn't the AI be more courageous, especially against rebels or when having strong military bonuses?

The AI does know about the defensive bonus, but it will often err on the side of caution, though the way you describe it certainly makes no sense from an AI perspective. If you have a save where it's reproducible please do submit it. (It's difficult and very time-consuming to investigate these kinds of things without being able to reproduce it)

Would this make scripting something like "rebel" armies going out into neighboring countries from their home province possible? I am thinking of something like robber barons.

Rebels will still stay in the area defined in the rebel type, setting the area attribute to some invalid token and then scripting specifically rebel AI could work, have not tried it though.

- How do these changes (and others being made) affect the overall A.I's decisiveness? I may be wrong but it feels like these last patches at least the friendly A.I. has been, in analogous scenarios, noticeably less willing to commit to an action than before (e.g. whether to siege province A or chase army B, or be in region A or B), resulting in much walking around but not much getting accomplished (e.g. ottomans at war with mamluks and doing multiple laps of the arabian peninsula). Im curious about the results of the changes to region assignment of armies and how it relates to this.
- How does the focus on homeland defense affect the willingness of friendly A.I. to invade relatively distant foreign lands in a big war (e.g. france going after bohemia or poland in a protestant league war)? Will it be far less common now?
- If there is one evaluated province score that is so good that no other comes close there is less of a chance that armies will change their mind frequently, so these changes might affect this behavior.
- If the AI is in the war and considers it an important war goal it will still go long ways, but not at the expense of leaving the homeland undefended. It's not all or nothing though, just a balance change towards the homeland.

Hmm, so how will the moddability of the AI affect rebels and such? There should be differences on how the different types of rebels "act". I'd expect separatist and pretender rebels to be the most organised and dangerous compared to say peasant tax dodgers.

Things defined in the rebel types still apply and hard-coded evaluation for armies (including rebels) is still being done just as before. The scripting just allows you to work with the result of that and modify it.

@mikesc What is the one thing that you would like to improve in the AI in the future? (doesn't matter if its possible at the moment)

Many things obviously, sadly there is not enough time to do it all. One thing I would like to tackle is the indecisiveness of armies which leads to all kinds problems. Basically armies will look at the state of the world every day and then decide what to do. Changing conditions will lead to some action being preferable to what the army was trying to do previously and the army canceling whatever it is doing at the moment. There is a lot of code to handle specific cases of this. I would like a more general system that will make it possible for armies to stick to a task, consider already invested time/resources and only change it if it really makes sense.
 
Last edited:

lolada

Field Marshal
23 Badges
Aug 27, 2013
3.001
1.778
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: The Old Gods
  • Crusader Kings II
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Third Rome
  • Europa Universalis 4: Emperor
  • Europa Universalis IV: Golden Century
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Rule Britannia
  • Stellaris: Apocalypse
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Mandate of Heaven
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Rights of Man
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV
Can you also check warscore goals please. For example AI Japan attacked me to take Jeju island - *island* - being the operative word when i obviously had naval dominance. I was in war with Ming, leading at 35% warscore, so they might have miscalculated their chances. Still if AI is gonna declare on player when player is in wars it should obviously *take into account if the player is winning and can peace out of wars*, thus win vs attacker AI easily.

In my case, I just set my fleet to hunt enemy fleets and Japan fleet never left their ports. Thats easy 25% warscore for me since they can never siege. Then i took their southern land since they can't cross straights...

So problem 1. bad AI declarations of war; 2. AI should evaluate someone if it can actually take wargoal.

I've also seen Ottomans attacks Castille in Trade war casus belli.... at beginning of game ergh.
 

AAV

Private
19 Badges
Jul 14, 2017
13
0
  • Europa Universalis IV
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Wealth of Nations
  • Imperator: Rome Sign Up
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Cradle of Civilization
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Pre-order
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Call to arms event
  • Crusader Kings II
Have you fixed the AI's tendency to engage in siege races?
What I mean is that if you have two large countries with 10k troops fighting each other, what always happens is that both armies will immediately invade the other country and begin sieging while completely ignoring each other. What they should be doing is going over force limit, taking loans, and trying to beat each other in a decisive battle.
This problem is very easy to reproduce.
 

hdhhshdsh<s

Second Lieutenant
22 Badges
Mar 1, 2016
166
0
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Res Publica
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Third Rome
  • Europa Universalis IV: Mare Nostrum
  • Imperator: Rome
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Rule Britannia
  • Surviving Mars
  • Europa Universalis IV: Mandate of Heaven
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Cadet
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: El Dorado
  • Cities: Skylines
  • Europa Universalis IV
  • Crusader Kings II
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Cradle of Civilization
Have you fixed the AI's tendency to engage in siege races?
What I mean is that if you have two large countries with 10k troops fighting each other, what always happens is that both armies will immediately invade the other country and begin sieging while completely ignoring each other. What they should be doing is going over force limit, taking loans, and trying to beat each other in a decisive battle.
This problem is very easy to reproduce.
I agree, huge problem that AI is so prone to base trading - especially I noticed Poland/Lithuania can easily get badly hurt by this behaviour (or any countries which tries to base trade with a country that has a strong defensive geographical position, while the aggressor lack one), if they get in a war against Denmark and Co.
Poland/Lit will split up their armies and some will go to Jutland (and be stuck there) while others will try and walk through finland/northern sweden and down through southern sweden (which is of course a suicide mission because of the winter attrition and forts), while Den/Swe/Nor happily and undisturbed can siege up all the polish/lithuanian lands.
 

Zak Preston

Zakharia
79 Badges
Aug 16, 2014
1.668
2.173
  • Crusader Kings III
  • Tyranny - Bastards Wound
  • Tyranny - Tales from the Tiers
  • Knights of Honor
  • Tyranny: Gold Edition
  • Tyranny: Archon Edition
  • Tyranny: Archon Edition
  • Europa Universalis IV
  • Europa Universalis IV: Call to arms event
  • Europa Universalis IV: Pre-order
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris Sign-up
  • Hearts of Iron IV: Cadet
  • Stellaris: Megacorp
  • Imperator: Rome Deluxe Edition
  • Imperator: Rome Sign Up
  • Mount & Blade: Warband
  • Europa Universalis III: Collection
  • Victoria 2
  • Stellaris: Galaxy Edition
  • Crusader Kings II
  • Imperator: Rome
  • War of the Roses
@mikesc
1. What is your opinion on "tall" gameplay?
  1. does it satisfy you in its current state (live version)?
  2. are there any plans to add more interactions for "tall" nations (more meaningful estates, additional realm management, international affairs, banking, food\famine system)?
  3. do you need any feedback or suggestions regarding "tall" gameplay?
2. The level of detail for India (superb), Poland region and now Iberia is astonishing. Compared to ultra-shredded Polish states, Silesia looks atrocious, same goes for Baltics, Muscovy, Steppes. In my opinion this creates an inconsistency, especially when (even now) North American (13 colonies) uncolonized coast or West African deserts look way more developed, populous, advanced, and relevant than some European lands. The inconsistency and disparity between some lands has never been so huge after Dharma release. Don't you think it's time for a new AoW-like (1.7) patch for the whole world?
 

Player 2

Corporal
48 Badges
Feb 24, 2013
40
27
  • Europa Universalis III
  • Heir to the Throne
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Art of War
  • Divine Wind
  • Europa Universalis III Complete
  • Europa Universalis III: Chronicles
  • Europa Universalis IV: Res Publica
  • Victoria 2: A House Divided
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Pre-order
  • Cities: Skylines - After Dark
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Conclave
  • Europa Universalis IV: El Dorado
  • Cities: Skylines - Natural Disasters
  • Crusader Kings II: Monks and Mystics
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Crusader Kings II: Holy Fury
  • Europa Universalis IV: Golden Century
  • Imperator: Rome
  • Europa Universalis 4: Emperor
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Common Sense
  • Cities: Skylines
  • Victoria 2
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Europa Universalis IV
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Jade Dragon
  • Crusader Kings II: Sunset Invasion
  • Europa Universalis IV: Third Rome
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV: Mare Nostrum
  • Crusader Kings II
  • Europa Universalis IV: Cossacks
Due to this Immersion pack being focused on Iberia can we expect to see unique national ideas added to the formable colonial nations such as Colombia, UPCA, Peru etc.. ? :)
 

pedrito_elcabra

Colonel
61 Badges
Dec 18, 2011
882
1.095
  • Crusader Kings II
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV: Third Rome
  • Crusader Kings II: Monks and Mystics
  • Victoria 2: Heart of Darkness
  • Victoria 2: A House Divided
  • Victoria: Revolutions
  • Europa Universalis IV: Res Publica
  • Magicka
  • Heir to the Throne
  • Hearts of Iron III
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV
  • Divine Wind
  • Europa Universalis III Complete
  • Europa Universalis III
  • Europa Universalis IV: Art of War
  • Arsenal of Democracy
  • Crusader Kings II: Conclave
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Rule Britannia
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Hearts of Iron IV: Field Marshal
  • Crusader Kings II: Reapers Due
  • Europa Universalis IV: Rights of Man
  • Tyranny: Archon Edition
  • Imperator: Rome
  • Europa Universalis IV: Mandate of Heaven
  • Hearts of Iron IV: Expansion Pass
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Cradle of Civilization
  • 500k Club
  • Europa Universalis III Complete
  • Europa Universalis 4: Emperor
  • Europa Universalis III Complete
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Golden Century
  • Victoria 2
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Parklife
  • Europa Universalis IV: El Dorado
  • Pride of Nations
  • Crusader Kings II: Way of Life
  • Pillars of Eternity
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Crusader Kings II: The Old Gods
Very nice to hear these news!

Any plans to fix the bug where the AI doesn't improve capital forts?

It's a massive gamebreaker when you can just walk up to the lvl 1 capital fort of a Great Power and siege it in a couple of months, making it willing to sign separate peace almost immediately. Especially when that country is swimming in ducats and has 20 or more lvl 8 forts all over the place, just not in their capital.
 

navaluiki

Major
86 Badges
Aug 18, 2017
739
66
  • Europa Universalis IV: Rights of Man
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Crusader Kings III
  • Stellaris: Humanoids Species Pack
  • Crusader Kings II: Conclave
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Golden Century
  • Europa Universalis IV: Cradle of Civilization
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Reapers Due
  • Crusader Kings II: Way of Life
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Cities: Skylines - Natural Disasters
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Stellaris: Federations
  • Cities: Skylines - Mass Transit
  • Europa Universalis IV: Mandate of Heaven
  • Hearts of Iron IV: La Resistance
  • Surviving Mars
  • Hearts of Iron IV: Death or Dishonor
  • Cities: Skylines - Green Cities
  • Mount & Blade: With Fire and Sword
  • Crusader Kings III: Royal Edition
  • Stellaris: Lithoids
  • Cities: Skylines Industries
  • Hearts of Iron IV: No Step Back
  • Europa Universalis 4: Emperor
  • Shadowrun Returns
  • Hearts of Iron IV: Expansion Pass
  • Stellaris: Distant Stars
  • Europa Universalis IV
  • Battle for Bosporus
  • Stellaris: Nemesis
  • Crusader Kings II: Holy Fury
  • Surviving Mars: First Colony Edition
  • Stellaris: Apocalypse
  • Cities: Skylines - Campus
  • Europa Universalis IV: Dharma
  • Victoria 2
  • Stellaris: Necroids
  • Cities: Skylines
  • Cities: Skylines Deluxe Edition
  • Europa Universalis IV: El Dorado
  • Cities: Skylines - Parklife
  • Europa Universalis IV: Call to arms event
@mikesc
1. What is your opinion on "tall" gameplay?
  1. does it satisfy you in its current state (live version)?
  2. are there any plans to add more interactions for "tall" nations (more meaningful estates, additional realm management, international affairs, banking, food\famine system)?
  3. do you need any feedback or suggestions regarding "tall" gameplay?
2. The level of detail for India (superb), Poland region and now Iberia is astonishing. Compared to ultra-shredded Polish states, Silesia looks atrocious, same goes for Baltics, Muscovy, Steppes. In my opinion this creates an inconsistency, especially when (even now) North American (13 colonies) uncolonized coast or West African deserts look way more developed, populous, advanced, and relevant than some European lands. The inconsistency and disparity between some lands has never been so huge after Dharma release. Don't you think it's time for a new AoW-like (1.7) patch for the whole world?
I would not point out Iberia as an example of a very detailed region. I don't think it is well represented, not even after the update.
Considering its population, size, wealth and major historical role; it has very few provinces and they are very badly distributed.

Imo, the best represented region is by far the British Isles.
 

123e55

Transylvanian Warmonger.
10 Badges
Oct 7, 2014
426
374
  • Crusader Kings II
  • Victoria: Revolutions
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Europa Universalis IV
  • Victoria 2
  • Cities: Skylines
  • Hearts of Iron IV Sign-up
  • Hearts of Iron IV: Cadet
  • Crusader Kings III
Welcome all to today’s dev diary, my name is Michael, and I've been on the EU4 team as a programmer for a bit more than a year now.

Many of you have noted that the AI has been showing some undesirable behavior after recent updates, especially when it comes to defending their homeland and when choosing which forts to siege. So for the upcoming "Spain" update we spent some time on improving those aspects of the army AI. In this dev diary I will be explaining some of the changes we made. In addition to the improved hard-coded AI behavior, with the upcoming update modders will be able to influence some parts of the army AI with scripts. I'll end this dev diary with a short explanation/tutorial of this.


First I'll go over the changes and improvements made so far. Since we are still working on this update all of this is of course subject to change.

- The selection of armies to go on invasions (overseas) does now consider potential threats to the homeland and will be smaller if necessary. There still is the option that the AI will decide to invade with the full force if it thinks it cannot win otherwise. The calculation of the required strength has been overhauled and should be better in determining how many troops are actually needed.

- Region assignment of armies used to be done about once per year. There was a random factor involved so in some cases it could take even longer. In addition to the random reassignments it is now recalculated whenever the threat to the homeland changes considerably, i.e. there are sieges, large amounts of hostile troops moving towards homeland, etc..

- If there is a threat to the homeland these regions will have a much higher priority when assigning AI agents to regions. Even if not threatened, the homeland has higher priority in region assignment, if enough armies are available. On the province level (Within the assigned region) provinces close to the own country are now preferred when looking at what to siege/where to defend and what war goals to go for first.

- Armies running away from a superior force will still try to find a safe place, but provinces that require using military access or long walks will have lower priority, and if reasonably safe, the homeland receives much higher priority. AI armies are more likely to stand their ground, especially if they are clearly inferior and there is no real chance of winning the ongoing war anymore. Previously the player was often forced to chase them around the world thanks to easily available military access.


Scriptable army AI
A central part of the EU4 army AI is the evaluation of provinces, which determines where and when armies move to. There are already many defines you can change to tweak the outcome of this evaluation, but starting with the coming update you will also be able to change or even overwrite the evaluation score by using any trigger you like.
You will find new script files that have some basic functionality in commmon/ai_army, but you can add as many of your own as you like.

Let's look at a simple example:

Code:
province = {
    war = {
        active = {
            is_at_war = yes
        }
        eval_multiply = {
            modifier = {
                factor = 0.1
                is_in_capital_area = yes
            }
        }
    }
}

For now the top-level scope is always "province". We might add different options later. The second level is just a name you can choose freely and it serves to separate different modifications you want to apply. Just like event probabilities the starting value for these is 1. The interesting scopes are "active", "eval_multiply" and (not shown) "eval_add" and "eval_overwrite". With those you can control the modifications that will be applied to the evaluated province score. In this case it will be applied whenever the country is at war.
It is important to note that the evaluation of provinces happens very frequently for all armies in the game, so this "active" trigger will not be checked every time a province is evaluated (Which might happen hundreds of times per daily tick).
It will be evaluated when any of the following happens:
- Whenever you gain or lose ownership or control of a province
- Whenever a war starts or ends
There are three ways to modify the score, you can multiply it, add to it or overwrite it. The factor can be negative and < 1.0 as well so the inverse operations are also possible.
Note that armies prefer the province with the lowest score.

While you can influence armies a lot with this, there are still some hard-coded things that will always take precedence and obviously armies will still always adhere to the rules of the game (e.g. shattered retreat). It is a nice option to have however and I'm looking forward to seeing if and how it will be used in mods. Of course it is also possible to break AI behavior with this, so I'd recommend being careful, especially with "eval_overwrite".

To debug your script you can use the AI mapmode. In this mapmode you can see the evaluation scores for every province if you select an army. You can enable this mapmode by running this command in the console:

Code:
mapmode aieval

View attachment 411237

That’s all for today! Next week we will be looking at new features of the upcoming immersion pack. In the meantime, I’ll be watching this thread, so feel free to ask any questions you might have.

Any chance of getting an immersion pack for the Romanian principalities or Poland?
 

Chief of Staff

The Duke of Rockford
85 Badges
Jun 27, 2010
2.193
1.063
37
www.virtualparadise.org
  • Cities: Skylines Deluxe Edition
  • Heir to the Throne
  • March of the Eagles
  • Europa Universalis IV: Res Publica
  • Rome Gold
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Rome: Vae Victis
  • Stellaris: Synthetic Dawn
  • Stellaris - Path to Destruction bundle
  • Cities in Motion 2
  • Europa Universalis IV: Third Rome
  • Cities: Skylines - After Dark
  • Europa Universalis IV: Cossacks
  • Cities: Skylines - Snowfall
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Steel Division: Normandy 44
  • Stellaris: Galaxy Edition
  • Crusader Kings II: Reapers Due
  • Europa Universalis III: Chronicles
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Sword of Islam
  • Crusader Kings II: Legacy of Rome
  • Hearts of Iron III
  • Crusader Kings II: Charlemagne
  • Crusader Kings II
  • Europa Universalis III
  • Divine Wind
  • Crusader Kings II: Jade Dragon
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Cities in Motion
  • Europa Universalis IV: Call to arms event
  • Pride of Nations
  • Hearts of Iron IV: Cadet
  • Hearts of Iron IV: Colonel
  • Europa Universalis IV: Rights of Man
  • Crusader Kings II: Conclave
  • Crusader Kings II: Horse Lords
  • Stellaris: Nemesis
  • Europa Universalis IV: Pre-order
  • Europa Universalis IV: El Dorado
  • Europa Universalis III Complete
  • Victoria 2
  • Europa Universalis III Complete
Awesome to see AI improvements and AI exposed a bit for the modders!

One thing I would love see one day in scriptable AI is influencing how they organize their forces. For example, I often organize my army into "divisions", each consisting of 20k (10k infantry, 4k cavalry, 4 artillery) but I often see AI organize their army into huge stacks way larger than 20k. Of course, if I were to mod that, I'd need to compensate for that with extra leadership slots for the AI and probably either some small MIL power buffs or give them leader recruitment cost discount (just like I gave myself leadership slot boost in order to make the "divisions" viable).

One other nice possibility would to be to influence how they position their army for a "front". This would be very useful for emulating the WW1-style warfare for the Victorian and post-Victorian mods out there for EU4 that has become popular lately. It is my understanding that warfare as depicted in Victoria II changes over the time from roving armies of the Napoleonic era to trench warfare in WW1, hence the "front" thing. Of course, this would need to account for the time or technology somehow as a factor in changing AI behavior on this aspect, probably with something like
Code:
modifier = { factor = 10 tech = ## }
where ## is tech number to determine when AI should adopt this new behavior.
 

MachopPower69

Lt. General
48 Badges
Feb 18, 2018
1.481
2.258
  • Europa Universalis IV: Golden Century
  • Hearts of Iron IV: Cadet
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Europa Universalis IV: Mandate of Heaven
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Cradle of Civilization
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Crusader Kings II: Holy Fury
  • Europa Universalis IV: Mare Nostrum
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Imperator: Rome Sign Up
  • Hearts of Iron IV: La Resistance
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Battle for Bosporus
  • Europa Universalis 4: Emperor
  • Victoria 3 Sign Up
  • Hearts of Iron IV: No Step Back
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Legacy of Rome
  • Cities: Skylines
  • Europa Universalis IV
  • Crusader Kings II: Rajas of India
  • Victoria 2
  • Crusader Kings II: Conclave
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: The Old Gods
  • Europa Universalis IV: Res Publica
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Europa Universalis IV: Third Rome
  • Crusader Kings II
Hey, can someone help explain what the dev is trying to say? It got my head messed up, and I want it summarised, as i am confused. Also, would the Iberia Update affect colonisation and trade routes? And will Portugal, Navarra and Granada have Focus Trees?
 

lolada

Field Marshal
23 Badges
Aug 27, 2013
3.001
1.778
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: The Old Gods
  • Crusader Kings II
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Europa Universalis IV: Res Publica
  • Europa Universalis IV: Third Rome
  • Europa Universalis 4: Emperor
  • Europa Universalis IV: Golden Century
  • Europa Universalis IV: Dharma
  • Europa Universalis IV: Rule Britannia
  • Stellaris: Apocalypse
  • Europa Universalis IV: Cradle of Civilization
  • Europa Universalis IV: Mandate of Heaven
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Rights of Man
  • Stellaris
  • Europa Universalis IV: Mare Nostrum
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV
Hey, can someone help explain what the dev is trying to say? It got my head messed up, and I want it summarised, as i am confused. Also, would the Iberia Update affect colonisation and trade routes? And will Portugal, Navarra and Granada have Focus Trees?
Dev is trying to say that AI will defend their country more :) smth like France will be less happy to leave and attack Korea while Paris is being sieged. And there are some other AI improvements.

- AI forts placement - can you teach AI to delete adjacent surplus forts, and reeval which forts to keep when it conquers territory. AI usually bankrupts :(, while player deletes forts that he cannot pay for.
- AI building fort in capital should be high priority - some AI's like Sweden are super useless because of this since their cap falls quickly
- AI upgrading forts - should be priority, capital and on side to rivals, if AI has money
 

MachopPower69

Lt. General
48 Badges
Feb 18, 2018
1.481
2.258
  • Europa Universalis IV: Golden Century
  • Hearts of Iron IV: Cadet
  • Europa Universalis IV: Rights of Man
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Europa Universalis IV: Mandate of Heaven
  • Hearts of Iron IV: Death or Dishonor
  • Europa Universalis IV: Cradle of Civilization
  • Hearts of Iron IV: Expansion Pass
  • Europa Universalis IV: Rule Britannia
  • Europa Universalis IV: Dharma
  • Crusader Kings II: Holy Fury
  • Europa Universalis IV: Mare Nostrum
  • Imperator: Rome
  • Hearts of Iron IV: Expansion Pass
  • Imperator: Rome Sign Up
  • Hearts of Iron IV: La Resistance
  • Crusader Kings III
  • Crusader Kings III: Royal Edition
  • Battle for Bosporus
  • Europa Universalis 4: Emperor
  • Victoria 3 Sign Up
  • Hearts of Iron IV: No Step Back
  • Crusader Kings II: Sword of Islam
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: El Dorado
  • Crusader Kings II: Legacy of Rome
  • Cities: Skylines
  • Europa Universalis IV
  • Crusader Kings II: Rajas of India
  • Victoria 2
  • Crusader Kings II: Conclave
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: The Old Gods
  • Europa Universalis IV: Res Publica
  • Crusader Kings II: Charlemagne
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Victoria 2: A House Divided
  • Victoria 2: Heart of Darkness
  • Europa Universalis IV: Third Rome
  • Crusader Kings II
Dev is trying to say that AI will defend their country more :) smth like France will be less happy to leave and attack Korea while Paris is being sieged. And there are some other AI improvements.

- AI forts placement - can you teach AI to delete adjacent surplus forts, and reeval which forts to keep when it conquers territory. AI usually bankrupts :(, while player deletes forts that he cannot pay for.
- AI building fort in capital should be high priority - some AI's like Sweden are super useless because of this since their cap falls quickly
- AI upgrading forts - should be priority, capital and on side to rivals, if AI has money
Thanks. Although they should tl;dr their dev diaries for people who just want the beef, and not the whole cow (If you know what I mean)
 

gougluinn

Captain
Jul 1, 2014
404
172
Great changes to the AI!
One thing I would like to see addressed as well is the fact that AI can be clairvoyant as if they permanently infiltrated administration. Sometimes the AI leaves a fort it almost sieged down, because it knows a superior force of mine is heading to that province. Fog of war means very little to the AI.
Worst is when I have a smaller force than the enemy. Outmaneuvering them becomes almost impossible as they always seem to know where I am hiding out.
just happened, lost stackwipe chance:
only with forced march you can catch them.
Screenshot (297) (2jpg).jpg
 

LetaBot

Captain
81 Badges
Mar 3, 2007
340
28
github.com
  • Europa Universalis IV: Rights of Man
  • Cities: Skylines
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
  • Crusader Kings II: Way of Life
  • Europa Universalis IV: Common Sense
  • Crusader Kings II: Horse Lords
  • Europa Universalis IV: Cossacks
  • Crusader Kings II: Conclave
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Hearts of Iron IV: Cadet
  • Crusader Kings II: Reapers Due
  • Warlock: Master of the Arcane
  • Tyranny: Archon Edition
  • Stellaris: Digital Anniversary Edition
  • Stellaris: Leviathans Story Pack
  • Hearts of Iron IV: Together for Victory
  • Crusader Kings II: Monks and Mystics
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Mandate of Heaven
  • Europa Universalis IV: Third Rome
  • BATTLETECH
  • Surviving Mars
  • Hearts of Iron IV: Death or Dishonor
  • Stellaris: Necroids
  • Europa Universalis IV: Wealth of Nations
  • Crusader Kings II: Charlemagne
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Old Gods
  • Crusader Kings II: Rajas of India
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Crusader Kings II: Sunset Invasion
  • Crusader Kings II: Sword of Islam
  • Darkest Hour
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Crusader Kings II
  • Europa Universalis IV: Call to arms event
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Hearts of Iron III Collection
  • Magicka
  • Europa Universalis IV: Res Publica
  • Semper Fi
  • Victoria 2
  • Victoria 2: A House Divided
Thanks for the changes, they are certainly welcome.

As for questions, recently I've noticed that the AI often refuses to attack similar stacks that are sieging its forts. Eg. if a 24k stack is sieging a fort, the AI will often park its similar sized army next to it, wait for the siege to finish and only attack after it's been occupied. It seems to me that the AI is scared of even battles and doesn't factor in the newish defensive bonus when relieving fort sieges. This often makes it lose fortresses to rebels or enemies for no reason. Oddly enough, it often chooses to engage right after the fort has been captured, needlessly taking attacker penalties. Shouldn't the AI be more courageous, especially against rebels or when having strong military bonuses?

This used to be the case in patch 1.13 . Not sure when that changed.