AI-Team Tests

Moderators: Order of Battle Moderators, The Artistocrats

Post Reply
Horst
Brigadier-General - 15 cm Nblwf 41
Brigadier-General - 15 cm Nblwf 41
Posts: 1927
Joined: Mon Feb 18, 2013 1:22 pm

AI-Team Tests

Post by Horst »

I did some tests about AI-Teams, how they affect AI processing time and how units in them act together.

1) AI-team test situations, with either only land, naval, or air vs. land units:
- 120x120 max. map size that is fully revealed to watch the (slower) unit movements with max-speed animations
- 25 AI land or naval units with movement 4 and (attack) range 4 on northern map edge, or 25 AI strategic bombers with movement 11 and off-map supply support on northern map edge
- 5 player units, either naval or land on the southern map edge being idle
- AI team settings Seek & Destroy with range 999, aggression 50 (all targets for naval/air)
- measuring time on turn 2 without possible graphic & sound initialisation delay
- restarting game for every test

Land units with unique AI team settings take 57s to think & execute.
Land units with shared AI team setting take 42s to think & execute.

Naval units with unique AI team settings take 32s to think & execute.
Naval units with shared AI team setting take 50s to think & execute.

Air units with unique AI team settings take 61s to think & execute.
Air units with shared AI team setting take 47s to think & execute.

The times can vary somewhat, on different hardware anyway, but the time difference should still be noticeable.
The AI processing time is faster for naval with unique teams, while the opposite is valid for land & air units with shared teams.
What is also interest to know that no AI naval unit kept guarding a supply-flag on a sea hex while a single AI land unit of these 25 didn’t move and kept guarding the supply-flag. The independence of naval units to supply points seems obvious here, like the opposite for land units.
Anyways, this also showed that single units can possibly ignore AI behaviours if there are still supply points to guard. Such overriding behaviour can also be observed when the AI runs out of supply sources.


2) Now a much more interesting test: how important are AI-teams for coordinated AI attacks, in particular land attacks?
Test map situation:
- small map with inexperienced 18 AI artillery units and a single AI infantry unit encircling a single fully-entrenched 5-star heavy tank player unit with 1-2 hex distance between. Both sides have enough supplies
- AI Seek and Destroy behaviours, either with aggro 50 or 100

At first, if AI infantry is alone in AI team-2 separated from the artillery units in team-1, the AI won’t attack with the infantry unit on turn 1 with aggro 100, and only moves next to the player unit with aggro 50. Afterwards, the artillery team-2 will attack without any further action of the infantry despite 0 efficiency of the player unit.
On turn 2, the AI infantry unit attacks first, afterwards the artillery units.

If AI infantry is in AI team-1 together with the artillery units, all artillery units will attack first before the infantry unit attacks also on turn 1.
Same happens on turn 2.

Conclusion: it looks like AI teams are important to execute coordinated assaults; otherwise the AI does these unfavourable orders of actions which can waste turns and damage potential.
As land units with shared AI teams also seem to be processed faster, I guess it’s very favourable to put as many in one team together as possible.
As the AI infantry unit in a lone team-2 always acted first before artillery team-1, it also showed that the AI doesn’t follow any numerical order of the AI-team list.

I hope you forgive me the lack of rather useless screenshots here. The number of test-scenarios also exceeds somewhat the motivation to upload them all. The test with arty and inf isn’t that time-consuming to reproduce if you are curious.
Last edited by Horst on Wed Feb 21, 2018 1:52 pm, edited 2 times in total.
Shards
Slitherine
Slitherine
Posts: 3991
Joined: Tue Aug 25, 2015 10:05 am

Re: AI-Team Test

Post by Shards »

Interesting stuff!

I'm experimenting with similar stuff at the moment. I'll let you know if I find any other interesting behaviours
Horst
Brigadier-General - 15 cm Nblwf 41
Brigadier-General - 15 cm Nblwf 41
Posts: 1927
Joined: Mon Feb 18, 2013 1:22 pm

Re: AI-Team Tests

Post by Horst »

I've just added a better introduction line and bolt text for less ambitious readers. :)

I’m also still curious about all the other AI behaviors which aren’t that clear, for example, which is better: Defend Hex or Local Defense?
Studying exact AI orders how they work together like different aircraft and land units in shared or unique teams couldn’t hurt either to optimize the AI strength and processing time.
Maybe studying the code would be more helpful, but I'm not competent enough for that gibberish. Watching units doing funny things is more interesting anyway!

PS: another question is if naval units with unique behavior act much different than with shared AI-team. Is the processing-time advantage really worth it, as shared AI-teams of land units act obviously better.
GabeKnight
Lieutenant-General - Karl-Gerat 040
Lieutenant-General - Karl-Gerat 040
Posts: 3710
Joined: Mon Nov 27, 2017 10:24 pm

Re: AI-Team Tests

Post by GabeKnight »

THANKS, Horst!
By now I reget not collecting all these "little" :wink: test I've found spread in the forums over the years in one thread (or PDF file) or similar. There were some very useful experiments with efficiency, entrenchment, experience and so forth out there. Quite the good reading material for advanced players.

Back on topic:
Nice findings so far, but your report doesn't quite correspond with my observations regarding naval teams and AI thinking times. I wasn't exaggerating in the USNavy thread. Just about now I've tested with v5.2.9 /64bit again (the "8Hawaii" mission, Erik's USNavy camp.) with the original-beta version and my split-team-mod version as single missions out of the campaign. It's more like day and night, not just double or half. How big were your AI-teams?
Seriously, the split-team run may have had thinking times of 5-10sec. (max) prior to each naval groups movement, and that's perfectly normal and consistent with usual gameplay. Granted, the moving animations take quite some time with many units, but that I don't mind at all. I've played four consecutive turns with no #orbital, no moving my forces or whatever. Basically just clicked on "end turn" four times and waited for the AI to make its move. During play, I always use the "pause AI calculation during gameplay animations" setting, that way I can tell the AI thinking times (also my CPU-fan high-revving and the CPU-usage monitoring program, of course :wink: ). Then restarted (whole program) with the original-beta version and even the very first turn had a single AI thinking time (between two groups) of over 5min, which I aborted about then.

Now I have two request, if you'd be so kind as to please
1) send me your naval test scenarios. By now I really want to know if I may be overrating my rig.
2) play a few turns with the attached above mentioned scenarios, and to inform me about your experiences with the AI thinking times there.

Thank you, again.
Attachments
Scenarios.rar
(130.57 KiB) Downloaded 124 times
bebro
Slitherine
Slitherine
Posts: 4576
Joined: Sun Nov 19, 2006 12:50 pm

Re: AI-Team Tests

Post by bebro »

Horst wrote: Conclusion: it looks like AI teams are important to execute coordinated assaults; otherwise the AI does these unfavourable orders of actions which can waste turns and damage potential.
As land units with shared AI teams also seem to be processed faster, I guess it’s very favourable to put as many in one team together as possible.
As the AI infantry unit in a lone team-2 always acted first before artillery team-1, it also showed that the AI doesn’t follow any numerical order of the AI-team list.
Not the AI coder here, but from my XP:

- Yes units in an AI team will coordinate better.
- Re calc speed/turn times: too large *active* AI teams may slow down everything.

Active meaning here: they are set to move/attack/search&destroy or NON-static defense orders ("def hex" with a certain radius). STATIC defense teams, which only fight when attacked, can be bigger, as it does not need much resources. From my XP teams active with max. 10-12 units are ok, I wouldn't use 20 or so (or only in rare cases when it's clear this team will suffer quick losses.
gunnyjs
Corporal - Strongpoint
Corporal - Strongpoint
Posts: 63
Joined: Mon Mar 13, 2017 8:17 pm

Re: AI-Team Tests

Post by gunnyjs »

I've noticed as I have play tested the same scenario over and over that I was working on some different AI behaviors. Which is nothing to frown upon but is great - there seems to be a "flexible" coding or whatever its called given to the AI.

I have the AI set at in a Local Defense mode at 6 hexes away. They are sitting at a Primary Victory point at this point in the scenario they are dug in - they have been sitting there since the beginning of the scenario - I generated a trigger to go into effect at turn 8 or something to where they go into Local Defense mode at 6 hexes away. My force that attacks this Primary Victory point always arrives around turn 18 or 19. ok so what happens:

One last thing the units were placed as is - strength of 10 zero experience same as my units.

Ok so sometimes when I approach a tank or infantry unit will come out of their dug in position and attack me - what is interesting is sometimes they will just sit there (I even thought there was a bug or the trigger got messed up ) What happens is THEY RESPOND ACCORDING TO MY ATTACK FORMATION If my tanks are leading and my units are basically on line with some infantry next to the tanks and the arty behind they sit there until the last hex or so but if I get close and my units strung out and not orderly they will attack sooner and will attack exposed units the arty there may even move.

Maybe all of this is already known but the point is the AI is going to respond different under the exact same conditions if the attacking force is attacking a particular way - I think this in and of itself is great.

Oh one last thing on the way to this objective I was smashing my way through the AI's initial front foxholes and some units but the AI at the Primary point is not on the same ai team as those I am smashing through. Maybe this is something to consider too.
Horst
Brigadier-General - 15 cm Nblwf 41
Brigadier-General - 15 cm Nblwf 41
Posts: 1927
Joined: Mon Feb 18, 2013 1:22 pm

Re: AI-Team Tests

Post by Horst »

It’s possible that many more enemy units on a map can vastly increase the thinking process for the AI during an S&D routine. This is something what I haven’t tested yet. Very fast rigs possibly also reduce the thinking time that much that the time of shared and unique AI-teams have only a slight difference. Slower rigs are therefore better for testing and showing differences.
However, it’s still interesting that 25 land or air units in a shared single AI-team behaviour are processed much faster than with unique AI-teams. No idea why it’s the opposite for naval units. I used the Ho-Ni II SPG in arty-mode with move and range 4 which is basically the same like the DD Matsu ’45 I used for naval units.
With shared AI team, the AI will first think a long time and then execute quickly every unit.
With unique AI teams, the AI will always think before executing each unit.
Somehow, the thinking process must take longer for land & air, but shorter for naval units with unique teams.

@gunnyjs: yep, jumping out of entrenchment 10 or even away from objective flags is something what I don't like to see at all for the AI. While playing the custom GGCampaign, I've observed quite often that the AI moves one hex away from settlements with infantry to open terrain when a tank of mine got next to it. That's a very strange behavior if the infantry unit has better mech-attack in settlements than in open ground.
Being too idle though and getting slapped out of objective hexes once without attempts to recapture it is something undesireable too, of course.
I still got plenty to learn about the AI behaviors.

I see I don't get around uploading the test-scenarios. I understand it's a bit too much text to comprehend and imagine anything.
Attachments
Test-AiTeam.7z
(60.24 KiB) Downloaded 123 times
Horst
Brigadier-General - 15 cm Nblwf 41
Brigadier-General - 15 cm Nblwf 41
Posts: 1927
Joined: Mon Feb 18, 2013 1:22 pm

Re: AI-Team Tests

Post by Horst »

@Gabe

8Hawaii_small-team: 2m39s
8Hawaii_orig-beta: endless waiting (crashed the task after 10 minutes)

This is a very good example for the sluggish thinking of large shared teams of naval units!
I've meassured the time with FoW to speed up the processing, so I have no idea which groups of units took longer than others.
I see both scenarios still have that large 19-aircraft team. Yeah, well, air units should still perform better in large AI-teams according to my own test.

The OOB's AI coder David Foster should really take a look at these two Hawaii scenarios what could possibly go wrong there.
In the output_log, I’ve found following last entry:
"Task of type CaptureHexTask has a team of type naval. Only teams of type land are allowed to have this task."
No idea if this possibly cause this endless thinking together with a large naval Ai-team.
GabeKnight
Lieutenant-General - Karl-Gerat 040
Lieutenant-General - Karl-Gerat 040
Posts: 3710
Joined: Mon Nov 27, 2017 10:24 pm

Re: AI-Team Tests

Post by GabeKnight »

Thank you very much, Horst. :!:

Your naval Multi-AI-test-scenarios had practically no measurable AI thinking time at all on my rig.
(I had no idea you've put every single unit in a different AI team. BTW you could've left the target definition blank, the AI units attack everything then.)

The Single-AI-test-scenario had about maybe 4-8sec thinking prior to making all moves at once. Just as you said.
Horst wrote:I see both scenarios still have that large 19-aircraft team. Yeah, well, air units should still perform better in large AI-teams according to my own test.
It made like no difference in AI thinking time on my rig, that's why I hadn't tested it further. And this large team specifically was for the recon planes, which Erik should have eliminated by the next update anyway. But it would be probably best to group bombers/fighters accordingly to their intended tasks on the map. The bombers with escorts should DEFINITELY be inside the same AI team then.
Horst wrote: "Task of type CaptureHexTask has a team of type naval. Only teams of type land are allowed to have this task."
No idea if this possibly cause this endless thinking together with a large naval Ai-team.
This may be worth some testing, too. Like changing all the naval teams to Seek&destroy instead, for example. Okay, thanks, noted.

I'll keep the above points in mind when returning to playtesting the USNavy campaign, as Erik usually groups fighters and bombers separately and uses Naval Capture Hex regularly.
Erik2
Order of Battle Moderator
Order of Battle Moderator
Posts: 9633
Joined: Thu Jul 14, 2011 12:59 pm
Location: Norway

Re: AI-Team Tests

Post by Erik2 »

Interesting results.
The US Naval Campaign has received substantial scenario updates. I'm still testing these.
uran21
Panzer Corps Map Designer
Panzer Corps Map Designer
Posts: 2318
Joined: Thu Dec 02, 2010 8:34 pm

Re: AI-Team Tests

Post by uran21 »

Horst wrote:I’m also still curious about all the other AI behaviors which aren’t that clear, for example, which is better: Defend Hex or Local Defense?
Defend Hex existed before Local Defense, later was added on request. Defend hex is centered around particular hex but this is not always the most optimal solution because radius is checked from the single hex. You may want surrounding units to have micro reactions when player is approaching from different directions. In case of Defend Hex they would all attack invader when in radius and counterattack could be overwhelming. To counter this several (too many) Defend Hex AI Teams should be made. Here comes Local Defense as diferent and time saving (when it comes to setup) behaviour. Radius is set around units current position. So when unit counterattacks on the next turn radius will apply from its current position. For Defend Hex you can set up exact locations where defenders should be. If invaders go out of radius defending units will not pursue but rather return to their posts.
uran21
Panzer Corps Map Designer
Panzer Corps Map Designer
Posts: 2318
Joined: Thu Dec 02, 2010 8:34 pm

Re: AI-Team Tests

Post by uran21 »

When it comes to AI Teams I am aware they are coordinated better but this coordination is not always optimal one when it comes mixing different unit classes. For example if one battlegroup is tasked to attack certain objective with Move To order artillery in trucks can be faster than infantry and it looks to literly go there instead of having that hex in range. Second problem is with recon if objective is empty and recon enters it first it will not capture the hex but will prevent other units moving in. Do note how my reserch may be outdate because it has been long long time I had made my observations.
Horst
Brigadier-General - 15 cm Nblwf 41
Brigadier-General - 15 cm Nblwf 41
Posts: 1927
Joined: Mon Feb 18, 2013 1:22 pm

Re: AI-Team Tests

Post by Horst »

Ok, thanks for the explanation, uran!
So local defenders are rather just units that freely box around enemies within their punch-radius. They have the disadvantage that they could possibly move to an isolated area with no enemy around anymore and will become idle.
I need to do some own tests sometime with the defend-hex behavior so see how beneficial certain radii are for a good defense, especially with the optional defensive positions.

I can imagine that mixed non-transported and transported groups can cause some trouble. I remember some AI transport-accidents in PzC scenarios too, hence they were rarely used there in official scenarios.
The issue with AI transports seems to be that they can only move at full speed, as mentioned on this page from terminator and myself: http://www.slitherine.com/forum/viewtop ... 4&start=80
If arty with transports gets closer than full-move the move-hex, it switches to crawl-mode which isn't really that bad. It's highly depended on the terrain of course how effective such an AI assault could be. That have to be tested for each scenario. Disasters are clearly guaranteed in a meeting engagement scenario. If transported units could also move slower, maybe the AI can let them rather stick in the rear behind infantry or other accompanied units.
It possibly works better with fully mechanized assault groups with SPGs or with fast light guns without transport. If arty starts with some hex distances behind its fellows, it possibly helps to avoid trouble during a longer move order.
Horst
Brigadier-General - 15 cm Nblwf 41
Brigadier-General - 15 cm Nblwf 41
Posts: 1927
Joined: Mon Feb 18, 2013 1:22 pm

Re: AI-Team Tests

Post by Horst »

I did a simple test with an AI fighter that got the Seek & Destroy behavior. Next to it, I placed a hostile player recon-plane of recon-class.
If you leave the target-definition blank, the fighter can attack whatever unit which is still fine.
However, if you start to add classes on the S&D list, it will scan for these targets. Now the problem: if valid targets exists on the map but all of them are not visible to the AI, then the fighter becomes idle. The Distance setting doesn't matter for this.
Let's say you define Fighter, Tactical/Strategical Bomber, and Transport (Air), then recon-planes as recon-class could be totally ignored as long as these other defined classes as units are hidden on the map.
Only when no more defined targets exist on the map, then the AI fighter will attack whatever other unit again.

This issue is also valid for the Naval Seek & Destroy behavior!
E.g.: set an AI battleship to s&d only hostile BB then hostile destroyers, naval-transport and other classes next to it will be ignored as long as hostile BB's are somewhere hidden in the fog-of.war.

I remember sometimes some AI idleness in the past. This should explain why this can happen.
Vanilla campaigns often have a target-list defined for fighters as far as I have checked, but rather miss recon-class as targets. This is a reason why such planes are often ignored. For modders, it's therefore recommended to change recon-planes to tactical bombers, as these are often listed for AI fighters.
If you create scenarios, I guess it's also best to leave the whole S&D target definition blank to avoid any idleness.
Post Reply

Return to “Order of Battle : World War II - Scenario Design”