Tutorial: Editing the AI 101

Discuss and post your mods and scenarios here for others to download.

Moderator: Vic

User avatar
Vic
Posts: 9265
Joined: Mon May 17, 2004 2:17 pm
Contact:

Tutorial: Editing the AI 101

Post by Vic »

Editing the AI 101

The AI of Advanced Tactics is hardcoded, you should not consider it a scriptable AI.
However there are several ways in which can nudge the behaviour of the AI.

These ways are:
- By setting the AIrole scores of SFTypes
- By using the ExecChangeAIVP( x , y, regime , points) Exec Command in an event
- By using the ExecAIConservative ( regime, % )
- By changing the rulevars in the AI Category

What i will do in this 101 is explain these methods.
Visit www.vrdesigns.net for the latest news, polls, screenshots and blogs on Shadow Empire, Decisive Campaigns and Advanced Tactics
User avatar
Vic
Posts: 9265
Joined: Mon May 17, 2004 2:17 pm
Contact:

RE: Editing the AI 101

Post by Vic »

AIROLE

For each SFType you can and must tell the AI in what role the AI should use it.
It is possible to give a SFType values in different AIRoles.

You can set any value you want... The AI always will use the best to determain what to produce or transfer, but also will take into account cost and enemy army composition.

A few roles dont work yet because the AI does not know how to use them. These are: Paradrop, AA, Transporter and Bomber strategic.

The others you can set and must set for an AI to function properly.

The higher you raise the AIRole of a certain SFType the more you'll see it being used.


Image
Attachments
screen1.jpg
screen1.jpg (106.03 KiB) Viewed 718 times
Visit www.vrdesigns.net for the latest news, polls, screenshots and blogs on Shadow Empire, Decisive Campaigns and Advanced Tactics
User avatar
Vic
Posts: 9265
Joined: Mon May 17, 2004 2:17 pm
Contact:

RE: Editing the AI 101

Post by Vic »


EXECS FOR AIs
 
The ExecChangeAIVP ( x, y ,regime ,points) can be used to let the AI think a certain hex is worth more VP then there are actually on it. By using this exec in events you can let the AI focus more on some areas then on others.
 
The ExecAIConservative ( regime, %) lets you set the modifier for how good the AI thinks its chances for offensive are. If you set it higher then 100% the AI will become more defensive. If you set it very high it will if possible retreat immediatly into the hinterland. Keep in mind you should switch off rulevar 248 when you use this Exec.
Visit www.vrdesigns.net for the latest news, polls, screenshots and blogs on Shadow Empire, Decisive Campaigns and Advanced Tactics
User avatar
Vic
Posts: 9265
Joined: Mon May 17, 2004 2:17 pm
Contact:

RE: Editing the AI 101

Post by Vic »

RULEVARS FOR AI

This will be the brunt of the information of this 101. I will discuss the AI rulevars one by one. Keep in mind you can change AI behaviour dynamicly by using the the SetRulevar Exec Command in events. What i often did in scenarios is check whose turn it is, and if it is a specific AI turn then i change the rulevars specificly for that specific AI.

151) Fuzzy VP weight modifier (default=2)
The higher you set this value the more the AI will focus on moving towards VPs instead of towards hostile units.

152) AI Matrix Start Weight (default=2000)
Leave as is.

153) AI mobilize % defenders (default=20)
This % of units of the AI in a defensive situation will be mobilized

154) AI mobilize % attacker (default=50)
Same as 153 but then for the AI in an offensive situation.

155) Frontoccupation % (default=100)
If you set it to 100% the AI will try to occupy all hexes on the front with a unit. If you set it lower then it will leave more gaps in the line.

156) Infantry Vs Support Ratio (default=75)
If you set this lower the AIs infantry units will have more support equipment like MG, mortars and bazookas with them.

157) Armour Vs Infantry Ratio (default=75)
If you set this lower the AIs armour units will have more infantry support.

158) Arty Vs Infantry Ratio (default=75)
If you set this lower the AIs artillery units will have more infantry support.

161-163) Unitgoals for Defensive Plan (default = 30% arm, 60% inf, 10% art)
Here you can set what sort of unit mix the AI should try to have on a defensive front

164) Always mobilize armor (default=1)
This rulevar if active and set on 1 overrules rulevar 153 and 154 and makes the AI try to make sure all armoured units are always mobile

165) Always mobilize artillery (default=0)
same as 164, but then for artillery units.

171-173) Unitgoals for Offensive Plan (default = 50% arm, 30% inf, 20% art)
Same as rulevar 161-163, but then for fronts on which the AI is in the offensive.

181) Political Points Minimum (default=10)
If PP of AI is lower then this value the AI will try to produce some Political Points in its towns.

182) Minimum Stack Points in unit (default=10)
The AI will try to avoid to have unit with less stack points then this.

183) Enemy unit gets full danger score (default=10)
If you set this value higher i think enemy units will be ignored more and if you set it lower (but never to 0) then it will cause the AI to react more strongly to enemy power concentrations. I think (*recheck this for v1.1*)

184) Max Stack per unit (default=100)
The AI will try to not make units larger then this many stack points

191) Max distance from HQ (default=6)
This distance is used for AI decisions if it should create new tactical HQs for the frontlines. Set it higher to have less HQs

201) Each X prodpoints is 1 AIVP (default = 1000)
This determines howmany virtual extra VPs the AI sees for each location.

211) Do engineer bridge road plans (default = 1)
If 1 then the AI will try to build road and bridges. if 0 the AI will not try.

212)
Not used

213)
Not used

214) Mobilized Engineers (default=1)
If 1 then AI will try to moblized engineers, otherwise it won't.

215) ammount of EP in engineer unit before mobilize (default = 80)
If X EP generated per turn then mobilze.

216) Minimum AP improvement before engineers to landfront plan (default=50)
An AI frontsector only gets engineers assigned if they can improve the distance between source and target hex with X action points. Set this value higher if you want less AI engineer activity.

217) Minimum AP improvement before engineers to backplan (default=25)
Same as 216 but then for behind the frontline between neighbouring friendly towns/vps

221) Ai do Air (default=1)
Set to 0 if you dont want the AI to use any air.

222) Backbench multiplier (default = 2.5)
Set this value higher if you want the AI to produce more Rear Area SFTypes. Set it lower if you want it to produce less of those.

223) AI Air Hex Radius (default = 10)
The AI assumes this is the range of an airunit. (*recheck this for v1.1*)

224) Air to land ratio in powerpoints (default = 0.2)
Set higher if you want the AI to produce more AIR, set lower if you want AI to produce less AIR.

225) Focus on destroying units ( default = 0)
You can set the AI to have focus or extreme focus on destroying enemy units.

226) Research Investment ( default = 0.05 )
The higher you set this, the more PP for research the AI will produce.

227) Do Naval AI (default=1)
Set to 0 if you dont want the AI to do any naval ops.

230-242) Naval operations unit types
NavHome is the most defensive AI naval stance for an area
Raid is a bit more offensive
SeaSupriority is the phase where the AI is trying to get supremacy of the seas in an area
Amph is the phase where the AI is trying to get land units over
For each you can set the ideal composition of the fleet.

239) Ideal units in naval op (default =5 )
If you set it higher you will see more naval units, if you set it lower you will see less.

244) Behind lines continent reserve (default =25%)
if you set this higher the AI will try to prepare larger reserves for meeting enemy amphibious invasions.

245) Blow bridges (default = 1)
you can set blowing of bridges for ai off by setting this value to 0.

246) Neutral forces modifier (default = 0.2)
Set this lower if you want the AI to keep less reserves at borders with regimes it is not at war with.

247) Minimum Stack Points in unit optimally. (default = 20)
Closely related to 182. I advice to keep these two values closely related.

248) Random AI personality (default=1)
Set to 0 to switch off random AI personality. If it is on 1 the offensivemindedness, the air campaign mindedness and the researchmindedness of each seperate AI on the map will be randomized for each game.

249) Block AI of creating new units (default=0)
If you set to 1 the AI will not attempt to create new units.

250) Free autoprepair of 33% for AI (default=1)
You can switch this advantage off. I put it in because the AI does not use engineers good enough to repair towns manually.

251) Garrison modifier (default = 1)
If you set this higher the AI will defend airunits better.

252) Defense in depth (default = 1)
Set how deep the AI will garrison towns and vps behind the line. If you set this higher the AI will defend deeper.

253) Free land transfers (default = 0)
Set to 1 to switch off the free land transfers for the AI.

254) Set Defense in depth strength modifier ( default =1)
The higher you set this the larger the behind the line garrisons will become.

255) Disable use of staff (default =0)
If you set to 1 the AI will not attempt to use any staff or keep HQ close to units. Usefull if you make scenarios without staff.

256) Always defend large towns (default=10000)
AI will always defend towns with prodpoint equal or higher then set in this rulevar.

Image
Attachments
screen2.jpg
screen2.jpg (158.84 KiB) Viewed 713 times
Visit www.vrdesigns.net for the latest news, polls, screenshots and blogs on Shadow Empire, Decisive Campaigns and Advanced Tactics
User avatar
Vic
Posts: 9265
Joined: Mon May 17, 2004 2:17 pm
Contact:

RE: Editing the AI 101

Post by Vic »


I hope this small walkthrough will help you improving the AI for your specific map a bit.
The next tutorial will be about how to make alternate random game masterfiles.
 
Kind regards,
Vic
Visit www.vrdesigns.net for the latest news, polls, screenshots and blogs on Shadow Empire, Decisive Campaigns and Advanced Tactics
elmerlee
Posts: 300
Joined: Tue Jul 20, 2004 2:07 am

RE: Tutorial: Editing the AI 101

Post by elmerlee »

Way to go Vic. Another positive step.
PDiFolco
Posts: 1195
Joined: Mon Oct 11, 2004 8:14 am

RE: Tutorial: Editing the AI 101

Post by PDiFolco »

Some things puzzle me : some AI variables are called "infantry xxx", "armor xxx".. But the game is totally open, and can be played without these categories (eg Tolkien has cav, no armor..) !
So how does the AI "know" what is armor/infantry/whatever ? Shouldn't all this refer to indirected categories ? (ie behavior would be defined for category #6, which happens to be a thing called 'armor", 'arty', 'dragon', or whatever).

PDF
User avatar
Vic
Posts: 9265
Joined: Mon May 17, 2004 2:17 pm
Contact:

RE: Tutorial: Editing the AI 101

Post by Vic »

I forgot to mention this in this tutorial but you can also block a certain LandscapeType for the AI. If you block it. it means the AI will never attempt to move through it.
Visit www.vrdesigns.net for the latest news, polls, screenshots and blogs on Shadow Empire, Decisive Campaigns and Advanced Tactics
User avatar
Arkady
Posts: 1261
Joined: Fri May 31, 2002 1:37 pm
Location: 27th Penal Battalion
Contact:

RE: Tutorial: Editing the AI 101

Post by Arkady »

And it is possible mark some landscape favorable for AI to defend in it ?

I make forts more immune to artillery but AI don't reflect it and move out from forts to open terrain to get slaughtered

and question about EXECs

ExecAIConservative ( 0, 125)  means that regime 0 will be 25%  more defensive ?


Image
User avatar
Vic
Posts: 9265
Joined: Mon May 17, 2004 2:17 pm
Contact:

RE: Tutorial: Editing the AI 101

Post by Vic »

Letting the AI consider staying in place on a good entrenchment location is something i am hoping to improve upon in v1.1.
 
Visit www.vrdesigns.net for the latest news, polls, screenshots and blogs on Shadow Empire, Decisive Campaigns and Advanced Tactics
PDiFolco
Posts: 1195
Joined: Mon Oct 11, 2004 8:14 am

RE: Tutorial: Editing the AI 101

Post by PDiFolco »

Good idea Vic !
In this game the AI is rather "backwards" compared to usual AI : it's pretty offensive and can give nasty surprises, but it badly defend !
I've seen it leaving only token units in big cities to send out armies in the open, that thus soon get cutoff when the city falls, and it doesn't seem to take much advantage of terrain, forts and entrenchments, so it's easy for the player to dig in and slaughter massive numbres of AI attackers..
PDF
User avatar
Arkady
Posts: 1261
Joined: Fri May 31, 2002 1:37 pm
Location: 27th Penal Battalion
Contact:

RE: Tutorial: Editing the AI 101

Post by Arkady »

ORIGINAL: Arkady

And it is possible mark some landscape favorable for AI to defend in it ?

I make forts more immune to artillery but AI don't reflect it and move out from forts to open terrain to get slaughtered

and question about EXECs

ExecAIConservative ( 0, 125) means that regime 0 will be 25% more defensive ?
and other question on Events and those execs...should be event with all AI execs checked each round or each turn ??



Image
elmerlee
Posts: 300
Joined: Tue Jul 20, 2004 2:07 am

RE: Tutorial: Editing the AI 101

Post by elmerlee »

There are any number of games out there that can play well in "two-person" mode. But not many that cut the mustard against the "AI".

I have spent much time playing vs the AI and tried many adjustments in the editor. Without being critical I must say that this has been disapointing. Certainly it is difficult, if not impossible, to program an AI that can be so flexible as AT demands.

It seems to me that the editor is not far from being able to let a senario maker assign specific changes for a single senario. There are a few more abilites needed in the editor and some good examples of how things interreact and that should do it. I have not gotten to naval usage as yet but my biggest AI faults have been ......

1. NO attacks from multiple hexes. Even if
there is no attempt to surround the the
AI certainly needs this ability.
2. Air usage is bad. If air is listed as
"rear" and has a 10 hex range it never
is used at all. I changed the range to
20 and the air is used but 90% of the
time it attacks depleted units. Which
is of no value.
3. Seems to me that the AI does an
outstanding job of using rivers for
defense so I wonder that it is not
other defensive positions.
miral
Posts: 170
Joined: Thu Dec 20, 2007 7:57 pm

RE: Tutorial: Editing the AI 101

Post by miral »

Thank you! This is exactly what is needed for old people like me who have played wargames for a couple of centuries but know little of computers. Now even I can edit the AI. Amazing!
miral
Posts: 170
Joined: Thu Dec 20, 2007 7:57 pm

RE: Tutorial: Editing the AI 101

Post by miral »

Emerlee, thanks for the advice about increasing air range to 20. It helps greatly. I am about to put up a post about the AI editor and the Air War. You all here are very computer knowledgeable so what I have to say may sound pretty puerile, but it may be useful for beginers.
User avatar
Jeffrey H.
Posts: 3154
Joined: Fri Apr 13, 2007 6:39 pm
Location: San Diego, Ca.

RE: Editing the AI 101

Post by Jeffrey H. »

ORIGINAL: Vic


I hope this small walkthrough will help you improving the AI for your specific map a bit.
The next tutorial will be about how to make alternate random game masterfiles.

Kind regards,
Vic

Did this one ever materialize ?

I keep wishing that the game could be set up to have modded AI's fight each other. Then you could evolve your AI mods in trial by fires.

Let the game run in autopilot and see who wins.

History began July 4th, 1776. Anything before that was a mistake.

Ron Swanson
User avatar
Vic
Posts: 9265
Joined: Mon May 17, 2004 2:17 pm
Contact:

RE: Editing the AI 101

Post by Vic »

Hi Jeffrey,
 
Yes that is certainly something that might be added in a future release. But this will take some time.
 
About the random games. check this tutorial:
http://www.matrixgames.com/forums/tm.asp?m=1618484
 
kind regards,
Vic
Visit www.vrdesigns.net for the latest news, polls, screenshots and blogs on Shadow Empire, Decisive Campaigns and Advanced Tactics
Tagwyn
Posts: 58
Joined: Mon Oct 23, 2006 1:00 pm

RE: Tutorial: Editing the AI 101

Post by Tagwyn »

Vic: I want to thank you for this wonderful game! I am sure you hear this quite often but IMHO not often enough. For retired military personnel such as I, it is a real boon to keep our brains working and turning into a vegatable, i.e. alzheimers disease. I saw what that can to to my beloved Grandmother. How heartbraking to not be known by the person you love most in the world. I was away in the milatary and could not be around to help. Thought brings tears to my eyes. Thanks again. L3 [&o]
User avatar
ernieschwitz
Posts: 4233
Joined: Tue Sep 15, 2009 3:46 pm
Location: Denmark

RE: Tutorial: Editing the AI 101

Post by ernieschwitz »

About AI-role scores:

I have a sort of problem i want to fix. I have alot of different Armor units, and i want the AI to build less of one type it is currently building by the boatload. I have lowered the AI scores by a factor of 10, on the unit it keeps building. Will that have any effect at all? Or is it that the AI-role scores are defined like ratios?

Some input would be great :)
Creator of High Quality Scenarios for:
  • Advanced Tactics Gold
    DC: Warsaw to Paris
    DC: Community Project.
Try this Global WW2 Scenario: https://www.vrdesigns.net/scenario.php?nr=280
User avatar
Vic
Posts: 9265
Joined: Mon May 17, 2004 2:17 pm
Contact:

RE: Tutorial: Editing the AI 101

Post by Vic »

It should. Putting it on 0 should result in the AI not building any.

best,
Vic
Visit www.vrdesigns.net for the latest news, polls, screenshots and blogs on Shadow Empire, Decisive Campaigns and Advanced Tactics
Post Reply

Return to “Mods and Scenarios”