HOI4 - Together For Victory AI Update #3

  • 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.

SteelVolt

Technomancer
2 Badges
Aug 4, 2014
735
4.201
  • Paradox Order
  • Hearts of Iron IV Sign-up
Hi everyone!
It is me again; your friendly neighbourhood AI developer. Today I will move on from focusing on bugs to looking at what we consider improvements, though as I stated at the end of the last diary the line between the two is very blurry when it comes to the AI.

This is the third installment of these mini diaries, and if you missed the other you can check out #1 (scroll to the bottom of that diary) and #2 respectively.

But to kick it off I thought I would tell you yet another story from the trenches.
We often run the game hands off over nights to see how it progresses for various countries, such as how the Japan vs China conflict works out. Some months before release I found an overnight had gotten a very surprising result: Italy had annexed almost the entire Soviet Union, while Germany had completely opted out of any Soviet territories. If any country beats Soviet Union, it does certainly NOT tend to be AI Italy, so something was clearly up. Going back in the autosaves we could see that it was indeed Germany pulling the most weight in the war, so the conclusion was that something unintended was going on in the peace conference. Letting the game run through the peace conference the crazy result was easily reproduced; Italy would consistently take Soviet territory, while Germany opts out and thus pass on their war score to Italy. So the question remained: why?
After a little digging I found that the fascist peace conference AI was set up to want to take neighboring territory, but be very reluctant with non-neighboring areas. But clearly Germany must have been neighboring Soviet? Well...in a sense. They had indeed defeated Poland before taking on the Soviet Union, but they were only occupying Polands states, since Poland had joined the Allies, which had of course not yet capitulated. Since we separate ownership and control of areas, and the neighboring check looked specifically at ownership (after all, Germany was not guaranteed to get to KEEP Poland), they ended up ignoring Soviet areas as NOT connected to their own areas, while Italy had annexed Romania in an earlier war and considered their areas as connected by land to Soviets.

The peace conference AI has since been refined to avoid silliness like this, but it does serve to illustrate how you need to keep a lot of different potential situations in mind when designing and programming AI. And this is far from the most complicated systems.

Today I will introduce something brand new; my work on encriclement AI!

- AI now attempts to detect and react to many encirclement opportunities, both against itself and against enemies. Includes evacuating dangerous areas and cutting off bottlenecks.
  • Detecting potential encirclement situations is a really hard problem. A human, with her superior pattern recognition abilities, can take a glance at a map and point out such situations in practically no time at all. A computer, not so much. The thing is that you need to consider the relation between at least five or so provinces to detect the smallest encirclements, and for large ones the number gets really big. Computers are inherently bad at considering more than one relation at a time. While the approach for narrower bottlenecks and larger encirclement patterns is somewhat different, and particularly the latter is not 100% accurate, but where to draw the line between potential encirclement is not always clear anyway. The type of reaction varies a bit depending on the situation detected, but all in all the AI is better at countering attempts at encirclement and to try to act on opportunities they get. Though there is of course room for some improvement I must say I am quite happy with the number of situations the AI is actually able to detect with relatively few false positives. I hope this makes the game both more challenging and engaging for you!


Of course, I cannot only leave you with only one point, even if it is a big one, so I will also use this diary to talk a bit about defensive AI.

- Split up AI garrison order in two: home area and other areas.
  • For a country like Germany, using a single garrison order is fine. For a country like the Soviet Union or even France, they risk having units sent around the world, not doing much to help at all, just because the order mechanic is attempting to balance the units inside the order. Not to mention how strangely balanced the spread becomes due to area around the capital typically gets too few units while far away areas ends up with too many. Splitting up the order greatly improves the AIs ability to defend. The units move around less withing each order, and the AI can balance between oversea areas (or...you know...Siberia) and the area around its capital.

- AI is no longer using all types of garrison locations.
  • The AI can and does indeed make use of this new feature. In many situations it is a waste of units to garrison everything you possibly can. While being on the offensive, garrisoning your forts can typically be wasteful if not all ports are covered to defend against potential invasions.

And that is all for today. Next time (which is probably going to be wednesday) I intend to be talking about boats and boaty related stuff. Until then, I am getting back to work on more improvements for future updates.
 
  • 65
  • 36
Reactions:
Great update, sounds like things are really being ironed out.
 
  • 7
Reactions:
Cheers for the DD Steelvolt, and more excellent AI goodness going on :). Great work on the encirclement side of things. I've only dabbled (and that's overstating it some) in AI, but enough to know that things like encirclements would be very challenging, so very impressive it's there, and am looking forward to seeing it in action :).

Very much looking forward to hearing about any naval AI improvements :).

More broadly, think you (and whoever else is involved/setting tasks/what-have-you) are doing a great job of building up the game's AI - very much looking forward to giving it a good shake later this week :).

A few quick question if easy/not inappropriate:
- do we get any new defines/scripting options/ai strategies for encirclements/garrison orders?
- does the AI's interest in offensive encirclements have any relation to the availability of mobile units (arm, mot, mec) that might make such operations easier to pull off?
- we haven't heard much about air unit allocation. The last vanilla games I've played, the AI has liked sending its aircraft all over the place (most of the Luftwaffe in China, SEA and Japan and things like that)? You've done a heap, and totally understand there's a need to prioritise (and think the priorities chosen have all been good), but just curious whether there's been any chance to look into that? I know not the topic of today's AI, but presume it doesn't fall under the 'boaty' category either.
 
  • 10
Reactions:
Very nice ! thank you :)
Really looking forward to testing these improvements. The splitting of the garrisoning order was good thinking.
 
@SteelVolt

Thanks for the update.

Though its not to do with this DD or you might mention it later I'd like to ask a question.

Leaving aside the controversy of the Spearhead command, I'd like to know will the AI use it regardless of whether you own the DLC or not? I would strongly argue that it should get to use it even if you don't have the DLC, because any help the AI can get is good IMO.
 
  • 3
Reactions:
@SteelVolt Regarding the garrisoning changes, does this mean the Axis AI will be more effective in combating resistance in occupied areas?
 
  • 1
Reactions:
The units move around less withing each order, and the AI can balance between oversea areas (or...you know...Siberia) and the area around its capital.
Glad to hear it, thank you. :)

By any chance, do these improvements also apply to the troops on a front? The battle planner seems to enjoy shuffling troops around longer fronts, keeping them from getting planning bonuses or thinking all the units are in position in order to attack.
 
  • 1
Reactions:
- do we get any new defines/scripting options/ai strategies for encirclements/garrison orders?
There are a few new defines to play around with, but that is all. But please post requests for mod features in the mod forum or suggestions forum :)

- does the AI's interest in offensive encirclements have any relation to the availability of mobile units (arm, mot, mec) that might make such operations easier to pull off?
Not at the moment, but there are plans for future improvement.

- we haven't heard much about air unit allocation. The last vanilla games I've played, the AI has liked sending its aircraft all over the place (most of the Luftwaffe in China, SEA and Japan and things like that)?
Just a bug fix or two, but some more proper stuff is in the pipeline.
 
  • 5
  • 1
Reactions:
@SteelVolt

Thanks for the update.

Though its not to do with this DD or you might mention it later I'd like to ask a question.

Leaving aside the controversy of the Spearhead command, I'd like to know will the AI use it regardless of whether you own the DLC or not? I would strongly argue that it should get to use it even if you don't have the DLC, because any help the AI can get is good IMO.

Unfortunately the AI does not use it in the current build. The reason behind this being that it would be tricky to get good, and in stead of adding a thing that the AI did half right we focused on improving the existing areas where it has not been performing as well as desired. But I certainly see your point, and it has been discussed internally as well.
 
  • 7
  • 1
Reactions:
Glad to hear it, thank you. :)

By any chance, do these improvements also apply to the troops on a front? The battle planner seems to enjoy shuffling troops around longer fronts, keeping them from getting planning bonuses or thinking all the units are in position in order to attack.

There is a partial overlap yes, and there has been some tweaks done to the front handling as well, but not as a main focus.
 
  • 4
  • 1
Reactions:
Okay, time to ask about my personal pet-issues ;)

1) The Great Soviet Truck Spam. Has it stopped? Will they use their industry to build more useful stuff?
2) Any improvements on how the AI spends political power?
 
  • 1
Reactions:
Of course, I cannot only leave you with only one point, even if it is a big one, so I will also use this diary to talk a bit about defensive AI.

- Split up AI garrison order in two: home area and other areas.
  • For a country like Germany, using a single garrison order is fine. For a country like the Soviet Union or even France, they risk having units sent around the world, not doing much to help at all, just because the order mechanic is attempting to balance the units inside the order. Not to mention how strangely balanced the spread becomes due to area around the capital typically gets too few units while far away areas ends up with too many. Splitting up the order greatly improves the AIs ability to defend. The units move around less withing each order, and the AI can balance between oversea areas (or...you know...Siberia) and the area around its capital.

- AI is no longer using all types of garrison locations.
  • The AI can and does indeed make use of this new feature. In many situations it is a waste of units to garrison everything you possibly can. While being on the offensive, garrisoning your forts can typically be wasteful if not all ports are covered to defend against potential invasions.
If this means that Italy is now going to try and oppose Allied landings around Rome in the first few months of the war, this is a great change. You've mentioned a lot of very good changes, of course, but this one is great.
 
  • 2
Reactions:
That was one of our wishes with the changes, but has not been looked at specifically enough for me to feel comfortable in commiting to a more grand statement ;)
Lot's of potential for making AI Germany great again in ensuring they do supress partisans properly. Especially if they can go harsh occupation Germany can gain 100-250 extra IC from occupation of Europe.
 
  • 2
Reactions:
@SteelVolt Hi, I don't know if anyone asked, i'm trying to find it in the bug reports but nothing....

There's a malus about being out of supplies, but Sovs, can low it down like a 80% with the guerrilla Tactics(from-50% to -10%). It's known that it's broken the "malus" and stuck on -50%, you know if there will be an update or something about this? Thanks.
 
Thanks for the info @SteelVolt

I have a question partly base on what you bring up here & defensive garrisons. If I were going to give an AI controled country a bunch of weak forces (maybe to defend low priority borders of Czechoslovakia or Poland or to defend the long coastline once Germany controls most of Europe or just to sit on VP provinces) through an event would the AI use them for lower priority duties and use the better forces for the major offensives/fromts?
 
  • 1
Reactions: