Sign in to follow this  
Zomis

Battles in Heroes of Might and Magic 3 - How is it calculated?

Recommended Posts

I started thinking for some days ago, when I took a break of programming by playing Heroes of might and magic 3, then I realized that this battle system is just what I need for my future game development ideas! And so I started thinking, how do they work really? Pretty soon I found the important factors... The important factors are: (Source = The unit which is going to attack, Target = The attacking target/the defender) Source: Count Attack Skill Minimum Damage Maximum Damage Target: Defence Skill And the result, luckily the value isn't just randomised and then the effects is shown to the player, but in tactic combat you can see the randomisation range of how much damage is inflicted by your unit by hovering on the target. It says something like "Shoot Green Dragons (12 shots left, 100-200 damage)." I will call these values (100 and 200 in this example) Result->Min and Result->Max. I very quickly found out that the skills of the hero is added to the creature skills. So if you have a creature with an attack skill of 7, and it's hero has an attack skill of 5, then the creature will have an attack skill of 12 (7+5). After an hour or two I found out that the Source->Count value simply multiplies the result. A group of 10 creatures inflict twice damage than 5 creatures of the same type. And after finding out the above, I noticed that the values has to be fractional, because 100 creatures would inflict a minimum damage of 220 or so, while only one creature of that type would inflict a minimum damage of 2. So that "2" value has probably been rounded down from "2.2" However, I still haven't found out how the attack and defence skills are used. I have found out that the Result->Max is calculated from Result->Min and the values of Source->MinDamage and Source->MaxDamage in this fasion: Result->Max = Result->Min * (Source->MaxDamage / Source->MinDamage) But then I had to find out, what exactly is the formula of calculating Result->Min? Below I have a couple of attacks I've tried to analyze, but note that the creature's skills (Attack and Defence) has been modified by the hero's attack and defence skills. 100 Gogs (Attack 8; Damage 2--4) Wood Elves (Defence 8) Result range: 200--400 The above shows clearly that if Attack = Defence then Result is simply Source->Damage * Count. 100 Gogs (Attack 10; Damage 2--4) Green Dragon (Defence 21) Result range: 145--290 100 Gogs (Attack 10; Damage 2--4) Green Dragon (Defence 26) Result range: 120--240 100 Gogs (Attack 10; Damage 2--4) Green Dragon (Defence 30) Result range: 100--200 In these 3 battles with 100 gogs against green dragons, I notice a pattern. For each defence point that is added to the green dragons, 5 is substracted from Result->Min (and Result->Max is adjusted accordingly, making the Result ratio propotional to the Source->Damage ratio). But where does this 5 come from? Could it be as simply as Source->Attack / Source->MinDamage? Oh no, apparently not... 4 Efreet (Attack 16; Damage 16--24) Boars (Defence 12) Result range: 80--120 4 Efreet (Attack 16; Damage 16--24) Dwarfs (Defence 15) Result range: 70--105 In the above 2 attacks, the efreet does 10 less damage if the defence value is increased by 3. So instead of that 5 we had with the 100 gogs and the dragons, we now have a value of 3.3333, and I still wonder: Where does this come from? Or should it simply be ignored, is it of no importance? And so, a few more battles: 100 Wood Elves (Attack 10; Damage 3--5) Gogs (Defence 5) Result range: 375--625 3 Monks (Attack 13; Damage 10--12) Centaurs (Defence 3) Result range: 45--54 18 Archers (Attack 7; Damage 2--3) Centaurs (Defence 3) Result range: 43--64 This is just some battles I've been working with. I will start to work more with 100 creatures instead of just 3 or so... since fractional integers have that much of an importance. If you have any ideas for the formula/algorithm used in Heroes of might and magic 3, please let me know! And by the way, if anyone has any links to articles going through similar battle calculations in similar games (not only turn-based but also Warcraft, Starcraft, Age of Empires, etc.), I'd really like to take a look at them. They could be very interesting. Since the battle system is such important part of the game.

Share this post


Link to post
Share on other sites
Yeah, it is an interesting problem. I've always wanted to know how Rome: Total War resolves it's combat calculations.
I wouldn't have the mathmatical ability to sit down and reverse engineer it though.

Share this post


Link to post
Share on other sites
Googling yields what you essentially already formulated: every attack point over the defence gives +5% damage, every defence point over the attack takes away 2,5% of the damage. And this was the case for HOMM2 as well, so it sounds likely.

Share this post


Link to post
Share on other sites
Quote:
Original post by CIJolly
Yeah, it is an interesting problem. I've always wanted to know how Rome: Total War resolves it's combat calculations.
I wouldn't have the mathmatical ability to sit down and reverse engineer it though.
If you have time, then you could try to learn the ability. (And so apparently I've had waaaay to much free time lately). Unfortunately, I have never played Rome: Total War. But if I ever do, I might try to figure out that calculation as well ;)

Quote:
Darkstrike
Googling yields what you essentially already formulated: every attack point over the defence gives +5% damage, every defence point over the attack takes away 2,5% of the damage. And this was the case for HOMM2 as well, so it sounds likely.
Thank you VERY MUCH for solving that problem for me! I can't believe it was as simple as that...

I did try to google before I asked here, but didn't find any such information. What did you google for, and which page did you found? Maybe there's more information there I could have use for.

There's some occations where the 2,5% are instead between 2,33% and 2,88 percent or so, but I think that's ok anyway. (But of course, I wish I could find out the reason why it behaved like that...)

Two of those special cases is:
100 Gogs (7; 2-4)
Green Dragon (26)
100-210
Attack-Defence = -19
Result->Min = 50,00% of Source->MinDamage*Count
-50/-19 = 2,63

100 Gogs (7; 2-4)
Green Dragon (22)
130-250
Attack-Defence = -15
Result->Min = 65,00% of Source->MinDamage*Count
-35/-15 = 2,33

Share this post


Link to post
Share on other sites
Also, if I'm not mistaken, there is a 30% cap bellow and a 400% cap above the damage multipliers. However, it has been a long time since I last heard that, I don't know where this information is comming from...

Share this post


Link to post
Share on other sites
I know this sounds very silly, but I can't reproduce the exact search >< So I can only provide a link from GameFAQs, the second guide contains the formula.

As to the discrepancy you illustrated, it looks like some extra effect to me, maybe terrain? IIRC, creatures battling on "their" terrain got bonuses.

Share this post


Link to post
Share on other sites
algumacoisaqualquer, seems like you're right. See the damage formula link below.

Darkstrike, thank you very much for that link. I've noticed the "unit mathematical analyzis" which is also avalible on that site, here: http://www.gamefaqs.com/computer/doswin/file/63965/42498 . That seems interesting.

I've found a link where the damage formula in Heroes 2 is exposed:
http://www.heroesofmightandmagic.com/heroes2/damageformula.shtml
So Heroes 2 and 3 is truly very similar at this point.

About Terrain bonuses, I doubt that's the reason. I think that the terrain bonuses (which I have heard of from somewhere else as well...), are added to the creature's attack/defence skills. So there has to be another reason behind it (if it's just not pure human error - i.e. I have written down the wrong numbers that was shown on the screen, or pure randomness, or something else).

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this