Troop Targeting and AI: Why Your Troops Do That
Mechanics
Updated: 18 September 2026 · By the Goblins Farm team
Clash of Clans troops are not clever. They follow a small set of rules with total consistency, and almost every attack that fails does so because the attacker expected intelligence where there was only a rule. Learn the rules and you stop being surprised.
Rule one: nearest target
Unless a troop has a preferred target, it walks toward whatever building is closest to it and attacks that. Not the most dangerous building. Not the building you want it to attack. The closest one.
This is why deployment position is the most important decision in an attack. A troop dropped at the corner of a base will attack the corner. A troop dropped next to a wall with a storage on the other side will, more often than not, walk around the wall to reach a building that is easier to get to, because it is looking for a path to the nearest target and the wall is not on the way.
Everything else in this page is an exception to this rule.
Rule two: preferred targets
Some troops ignore nearest-target logic and instead seek out one category of building, walking past everything else to reach it, taking damage the entire way. These are the units that make or break attacks:
- Giants prefer defences. They will march past storages and huts to reach a cannon.
- Goblins prefer resource buildings, and deal bonus damage to them. Dropped in the wrong place they sprint into the core after a storage and die.
- Wall Breakers prefer walls, specifically walls that protect something they have not yet reached.
- Hog Riders prefer defences and jump walls rather than breaking them.
- Balloons prefer defences, from the air.
- Miners travel underground and are untargetable while doing so.
The critical corollary: once every building of a troop's preferred type is destroyed, it reverts to plain nearest-target behaviour. Giants that have flattened every defence will happily wander off to punch a builder's hut on the far side of the map while the timer runs out. This single behaviour is responsible for an enormous number of failed 99% attacks.
Air versus ground
The other hard division is movement type. Ground troops walk, are stopped by walls, and can be hit by every defence except pure anti-air. Air troops fly in a straight line over walls, buildings and traps, and can only be hit by defences that target air.
Two practical consequences. First, walls are worth nothing against air; a base with beautiful compartments and one Air Defence is a free win for Dragons. Second, air attacks are far more predictable, because you have removed pathing from the equation entirely, which is exactly why they are the standard recommendation for newer players.
A handful of troops sit in between: some ground units jump walls, some travel underground, and some switch behaviour when damaged. Those exceptions are noted on each unit's own page.
What defends actively
Most of the base is passive: buildings sit still and shoot whatever comes near. Three things are not passive, and they will come to you.
- Clan Castle troops deploy when an attacker enters their radius and then chase, aggressively and across the whole map. Dealing with them is a skill of its own, covered in Clan Castle troops.
- Defending heroes wake up when an attacker comes within range of their altar and then fight like a troop, pursuing targets.
- Skeleton and similar traps spawn units that behave like troops rather than dealing instant damage.
The pattern for all three is the same: pull them out to somewhere harmless, kill them there, then attack the base you actually wanted to attack. An attack that walks into a defending Castle with the main army is an attack that has already gone wrong.
Using the rules on purpose
Once you accept that troops are simple, you can steer them:
- Clear the outside first. Ground troops only path inward when there is nothing left outside. Destroying the perimeter buildings on a side is what forces the army in, and it is the whole idea behind funnelling.
- Deploy in a line, not a pile. Troops dropped on top of each other die to a single splash defence. Spread along a side, they engage more buildings and survive longer.
- Send the tank first. Whatever soaks damage goes down several seconds before whatever deals it, so the defences are already busy when the fragile units arrive.
- Watch for the revert. When the last defence falls and your Giants pause, that is the moment to drop clean-up troops on the buildings you still need, because the Giants are about to wander.
What this page talks about
Frequently asked
Why do my Giants ignore the nearby cannon?
They are not ignoring it, they are pathing to the nearest defence they can actually reach. If a wall blocks the direct route, the game routes them around it toward whichever defence has a walkable path, which is frequently not the one you had in mind. Break the wall, or deploy where the route you want is the shortest one.
Do troops attack walls?
Only when a wall blocks the path to their target and going around would take significantly longer, or when the troop is a Wall Breaker, which targets walls deliberately. Most ground troops prefer to walk around, which is why wall compartments funnel attacks rather than stopping them.
What happens when all the defences are destroyed?
Troops with a defence preference revert to normal nearest-target behaviour and start attacking whatever building is closest, including huts and decorations at the far edge of the map. This is a common cause of failed attacks that end at 99 per cent with the timer expired.
Goblins Farm is not affiliated with, endorsed by, sponsored by, or specifically approved by Supercell. Clash of Clans is a trademark of Supercell Oy. This material is unofficial fan content produced under Supercell's Fan Content Policy. Game values change with every update; always verify in-game before committing an upgrade.











