YAAAAAI (Yet Another All Action Assault AI)

Jeffrey Harpen
Algorithm
Algorithm
Posts: 99

YAAAAAI (Yet Another All Action Assault AI)

Post#1 » 08 May 2018, 20:07

Two AIs, actually. :)

Although I promised myself to give up making all action AIs, I couldn't resist and not try to exploit some new possibilities that are given by new filters. I tried many all action AIs, most of them stayed in the Diamond League, but two of them were lucky enough to get to Master and stay there for a few dozens of matches. Here they are:

Screenshot_20180506-000755.png
Screenshot_20180506-000755.png (639.83 KiB) Viewed 785 times


Screenshot_20180506-000246.png
Screenshot_20180506-000246.png (586.71 KiB) Viewed 785 times


What's so interesting of it? I think some filters can simplify the code in quite surprising way and be useful for both beginners and advanced players, so I think it would be nice to share what I've found. I hope you find it interesting.

One of my favorite filters usage is this action:
"ATTACK ENEMY at short or medium range from me AND at short or medium range from ally"
(Of course it's simplified description, but I don't want it to be very long and hope you get the meaning.)
Actually this is the action that made me experiment more with filters. It makes the first bot aproaching the enemy wait a while for an ally to come. As soon as it comes they both start attacking and together are much more powerful. Two assault bots at medium range give 55%+55%=110% damage, which can terrify enemy a bit. Actually there is a bit higher chance that the enemy would start retreating (especially if it has "IF attacking me ENEMIES >= 2" condition in its code) and (last but no least) the first bot is usually a bit closer to the enemy, so it would keep attacking a bit longer it the enemy retreated.

There is another version of this action:
"ATTACK ENEMY at short or medium or long range from me AND at short range from ally"
which seems even be more useful in both offensive and defensive situations. I means if there was an enemy at short range from your ally, there was a danger it would attack the ally succesfully, right? So it seems reasonable to attack even if it would not kill him (and looking at my matches I can say it works). Actually one assault at short range and another assualt at long range together give also 95%+15%=110% damage, so it's not worse than previous action node.

The only blue node in both above AIs is quite tricky way to retreat at the border. It makes my bots flee from allies, but it makes sense. The biggest problem at the border seems to be that some bots push the wall when attacked, thus losing many shield and health points. It would be good to make them move along the border a bit. Right now there is no good fixed reference point to move towards (corners would be nice - next alpha maybe?), but if there is an ally somewhere near, we can try to split this group of bots. The problem is not to make it more important than attacking or fleeing from the enemy, so I decided to split the team only if there are many allies that are running away from the enemy. The adequate action is:
"FLEE FROM ALLY at short or medium range from me AND at short range from border AND fleeing from enemy"
As my bots don't flee too much it seems to be a nice compromise and actually it saved my ass in many matches. Simple and effective. :)

People who played against me recently could see some quite complex behaviour of my bots. I.e. after pushing enemies close to the border bots start to gather the resources. No conditions here, it's because some of my "MOVE TOWARDS ENEMY" actions have "out of range from border" filter. They simply ignore the enemies that are to close to the border and if all the enemies meet this condition... (or filter ;) )... my bots simply goes to next nodes which are "catch the resource".

Similar situation with a single assault gathering resources when other bots keep pushing enemies. No conditions, just "not attacked by ally" filter to "MOVE TOWARDS ENEMY" action. It means that if number of my bots was higher than the number of enemy bots, there was quite high chance that all the enemies were attacked at the same moment by allies, so one of my bots would skip "move towards enemy" action and start to gather the resources.

OK, so these were the examples of useful filters in all action AI. I have also few more examples of not so useful, but still interesting filters, which are not in the AIs above.

"FLEE FROM ALLY not out of range from me AND at short range from ally"
splits a group of four bots into two groups two bots each. Using some other filters you one make it in a certain situation and using tags one can do it for a limited number of times.

"SCORE RESOURCE TO farthest from enemies ALLY BASE at short or medium or long or out of range from enemy"
seems to be a mad idea, but followed by simple
"SCORE RESOURCE TO closest to me ALLY BASE"
makes the bot move to the farthest from enemies base if any of enemies exists and to the closest base if they don't.

Speaking of scoring - the main disadvantage of all action AI is that I've found no way to make the bot drop the resource using filters only. I mean you could probably make the bot drop and pick up the resource in the shotgun exploit way using only actions, but it doesn't seem to be the way I want it to be. So all my bots that have already catched the resource have only two options: run to the base or run away from the enemy. The latter usually doesn't end well and I think it's the main reason why all my all action AIs have ELO around 1500, not higher.

And you? What is your experience with filters? Have you tried something similar?

pier4r
Skynet
Skynet
Posts: 3188

Re: YAAAAAI (Yet Another All Action Assault AI)

Post#2 » 08 May 2018, 21:29

Some nice ideas
http://www.reddit.com/r/Gladiabots/wiki/players/pier4r_nvidia_shield_k1 -> Gladiabots CHAT, stats, insights and more ;

ElvenMonk
Automaton
Automaton
Posts: 129

Re: YAAAAAI (Yet Another All Action Assault AI)

Post#3 » 18 May 2018, 14:47

Jeffrey Harpen wrote:Speaking of scoring - the main disadvantage of all action AI is that I've found no way to make the bot drop the resource using filters only. I mean you could probably make the bot drop and pick up the resource in the shotgun exploit way using only actions, but it doesn't seem to be the way I want it to be. So all my bots that have already catched the resource have only two options: run to the base or run away from the enemy. The latter usually doesn't end well and I think it's the main reason why all my all action AIs have ELO around 1500, not higher.


I have kind of solution for you, as tag nodes are only evaluated once per turn. Node sequence:

1) Remove tag 1 from all ally bases
1) Remove tag 2 from all ally bases
2) Put tag 1 on ally base (closest to ally/farthest from enemy etc.)
3) Put tag 2 on ally base tagged by 3 you are not moving to
4) Remove tag 3 from all ally bases you are not moving to
6) Flee from enemy you are not fleeing from + other conditions
7) Move to ally you are not moving to + other conditions
5) Put tag 3 on ally base you are moving to
7) Score to ally base tagged by 1 and not tagged by 2
8) Drop resource
9) Flee from enemy (other conditions)
10) Move to ally (other conditions)
11) Do something else
12) Catch resource
...

This way you will put permanent tag 3 on ally base you are scoring to, then will detect when your bot desided to switch the base or started doing something else and will drop resource on next tick.
After that bot will probably continue fleeing/fighting/etc. without a resource.

ElvenMonk
Automaton
Automaton
Posts: 129

Re: YAAAAAI (Yet Another All Action Assault AI)

Post#4 » 19 May 2018, 17:28

I took your second script, added workaround for drop and it worked with few notes:
1) You can specify only one ally base to score to. Combined with the fact that distance to enemy filters don't work when no enemies left, you have to score even to base in short range from enemies.
2) bots will do first fleeing move even when they don't carry resource.

I found it also usefull to add sub-AI for enemy aiming counting and added 2 nodes to avoid damage from sniper and machine gun.
Resulting ai reached chapter6 of campaign, with MG, SG + 2 assaults crew, so my guess it will reach somewrere around 1600.

Much better results could be achieved by providing separate scripts for each bot class, I believe.

Resulting ai (sorry, few nodes accidenty went under connection lines):
Image
And enemy aiming counter ai:
Image

(Edit: fixed broken image links)

Jeffrey Harpen
Algorithm
Algorithm
Posts: 99

Re: YAAAAAI (Yet Another All Action Assault AI)

Post#5 » 01 Jul 2018, 00:11

Nice idea, ElvenMonk! :)

You inspired me and I thought up something similar, but using only two tags on bases and two tags on enemies. It goes like this:

1. Tag 1 all safe ally bases. (For me "safe" means "out of enemies range", but it can be defined in any other way.)
2. Tag 2 ally base I am moving to.
3. Untag 1 all ally bases tagged 2.
4. Untag 1 all not safe bases.
5. Untag 1 all enemies tagged 1 and 2.
6. Untag 2 all harmless enemies.
7. Tag 2 all enemies I am fleeing from and tagged 1.
8. Tag 1 all harmful enemies. ("Harmful" needs a definition just like "safe" above.)
9. Flee from all enemies tagged 1.
10. Untag 2 all bases I am not moving to.
11. Score resource to the closest base tagged 2.
12. Score resource to the closest base tagged 1.
13. Drop resource.
14. Flee from all enemies tagged 2.

(Sorry for not putting an image here, but this part of code is embedded between other parts and it's hard to separate the main idea from other ideas in a picture.)

Let me explain, how it works:
When the bot catches the resource, it goes to the nearest base tagged 1 (see nodes 1 and 12), which suppose to be safe. The base it goes to is tagged 2 (node 2) and untagged 1 (node 3) in the next tick. So all safe bases are tagged 1 and the base the bot goes to is tagged 2. If there is any harmful enemy (this means the enemy tagged 1), the bot will start fleeing from this enemy (node 9). In the next tick it wil change tag 1 to tag 2 on an enemy it is fleeing from (node 7) and untag 2 the base it is not moving to anymore (node 10). Now nodes 9 and 10 are inactive and there are two options: the bot will start moving to another safe base (if there is any, node 12) or will drop the resource (if there isn't, node 13) and then (in the next tick) flee from enemies tagged 2 (node 14).

Of course it's not perfect. I.e. I've seen bots running through a group of enemies to "safe base" which happened to be too far to reach, especially being under attack. :( But on the other hand this way bots can not only drop resources, but also flee with resource, which seems to be good in some situations.
Last edited by Jeffrey Harpen on 01 Jul 2018, 18:43, edited 3 times in total.

ElvenMonk
Automaton
Automaton
Posts: 129

Re: YAAAAAI (Yet Another All Action Assault AI)

Post#6 » 01 Jul 2018, 10:41

I usually team tag A all ally bases, which had ever reached in distance of some of my bots and only consider those as safe. This way I never go to Bases behind enemies back.

Mostly I followed your idea, except node 3, which is not quite clear to me.

Jeffrey Harpen
Algorithm
Algorithm
Posts: 99

Re: YAAAAAI (Yet Another All Action Assault AI)

Post#7 » 01 Jul 2018, 18:40

ElvenMonk wrote:I usually team tag A all ally bases, which had ever reached in distance of some of my bots and only consider those as safe. This way I never go to Bases behind enemies back.
Good idea, but on the other hand sometimes bases behind enemy lines are the safest, especially when enemy is pushing you to a wall. ;)

ElvenMonk wrote:Mostly I followed your idea, except node 3, which is not quite clear to me.
Sorry, my mistake! Should be "3. Untag 1 all ally bases tagged 2." Fixed (also in the description)!

User avatar
LSTM
Script
Script
Posts: 11

Re: YAAAAAI (Yet Another All Action Assault AI)

Post#8 » 02 Aug 2018, 09:32

This is a great post, thanks for sharing!
I should definitely give All Action AIs a try

Return to “Strategies”

Who is online

Users browsing this forum: No registered users and 2 guests