AI kills its army

ImageImageTalking about Modding for EE2 and EE2 AOS. New maps, patches, programs and Multiplayer scenarios.
Post Reply
Bogdan
Posts: 67
Joined: 25 Feb 2017, 17:26

AI kills its army

Post by Bogdan » 07 Jul 2017, 12:03

Hi, trying to make a new scenario now and have a problem with AI. I gave AI a big army but AI gets rid of it to produce citizens. I know it's a common problem, but is there any script to solve this?


User avatar
Dr.MonaLisa
High Representative
Posts: 7413
Joined: 17 Jun 2010, 11:21
Location: Poland

Re: AI kills its army

Post by Dr.MonaLisa » 07 Jul 2017, 18:17

Hi. Are you sure that AI deletes it's army? I have never seen/heard about this problem before.
Basically, AI should respect population limits and just not produce new units when population is reached.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains

Bogdan
Posts: 67
Joined: 25 Feb 2017, 17:26

Re: AI kills its army

Post by Bogdan » 08 Jul 2017, 13:24

Well, it should respect, but it doesn't. I could see what actually AI does after new game is started and in 10 cases out of 10 AI prefers to kill ~60-80% of its army (one or several times) to produce citizens. It depends on pop limit AI has. This problem is well known and you can reproduce it if you give AI no resources, but a big army and city.

UPD: Managed to solve this problem! Just deprived AI of all its cities but left some citizens and storehouses (preventing AI to capitulate). In my scenario there're no spare territories for AI, it can't just built a new city and produce citizens, so now it saves all units it has! Maybe someone will find it helpful

User avatar
Dr.MonaLisa
High Representative
Posts: 7413
Joined: 17 Jun 2010, 11:21
Location: Poland

Re: AI kills its army

Post by Dr.MonaLisa » 08 Jul 2017, 14:36

I found something in AIPs files, but it won't fix the problem. Just some information:
In files:
aips\AIPDefaults.h
aips\aips\Mil_Default.h

Code: Select all

// do we kill off our units if we get close to popcap?
int killsUnitsForPopcap = 0;
It means, by default this option is disabled. So by default AI should not kill units.

However, for example in file: aips\Skirmish_Default.aip:

Code: Select all

// do we kill off our units if we get close to popcap?
int killsUnitsForPopcap = 1;
So then units might be killed.

What's interesting, this "killsUnitsForPopcap = 1" is present only in 1 file, however this file is probably read by all other scripts.

I could change it with a minor update, but I'm not sure if it wouldn't cause more problems in normal games.

However, I know that it's possible to load custom .aips scripts to scenarios by the Map Editor -> Mission Properties (AI Script tab). The new AI script should be pasted to some folder in Documents/Empire Earth II, but I don't know where exactly. So then you could copy that Skirmish_Default.aip, rename it, modify and try to load for the AI. Also, maybe selecting the other default script would solve the problem? By default it's set to "Mil_Crown".
And yes, I'm sure that custom AI scripts can be loaded, because TheGrouchDE used to do it in the past to control AI behavior. I'll ask him to look into this case, since he's the Minister of the Department of Mods. Maybe he'll give some tips how to load a custom ai script in map editor.
Best regards,
Dr.MonaLisa
Ministry of Game Affairs
Department of Control and Complains

Bogdan
Posts: 67
Joined: 25 Feb 2017, 17:26

Re: AI kills its army

Post by Bogdan » 09 Mar 2019, 14:56

It's interesting that even turning citizens off like

Code: Select all

SetTechEnabled(OTTOMAN_TURKS, "Citizen", false);
doesn't stop AI from killing it's army.

It's just awful. What did developers think about? What's the reason of eliminating your own army function when you've already got a big one?

User avatar
TheGrouchDE
Posts: 108
Joined: 26 Jul 2012, 11:22

Re: AI kills its army

Post by TheGrouchDE » 09 Mar 2019, 16:19

Hi Bogdan,

i've had already cases when playing the game in which the AI just deleted some of his units. So you're not the only one noticing that sort of behaviour by the AI.
That folder that Dr.MonaLisa mentioned in the post above is the "aips" folder in your installation folder. You edit a copy of a aip file to your wishes and load it with the script AI_ChangePersonality(playerID, "bully.aip"); You just have to change playerID with the name or the number of the AI according to the list of players in EE2 Scenario Editor and the exact name of the your edited .aip file. It then will do exactly what it is told in there. But if you want to play online you need to remove it out of the folder. Otherwise you'll get error about aip files not being the same.

Greetings,
TheGrouchDE

Department of Modding and Testing

Post Reply

Return to “EE2 files, modding, maps, testing, etc.”