Hearts of Iron IV - Development Diary 54 - AI

  • 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.
First, Thanks for your hard work on the AI.

You did not mention, for most guys, the most important feature of the AI for a player?
When the AI is attacking, will it surround enemy units and kill them. Guys really like to see this in Darkest Hour for instance.

Guys don't want a broad front of units all attacking at the same time. They want to see some units charging ahead, surrounding the enemy where possible, and then annihilating those units trapped in the "kessel".

Can your AI do this?
If not, do you think with some work (by modders maybe?) it could do this?

Thanks Again.

It has been known to happen, but typically it is due to the AI taking advantage of situations that happen to occur. Give it an opening and the AI will use it.
Specific unit movements will unfortunately not be moddable, but I am continuously thinking about how I can improve on things like this to make the AI more effecient.
 
  • 4
Reactions:
It has been known to happen, but typically it is due to the AI taking advantage of situations that happen to occur. Give it an opening and the AI will use it.
Specific unit movements will unfortunately not be moddable, but I am continuously thinking about how I can improve on things like this to make the AI more effecient.

Thanks for your reply.
I think if you can get the AI to do this even sometimes, you will soon be a God among men! Cheers
 
  • 1
Reactions:
You cannot set the AI to "make a naval invasion plan against country X", that is handled dynamically. What you can do is push the country in the direction of war, but how exactly the war is fought is determined dynamically.
Of course, I can`t tell AI to do naval invasion, but unless I tell AI to build a navy, marines and such, AI will never invade anywhere ;)

It was possible to make German AI to make sealion, I needed to give it all the resources (navy, naval bombers, marines) and then, it typically would do just that, even air battle for Britain was possible with enough German planes. Obviously, no guarantees, but it was pretty stable and reliable ;)
We are not using LUA for HoI4. This was a decision made before I started working at PDS, and was based primarily on lack of in house LUA skills and performance cost.
I`m interested if such functions are possible to implement in HOI4 in principle, LUA or not, i don`t particularly care, if anything, C++ is my working programming language ;)

Is there some sort of country-specific set of "pointers" that a modder can use to dynamically alter what AI strategy is? It would be great if we could at least have dynamic allocation of weights, based on conditions ;)
 
  • 1
Reactions:
@SteelVolt I would like to inquire again which aspects of the AI are open to (heavy) modding. I understand the dynamic AI underpinning the game can be tweaked via changing the factors. What else is possible? The game can be divided up into several areas very important to the AI.

Production - Can we script build orders to trigger dynamically (usually in response to certain dates date/war/victory conditions), especially implementing new units and triggers? This is different from changing the weights of equipment.
Research - Dynamic triggers to rush ahead of time tech in response to battlefield conditions or national foci would be great here
Land Combat - I'm not hopeful for this since I understand this is much valuable in terms of IP, but anyway to tweak the combat AI especially with regards to stance (seems to be gone now), and deployment orders?
Naval Combat - Are we free to define fleets types, patrol areas and/or missions for the AI to follow?
Air combat - Similar to naval combat, what's the potential for modding

Lastly since no one has asked yet, what language are we looking at when coding scripts for the AI to follow?

Generally speaking, I think the more exposed the AI logic is to tweaking especially the subroutines, the better the game will age with mods. If possible try to let us have access to the underlying logic rather than just the 200+ triggers/modifiers/factors involved!

1: No.
2: You can tweak weight for individual techs and foci, giving this effect.
3: No.
4: Not at the moment, no.

The language is our internal scripting language. As was stated in the mod DD and one of my replies here, we are no longer using LUA for scripting.

Still, while I want to make as much as possible available through script, I need to take into account the time it takes to do that compared to making a dynamic solution, as well as which approach gives the best results, primarily for release.

I too am looking forward to see what the modding community does with HoI4 :)
 
  • 3
  • 1
Reactions:
Building a strong marine force seems like it should be a number one priority for democratic countries with navies, like France, UK, Canada, Australia and New Zealand.
 
  • 1
Reactions:
Of course, I can`t tell AI to do naval invasion, but unless I tell AI to build a navy, marines and such, AI will never invade anywhere ;)

It was possible to make German AI to make sealion, I needed to give it all the resources (navy, naval bombers, marines) and then, it typically would do just that, even air battle for Britain was possible with enough German planes. Obviously, no guarantees, but it was pretty stable and reliable ;)

I`m interested if such functions are possible to implement in HOI4 in principle, LUA or not, i don`t particularly care, if anything, C++ is my working programming language ;)

Is there some sort of country-specific set of "pointers" that a modder can use to dynamically alter what AI strategy is? It would be great if we could at least have dynamic allocation of weights, based on conditions ;)

If you give it the resources and set up a war it is likely to happen, sure. What you cannot do is define the specific behavior, just nudge it (for some things pretty hard) in certain directions.

Since the scripting language is our own internal one, you cannot script algorithms, as such. Please read the modding DD for more info, as the system is the same as for the AI :)
 
  • 2
Reactions:
So if I understand you correctly, there's no possibility of any mod with dynamic solutions if all the dynamic solutions are internal and baked into the exe?

I foresee a lot of scripting "abuse" coming in the mods if this is the case, to push the AI past what you guys ever intended :p.
 
So how will ai naval invasions be handled in general? Also all nations will in some degree do them looking for weak spots like innl your example or just specified ones like usa or gb?
 
AI work is like the least appreciated part of games. No matter how good it is, people will always complain 'The AI sucks' when they see the AI doing something they wouldn't do. Well, I for for one thanks you for the hard work!
 
  • 4
Reactions:
If you give it the resources and set up a war it is likely to happen, sure. What you cannot do is define the specific behavior, just nudge it (for some things pretty hard) in certain directions.

Since the scripting language is our own internal one, you cannot script algorithms, as such. Please read the modding DD for more info, as the system is the same as for the AI :)

You may find it useful to see the AI file from Darkest Hour. I KNOW it is totally different, but you might see something useful or get some ideas from it? Attached
 

Attachments

  • AI Files Modifiers.txt
    25 KB · Views: 212
So if I understand you correctly, there's no possibility of any mod with dynamic solutions if all the dynamic solutions are internal and baked into the exe?

I foresee a lot of scripting "abuse" coming in the mods if this is the case, to push the AI past what you guys ever intended :p.

Yup, pretty much.
 
  • 2
  • 1
Reactions:
So how will ai naval invasions be handled in general? Also all nations will in some degree do them looking for weak spots like innl your example or just specified ones like usa or gb?

The AI tries to draw naval invasion plans the same way a player would. No country is blocked from it, but you do need naval supremacy to carry them out, giving England, USA and Japan an edge from the start with their big navies.
 
  • 2
Reactions:
@SteelVolt On a separate note, if you could help comment (document) on what the 200+ modifiers (and indeed for all the other defines) are actually used for, in which specific algorithm and the underlying logic, that would save us years of experimenting. It took the HOI3 community ages to even figure out how combat resolved, and without access to the underlying code having so many modifiers to tweak feels like firing shots in the dark for such a new AI system.
 
@SteelVolt On a separate note, if you could help comment (document) on what the 200+ modifiers (and indeed for all the other defines) are actually used for, in which specific algorithm and the underlying logic, that would save us years of experimenting. It took the HOI3 community ages to even figure out how combat resolved, and without access to the underlying code having so many modifiers to tweak feels like firing shots in the dark for such a new AI system.

All of the defines have descriptions to aid with this.
 
  • 5
  • 3
Reactions:
The AI tries to draw naval invasion plans the same way a player would. No country is blocked from it, but you do need naval supremacy to carry them out, giving England, USA and Japan an edge from the start with their big navies.

So they will actively seek a way to perform it if they have the possibilty? Wow that is great!
 
Since the scripting language is our own internal one, you cannot script algorithms, as such. Please read the modding DD for more info, as the system is the same as for the AI :)
But what can I script is the question!
What is even an option, aside from NFs and events?
Production "weights"?
Army composition "weights"?
Any option to tell AI where to invest it`s civilian factories? (more military factories/naval yards/civilian industry, ex)
Any options to tell AI what it needs to prioritise during expansion?
 
  • 1
Reactions: