Troops A.I. Behavior

firedancer

Approved user
Joined
Apr 6, 2015
Messages
818
Did you all notice that our troops will walk all the way around a defense building before starting to attack? If I observed correctly, they will somehow walk to the corner of the defense building before attacking causing most of them to die before landing a hit.
 

dbukalski

Approved user
Joined
Apr 8, 2015
Messages
2,015
offense has the advantage in this game so im generally ok with the ai...just the miners are retarded
 

finger

Approved user
Joined
Apr 27, 2015
Messages
117
I attacked a base that had 12 buildings walled in a rectangle with 3 rows of 4 buildings. I released samurai at the corner expecting them to clear the row once they broke the wall.

Sadly they took out the first building then tried to head directly through the wall into the next row.

My assumption is that technically the building was only once space away through the wall so this behavior actually made some sort of sense even tho it forced me to facepalm violently.
 

woolybugger

Banned
Joined
Apr 15, 2015
Messages
141
The AI of foot soldiers is still a mystery I'm trying to figure out.
Much more luck with Horsemen and Cavalry raiders as they target specific things like defenses and resources.
 

Link5549

Approved user
Joined
Apr 13, 2015
Messages
132
ai for foot soldiers and wall miners are complete jokes lol. Hey I see you already broke through that wall but I'm gonna destroy this piece right next to it as well derp.
 

Bau Wau

Approved user
Joined
Apr 27, 2015
Messages
33
Actually, to me the AI seems pretty good until you use the rally command. Somehow that has very weird issues where it overwrites the AI in odd ways. I rally to destroy a building and once it is gone, everyone still goes to the spot (sometimes). Occasionally even after I rally they will continue to kill whatever they are hitting. Sometimes they will stop on their way to the rally point to attack other things, sometimes they walk through all possible fire to get there.

Also, for fun, they will take very unpredictable paths to the rally point. Sometimes they will go back through cleared area (Hooray) other times they will walk all the way around the outer wall taking fire from everything while they walk (boo).

If i don't use rally at all, the AI seems fine(ish). I think it would be unfair if all soldiers were smart enough to focus defenses, etc. But not the miners. They go for the correct wall, but then just run to the next wall and guaranteed die punching it.
 

firedancer

Approved user
Joined
Apr 6, 2015
Messages
818
Now that you have mentioned it, I will observe again whether it is the rallying that messed them up.

Thanks.
 

Lissanne

Approved user
Joined
Apr 18, 2015
Messages
74
There is also a "rally delay" where they carry on as they were for a bit before u-turning to where they were pointed. Sometimes the building in question gets destroyed in that pause. Then they dance around on empty grass before heading back about their business. The best attacks seems to use rally very sparingly and strategically, instead relying on good troop placement and their natural tendencies.
 

TmpUsr

Approved user
Joined
Apr 20, 2015
Messages
22
A big part of learning to play this game is learning to predict AI behavior, and to use these predictions to get your troops to do what you want. It is not that hard. I'll walk you through it.

1. The AI is starts out doing nothing. It looks for the nearest preferred target, and initiates a move command. If there are no preferred targets, they initiate a movecommand on that.

2. The AI finds the shortest route to the target, acting as if walls don't exist. If there is a wall in the way of this shortest path, it will search for other routes which avoid walls. If the shortest route which avoids walls more than ~8 distance longer than the route with walls, then they will go with the initial route (which goes through the wall) and attack the wall where it intersects before continuing to move towards the target. If the target is destroyed before this step is completed, they will go back to step 1 and start over.

3. The unit arrives at its target. Where it arrives depends a bit upon how the move command was issued. If rally issued the move command, then each unit will be given a slightly different position along the edge of a structure. If the move command was part of normal AI, then it will go to the closest edge to the place where it started out. Anyway, once it arrives, it starts attacking.

4. It will now delay a certain amount of time (dependent upon the unit type) before it attacks again, and then issue a new attack. If the target is destroyed by the attack, then it will go back to step 1. If the target is not destroyed, then it will repeat this step.

* Rally - Rally gives all units a new target, based upon the grid location selected. It is important that while Rally can interrupt steps 1-3, it CANNOT interrupt step 4. Units will always wait their attack cooldown and issue one final attack before responding to the rally if they were in the middle of attacking a structure. If a unit cannot finish its current cooldown/attack before a building is destroyed, then it will process the rally command in terms of rallying to a location rather than on the target... But, correspondingly, if a unit responds to the rally when a building is not yet destroyed, and the building is destroyed while on the way to the rally location, then the rallied troop will never go there, and will return to step 1 as normal.

The uninteruptability of step 4 presumably is there so you cannot rally to make your units quickly double-attack, getting more burst damage. Rally is supposed to be purely a movement/control buff.


Granted, archers work a little different than this, they have a limited radius for their preferred targets, as opposed to map-wide like raiders/knights, and it misses some of the complexity, considering I'm pretty sure that unit AI has an action queue for each unit, but this should cover the vast majority


Some consequences of this:

* If you are running an infantry-heavy army It is sometimes beneficial to rally a building past the buildings you really want destroyed. The first of your troops will run to it and destroy it before the rest can arrive. The stragglers will then turn, and quickly destroy all of their nearest buildings.

* Where you initially drop a unit effects not only what it will begin attacking first, but what it will attack after that. When you get lucky with exceedingly poor base construction, sometimes you can set a unit up to attack long sequences of buildings without having any defenses activate.
 

finger

Approved user
Joined
Apr 27, 2015
Messages
117
TmpUsr nice writeup thanks.

I run infantry heavy armies and use Rally as a "fall back" tool to keep my "Tardlings" (infantry/archers) out of danger and re-position them so they select better targets.

I could be totally wrong but I'm starting to think Rally has a large circular radius (Arcopolis effect radius sized).

I say this because i have noticed my melee AND archers ignoring my rallies if they are far enough away.
 
Top