Hearts of Iron IV

Hearts of Iron IV

Expert AI 5.0
 This topic has been pinned, so it's probably important
Kondi  [developer] 1 Oct, 2022 @ 12:56pm
Patch notes (EAI 4.7 - HOI4 1.12)
IMPORTANT: see the github page for details of all changes made. Small fixes won't be mentioned elsewhere.

https://github.com/Kondikka/expertai

_____________________________________________

-By Blood Alone is basically a required DLC. The mod technically works without it but there will be no support from my end for fixing potential air AI issues or balancing when not using this DLC.

-Added EAI equipment scripts for all air plane types. Since air balance is currently up in the air, there I'm not going too much into optimizing these designs. Not much point complaining about single vs dual engines for fighters or what type of fighters the AI builds (it builds regular fighters instead of heavy fighters but you can switch that over if you want).

-AI military focuses: added configurable fighter and maritime patrol categories. Added cheap AI fighter equipment type for countries with no access to aluminium which the AI can switch to dynamically (e.g. ENG loses its convoys and has almost no aluminium, it will start building planes out of paper).

-New construction AI framework in the mod built around the building_target strategies. Instead of inserting buildings into the queue via scripts, there is a scripted building AI that uses building_target strategies to manage how much CIC / MIC / NIC the AI wants to build in total with respect to its building slots as well as refineries and silos based on need. In some cases queue insertion into the queue is still used for other buildings, as well as the decision based priority constructions for critical buildings. The new system is a lot less problematic in a lot of ways and allows me to easily add a lot of dynamic AI logic to how much it wants to build as well as take care of any special cases. Probably needs further tweaking to get things more optimal...

-Allied naval invasion coordination diplomatic action/interface: Added a diplomatic action similar to border avoidance control for naval invasion control. Set rules for allied countries to invade target states or countries. The AI is even more selective when deciding to follow these rules than with border avoidance. Basically, try your luck and see if anything happens. It should be no worse than the old invasion coordination decisions in any case.

-Border avoidance/invasion control: shows icons on map on states that are in the target states list.

-Added a strategy for AI to make it ground its air force when its air force is being overwhelmed by the enemy. E.g. instead of USSR sending its only 100 planes against Germany's 10k, it will keep its air force grounded until it has built enough to put up a better fight. This means that the old production strategy that cancelled the AI's entire air production in similar situations to prevent a massive waste of resources is not needed anymore.

-A military focuses: built a better framework for AI dynamically switching its own military focuses during a campaign. Previous system was crude, and generally AI nations would simply stick with the military focuses they chose during initialization. Now the AI will switch around more especially when it comes to air and naval focuses so that it starts/stops trying to develop and produce things that make no sense for its circumstances e.g. when to build strategic bombers, big fleets.

-Fixed mod possibly not allowing the AI to upgrade ships in some cases.

-Fixed multiple negative value equipment AI strategies possibly causing strange issues with equipment production with tanks and planes in particular.

-Fixed issues with AI having trouble getting Women in the workforce decision, causing issues with manpower.

-Temporarily stopped the invasion of Iran happening as the peace treaty resulting from it breaks the game.

-Made infantry divisions in general cheaper as the AI didn't seem to deal with them very well. No maintenance companies, less artillery. Added a very cheap template variant for all infantry template types that use even less support companies that generally used in the early game or countries with a small industry.

-Majors on Challenging mode build capital ships again.

-Restored air AI defines to mostly vanilla settings because these tweaks were relevant years ago.

-Reworked AI's occupation law logic to work better with the new changes.

-Restored a lot of vanilla AI strategies, mostly things that relate to ahistorical things but also some that are relevant to how this mod is meant to work and don't conflict with EAI strategies.


Some of the more notable country specific AI strategy tweaks:

-Japan/UK should defend their home islands more fanatically.


AI Japan:

-General rework of the AI's approach to this war.

-Builds 21w infantry divisions.

-Builds some air during the war with China.

-Adjusted how many troops it deploys in fronts, how and when it pushes fronts in different areas like north, coast, inland.

-Does semi random operational pauses to regroup and then intensify attacks for a bit. (why?! I don't know, because I could - maybe it will make the war more interesting compared to constant pushing or even help a bit)

-AI in general does larger invasions again, like in vanilla.

-Should prioritize getting Okamura to boost its infantry early.

-Builds capital ships again instead of preferring lots of screens.

-Reworked the logic AI Japan uses to declare war on the Allies. This is not meant to be railroaded to work out historically. Japan declares war on USA but if USA doesn't join the Allies, Japan doesn't immediately declare war on the Allies. Japan can declare the war earlier or later depending on the state of its country. It doesn't make sense to force it to declare the war if it is in horrible condition equipment or army size wise. Using the stalemate setting probably has the best chance of making the war happen at the historical time.


AI GER:

-More specific strategies to avoid attacking the Maginot line during the Phoney war and push the low countries more.

-Adjusted production so that it builds a bigger infantry army pre-war.

-Builds 21w infantry by default.

-Due to various fixes and changes, it should be building more armor now, though there is still a general problem with the AI's armor production.

-Should be more likely to invade USSR around the historical timing.


Operation Barbarossa (both sides):

-Reworked AI military scripting.

-Added strategies governing the AI's seasonal behavior. (meaning which plan aggression setting the AI uses)

-Periodic operational pauses to possibly help regrouping/supplying/planning for the AI.

-Opportunistic offensives where the AI pushes very hard for some time if it looks like the enemy is weak.

-Pausing operations completely when equipment/manpower levels are critical.

-Generally, prioritize assigning air and armor to the eastern front.

(note: these types of changes relate to general front-wide behavior (aggressiveness, activating/deactivating plans) and NOT division level AI adjustments. Also very experimental, so maybe it helps, maybe it doesn't. Possibly makes things more interesting.)
Last edited by Kondi; 13 May, 2023 @ 12:37pm
< >
Showing 1-10 of 10 comments
Kondi  [developer] 3 Oct, 2022 @ 11:04am 
-some adjustments to help Japan with its invasions

-naval invasion coordination: a change that may or may not make the state targetted invasions work better
Kondi  [developer] 7 Oct, 2022 @ 11:24am 
-Commonwealth should send a couple of divisions at most to defend France (vs AI Germany anyways).

-Allies should send a couple of divisions at most to Greece/Yugoslavia during the initial blitz.

-Workaround fix to an extremely frustrating bug that broke the ratios of divisions the AI wants to build. The AI may not necessarily build a lot more divisions in general after the fix but it should be queuing the right types in the right ratios at least. If you use difficulty settings to boost a country, it might make a big difference however.

This is actually a much wider issue that leads to AI strategies behaving weirdly, including things that affect naval production (causing issues such as nations not producing the right amount convoys leading to massive issues later, not building the right ratios of ships), air production (incorrect amounts of factories assigned to things like navs and transports in particular), equipment production and a lot of other AI strategy related things potentially.

For now I implemented workarounds for division, air and navy production and adjusted some strategies so that they do not trigger this bug. (by the way, this is the sort of bug that also resolves when you reload a game and returns after a while, explaining some of the wild AI production changes when doing so)

-Improved GER/Axis blitz strategies for France, Denmark, Norway, Balkans.

-Fixed a case of Japan declaring war on Sinkiang on historical.

-Added some strategies to make Japan more aggressive in the Pacific and hold off on Raj.

-Japan should go for the killing blow on China when it has pushed inland and China is very weak, instead of standing around for no reason.

-Added reserve manpower sanity checks in addition to the fielded equipment ratio checks to AI strategies that make the AI push aggressively.

-Adjustment to AI naval invasion system that might improve where AI targets its invasions.

-Fixed some cases of AI improving relations too much when trying to send an attache to Spain.

-AI should prioritize war propaganda decision that counters bombing effect so that it can get women in the workforce

-Fixed AI not building maritime patrol if enabled for it.

Overhaul of the outdated AI's law selection logic in the mod. Most importantly:

-when the AI should go for total mobilization without causing manpower issues, factor in whether it can get women in the workforce after
-when to downgrade to war economy to free up manpower if it doesn't have / can't take women in the workforce
-GER should use free trade early on
-when to upgrade conscription law, wait mobile warfare conscription techs before going for more expensive laws

-Made sure the majors prioritize air regions near its core territory.

-France should guard its capital/coast more heavily

-Added a number of generic strategies for most important capital city locations so that the owner makes a separate garrison army that only occupies that state which makes it more likely to have divisions there.

-Fixed ITA not sending volunteers to Spain.

-Implemented some more strategies for the invasion of normandy and operation torch to perhaps help the AI target the right areas (however UK really can't protect its convoys so unless you boost its convoy production, Allied invasions will likely be lackluster).

-AI again properly switches its mobile warfare doctrine to the manpower branch when needed.

-Stopped most minors around the poorer regions of the world from maxing out their infrastructure (in most cases) for immersion.

-Added some air xp prioritization checks so that the AI makes at least some type of design it can build before dumping xp on doctrines or plane types that are less important.
Kondi  [developer] 9 Oct, 2022 @ 1:30pm 
Reworked AI air designs and related AI tech research factors.

Cliff notes:

-fighter: added cannons, armor plates
-cv fighter: same and added self sealing fuel tanks
-heavy fighter: added armor plates
-cas: added anti-tank guns, armor plates, dive brakes
-tac: added armor plates, anti-tank guns, bomb sights
-strat: reduced bomb bays, added self sealing tanks, air to ground radar, radio navigation, armor plates
-cv nav: added self sealing tanks, armor plates
-maritime patrol: added air to ground radar, self sealing tanks, armor plates

Boosted AI's willingess to use XP on air and naval designs by a lot.
Kondi  [developer] 10 Oct, 2022 @ 9:22am 
-SOV guards its border vs FIN better and doesn't push it too hard while fighting GER

-AI should always use flexible cohesion now as it seems like the other settings might be causing strange unit stacking behavior for the AI.

-Added strategies to make Allies strategic bomb Axis homelands if they are fielding strategic bomber, as the AI was reluctant to use them.

-If things get very desperate manpower-wise, the AI will risk crisis events by raising conscription law.
Kondi  [developer] 21 Oct, 2022 @ 5:47am 
-Split possible AI fighter designs into 4 variants: regular, self sealing tanks variant, non strategic materials type, self sealing tank + NSM type. AI should make the one that it can afford resources-wise. Removed the "cheap fighter" military focuses.

-Adjusted AI plane designs to work with the new patch changes.

-Possibly fixed a case where China abandons a front against Japan.

-Italy does not create a puppet out of Albania.
Last edited by Kondi; 21 Oct, 2022 @ 5:48am
Kondi  [developer] 27 Oct, 2022 @ 9:26am 
-Increased air importance in naval zones and against strategic bombing. Seems like the AI was massively neglecting them.

-Restored invasion of Iran.
Kondi  [developer] 22 Jan, 2023 @ 8:36am 
-Streamlined AI template scripts to fix a crash and to avoid the AI generally just going nuts.

-Removed anti-tank infantry role from the AI (caused problems with the AI, templates were outdated, the AI generally never built them, their effectiveness was very questionable and they existed mostly for variety).

-Increased the amount of motorized battalions in all tank templates.

-Tech prioritization fixes.
Kondi  [developer] 27 Jun, 2023 @ 7:04am 
-spanish localizations added
Kondi  [developer] 5 Jul, 2023 @ 7:20am 
-fixed broken fighter military focus AI customization

-fixed GER creating VIC on aggressive GER setting
Kondi  [developer] 8 Jul, 2023 @ 6:32am 
-fixed Turkey joining a faction with Italy
< >
Showing 1-10 of 10 comments
Per page: 1530 50