almost 3 years ago - /u/ - Direct link
A lil somethin somethin: You can find the details for this event on the announcement page here.
almost 3 years ago - BjornB - Direct link
Hello folks, Gnivom here.

Today I’ll talk about some of the many AI updates coming in the next patch, 1.33. At the end I’ll also mention some minor but impactful changes to the rules of land combat.

Our last major update, we shipped some AI improvements[forum.paradoxplaza.com], but a few new issues slipped through as well. Two of those in particular (advisors and forts) were too complex to make it into any of the hotfixes. For 1.33, we have not only addressed those issues, but done a range of further AI fixes/improvements as well. Because of the large number of changes, some new AI issues will probably slip through this time as well. Our goal is to have a public beta for 1.33, which could help a lot with early feedback and time to address it before the final release.

Forts
The issue introduced (or at least worsened) in 1.32 was that the AI deletes many of its forts, and seldom builds new. This was likely triggered by changes we did to tighten the AI’s budget, as it had had serious budget issues for a number of versions before that. Clearly we couldn't just revert the changes blindly. Instead I wanted to dig deeper and fix underlying issues with the AI's handling of forts.

For example, there has for a long time been a bug that caused large countries to only build level 2 forts. In simplified terms: When the AI "defense minister" considered upgrading a fort, it wanted to make sure it could afford upgrading all its forts to the same level, or it would only upgrade to a lower level. So it asked the AI "finance minister" if it can afford maintaining e.g. 10 level 4 forts, but the finance minister says no, reasoning that "you shouldn't need this much money for building one fort". So the AI was in a stalemate, where it could only build the lowest level of forts.

Another issue was fort mothballing. The AI would often mothball forts in a way that allowed players to blitz them.

The result after spending some time with this is an AI that seldom deletes any forts, often upgrades forts to higher levels, sometimes builds new forts (especially in strategic locations with good terrain), and is much more careful/intelligent with mothballing. Of course, the AI will still delete forts it really can't afford (such as QQ at game start), and it doesn't have human-level tactical or strategic understanding of fort positioning. But overall, I hope you will find it a big improvement :).


(All of these are level 8 forts, in an 1821 AI-only game. Maybe it’s a bit front-heavy…)

Advisors
In 1.32 the AI rarely hires advisors, and often fires them as soon as they're at war. This too was the result of code intended to tighten the budget. Like with forts though, it turned out that there were other issues worsening the problem.

One such bug was that when deciding which mana it needed the most, two of them could tie for first place - causing the AI to pick the third (worst) type instead. This made the AI hire diplo advisors way too often. Another obscure bug was that if it took the AI too long to save up the money for the initial advisor cost, it could lose track of it, making the money "earmarked" but ever used.

In 1.33, the AI will usually keep a reasonable amount of advisors, often prioritizing military or admin. A reworked threshold system makes it not hire-and-fire advisors frivolously. AIs with Meritocracy will realize the importance of having enough advisors to keep it growing. With these improvements, and considering how it stacks with some Monuments and Estate Privileges, we've decided to remove the -20% Advisor Cost modifier for Lucky Nations. Most of them are doing more than fine.

Other budgeting
Other areas where the AI sometimes didn't spend enough include colonists and missionaries. Colonial Nations and AIs with Colonialist personality in particular will spend a larger amount on colonization. One neat addition is that Colonial Nation subjects will now direct all received subsidies towards colonization, in addition to what they would otherwise have spent, unless they have loans. This lets their overlord (or anyone else ;)) make sure they put their colonists to work.

Peace-time armies are now also a greater priority for small nations, especially for those without powerful allies/guarantors. You should find for example uniting Ireland to be more challenging.

Now of course you may wonder, if all these things get more spending, won't the AI go into debt spirals again? It turns out there were a couple of places where spending could be cut:
- Drilling armies: The AI now only does this only if it has a large budget surplus
- Corruption: Sometimes it makes sense to get "free money" for corruption, but the AI overused that, and then found itself rooting it out at several times the cost.
- Navy Force Limit: It makes sense for some AIs to go above Naval FL, but this has been reduced somewhat.
- Consolidate Regiments: When the AI finds itself with troops it doesn't need at the moment, usually after a war or a battle with rebels, it will consolidate regiments.
- Fort maintenance: Wait, didn't I say the AI is better at maintaining, building and upgrading forts? Sure. But in some cases, in particular poor OPMs with an expensive capital fort, mothballing it really can be worth it.
- Inflation: By giving a higher prio to reducing inflation, many AIs reduce all expenses by several percent.

If these measures are not enough, when the AI goes into longterm deficits and debt, it will implement progressive austerity measures. Firing advisors, reducing army size, and even deleting forts. As far as I've observed, this only happens during/after severe crises, and works fairly well.

The budget is also significantly helped by increased crownland, which we'll get to later.



(16’th century Ethiopian budget, recouping after an expensive war. They’ll soon lower army maintenance and mothball a couple of forts to get a better surplus)

Monarch Power (mana)
At release of 1.32, there was a major issue with AI mana spending, causing the AI to often fall behind in tech and/or ideas. This was made worse by how it interacted with the new institution tech cost, and by the issues with advisors mentioned above. Although a hotfix was issued including a fix to the main issue, we've spent more time looking at the AI's mana economy. The AI now:
- better understands when to buy tech vs. ideas vs. other things.
- uses more advisors (as mentioned before).
- uses Estate Privileges for free mana.
- better understands when to prioritize a certain mana, in terms of National Focus, Advisors, and Estate Privileges.

It also turns out that if you play a Republic, and especially with Plutocratic ideas, choosing randomly between the event options of those events can cause you to spend a majority of your ADM on boosting stability. We've gone through many of the events affecting Stability and/or Republican Tradition, and made the AI pick the better/safer option.
Estates

When the Estates system was last redesigned, AI was written to interact with it. But that AI wasn't necessarily written/tested too carefully, and years of design changes and lack of proper attention have made it worse.
It turns out that by making the AI play a fairly simple estates meta, but play it consistently, it gets quite a nice set of bonuses; from tax income and autonomy reduction, to mana; at very small cost.
The AI will:
- Seize Land even when it causes revolts (but only after maintaining troops and forts)
- Occasionally Call Diet to temporarily increase Loyalty, although it doesn't usually try to complete it
- Prioritize Privileges that give loyalty and mana
- Sell Titles only when crownland is high and/or the money is badly needed

Naval Invasions
1.32 saw some fixes in this area. 1.33 will have a couple of further small improvements/fixes that should reduce friction for multi-continent empires in particular. For example:
- Armies that have nothing to do are less likely to refuse an invasion mission
- Invasions will no longer wait for faraway ships to help out, unless they are necessary

In one game, I actually saw AI Portugal conquering a third of India by 1700 or so, while also having colonies in the Americas and Africa. But in fairness, that is not a common sight. AI naval invasions will remain an Achilles’ heel.

Army Quality
This is a major one. And huge thanks to [USER=1294106]@Tempscire[/user], who has helped me with running simulations, with mathematical analysis, and schooling me on how EU4 land combat actually works.

The question the AI is trying to answer here is whether to start a battle, or even a war. To do so, it must estimate the quality of troops. Basically: how many Swedish soldiers does it take to equal 1 Prussian soldier? Until 1.32, the AI did this by applying a series of modifiers, based on Discipline, Morale, etc., that were tuned on gut feeling. From 1.33 (and somewhat already from 1.32) we have proper math and simulations to back them up.

The AI now appreciates the value of morale more than before. It understands how a general’s impact on a battle depends on the terrain. It understands the interplay between e.g. Infantry Fire, Fire Pips of the Unit Type, Fire Damage, and Infantry Combat Ability. It also understands combat width and flanking, but it doesn’t yet understand army composition between infantry/cavalry/artillery. That is definitely something to continue working on.

With this improved confidence in its understanding of army strength, the AI’s safety margin for starting attacks has been reduced somewhat. It has also been made more aware of nearby armies on both sides. You will find the AI starting more winning battles, and hopefully fewer losing battles. Although the reduced safety margin combined with bad understanding of army composition can make the AI fail in this regard.

Changes to Land Combat
The thought that went into the army quality AI made us realize (again, with @tempscire’s guidance) we should change some things about how combat works. As mentioned in last week’s DD; Unit Type Fire and Shock pips now affect morale damage as well strength damage. This makes the choice between Unit Types less imbalanced. Contrary to what was said last week, and in part because of feedback on that post, this will also apply to morale defense from backrow. The fact that this makes artillery more powerful and battles longer is counteracted by some more important changes we decided to do:
  • Infantry and Cavalry can no longer deploy/reinforce to the backrow.
  • Backrow regiments will now retreat when reaching 0% morale (same as frontrow regiments).
  • Constant 0.03 morale damage per day is now only applied to reserves, and not to regiments on the battlefield.

I’m sure many of you (just as myself not too long ago) do not understand how this affects the combat meta in practice. Without making this DD much longer than it already is, some important effects are:
  • It’s no longer critically important to have a full combat width of artillery in the battle on day 1.
  • An army of 2x combat width infantry is now superior to an army of 1x combat width infantry. Previously they were roughly equal.
  • You’ll need more artillery than just the combat width to last a long battle.


That’s it for this week, hope you’re as excited for 1.33 as I am!
Next week @pavia will make a Dev Diary on the subject of “Script Debt”.

Thanks again to @Tempscire, but also to @xorme whose AI mod inspired some of the improvements. And thanks to everyone who provides great feedback on this forum and elsewhere!

Oh, and here is a full list of AI-related changes from the in-progress changelog:

*** AI Changelog in 1.33 ***

- Fixed Celestial Emperor advisor budgeting issue.
- Rewrote AI savings logic.
- Colonial nations spend more money on colonists.
- Increased AI minimum colonization budget.
- Reworked AI fort mothballing forts.
- Fixed issue that AIs in debt didn't convert provinces.
- Made AI consider flanking.
- AI better understands importance of generals' pips.
- AI now considers units' drill before starting a battle.
- Fixed bug where AI thought 'coordinated attack' and instead sent individual armies to die.
- Fixed multiple issues with scripted ai_army, one of which made it not work at all. It can now also be debugged with the 'mapmode armyeval' command.
- The AI now makes smarter decisions regarding Patriarchal Authority in events.
- AI better at consolidating regiments before battle.
- AI can now declare wars when overextension is up to 50% (previously 25%), but only if already coring everything.
- AI considers nearby units more when considering a battle.
- AI will now seize land from estates more often, but raise army/fort maintenance.
- Added AI priority to a few conquest missions of France and the Ottomans in order to ensure them prioritizing their missions.
- Better at taking home troops overseas (instead of disbanding).
- Build a bit more universities.
- Made AI Care about beijing, nanjing, canton for mandate.
- Made AI Care about corruption for mandate.
- Celestial Emperor more aggressive towards countries that refuse to pay tribute.
- Colonial Nations without debt are now likely to spend all subsidies they get on colonists.
- Colonial subjects will care more about wars against countries in their colonial region.
- Coordinated offensives will now focus on committed sieges.
- Fixed AI army ignoring terrain for some threat evaluation.
- Fixed bug that AI sometimes ignored armies with insufficient troops for siege.
- Fixed bug that caused exiled armies to behave erratically.
- Fixed bug that made AI less afraid of non-rebel armies, when it should be rebel armies.
- Fixed bug that made AI not declare easy wars as often.
- Fixed bug that made colonial nations not colonize islands in their own colonial region.
- Fixed issue where armies would refuse to do things nearby, because it was assigned to a region far away.
- Fixed issue with colonists not being recalled when they should be.
- Fixed issues sometimes preventing AI upgrading forts to higher level.
- Fixed issues with colonial budgeting (causing bankruptcy spirals).
- Fixed that autonomous sieging could go back and forth between provinces that were flipped back by a fort.
- Improved AI understanding of native uprising risks (less africans getting stackwiped taking a shortcut).
- Improved AI handling of estate privileges.
- Improved army quality calculations.
- Improved handling of corruption.
- Improved handling of inflation.
- Improved logic for where to build forts.
- Improved national focus (mana) handling.
- Improved the AI decision making for Orthodox events.
- Increased budget priority for saving money.
- Made AI less eager to demand return core treaty unless it likes the benefactor.
- Made AI less eager to go over naval forcelimit.
- Made AI less likely to mothball forts when risky.
- Lowered AI priority on building great projects over other buildings.
- Lowered AI safety margin when attacking to compensate for other fixes.
- Made AI aware of risk of rebels spawning in a province.
- Made AI chase your small armies in more cases.
- Made all chinese countries want to conquer the 3 Mandate cities, if they have 1 already.
- Made AI armies which are afraid of enemies, prefer safe terrain even more.
- Made AI more likely to enforce rebel demands (peace treaty) in the rare case that it can do so.
- Made AI more likely to promote cultures (with large development).
- Reduced maximum budget for subsidies to 10% of income.
- Several fixes and improvements regarding advisors.
- Somewhat more competent at naval invasions for large empires.
- Subjects with loans will keep a standing army again (although it will be small).
- The Ethopian AI will no longer move its capital while being at war.
- Tweaked AI siege priorities.
- Very small countries with scary neighbors will now keep a larger army when at peace.
- Made AI less likely to split armies in threatening places.
- Made AI more happy to hunt nearby armies.
- Army AI only takes its own armies on fleets.
- Fixed small AIs militarizing also when Rights of Man DLC disabled.
- Improved Strong Duchies AI.
- AI can handle reassigning merchants.
- AI no longer sells provinces to charter cheaply, and added new malus for presence of great projects in the province too.
- AI no longer uses pillage capital state when it has nothing to gain from it.