Flanking(the new ability for mounted units to kill siege weapons) how does it work?

From the mighty siege of Seville I remember the knights dealing like 30% damage to 3-5 units maybe? The catapults were at either 3.5 or 2 or 0.5 strength til dead. Can't say if it's different rates for HA's or Cavs or whatever. But sorry, no hard facts here, just vague recollections. I mostly just wrote since you were gettin no love.

Ya, if you can damage the units first flanking can be pretty brutal...

in our battles I don't recall a single time my cavalry flanked one of your cannons, so I'm curious about this as well
there's definitely a random element, sometimes you get nothing at all

I didn't have much cannons though
 
So flanking promotions increase the chance of hitting an individual siege unit, and collateral damage increases the damage (and chance) of flanking attacks. In addition to what they already do.
I think fireaxis should change flanking to a set number of flanking attempts, not flanking successes.
 
The following picture shows a slightly more verbose combat help with an extra line for the XPs the attacker will get for winning this combat, the green / red number of HPs the attacker / defender takes away in 1 combat round, and the Odds for the attacker to win a combat round (= 100 - DefenderOdds). Note that the EscapeOdds (32%) of the siege units have nothing to do directly with the Combat Odds (93.6%) or the Retreat Odds (1.3%).

FLANK2.png

Wandering OT, but where did you get the "verbose combat help" hover mod?
 
I agree. It's overpowered. And maby melée units in the stack could be given variable chances to block? I.E. Spear 30%, Ax and GunPowder 20%, Sword 15%? :) and Phlanx 50 because the unit is underpowered.
 
Technically, spears reduce the flanking damage. Unfortunately the way phalanxes are balanced to just be a little stronger than knights, and rifles a little stronger than cavalry, they're not a strong enough counter to stop the flanking damage. Mounted counters have to really overpower to minimize flanking damage.
 
Well war elephants at least stop horse archers, as outlined above ;).
 
Wandering OT, but where did you get the "verbose combat help" hover mod?
That was self-made -- a few extra lines of code added to CvGameTextMgr::setCombatPlotHelp() plus recompiling the dll. The following code also includes the needed rounds to kill/retreat for the attacker / defender:
CombatHelp.png

Spoiler :
Code:
[SIZE="3"]int iAttackerStrength  = pAttacker->currCombatStr(NULL, NULL);
int iAttackerFirepower = pAttacker->currFirepower(NULL, NULL);
int iDefenderStrength  = pDefender->currCombatStr(pPlot, pAttacker);
int iDefenderFirepower = pDefender->currFirepower(pPlot, pAttacker);
FAssert((iAttackerStrength + iDefenderStrength)*(iAttackerFirepower + iDefenderFirepower) > 0);

int iAttackerOdds      = ((GC.getDefineINT("COMBAT_DIE_SIDES") * iAttackerStrength) / (iAttackerStrength + iDefenderStrength));
int iStrengthFactor    = ((iAttackerFirepower + iDefenderFirepower + 1) / 2);
int iDamageToAttacker  = std::max(1, ((GC.getDefineINT("COMBAT_DAMAGE") * (iDefenderFirepower + iStrengthFactor)) / (iAttackerFirepower + iStrengthFactor)));
int iDamageToDefender  = std::max(1, ((GC.getDefineINT("COMBAT_DAMAGE") * (iAttackerFirepower + iStrengthFactor)) / (iDefenderFirepower + iStrengthFactor)));

int iExperience; 
if (pAttacker->combatLimit() < 100)
{
	iExperience        = GC.getDefineINT("EXPERIENCE_FROM_WITHDRAWL");
}
else
{
	iExperience        = (pDefender->attackXPValue() * iDefenderStrength) / iAttackerStrength;
	iExperience        = range(iExperience, GC.getDefineINT("MIN_EXPERIENCE_PER_COMBAT"), GC.getDefineINT("MAX_EXPERIENCE_PER_COMBAT"));
}
int iNeededRoundsAttacker = (pDefender->currHitPoints() - 1 - pDefender->maxHitPoints() + pAttacker->combatLimit())/iDamageToDefender + 1;
int iNeededRoundsDefender = (pAttacker->currHitPoints() - 1)/iDamageToAttacker + 1;

szTempBuffer.Format(L"for %d XP -- " SETCOLR L"%d*%dHP" ENDCOLR L" / " SETCOLR L"%d*%dHP" ENDCOLR L" Odds: %.1f%%", 
					  iExperience, TEXT_COLOR("COLOR_POSITIVE_TEXT"), iNeededRoundsAttacker, iDamageToDefender, TEXT_COLOR("COLOR_NEGATIVE_TEXT"), iNeededRoundsDefender, iDamageToAttacker, float(iAttackerOdds)/10.0f);

szString.append(NEWLINE);
szString.append(szTempBuffer.GetCString());[/SIZE]
 
That was self-made -- a few extra lines of code added to CvGameTextMgr::setCombatPlotHelp() plus recompiling the dll. The following code also includes the needed rounds to kill/retreat for the attacker / defender:
CombatHelp.png

Spoiler :
Code:
[SIZE="3"]int iAttackerStrength  = pAttacker->currCombatStr(NULL, NULL);
int iAttackerFirepower = pAttacker->currFirepower(NULL, NULL);
int iDefenderStrength  = pDefender->currCombatStr(pPlot, pAttacker);
int iDefenderFirepower = pDefender->currFirepower(pPlot, pAttacker);
FAssert((iAttackerStrength + iDefenderStrength)*(iAttackerFirepower + iDefenderFirepower) > 0);

int iAttackerOdds      = ((GC.getDefineINT("COMBAT_DIE_SIDES") * iAttackerStrength) / (iAttackerStrength + iDefenderStrength));
int iStrengthFactor    = ((iAttackerFirepower + iDefenderFirepower + 1) / 2);
int iDamageToAttacker  = std::max(1, ((GC.getDefineINT("COMBAT_DAMAGE") * (iDefenderFirepower + iStrengthFactor)) / (iAttackerFirepower + iStrengthFactor)));
int iDamageToDefender  = std::max(1, ((GC.getDefineINT("COMBAT_DAMAGE") * (iAttackerFirepower + iStrengthFactor)) / (iDefenderFirepower + iStrengthFactor)));

int iExperience; 
if (pAttacker->combatLimit() < 100)
{
	iExperience        = GC.getDefineINT("EXPERIENCE_FROM_WITHDRAWL");
}
else
{
	iExperience        = (pDefender->attackXPValue() * iDefenderStrength) / iAttackerStrength;
	iExperience        = range(iExperience, GC.getDefineINT("MIN_EXPERIENCE_PER_COMBAT"), GC.getDefineINT("MAX_EXPERIENCE_PER_COMBAT"));
}
int iNeededRoundsAttacker = (pDefender->currHitPoints() - 1 - pDefender->maxHitPoints() + pAttacker->combatLimit())/iDamageToDefender + 1;
int iNeededRoundsDefender = (pAttacker->currHitPoints() - 1)/iDamageToAttacker + 1;

szTempBuffer.Format(L"for %d XP -- " SETCOLR L"%d*%dHP" ENDCOLR L" / " SETCOLR L"%d*%dHP" ENDCOLR L" Odds: %.1f%%", 
					  iExperience, TEXT_COLOR("COLOR_POSITIVE_TEXT"), iNeededRoundsAttacker, iDamageToDefender, TEXT_COLOR("COLOR_NEGATIVE_TEXT"), iNeededRoundsDefender, iDamageToAttacker, float(iAttackerOdds)/10.0f);

szString.append(NEWLINE);
szString.append(szTempBuffer.GetCString());[/SIZE]

I finally got around to learning how to mod this in, and I just wanted to say thank you for posting this! :goodjob:

I have no idea how I'll go but I hope to add some more functionality to this tool.
 
:cool: - I actually just implemented this for some quick tests, but found it very useful and kept it in since then.
E.g. I learned that my Chariots can attack barb Warriors in the open at 99.1% combat odds and get 2XP, or that it's better to wait and attack these barbs with your Axes if they are on forested hills to get a similar E[XP]...

So what else do you have in mind?
 
-The obvious ones, for me at least, are E[HP attacker] and E[HP defender] (or just as good, the E[Attacker HP lost] and E[Defender HP lost]).

-Perhaps changing the XP to a non-integer, so you can see if you're near a xp jump. (or including both)

-Again, a personal preference, but I'd like to remove all the percents and use decimal proportions for probabilities.

-Ultimately what I would like to see, but which would take far more skill than I'll possibly have, is to have something on the interface which gives you two very simple graphs of the discrete probability distributions for the HP to each combatant (after battle obviously). They could be set up on the same axes... It could be done with just numbers, but a chart/graph would be a lot more impressive. I'm not sure how much it would take to draw them, but the calculations are not too intensive I don't think, especially not if I've already calculated E[A HP] and E[D HP] earlier.

-Defender XP could be put in.

-E[hammers lost] and E[hammers killed], which would need to refer specifically to the hammer cost of each unit, but would probably have to ignore promotions.

Just some ideas at this stage. For the time being I'm happy using this compiled in with Better AI :). I guess I've officially created my first mod! :lol:
 
It is not terribly hard to see if you are close to a break point from the damage dealt and the total hp of the attacker / defender though... expected values means pretty little, but the probability of winning a given round is nice to have...
 
It is not terribly hard to see if you are close to a break point from the damage dealt and the total hp of the attacker / defender though...
Good for you. Would you care to enlighten us how you do this via a simple calculation in your head? Does it take you more than 5 seconds?

expected values means pretty little, but the probability of winning a given round is nice to have...

You say expected values mean pretty little... What are you basing this on? This is your opinion and I think (i.e. my opinion is) you're mistaken. It's often the case that expected values are more useful than straight victory odds. More often however, having the two paired together gives a much better indication of how a battle turns out.

Here is a real example:
Two units attacking a city.

Unit1
99.0% odds
E[Attacker HP] = 93.6
E[Defender HP] = 0.2
Attacker XP = 3

Unit 2
99.4% odds
E[Attacker HP] = 76.8
E[Defender HP] = 0.2
Attacker XP = 1

Moreover, Unit1 has an 83.5% chance to not take a hit (come out of battle with 100HP). Unit2 has only a 30.4% chance to not take a hit.


I would find all this information useful.

Based on these results, which unit would you attack with? Is the decision obvious to you?

Final example, a mace attacks infantry. Tell me, how much damage can you expect the mace to deal? How many maces would you probably need to take the infantry down? If you can tell me these things using just the combat odds of 0.1% I'd be very interested in seeing how you worked it out.

Thanks
 
Good for you. Would you care to enlighten us how you do this via a simple calculation in your head? Does it take you more than 5 seconds?

Divide the HP by the damage dealt then find the reminder and divide that by number of hits. (HP%damage)/(HP/damage(integer division)) this tells you how much more damage you need to get one more hit in.

@ Expected value, sure the second one is better, but that is a rather rare case with massive amount of first strikes but i concende the point that it might be useful to have it displayed in some way.
 
Divide the HP by the damage dealt then find the reminder and divide that by number of hits. (HP%damage)/(HP/damage(integer division)) this tells you how much more damage you need to get one more hit in.

Seems pretty hard to do in less than 5 seconds if you ask me, unless you're a maths wiz. Doing things modulo numbers near 20 eg. modulo 17 and modulo 23 I don't consider to be very quick in-head calculations. Do you suggest most people can do this quickly?

Also, I feel some things need qualifying.

"this tells you how much more damage you need to get one more hit in."

Without mention of attacker or defender it's very hard to figure out what you even mean. And get one more hit in for what? Wouldn't you be trying to change the ratio so you need one less hit rather than one more hit? Perhaps it would be clearer if you gave an example?

You could, for example, use the notation dA for damage dealt by attacker, and HA as hitpoints of attacker and use the subscript D for the same values for the defender.

@ Expected value, sure the second one is better, but that is a rather rare case with massive amount of first strikes but i concende the point that it might be useful to have it displayed in some way.

Hmm I would have called the first one better. Keeps more hitpoints and gains more XP for only a minor decrease in odds. The first unit does have 4-7 first strikes but it's not rare if you play a Protective leader. If you consider it rare then it's probably only rare with the way you use promotions on your units or for the leaders you play. People who use drill in particular, but also people who have other units with first strikes (keshiks, samurai, Cho Ko Nu (and crossbows more generally), modern armour etc., definitely could see the effects of first strikes in games.
 
Good for you. Would you care to enlighten us how you do this via a simple calculation in your head? Does it take you more than 5 seconds?



You say expected values mean pretty little... What are you basing this on? This is your opinion and I think (i.e. my opinion is) you're mistaken. It's often the case that expected values are more useful than straight victory odds. More often however, having the two paired together gives a much better indication of how a battle turns out.

Here is a real example:
Two units attacking a city.

Unit1
99.0% odds
E[Attacker HP] = 93.6
E[Defender HP] = 0.2
Attacker XP = 3

Unit 2
99.4% odds
E[Attacker HP] = 76.8
E[Defender HP] = 0.2
Attacker XP = 1

Moreover, Unit1 has an 83.5% chance to not take a hit (come out of battle with 100HP). Unit2 has only a 30.4% chance to not take a hit.


I would find all this information useful.

Based on these results, which unit would you attack with? Is the decision obvious to you?

Final example, a mace attacks infantry. Tell me, how much damage can you expect the mace to deal? How many maces would you probably need to take the infantry down? If you can tell me these things using just the combat odds of 0.1% I'd be very interested in seeing how you worked it out.

Thanks

I am a bit confused. Why wouldunit1 with more hit points than unit2 have a better chance of winning?
 
You may not have understood what I meant by the notation E[Attacker HP] and E[Defender HP]

E[Attacker HP] := The expected (i.e. average) hitpoints the attacker will have after the battle. Similarly for E[Defender HP].

Since these units are attacking, I had assumed we have full health 100HP units.

Note that because both units are very very likely to kill the defender, that is why the expected defender hitpoints are so low (less than 1HP!).

Whenever I write E[something] I mean expected value of something.
 
Sorry for another bump, but I'm just letting anyone who read my above posts know that probably tonight or tomorrow I'll be uploading the first version of an Advanced Combat Odds mod or interface.

Here's a peak at what it will do in the first version...

attachment.php


@DanF,
Spoiler :

Can I suggest you make the following change to your code so it does not depend on COMBAT_DIE_SIDES? If you fiddle with COMBAT_DIE_SIDES by making it something like 2 or 3 you will see why this is important. When the die has 1000 sides it's hard to notice anything wrong.

Code:
int iDefenderOdds = ((GC.getDefineINT("COMBAT_DIE_SIDES") * iDefenderStrength) / (iAttackerStrength + iDefenderStrength));
int iAttackerOdds = GC.getDefineINT("COMBAT_DIE_SIDES") - iDefenderOdds;
 

Attachments

  • odds_example.JPG
    odds_example.JPG
    36.1 KB · Views: 1,232
It's the variance between combat promotions and first strikes.

TMIT you are right about the first strikes there but that example did not include Combat promotions necessarily.

That example was meant to demonstrate the simple fact that having more first strikes gives greater combat odds at the same time as further increasing odds of surviving unhurt and leaving XP earned constant.

Without first strikes, the only way to affect combat odds is by changing one or the other combatant's modified strengths which in turn affects XP earned.
 
Sorry for another bump, but I'm just letting anyone who read my above posts know that probably tonight or tomorrow I'll be uploading the first version of an Advanced Combat Odds mod or interface.

Here's a peak at what it will do in the first version...

attachment.php

This looks really good!

Can you include install instructions for a newbie please?

I used the Installer for BAT/BUG and Blue Marble Gold, but I am confident enough to be able to extract it and put it the right folder. I used to run a lot of WOW addons and maintained a Fubar starter pack for ages (I can't believe people are STILL downloading it!)

I'm hoping it integrates, or at least works nicely with BAT/BUG
 
Back
Top Bottom