Resource icon

[vanilla] The Mechanics of Combat (vanilla)

vexing

knows
Joined
Dec 24, 2010
Messages
2,668
vexing submitted a new resource:

The Mechanics of Combat - The Mechanics of Combat

Combat
How attacking and defending work

Introduction

Highly promoted spearman attacking highly penalized tank

"Writing an anti-war book is like writing an anti-glacier book" - Kurt Vonnegut, Jr.
"Knowing is half the battle" - G.I. Joe

Given the...

Read more about this resource...
 
Last edited by a moderator:

evahaut

Chieftain
Joined
Jun 21, 2011
Messages
19
Location
Brussels
Thanks Vexing, very nice article! Would you happen to know how defensive buildings are taken into account of a city's combat strength?
 

KiffeLesBiffles

Do you like dogs?
Joined
Apr 18, 2011
Messages
385
Location
Paris
Damaged Unit: ceil( current hp / full hp * 5 ) / 5 (a 10% reduction per two points of damage)

Is it not more like 20% per 2 point of damage ? if you have 8 hp: ceil(8/10*5)/5 = 80%
 

vexing

knows
Joined
Dec 24, 2010
Messages
2,668
Thanks Vexing, very nice article! Would you happen to know how defensive buildings are taken into account of a city's combat strength?

they are indeed; a city's combat strength is just the number it has displayed. that number is calculated by
6 base strength
1 strength per 4 pop
an exponentially increasing number based on number of techs (that goes up to 48 for all techs)
1/5th of a garrison's strength,
all raw + defense building mods,
and a 15% modifier for being on a hill

Is it not more like 20% per 2 point of damage ? if you have 8 hp: ceil(8/10*5)/5 = 80%

woops, the words were right, i adjusted the formula.
 

DaveMcW

Deity
Joined
Oct 8, 2002
Messages
6,489
The same rules are applied when capturing cities, which can result in low hp units successfully capturing low hp cities without dying in many situations. A city's inherent 50% penalty makes this easier than regular killing; a 1 hp unit will capture an equal strength 1 hp city more than half the time, while it'd die attacking a unit about two thirds of the time.

After max bombarding a city, it's an auto-win for any melee unit. Is that because it has 0 hit points?
 

vexing

knows
Joined
Dec 24, 2010
Messages
2,668
have you verified that? i'd be surprised to see a scout taking a 40 str city. i didn't actually test taking cities, it might have different rules than unit killing.
 

MadDjinn

Deity
Joined
Jan 28, 2011
Messages
4,554
have you verified that? i'd be surprised to see a scout taking a 40 str city. i didn't actually test taking cities, it might have different rules than unit killing.

it is true. (I do it often)

once a city is down to 1 HP it can be taken by any unit, no matter it's health.

Damage is still done to the unit, but the unit will never die.

This is unlike a unit at 1 HP that might roll a lucky win and stay at 1 HP. The city always falls, even with 100 CS vs. a 1 HP scout.
 

vexing

knows
Joined
Dec 24, 2010
Messages
2,668
once a city is down to 1 HP it can be taken by any unit, no matter it's health.

i know that is untrue, i've had a mega capital at above 120 strength kill multiple aa guns (32 strength) that were at or near full health. i don't know if 0 hp is special cased.
 

KiffeLesBiffles

Do you like dogs?
Joined
Apr 18, 2011
Messages
385
Location
Paris
it is true. (I do it often)

once a city is down to 1 HP it can be taken by any unit, no matter it's health.

Damage is still done to the unit, but the unit will never die.

This is unlike a unit at 1 HP that might roll a lucky win and stay at 1 HP. The city always falls, even with 100 CS vs. a 1 HP scout.

It is true
 

vexing

knows
Joined
Dec 24, 2010
Messages
2,668
okay, my bad - i tested and cities do indeed fall to any attack when at 1 hp. i've adjusted that part of the "death" section appropriately.
 

Augustus Bob

Chieftain
Joined
Nov 17, 2010
Messages
3
What about air combat? I dont quite understand how it works. Unless im mistaken, doesnt the jet fighter receive damage attacking swordsmen? What is the pilot doing exactly? How could an archer's reach be longer than a bomber's that it doesnt get damaged? The damage predicted by the computer is a logical zero, but i guess my airplanes shoot their own...
 

vexing

knows
Joined
Dec 24, 2010
Messages
2,668
i'm not sure how air combat works either. it will probably get a full article, with the basic numbers added here as well.

here's what i think so far:
the attack works as ranged does (ie floor(2 + rand(0,4)) at equal strength)
the combat window lies about the damage you're take; it lists the ranged 0 expected, but in fact you always receive damage. this damage is half of normal melee damage (ie floor(2 + rand(0,2)) at equal strength).

interception causes your unit to take additional damage from the interceptor. this damage is floor(4 + rand(0,3) at equal strength. this means an AA gun (64 str) will tend to hurt your bombers (50 str) pretty badly. the damage from each seems to be calculated separately and added together, so even fighting a 1 str aa gun and scout would cause 2 dmg.
when intercepted the damage you deal to your target is reduced, but i can't tell you by how much yet.

i also don't know how evasion works. the in game tool tip says reduces the damage taken from interception by 50%, but that doesn't seem to be what it really does.

doing an air sweep causes your fighter to just fight whatever interceptor to eat the up the interception, while taking only 75% of normal damage.
 

Augustus Bob

Chieftain
Joined
Nov 17, 2010
Messages
3
Well im happy to see im not the only one to get baffled. Lets just say ive decided airplanes were a waste except to bomb a city before getting in. I much prefer artillery, where at least i know where i stand in terms of damage. Thanks anyway
 

thectexperience

Chieftain
Joined
Nov 30, 2010
Messages
49
Location
Sydney
Well im happy to see im not the only one to get baffled. Lets just say ive decided airplanes were a waste except to bomb a city before getting in. I much prefer artillery, where at least i know where i stand in terms of damage. Thanks anyway

Except when the AI builds 20 fighters. Then you'll have to watch your units die v. slowly, & you'll wish you set quick combat on

Thanks for the article Vexing. Cleared up my query about bushido too
 

bweenie

Chieftain
Joined
Mar 19, 2003
Messages
12
Location
Vancouver, BC
The same rules are not applied when capturing cities; if a city is brought to 0 hp, the unit is guaranteed to survive and capture the city. This can result in low hp units successfully capturing low hp cities without dying in many situations, and a city at 1 hp is guaranteed to fall to any attack.

How many hit points does a city have?
 

vexing

knows
Joined
Dec 24, 2010
Messages
2,668
How many hit points does a city have?

they start at 25 hit points.
unfortunately the combat window does not tell the current hit points for cities, but you can see when they're at one hit point left if the little red bar flashes to empty when a unit expecting to do one damage is poised to attack.
 

volanchik

Chieftain
Joined
Dec 30, 2011
Messages
5
I was trying to calculate example with 2 destroyers.

DESTROYER
Combat: 35 melee, 22 ranged

Attack strength: 22 * 1.6 (via Targeting III) = 35.2
Defence strength: 35 * 1.6 (via Targeting III) * 0.4 (via naval defense penalty) = 22.4

Damage:
r = 35.2/22.4 = 1.57
m = 0.5 + (1.57 + 3) ^ 4 / 512 = 1.35
min damage to weaker party = 4 * m = 4 * 1.35 = 5.4
min damage to stronger party = 4 / m = NA (no back damage - ranged attack)
mean damage = min damage * 3 / 2 - 0.5 = 7.6
max damage = floor( min * 2 ) = 10

Why on the screen approx damage inflicted is 5? Why not 7 or 8?
What did I miss in formulas?
 

Wargizmo

Warlord
Joined
Jan 5, 2011
Messages
193
Location
Australia
Does anyone know why my ranged units sometimes have melee range, it doesn't seem to be related to whether there's a unit in the way, sometimes I can shoot over rivers sometimes not, I thought it was when hills were in the way but it's happened without there even being a hill there. It just seems like randomly every now and then I can't actually shoot anything with my archers/crossbowmen.
 

DaveMcW

Deity
Joined
Oct 8, 2002
Messages
6,489
You can always bombard over flatland.
You can bombard over hills or forest if you are on a hill.
You can never bombard over forested hills or mountains.

You can bombard over anything if you have Indirect Fire and a unit spotting for you.
 
Top Bottom