Hearts of Iron IV

Hearts of Iron IV

Expert AI 5.0
This topic has been locked
Kondi  [developer] 10 Dec, 2021 @ 7:29am
Patch notes (EAI 4.6 - HOI4 1.11)
https://github.com/Kondikka/expertai

-The mod manages the AI's army experience in such a way that the AI cannot research land doctrines if it doesn't have certain things like a theorist that reduces doctrine cost (the system is necessary because the AI can't be blocked from taking doctrines with triggers). Likewise, air xp is managed so that fighter variants take high priority over doctrine upgrades.

-Removed mod changes to weather effects, army speed, reinforcement speeds for now as the game has changed quite a bit.

-Improved Norways coastal garrisons. Improved Japans home island garrisons, and if it looks like it might get invaded, it should attempt to heavily increase home island garrisons for a last stand.

-Adjusted tech prios to account for the changes in the tech tree. Put in a workaround that should avoid the AI not using its research slots due to the way research works in this mod, especially if its research has been buffed.

-Desperate defense ramps up in difficulty twice as fast relative to surrender progress.

-Restructured the way the mod handles its various AI functions to rely mostly on on_actions instead of events which wasn't possible back when this mod was designed. Might improve performance.

-Removed Operation Countenance added in the mod previously. Tweaked the new Operation Countenance related event choices to work out historically. Added AI strategies to have the invasion be executed smoothly.

-Added armor equipment AI scripts that are in line with this mod's military focus system but they are essentially placeholder designs.

-Updated infantry, mountaineer and marine templates to use 10w/21w/27w/42w. 21w/27w/42w now always include anti air brigades. Anti-tank, armor, motorized templates are unchanged for now.

-Merged the mod's separate light, medium and heavy armor roles back into one armor role because the armor role probably has some unique hard coded behavior that makes the AI utilize them better. The previous system allowed the AI to build several types of armor divisions at the same time which was cool but it's not really useful.

-Added light armor military focus to the military focus armor category.

-Fixed various things that derailed historical mode because of the AI taking weird focuses and such.

-Allies garrison Iceland and Greenland

-Countries with Mass Assault prioritise spending XP on land doctrines until they get the width reduction instead of upgrading niche templates, army spirits, equipment variants.

-Adjusted factory assignments. Less armor, more air. Infantry + air is the safer bet for the AI especially until I figure out what kind of armor is good and how much the AI can handle.

-Adjusted AI factors for all spirits.

-Adjusted AI factors for government ideas/advisors. Land doctrine theorists are higher prio, so are land military staff that give army xp.

Reworked SOV AI historical focus order, AI factors for decisions, events and such heavily to build as good an industry as it is possible for the AI.
-Optimized internal country focuses while external diplomacy focuses may be more historically timed.
-AI finishes the purge as fast as possible
-Made sure the AI goes for Foreign Experts, improves relations enough with USA and takes the industry idea and improves it with decisions.
-Propaganda, paranoia and other decision/event factors tweaked.
-Consumer goods reducing effects are a priority.
-Adjusted the mod's construction queue strategies.

-Changed the land doctrines countries choose on Challenging mode. Majors stick to the doctrines they start with.

-Workaround fix to AI not wanting to build divisions due to an unknown issue.

-Made the AI be more aggressive about using harsh quotas on states with lots of factories and forced labor on states with tons of resources.

-Added an auto balancing strategy for the Spanish civil war AIs similar to the one for North African theatre - AI's will limit their offensives if the opposing side is too close to surrendering and amount they are allowed to push increases the closer the war gets to its historical end date. Doesn't guarantee it's going to end at any particular time.

-Winter War should start on the historical date.

-Baltic AIs will use the generic focus trees even with NSB DLC when using historical AI. They are causing endless issues with ahistorical outcomes, joining random factions, having civil wars etc.

-Eastern Front default setting is now "Favor USSR"
Last edited by Kondi; 12 Dec, 2021 @ 7:40am
< >
Showing 1-12 of 12 comments
Kondi  [developer] 12 Dec, 2021 @ 7:41am 
-Improved the logic for Japan's invasions vs CHI (maybe). Fixed Japan not using the escalate war in China decision. Nerfed AI China when fighting AI Japan. Fixed Japan switching to Mass Assault on normal mode.

-Adjusted armor design, production, template logic, XP priorities.

-Reworked SOV paranoia focuses/decisions so that there should be less unnecessary purge events. SOV goes for Gobi Gambing and Takes Foreign Experts earlier. It manages paranoia better now but it's still not perfect.

-Attempted some fixes to make the AI push out divisions faster during peace in order to fix GER not being able to declare war on Poland on time on normal mode.

-Raised the threshold for neutral countries joining the Allies at the end of the war.
Last edited by Kondi; 12 Dec, 2021 @ 10:50pm
Kondi  [developer] 13 Dec, 2021 @ 2:28pm 
-Fixed Baltics having a generic tree when controlled by a player.

-Fixed countries upgrading conscription law too early.

-Quick pass on all armor templates and designs. Widths changed to 21/28/42. Attempted to have armor template reliability over 80% and armor over 60 on '41 armor tech medium templates. More armor, less speed in heavies. Tried to cut down on unnecessary costs, using lower tier turrets and such. A lot more focus on soft attack over hard attack. Speed has less focus because I don't think it's very useful to the AI.

-AI should in theory be upgrading tank templates with piercing when it sees high armor templates if that part hasn't broken as well. Might be able to implement AI upgrading design armor to try to match piercing it has seen.

-Fixed the mod declaring war on FIN when SOV is a player.

-Fixed some armor related production issues.

-Adjusted the armor focuses the AI may choose on normal and challenging modes. More variety.
Kondi  [developer] 23 Dec, 2021 @ 9:28am 
Fixed modify government notification bug

Fixed some issues in vanilla files

Adjusted AI logic for blowing up Suez

Fixed Baltics having generic trees on non historical AI

Increased GER air production again as well as armor production

SOV/GER pre-emptively design armor with more piercing

Adjusted AI logic for xp use in armor designs to funnel it into the right designs

Fixed some outdated research logic for armor techs, some invalid tank designs causing delayed armor production in some cases

AI is more willing to make basic tier armor designs to get some early game production going but they are cheap XP wise because it should really save XP for better tiers

AI again makes a more basic armor template if it hasn't developed things like MSPAA, and it focuses on making a good design for tank before other types
Kondi  [developer] 26 Dec, 2021 @ 9:52am 
AI SOV does the Trotsky assassination operation

Implemented a scripted AI system for AI sending attaches to other AI countries (because the game AI seems hardcoded not to send any attaches). Should be mostly equivalent to the hard coded attaches (gives the same amount of XP to the sender, some opinion factors may be missing) and other countries *should* be able to object to it the normal way.

It creates such a crazy advantage in any min-max strategy that it seems silly to omit in this mod. Early war economy for SOV/GER (+20-30 factories for SOV by July '41), partial mobilization for ENG, xp for USA to get those fully developed armor templates going way before the war

It could be made dynamic but as it is now, there are specific attache strategies for SOV, GER, ITA, USA, ENG. If people have ideas for countries using attaches, feel free...

Adjusted economy law choices for countries that now send attaches.
Last edited by Kondi; 28 Dec, 2021 @ 2:51am
Kondi  [developer] 2 Jan, 2022 @ 2:32am 
Fixed some potential issues with AI's doctrine research prioritization and with AI switching doctrines from what it started with not working properly.

Fixed some strategy issues causing problems for Japan vs China.
Kondi  [developer] 9 Jan, 2022 @ 12:28am 
Save compatible: most likely
HOI4 version: 1.11.4 (not beta)

Reworked espionage AI. Previously this mod had some specific scripted AI strategies for a couple of ops while the vanilla's own scripted espionage AI also ran its ops at the same time. Basically, this mod ignored the espionage part of the game. The new AI replaces the vanilla espionage AI and is designed to be more effective at playing the espionage game in general, obviously, as well as use all the useful and/or historical operations in the game.

-AI has priorities for certain types of operation strategies in this order: rescue, historical, collaboration operations which should always take priority if available/appropriate to the country, and a random selector for the remaining non-priority espionage operations.

-AI cancels operations that it can no longer complete and tries other targets if it's getting nowhere with its current operation target or is constantly getting its operatives captured against it.

-Able to start new operations elsewhere once it has started running the current op if it has enough available agents left over.

-Will keep existing network alive with quiet network while running an op in case the AI wants another op on the same target later.

-Historical operation strategies include most historical operations in the game (which I believe the AI did not do before). For instance, the Warsaw Uprising is something Poland will work towards and other countries on the same side will assist in enabling it. Historical ops: heavy_water_raid, bruneval_raid, rescue_mussolini, operation_warsaw_uprising, nuclear_espionage, murder_trotsky, FRA_coup_in_north_africa, FRA_coup_in_madagascar

Random operation selector evaluates the highest scoring target for each operation type and then uses the score as the random weight to roll which operation to run. Difference to vanilla AI being that each operation has a lot more specific logic to its target evaluation and the final choice is more random/flexible at the same time. And of course, it can choose from all generic operations except for Coordinated Strike and Fake Intel whereas AFAIK the vanilla AI never did steal tech, sabotage or cipher operations.

The total operations successfully completed by Jan 1943 with this mod by all AIs is 270, and without the mod 15. Whether that's better or fun or even makes any difference... well, I guess we'll see. :)

----------------

Fixed AI building too many agency upgrades but made the amount it builds scale with the size of its industry as well as date.

Added a scripted AI to upgrade AI agencies to level 5 because the AI seems hard coded not to do that if it has a small industry. Minors weren't able to get 2 agents even by '39 which is unfortunate especially for those countries that capitulate and won't have the industry to upgrade them afterwards so they can't run better operations on the occupiers. Also a problem with medium countries like ♥♥♥/ITA, helps GER with collaborations etc.

Adjusted agency branch upgrade priorities.

Added priority collaboration operation strategy targets for ♥♥♥, ITA.

Capitulated countries are extra into building spy agencies and running boost resistance operations on the country controlling its owned states.

AI builds transport aircraft again. Even minors should have 1 factory on it to enable help some espionage operations.

Added a refinery priority construction strategy for when the AI has a significant rubber deficit for a long period of time that it cannot fix otherwise.

GER/SOV go for free trade at the start.

Adjusted logic for switching trade laws. Mainly the AI shouldn't want to lower its trade law even when it has a resource shortage if it's not going to gain a significant amount of the resources it needs from the switch.

Possibly fixed AI building CAS or TAC when it is not supposed to.

Removed some old/vanilla GER/SOV strategies that are outdated or/and potentially conflicting with the mod.

Updated motorized templates to 21/27/42 width.

Added 'motorized' armor category military focus.

Added 'no attachment' attachment military focus.

Added 'CAS+TAC' ground air support military focus.

Adjusted minors to (maybe) build more civilian factories

AI more likely to want espionage advisors.

AI should demobilise economy/conscription if it is risking having stability events.

Rebalanced all the aircraft production strategies/attempted some fixes to avoid all the air production assignment strangeness. However, I think there might be a bug in the game that messes with this because reloading the game seems to reset the AI to its intended air production ratios.

Medium/heavy/modern tanks use medium tank cannons instead of howitzers

Marine templates use light flame thrower tanks if available

Fixed some outdated lend lease logic so that AI should want to (in theory) lend lease its capitulated allies to help with resistance operations.

Prioritised some useful focuses for USSR late game.
Kondi  [developer] 10 Jan, 2022 @ 8:11am 
Added 25xCAV + MP suppression template upgrade for late game. Prioritized military police techs based on occupied states.

Fix air production attempt #426

Resource prospecting decisions are lower prio than other political power uses.

Added a conversion strategy for SOV. It will convert 10 MIC to CIC in Stalingrad/Leningrad/Moscow at the start of the game.

SOV won't vassalise Sinkiang.

Prioritized Rychagov for SOV.

Fixed some potential issues with conscription law and economy law choices.
Last edited by Kondi; 10 Jan, 2022 @ 10:20am
Kondi  [developer] 11 Jan, 2022 @ 9:39am 
Made sure SCW starts around the historical time.

Made sure GER/SOV/others get their attaches going quicker.
Kondi  [developer] 14 Jan, 2022 @ 2:06pm 
Tried to get minors to build some fighters even though the AI really doesn't seem to want to

Hopefully final fix to AI researching doctrines properly when switching from what it started with

Trying out maintenance companies in AI's divisions

AI should stop front attacks if out of manpower until it recovers if it is possible to recover, else just keep attacking until it dies, I guess
Kondi  [developer] 15 Jan, 2022 @ 1:31am 
Improved officer corps spirit choices for the AI

More xp prioritization checks for the AI to avoid spending XP on niche templates like mountaineers and motorized before doctrines and main division templates
Kondi  [developer] 22 Jan, 2022 @ 11:23am 
AI sends more fighters against enemy naval bombers

AI re-evaluates air deployment every day instead of every 4 days

Implemented a system that should ensure minors at least get some of the important political advisors in a logical order if available: silent_workhorse > captain_of_industry > head_of_intelligence > popular_figurehead > war_industrialist. Big help for minors' espionage since they now can get 3 agents.

Added some probably unnecessary micro ability to espionage AI:

-Better estimates the required time to build up an intel network needed to start an operation so that it gets a better idea of when to give up on an operation.

-Doesn't commit more than 2 agents to building up an intel network as it isn't efficient and creates unnecessary risk to its operatives and its defense against enemy operatives.

-Switches to quiet network using 1 agent on the target if it has 1) enough network to start preparing the op 2) is preparing the op 3) is ready to start the op 4) is running the op which allows it to move the extra agent to counterintelligence while waiting for the op to start instead of having a bunch of agents building network risking being captured when they could be used for other things.

-Better at factoring in previously built intel networks in countries when evaluating target scores.

-Does not count agents that are wounded or in hiding as available for operations.

-Cares even more about rescuing agents

-Factors in operative deaths in operation risk assessment in addition to captures

-AI's civilian industry size affects the frequency it likes to run random operations. All the AIs are still meant to be running operations very often but maybe not quite as often with small economies.

-Global threat has a small effect on random operation frequency.

-Not having 3 agent slots unlocked makes the AI do operations a lot less frequently.
Last edited by Kondi; 22 Jan, 2022 @ 11:25am
Kondi  [developer] 3 Feb, 2022 @ 8:11am 
Fixed and re-enabled the AI strategy for stopping air production when it becomes pointless after losing the air war. This is going to cause some weird behavior later but since the AI production here is already weird, it probably won't hurt much.

Added an additional AI research factor on armor and navy techs to scale the need according to things like industry and research slots so that countries like USSR don't waste too much research on it.

USSR is more aggressive with increasing its conscription laws.

Tweaks to USSR focuses.

AI (maybe) recruits divisions while at peace

Tier 3/4 armor and engine tech are very low prio for AI as it doesn't make use of them.

Fixed AI medium and heavy tank designs that were broken due to changes in the new patch that caused the AI to build basic tank types only.
< >
Showing 1-12 of 12 comments
Per page: 1530 50