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

Beagá

Banned
74 Badges
May 27, 2007
13.783
4.044
  • Hearts of Iron IV: Colonel
  • 500k Club
  • Crusader Kings II: Holy Knight (pre-order)
  • Europa Universalis IV: El Dorado
  • Europa Universalis IV: Pre-order
  • Europa Universalis IV: Common Sense
  • Europa Universalis IV: Cossacks
  • Europa Universalis IV: Mare Nostrum
  • Stellaris
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Stellaris: Galaxy Edition
  • Hearts of Iron IV: Cadet
  • Victoria 2: Heart of Darkness
  • Hearts of Iron IV: Field Marshal
  • Europa Universalis IV: Rights of Man
  • Tyranny: Archon Edition
  • Tyranny: Archon Edition
  • Stellaris: Leviathans Story Pack
  • Stellaris - Path to Destruction bundle
  • Europa Universalis IV: Mandate of Heaven
  • Crusader Kings Complete
  • Europa Universalis IV: Third Rome
  • BATTLETECH
  • Hearts of Iron IV: Death or Dishonor
  • Hearts of Iron IV: No Step Back
  • For The Glory
  • Crusader Kings II
  • Crusader Kings II: Legacy of Rome
  • Crusader Kings II: The Republic
  • Crusader Kings II: Sons of Abraham
  • Darkest Hour
  • Europa Universalis III
  • Europa Universalis III Complete
  • Divine Wind
  • Europa Universalis IV
  • Europa Universalis IV: Art of War
  • Europa Universalis IV: Conquest of Paradise
  • Europa Universalis IV: Wealth of Nations
  • Arsenal of Democracy
  • For the Motherland
  • Hearts of Iron III
  • Hearts of Iron III: Their Finest Hour
  • Heir to the Throne
  • Europa Universalis III Complete
  • Europa Universalis III Complete
  • Europa Universalis IV: Res Publica
  • Victoria: Revolutions
  • Semper Fi
  • Victoria 2
Ok, so after knowing the game better I´ve noticed vanilla AI has nasty faults; in particular, both Germany and SU have dissapointing performances, specially when you play as one of them and fight your nemesis; if you play SU, it´s obvious the AI makes many mistakes in its build order.

Looking at the ai folder, I´ve noticed that there aren´t switches to other files (for example, 1936 scenario Germany AI will follow the same script till the end), which creates all kinds of nasty effects. In particular a huge infantry spam, depletion of MP, and necessity or hundreds of IC for upgrades. Eventually the AI runs out of MP to reinforce their divisions and Germany collapses in a ridiculous way.

So, what I want to know is:

1- How I edit scripts so that the AI will switch to other at a given year? How exactly should I type it (for example I want Germany to switch from ger_1936 to ger_1938, what I must type?)
2- Suppose I want the 1938 script for Germany to make them increase airplanes production and decrease infantry - what exact parameters I should change? What about making the 1936 script produce more IC?
3- What about making SU reduce it´s garrison in Siberia after Nomonhan? How can I do that?
4- What means max_front_ratio? And max_garrison_prop (these lines are right at the start of the AI files)? I really wanted SU to make a decent force deployment previous to Barbarossa - As Germany it´s easy to encircle the soviets in part because they garrison their provinces with you with 5, 6 divisions, and those are easily overrun by your 24 divisions (that you amassed on their borders weeks ago :( )supported by planes...

I love the game and I think extra scripts for the major powers would be a huge step to improve the experience.
 
I fear your good will won't be enough to solve the problem, which is that german AI does NOT follow even those basic instructions that are in its 1936 file. It must be a hardcoded behaviour introduced by the devs for some unknown reason or a bug. But anyway.

1-you'll need AI switch events afaik. At least it's one possible solution, don't know if other are available.
2-Look at the ai file, it's pretty straighforward. You have to spend 100 on units, you choose how much to spend on every unit. But those commands do not work, and the AI only builds infantry.
For the IC you have several commands too, force_IC until, etc, but the AI won't follow them and will build infantry divisions instead of factories. If it has not enough manpower do build infantry, it will build lev.1 tactical bombers.
3-You have a list of provinces to garrison IIRC
4-Max front ratio is basically how much divisions the AI has to put in every province facing enemy.
 
I´m not interested in value changes. The only thing I really want to do is to make a better script for the AI to follow, I´m more than happy with AOD features and stats. It´s the AI that bothers me most. And not all AIs, the only AIs that I want to change are Germany, SU, and maybe Italy (because frankly the allies are not my favorite faction).

1- For Germany, I want more IC focus until 1938, then it should switch to building INF and planes. Then in 1939, more ARM, and start allocating more IC to upgrades. And reasonable production, I want them to start Barbarossa with at least 500 mp in reserve.
2- For SU, almost the same as Germany, except that I also want more intelligent garrisoning; in particular Siberia should only have garrison divisions, I want 80% of their army at the border (so that they can put up a decent resistance - nowadays a breakthrough is ridiculously easy).

If anyone could give me tips on what values I should change in the files I would be grateful.
 
Looking at the ai folder, I´ve noticed that there aren´t switches to other files (for example, 1936 scenario Germany AI will follow the same script till the end), which creates all kinds of nasty effects.
The German and Soviet ai setup could certainly benefit from more work after 1.05, but I'm not sure where you get this idea from that it doesn't switch. Maybe you are looking at the "Switch = no" statement in the ger_1936.ai file? That is actually not very important - here is what you need to look at:

1) There are two ways that ai files 'switch' in AoD. The first is when the "Switch =" statement is set to "yes" in the base ai file, but this only causes it to switch to the ai file for the corresponding year (i.e. as used in later scenarios) at each new year. Since the situation may be very different in a 1936 game to the situation at the start of a later scenario, this is very dangerous. The second way is by events; this is much more useful as you set up trigger conditions for the switch.

2) Look in the /switch subdirectory under the /ai directory. There you should see lots of ger_***.ai and sov_***.ai files. These are the ai files used by the event switches. They are not "complete" ai files - when the game switches to one of these files it just overwrites the specific variables referenced in the file and leaves all the other ai variables as they were. The files are in plain text, so you can open them in notepad and read them.

3) Look also in the /db/events subdirectory and find the file ai_ger.txt. This is the event file that switches those ai files in and out for Germany. Of course, there is a similar one for the Soviets. These are the main files you might want to modify.

4) Look also at the file "event commands.txt" to get notes on what all the commands in the event file do - the ones we have added have been explained there, as well as the HoI2 ones that still work. The file "ai_file_doc.txt" in the /ai subdirectory does the same for the .ai file commands.

Enjoy!
 
Oh sweet. Indeed I thought they never changed scrips because of the "Switch=no" statement.

Guess I´ll have some stuff to do at the weekend :D

EDIT: Ok trying my hand at it, but it´s tricky business. First things first - suppose I want the AI to switch to another AI file in 1938 - How I do that? Should the line read like this:

switch = yes ger_1938

Or if I just leave switch = yes and create a ger_1938.ai , the game will automatically switch to it once it´s 1938?

Also what I must change if I want more troops at the front (for example, SU putting more troops in the border with Germany instead of Vladivostok or Persia border)?
 
Last edited:
I fear your good will won't be enough to solve the problem, which is that german AI does NOT follow even those basic instructions that are in its 1936 file. It must be a hardcoded behaviour introduced by the devs for some unknown reason or a bug. But anyway.

1-you'll need AI switch events afaik. At least it's one possible solution, don't know if other are available.
2-Look at the ai file, it's pretty straighforward. You have to spend 100 on units, you choose how much to spend on every unit. But those commands do not work, and the AI only builds infantry.
For the IC you have several commands too, force_IC until, etc, but the AI won't follow them and will build infantry divisions instead of factories. If it has not enough manpower do build infantry, it will build lev.1 tactical bombers.
3-You have a list of provinces to garrison IIRC
4-Max front ratio is basically how much divisions the AI has to put in every province facing enemy.

ad 2:
Because of the recent behaviour of the ai, which will hopefully be fixed soon, I've been wondering how the game engine actually does handle this issue. If the ai ignores those build priorities which have a lower priority this might indicate that the ai picks those unit types for its build orders randomly by chance. build priority = chance!?

It might also be that the ai disregards its build priorities in favour of a cheaper unit simply because the new unit which should be started is more expensive than the one finished earlier. So it might be that the ai does this because it wants to avoid allocating a higher proportion of its IC to unit production.

I don't know if the ai tries to have its actual queue of build orders mimic the build priorities of its ai file at any time. Or if the ai tries to have its existing units mimic the build priorities of its ai file at any time.
 
Oh sweet. Indeed I thought they never changed scrips because of the "Switch=no" statement.

Guess I´ll have some stuff to do at the weekend :D

EDIT: Ok trying my hand at it, but it´s tricky business. First things first - suppose I want the AI to switch to another AI file in 1938 - How I do that? Should the line read like this:

switch = yes ger_1938

Or if I just leave switch = yes and create a ger_1938.ai , the game will automatically switch to it once it´s 1938?

Don't use the switch and create instead a new ai event which loads up your newly added ai file. Then you'll have full control what happens when in the game.

Also what I must change if I want more troops at the front (for example, SU putting more troops in the border with Germany instead of Vladivostok or Persia border)?

You can give a higher priority to these provinces
province_priorities = {
56 = 20 # Paris
44 = 20 # Lille
51 = 20 # Brussels
67 = 20 # Prague
72 = 20 # Metz
}
and also encourage the ai to garrision certain provinces with more units than usual
area_multiplier = {
489 = 6.0 # Przemyst
509 = 8.0 # Suwalki
510 = 8.0 # Königsberg
606 = 8.0 # Memel
}