AI Production Adjustments

If you liked this item, please rate it up on Steam Workshop page.

Author: Boonie

Last revision: 6 Jan, 2017 at 17:15 UTC (2)

File size: 4.1 KB

On Steam Workshop

Description:

What this mod does:

-Changes the deployment AI for major and minor nations.
-AI will no longer attempt to train and deploy divisions if they have neither the equipment nor the manpower to field them.
-AI will ONLY deploy divisions when they have sufficient equipment and manpower to field them, so there will likely be less divisions overall.
-Increases the amount of Armored divisions slightly.

What this mod doesn’t do:

-Magically fix every problem with the AI
-Wake you up every morning with breakfast in bed
-Do somersaults (Paid DLC, $4.99), or any other unreasonable things to expect of a few lines of code

For those of you with interest in the code behind the scenes I’ll take an example out of the file and elaborate on it a bit, as well as the original code being used:

##### START MODDER INFORMATION #####

In the base game the AI will train and deploy divisions regardless of the number of equipment and manpower it has, this can lead to both unreasonable division spam, but also most of these divisions lacking any equipment at all. It makes no sense for the AI to go about building divisions when it is already in a deficit for a particular type of equipment, thus making equipment problems even worse.

To fix these issues I have therefore made a few changes to the AI that is used when determining when to deploy divisions, an example is below for the production of Infantry Divisions:

default_infantry_production_majors = {
enable = {
AND = { ##### All of the following must be true
is_major = yes ##### Is a Major nation
has_manpower > 250000 ##### Has more than 250k MP
has_equipment = { infantry_equipment > 10000 } ##### Has more than 10k Infantry Equipment
}
}

abort = {
OR = { ##### Any of the following can be true to stop production
is_major = no ##### Is no longer a Major nation (seperate AI for Minor nations)
has_manpower < 200000 ##### Has less than 200k MP
has_equipment = { infantry_equipment < 5000 } ##### Has less than 5k Infantry Equipment
}
}

ai_strategy = {
type = unit_base
id = infantry
value = 75
}
}

There are also versions for the training and production of Mountaineers/Marines/Paratroopers/Motorised/Mechanised/Armoured. Motorised will require Motorised equipment to produce, Mechanised will require Mechanised Equipment. And Armoured will require Light Tanks before 1939, after 1939 it will require Medium Tanks.

When playing you should notice less divisions overall, but also the Division strength will be far more likely be up to full strength during peace-time.

##### END MODDER INFORMATION #####

Future Updates:

-Divide AI based on nation and government type.
-Divide into peacetime and wartime production.
-Currently each minor nation uses the same production AI, in the future this may change so that nations with small MP pools can still build some divisions.

Notes:

-This mod DOES change the Checksum.
-You can NOT get Achievements when using this mod
-Should be compatible with most other mods as long as they don’t change either default.txt or GER.txt in common/ai_strategy
-Some minor nations with low MP pools (Luxembourg, Bhutan etc) will not build any divisions at all. This mod is primarily intended to affect Major nations.

Update 24/12/2016:

-Decreased number of Mountaineer Divisions the AI wants.
-Added the condition that the AI must have Motorised equipment stockpiled to produce Armoured Divisions (as AI division templates tend to be about 50/50 Armour/Motorised).
-Change the date from when the AI will stop being concerned about Light Tanks in stockpile from 1939 to 1940 (Currently looking for a better way to do this than what date it is).
-Added conditions for producing Infantry Divisions after 1940 where the AI needs more than 250 Units of Artillery stockpiled and will cancel training if it has less than 0 (this is to prevent massive deficits of Artillery equipment late game).

Update 6/1/2017:

-Fixed bug where AI would continue to produce Divisions regardless of equipment levels after the year reaches 1940.
-Added condition for building Infantry Divisions after 1942 where Anti-Tank Guns are required (>500 in stockpile to begin training, <100 in stockpile to cease training).
-Changed method when AI should start checking if it has Medium Tanks stockpiled instead of Light Tanks in Armour Division training (AI will now check if it has a template with Medium Tanks, if it does only train Armoured Divisions if you have Medium Tanks stockpiled, if no templates have Medium Tanks then only train Armoured Divisions when you have Light Tanks stockpiled).

Download
Revisions:

Old revisions of this mod are available below. Click the link to download.