Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How do you calculate %xHKO?
#1
I'm no good with probability distributions Sad

Basically I'm trying to figure out what damage range I need to
95% 2/3hko each Oblivion monster with Cannon
95% 4/5/6hko each Oblivion monster with Torpedo
95% 3hko Skeles with Torpedo
95% 1hko Skeles with Cannon (if possible o_o) and 2hko with Torpedo

1hko is quite easy to figure, and so is 100% xhko. But I don't know how to calculate points on the bell curve. 100% xhko is overdoing it because it always reports a number way beyond what you actually need.
Reply
#2
Dusk Wrote:I'm no good with probability distributions Sad

Basically I'm trying to figure out what damage range I need to
95% 2/3hko each Oblivion monster with Cannon
95% 4/5/6hko each Oblivion monster with Torpedo
95% 3hko Skeles with Torpedo
95% 1hko Skeles with Cannon (if possible o_o) and 2hko with Torpedo

1hko is quite easy to figure, and so is 100% xhko. But I don't know how to calculate points on the bell curve. 100% xhko is overdoing it because it always reports a number way beyond what you actually need.
I'm not really good with the damage formulas, but basically to 1hko a monster with 100 hp at 95% you will need the actual range (after skill modifiers) to be 95-195.

Its like, max dmg - min dmg is your 100%. monster hp - min dmg is the change to 1hko a monster (out of the 100%).
so your chance to 1hko a monster is:
max dmg - monster hp
__________________
max dmg - min dmg


for xhko, i suppose you just divide the monster hp by the number of hits. like, to 95% 2hko the monster above (100 hp) you will need the damage range required to 95% 1hko a monster with 50 hp.
Reply
#3
1 hit KO is easy to calculate like that, with more hits it gets more complicated...

Your best bet may be playing with a damage calculator and the hits-to-kill calculator Russt made.

http://krakia.110mb.com/testing.htm
Reply
#4
Kortestanov Wrote:like, to 95% 2hko the monster above (100 hp) you will need the damage range required to 95% 1hko a monster with 50 hp.

The percentages won't match up though, if you combine multiple uniform distributions (eg. rolling dice) they end up coming closer to a normal distribution. Like if you roll 1d6*6 (ie. it has 6 12 18 24 30 36 on the faces) you only have a 95% chance of rolling at least 6 (1/6). 2d6*3 then you have a 95% chance of getting at least 9 (1/4). 3d6*2 you have 95% chance of getting 12 (1/3 of your max). These numbers are approaching the bottom 50% of the range. With 6d6 it's around 14.

The reason this happens is because if in order to fail, you need to be in the bottom 5% twice, or 6% and 4%, or 7% and 3%, etc. which is combined probability of 0.05*0.05 + 0.06*0.04 etc., which is smaller than 5%. So the actual % of the range increases. (like 10%+10%, 9%+11%, etc.) until the total probability is only 5% again.

The more hits it takes, the closer the 95% probability gets to the bottom 1/2 of your damage range. If (like with TT) it takes 12 independent hits to 4hko, then the 95% chance of doing 4hko or better only requires the average per hit to be around 1/12 of the monster's hp.


So for classes with multiple hits, you could generally assume around 40-45% of your range to have a 95% chance to KO at that rate. It's more difficult for classes that actually only hit 2-4 times, especially if those hits can crit or have other damage mods applied individually.
Reply
#5
Dusk Wrote:I'm no good with probability distributions Sad

Basically I'm trying to figure out what damage range I need to
95% 2/3hko each Oblivion monster with Cannon
95% 4/5/6hko each Oblivion monster with Torpedo
95% 3hko Skeles with Torpedo
95% 1hko Skeles with Cannon (if possible o_o) and 2hko with Torpedo

1hko is quite easy to figure, and so is 100% xhko. But I don't know how to calculate points on the bell curve. 100% xhko is overdoing it because it always reports a number way beyond what you actually need.
I second this question. I didn't pass my Statistics class, so this is a mystery to me. To make matters worse, crits completely throw the whole thing for a loop. Is anyone here a Math PHD?
Reply
#6
The calculator works.

I don't know how anymore. But it works.
Reply
#7
use calculus! find the normal distribution / gaussian curve that goes with what you wanna know and integrate!

entry level stats books for engineers make it even easier, they have tables that tell you the info because those fuckers are too lazy to remember how to derive what they want.
i dont care enough to look in my crappy book atm because i hate the way engineering works Stunned
Reply
#8
Edit: fffff I've no clue what I'm talking about
Reply
#9
The integral for the bell curve is not analitical. You have to calculate it numerically.

And this types of probability use several uniform distributions on top of each other (for normal range) and a composition of two piles of uniform distributions stacked for crits.

Multihitting stuff makes it even worse.

Idk how Russt managed to do that calculator, I remember he ran into problems with it generating big numbers and such =P
Reply
#10
Some time last year I posted how I managed to code it in VBA for Excel (for NL's L7/TT/Avenger).
singularity Wrote:Looks like the formatting of the script wasn't preserved when I posted. Anyway, I'll go ahead and break down the algorithm in my script. Oh, I'll say right now that it would be more accurate if I had used "attacks" instead of "hits" in my code.

My commentary is enclosed in the spoiler below because it is quite long.
 Spoiler
I think the code I originally posted would be erroneous for any time damage would be 1~(something). For example, some lvl 7x training on Squids. Other than that, should be accurate.

Also, about Russt's calculator, I'm pretty sure there is an error in it.
 Spoiler
Of note is that I had a similar error to Russt's initially. And I had results similar to that second pic of non-conjured up numbers (predicted much higher 1hko than should actually occur). Then I fixed the error.
Reply
#11
^ Actually, those outputs appear to be correct for the numbers you entered.

Quick and dirty empirical test (this is a Lua interpreter):
Code:
> function hit()
>> return math.random(2) == 2 and math.random(14167, 48745) or math.random(23613, 48745)
>> end
> for i = 1, 50 do print(hit() + hit() + hit()) end
113858
127556
72631
112086
55773
83884
113466
87781
128978
131475
119426
84046
76642
127260
93927
98370
91774
67336
105573
82533
78104
95773
82969
68301
118865
129770
100678
112979
107070
90977
95061
115384
114659
88434
103860
91419
86059
95861
68483
106536
109068
90778
86914
100392
100511
111596
75410
114003
101673
108739
> num = 0; for i = 1, 100000 do
>> if hit() + hit() + hit() > 85000 then num = num + 1 end
>> end; print(num)
84673
> function hit()
>> return math.random(2) == 2 and math.random(14167, 29247) or math.random(23613, 48745)
>> end
> num = 0; for i = 1, 100000 do
>> if hit() + hit() + hit() > 85000 then num = num + 1 end
>> end; print(num)
52602

Running for 100000 iterations, 84753 of the results are above 85000, or 84.753% chance. Reasonably close enough.

Likewise, for the left data set, it returns 52602 out of 100000.
Reply
#12
Range A = a1 ~ a2= 100% OHKO
Range B = (a1 – F) ~ (a2 + S) = xx% OHKO

A = 600 ~ 1000 <60% mastery, it might be the flaw in this
B = ?

1000 – 600 = 400 = 100%

S= 400 x 95% = 380
F = this is where it gets tricky Big Grin

Have to add new range C: >600 ~ 600 = xKHO
(1000 – 600) / 0.6
400 / 0.6 = 240
There is where we get our last 5% from

F = 240 x 5% = 12

**0.6 = mastery**



Tadaa, range is 588 ~ 980. The 60% mastery is there.
If I'm wrong, please tell me.


PS: sorry for my sloppiness
Reply
#13
I'm going to concede that my program doesn't calculate it correctly at the moment. Has a problem with not counting all the different ways a certain damage amount can occur (e.g., 42504 can occur 6 different ways). For the case above, I think it should give correct results due to a 50/50 scenario being symmetric... but being correct because of that is hardly satisfactory.
--------------------------
Also, since I must (at some time) rewrite my program, I have a question.
Question: How exactly is damage calculated? More precisely, at what point in damage calculation does the game (randomly) choose a number?

 Spoiler
-------------------
So the reason it matters is because:
If the game calculates damage by a), then there are gaps in damage. Your min/max damage will be possibilities but not so for all the numbers in between. For example, damage possibilities might be like: 14167, 14169, 14170, 14172, etc.

And of course, this affects how I should write the calculation section.
Reply
#14
singularity Wrote:Of note is that I had a similar error to Russt's initially. And I had results similar to that second pic of non-conjured up numbers (predicted much higher 1hko than should actually occur). Then I fixed the error.

It would be tricky but you could reproduce those results ingame on a crit class, probably. You'd need a gap between max non-crit and min crit damage though, which limits the attacks it applies to.

But for example, say the min damage of a bowman is around 81% of the max (due to 90% mastery). It'll actually be a bit higher due to STR.
Then their attack does 81-100% with non-crit Strafe (per arrow), 275.4-340% with crit arrow.

Total it up and you get 1101.6% minimum damage with 4x crit, and 1120% maximum damage with 3x crit, 1x non-crit. Just another 18% and it would have been impossible for the character to do damage between 1120% and 1121% (or whatever), meaning a jump from 1 to 3hkos. Not too likely to happen in any real situations though.


@ Singularity there are 2 random numbers, for defense and for attack. I think they're just applied from the possible ranges of defense (0.5 ~ 0.6) and mastery (%*0.9 ~ 1), and rounded after the skill percents are all applied. I haven't noticed hitting the same numbers and holes over and over on my paladin, even though it has high percent single skills (which are the most likely to generate gaps)
Reply
#15
I thought that your damage range was calculated first, defense subtracted and all, and then the random was chosen.

One could, of course, do a study of some sort on damage distributions, but it'd be tedious and/or not reveal much.
Reply
#16
I kind of just want an approximation. I don't think it would hurt to use a random number from your range.

Also, who says it's an exact number? It's probably just a double between 0 and 1 multiplied by your (max-min) and added to your min, then multiplied by the modifiers.
Reply
#17
Russt Wrote:I thought that your damage range was calculated first, defense subtracted and all, and then the random was chosen.

One could, of course, do a study of some sort on damage distributions, but it'd be tedious and/or not reveal much.

pretty sure that since we dont do damage in increments of 2-11 (depending on skills used) instead of 1 that everything gets applied before taking the random.
with a damage range of 160~300 powerstrike can dish out both 599 and 600 on [certain monsters] no problem. i dont think you can find a clearer revelation.
Reply
#18
^ Or the modifiers are applied to the max and min. Or it's a double, as Dusk said.

My method actually assumes that damage distribution is continuous. Doesn't make a difference when the numbers are sufficiently high enough (more than a couple hundred). I think I adjusted for it by subtracting 0.5 or something like that, but the truth is it doesn't matter very much.
Reply
#19
Which is why I'm trying to figure out how to calculate probabilities in a multinomial distribution. It shouldn't matter how the numbers are derived, you just need a range and a number of variables.
Reply
#20
Okay I went to Wikipedia's page on Dice and found an algorithm to calculate the odds of getting a certain sum with i s-sided dice. Wrote a Perl script to test it.

[Image: distt.png]
95% means you'll be doing that at least that number 95% of the time. So if it says 95% = 100, you can 95% 1hko anything with 100 HP.

Only problem is that it's massively recursive so that it takes forever to calculate anything with more than 3 dice, and that's on 2-digit ranges. Does not work at all for large ranges.

Here's the code:
Code:
#!usr/bin/perl

use strict;
use warnings;

die "Usage: $0 min max hits %dmg\n" if (@ARGV != 4);

#main
my $sides = $ARGV[1] - $ARGV[0] + 1;
my $dice = $ARGV[2];
my $offset_add = ($ARGV[0] - 1);
my $offset_mult = $ARGV[3];
my $poss = &power($sides, $dice);
my $sum = 0;
my %distr;
my @checkpoints = qw(100 095 075 050 025 005 001);
my $counter = 0;

for (my $i = $dice; $i <= $sides*$dice; $i++)
{
    if (100*$sum/$poss >= 100 - $checkpoints[$counter])
    {
        $distr{$checkpoints[$counter]} = $i;
        $counter++; #find next distribution checkpoint
        last if ($counter >= @checkpoints);
    }
    $sum += &recf($sides, $dice, $i);
}

print "Distribution:\n",
foreach my $key (sort keys %distr)
{
    my $vl = ($distr{$key} + $offset_add*$dice) * $offset_mult/100;
    printf "%3d%% = %d\n", $key, $vl;
}


sub recf #(sds, ithd, num)
#Recursive function to find possible ways to roll a particular number. algorithm is
#F[sds,ithd](num) = sum(F[sds,1](n)*F[sds,i-1](num-n), n) for all integer n
#base case is f[sds,1](num) = 1 if 1 <= num <= sds, 0 else
{
    my ($sds, $ithd, $num) = @_;
    return ($num >= 1 && $num <= $sds)? 1 : 0 if ($ithd == 1);

    my $total = 0;
    for (my $i = 1; $i <= $sds; $i++)
    {
        my $j = $num - $i;
        $total += &recf($sds, 1, $i) * &recf($sds, $ithd - 1, $j);
    }
    return $total;
}

sub power #(base, expo)
{
    my ($base, $expo) = @_;
    if ($expo == 0) { return 1; }
    elsif ($expo % 2 == 1) { return $base * &power($base, $expo - 1); }
    else
    {
        my $x = &power($base, $expo/2);
        return $x*$x;
    }
}
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)