Full notes
Full Hearts of Iron IV update
Read the full published notes in a cleaner layout. The original post stays linked below.
Repeated intro
Greetings every one! This weeks DD is about something I know many of you have been hoping and waiting for a long time; AI! "The field of ridiculously high expectations and abysmally low standards." - Wiz Being the only one crazy enough to want to take on the AI in HoI4 as Wiz went on to other projects, I was thrown in to it over a year ago now, and while it has been the hardest job I have ever had, it has also been the most fun and rewarding one. So, lets jump in, shall we? Right off the bat there were a couple of MASSIVE challenges in making the HoI4 AI; 1: Maintaining plausible historical behavior in a relatively dynamic and sandbox oriented game 2: Making the execution of player drawn battle plans solid enough that it would feel beneficial to use it. Rest assured that significant amounts of sweat, blood and tears have been shed to tackle these issues. For the first challenge, a couple of things sets the AI of Heart of Iron apart from the other PDS titles. First of all the chronologically compact and recent nature means people have different expectations on the HoI AI to act more or less according to history. While HoI4 is more of a sandbox experience than at the very least its latest predecessor, the set up is still historical and there were often reasons for countries to take certain actions at the times that they did. The challenge here was to have an AI capable of handling new situations dynamically in a way that makes at least some sense, regardless of if they are historical or not. Our approach to this problem is a dynamic AI as a foundation, with game mechanics pushing countries in certain directions both for players and AI. The primary mechanic for this is, of course, the national foci, which have been covered in previous diaries. These direct the player and AI towards various goals both before and during the great war that eventually happens. But how does the AI pick focuses? This can either be strictly scripted on a per country basis and activated by playing the game in 'historical focus mode'. While it is fully moddable a historical setup for this is included. When that mode is NOT active, the AI picks foci using a combination of scripted weights and dynamic underlying systems that look at the situation of the country. That dynamic system pushed by scripted weights is something that runs throughout all of the AI. Aside from well over 200 tweakable defines which tweak various aspects of the internal dynamic AI behavior, the weights can pretty much always be tweaked using the trigger system discussed in the modding DD. All in all there are practically no aspect of the AI which cannot be touched through defines, weight tweaks or both. For example, the desire for Austria to accept the Anschluss event could look like this:
What changed
- Events
ai_chance = { base = 30 modifier = { add = -25 GER = { has_army_size = { size < 20 } } } modifier = { factor = 10 GER = { has_army_size = { size > 19 } } } }And if they refuse, Germanys attitude towards them can be altered like this:
anschluss_rejected = { # Conditions enable = { tag = GER has_completed_focus = GER_anschluss country_exists = AUS } abort = { NOT = { country_exists = AUS } } # Modification if strategy is enabled ai_strategy = { type = antagonize id = "AUS" value = 300 } }To give even more flavor to the behavior of countries, there are ways to modify things like the attitude towards other countries with...well, modifiers. These modifiers can be attached to to things like ministers, laws or even leader traits. This means that depending on who is in charge of a country, their interactions with other countries can vary, not just because of their ideology. This is something I want to look at expanding on even
Source
Changelog.gg summarizes and formats this update. How we read updates.
