Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Library of Enlightenment > Thread: Feeling lucky?
Thread: Feeling lucky?
Binabik
Binabik


Responsible
Legendary Hero
posted January 26, 2006 10:10 AM

Feeling lucky?

When one stack attacks another there is a range of posible damage.  There is also a chance that luck will shine and do additional damage.

There are times when you really want to know just where in that damage range the actual damage is likely to be.  Like when you really want to completely take out a stack in one attack.

Or your gold dragon needs to kill two black dragons or you'll lose a gold from retal.  To kill two blacks, you need to do 600 points damage.  Your 14 golds have a damage range of 560-700.  (equal att/def)  So what are the odds of killing two blacks?  It's somewhere around 96-97%.

So how the heck did I come up with that number?  Well, I guessed.  But I guessed with a little knowledge.  During a game you normally don't want to know exactly.  You just want to know if the odds are real good, real bad, or somewhere in between.

Time for the disclaimer.  To statistically find the actual odds would require a huge amount of testing.  The testing I did was enough to satisfy myself that the following numbers are approximately correct (over 1000 attacks).  They are also rounded off to make it easier to remember.

Lets say the damage range is 100-200.

There's approx a 70% chance of being in the middle 30% of that range.
So a 70% chance of damge from 135-165 (150 +/- 15)

There's approx a 95% chance of being in the middle 50% of that range.
So a 95% chance of damage from 125-175 (150 +/- 25)

The top and bottom quarter of the range split the remaining 5%.
So a 2.5% chance of 100-125 damage.
And a 2.5% chance of 175-200 damage.

To summerize:

Bottom quarter is 2.5%
Middle half is 95%
Top quarter is 2.5%

So with the gold and black dragon I needed at least 40 out of a range of 140.  That's a little more than the bottom quarter.  So I took 2.5% and added a little to it.



So how does luck figure into this?  Well, I don't know for sure.  But there is pretty strong evidence that points to a couple things.  First, the idea that getting luck does double damage is only partly true.

What APPEARS to happen is that luck does:

Either double damage
or, normal damage plus base damage
whichever is smaller.

What that means is that it's dependent on whether the attacker has an att/def bonus or penalty.

With an attack penalty, then luck will be double damage.

With an attack bonus, then luck will be normal damage plus base damage (normal damage is calculated as usual and base damage ignores att/def bonus).

So a single AA with +20 attack will do 100 points of damage.  With a positive attack bonus, if he gets luck he will do the 100 points damage plus base damage of 50....for a total of 150.

With an AA (or naga) it's pretty obvious what's happening because they have fixed damage.  But how is luck damage calculated when there is a range of damage?  If there's an att/def bonus, base damage is used.  If there's a range of base damage, it APPEARS to select a value for luck damage the same way as normal damage.  In other words, the luck damage will have a 95% chance of being in the middle half of the range.

So if you have ten black dragons with +20 attack, normal damage will be 800-1000.  If the blackie gets luck there will be an additional 400-500 damage with a 95% chance it will be 425-475.  

Again I emphasize that it APPEARS to work like this.  With the data I have, I see other possibilities, but I consider this the most likely.  For one thing, using a different method for attack bonus and attack penalty makes sense.  What it does is provide balance between high level creatures or strong attack towns like Stronghold and low level creatures or defense towns like Fortress.

If luck always did double damage, it would benifit strong attack creatures/towns more. If it always did base damage it would benifit weak creatures/strong defense towns more.

What's interesting is that you can get luck and do less than the normal maximum damage.  When you have a large att/def bonus, this happens a lot.  I even had a marksman get luck on his first shot and not the second.  He did more damage with the second shot.

I mentioned other posibilites how this all works.  One is an alternative to my earlier statement.

Either a MAXIMUM of double damage
or, normal damage plus a MAXIMUM of base damage

The difference between this and the first one, is that instead of selecting a damage value from the range and doubling it.  A value is selected twice, and the two added together.  Same thing goes for normal damage plus base damage.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Binabik
Binabik


Responsible
Legendary Hero
posted January 26, 2006 10:14 AM

During my tests for luck and damage, I discovered something really interesting completely by accident.

When the AI is selecting actual damage from the range, it won't pick just any number.  It takes the range and divides it by a nice round number.  And uses only those even divisions for the actual damage.

For example I had 100 marksmen with a damage range of 800-1200.  The AI took the difference of 400 and divided by 10, giving 40.  The actual damage was ALWAYS a multiple of 40.

So the possibilities are:

800, 840, 880, 920, 960, etc

They would never do any other damage.


No matter what creature, the AI always did this.  It didn't always divide by 10, but it was always a nice round number.

With the dread knight test the range was 4650-9300.  Dividing by 10 would give damage increments of 465 which is way too big.  So the AI divided by 150, giving increments of 31.

So the possibilities are:

4650, 4681, 4712, 4743, etc

Again, it would never do any other damage.

It also did the same thing with luck damage.

____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Russ
Russ


Promising
Supreme Hero
blah, blah, blah
posted January 26, 2006 03:23 PM
Edited by Russ on 26 Jan 2006

Just out of curiosity (and maybe to help us find a pattern here) - how many dread knights were there?

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Binabik
Binabik


Responsible
Legendary Hero
posted January 26, 2006 08:54 PM
Edited by Binabik on 26 Jan 2006

All of the tests were done with stacks of 100 units.

Dread Knight attack=48 against Halberdiers with defense=6.  Tested on grass and cast mass haste on halbs so they could wait rather than defend.

If you're looking for a pattern, note that the range is *divided* by a round number.  But the *increment* can be fractional.  My tests always divided by a multiple of 10, but with smaller stack sizes it may use a smaller division, or maybe none at all with very small damage range.

Like one test the range was 210-315. It was divided by 10 giving increments of 10.5.  So damage was 210, 220, 231, 241, 252, etc.  (add 10, add 11, add 10, etc)

I'd be curious if you come up with the same results using the same test.  There may be some random factor in there.


Edit:

Russ

When you think it through, it makes sense that the programmers would do it this way.

First, consider this.  It's fairly easy to always pick a number between 1-10.  It's more difficult to pick a number between 1-37 one time, 1-468 the next and 1-743 the next time.

But that's the easy part.  To select a number within the range uses some sort of bell shaped curve.....all the numbers don't have an equal chance of occuring.

The damage limits in HOMM are very high.  I've seen damage ranges of several hundred thousand.  Could you imagine the amount of calculations involved in applying a bell curve to each individual number over a range of 300,000?  That might even cause a noticable delay during battle.  It would be much easier and faster to take the range and divide it by some even amount like 10, 20 or 30.  Then assign a percentage chance to each increment.

It wouldn't surprise me if they ALWAYS divided by 10 when applying the bell curve.  In a case like the dread knights where the range was divided by 150, they could first divide by 10 to apply the bell curve.  Then sub-divide by 15, with each of those 15 having an equal chance.
____________

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Ecoris
Ecoris


Promising
Supreme Hero
posted January 21, 2007 02:26 PM

Well now I can explain your results:

100 DK: attack = 48. The halberdiers have defense = 6 so the difference is 42 or a 210% damage bonus. Thus the base damage is calculated and then multiplied by 3.1. The possible values for the base damage are 1500,1510,1520,...,3000. The increment is 10, but the damage is multiplied by 3.1 resulting in the increments of 31.

I never knew you had done tests like this.

AFAIK luck is just treated as a 100% damage bonus, which is not the same as double damage.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread »
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.0490 seconds