# How does "countering a unit" work?

Hi everyone

I’ve posted yesterday about aoe2counters.com and I have received quite a lot of feedback and also, quite a lot of people told me that there’s some mistakes in the Strong vs. / Weak vs. information.

I will rebuild my whole database from scratch and I am trying to calculate the unit counters in a more dynamic way, rather than hard code it. For this, I am trying to understand how a unit “counter” is computed.

From what I understand from Wiki, each unit has an armour class and an attack type, which can be melee or ranged. And, most units have an attack bonus against certain armour classes. So, for example, a Halberdier has +32 attack bonus vs. Cavalry. This means that a Halberdier has his normal attack + blacksmith upgrades + 32 against any unit with a Cavalry armour type? Regardless of circumstances, as long as a unit has Cavalry, the Halberdier will ALWAYS have +32 attack bonus?

Because if so, the whole business would be really simple: find which unit has the highest attack bonus vs. Unit Y and put that down as the counter.

Please, if you know anything extra about unit counters that I could use in my project, feel free to share.

Much appreciated.

Short, yes. Longer: Yes, if attacked unit has Cavalry Armour set on “0” - what is deafult setting. And dmg equasion will be:
(Attack - Armour(meele or pierce)) + (Bonus Attack - Bonus Armour)= Dmg output. Dmg Output cannot be smaller than 1.
Also good thing will be how dmg output is realted to the max Target HP. Dmg output =% of max HP - this will give you idea how strong counter is.

For normal units its rather simple, more complicated is with the Unique Units.

1 Like

Absolute legend, thank you very much. Things are more clear now.

I always thought that Damage output is substracted from HP. As in, if unit attacking causes 20 damage, then the defending unit loses 20 HP. Now I find out that damage output is actually a percentage of the target’s max. HP.

Happy days.

No, is not. You understand correctly, its just my lausy English. I sugested you to visualised this numbers as % of max HP, to better see the counter.

For example, Hussar and Paladin take the same bonus dmg from Camel. But Camel is harder counter to Hussar, because thid dmg is larger % of Hussar HP.

4 Likes

Yes, I now understand what you’re saying and it is a great point.

Also, if you will make meele counters to ranged units, its also one more factor.

• Speed.

We can have few options.

• Something can have Speed larger than Archer, and good pierce armour - its now hard counter. Like Paladin
• Something can have Speed, but bad pierce armour - its soft counter and result depends on fight. This is when those % matters. Like Cataphract.
• Something can have bonus dmg, but have no speed or armour. Its soft counter. Like Halbs vs CavArchers.
• Something has good armour, but have no speed - Is not counter to archers, unless armour and HP is ridoculously large - Like Rams.
2 Likes

If you want to understand how damage calculations use the attack and armor classes, I have a video about that: https://youtu.be/FdBk8zGbE7U

There’s a version of the Advanced Genie Editor included along with the files for DE (select to browse local files, then look in the `Tools_Builds` folder. You can use this to view the information for all units. There’s a C++ library called “genieutils” you can use if you want to parse the game’s data files.

As far as what a “counter” is, though, I’m not sure if there’s a good way to generate that automatically. The attack/defense armor classes don’t tell the whole story. Timing, upgrades, and micro matter significantly. For example, Skirmishers counter Archers. But Feudal Age Skirmishers lose to Crossbowmen, since the Crossbowmen have extra range. But if those Crossbowmen wander blindly into Feudal Age Skirmishers, then the Skirms still can win. And then when the Skirmishers are themselves upgraded to Elite Skirmisher, then they counter the Crossbowmen again.

Further, sometimes “counter” units don’t beat the unit they counter in a straight-up fight, but rather work as a counter because they are more cost effective and easier/cheaper to create.

2 Likes