User:Praise/Critical Hit Probability Calculation

From Guild Wars Wiki
Jump to navigationJump to search

Critical Hit Probability calculation for martial weapons[edit]

Firstly, let's define the basic incomplete formula, I refer to it as the "wiki formula". It's generally accepted that this formula predicts probabilities below 30% pretty well.


Incomplete formula, "wiki formula"


I will first give my observations, datasets where each time one of these is changed and the others stay the same. Then discuss the implications and try to complete the wiki formula.

Observations[edit]

Critical hit probability depends on 3 variables, with relevant ranges in game:

  • Attacker level, between 0-42
  • Target level, between 0-42
  • Weapon mastery, between 0-20


Collecting datasets for the Attacker level variable is quite difficult because players have few attribute points at lower levels. Datasets with 0 Weapon mastery are not informative because there is not much variation in critical hit probability at 0 mastery. Therefore, I decided to start at level 8, with 6 Weapon mastery. To get a clearer picture, I chose a lvl 14 target as well as a lvl20 target. These data are explained pretty well by the corrected wiki formula. However, when you increase Attacker lvl above 20 with appropriately high Mastery, the wiki formula is not accurate anymore. For example, Galrath in Hard Mode (lvl 40) has a crit probability of 95% against a lvl 20 player, while the wiki formula predicts a probability of 340%.


When varying Target level, it becomes obvious that the wiki formula does not perfectly describe the real situation at predicted probabilities higher than 20%, and is completely off at around 50% and above (approximately Target lvl 12). However the Minimum factor (the +[Mastery]% thing at the end) appears to be correct, I also checked this with a different Mastery to be sure.


When varying Mastery, the wiki formula gives very good predictions as long as Attacker & Target levels are close to each other (for example, lvl 20 and 20 as shown). When the difference between levels is more than ~6, and the Attacker's Mastery is high, the wiki formula is not a good description of reality. It's the same story as for the Target level curve: the wiki formula predictions will go above 100% while in reality it is limited to 100%.
The lvl 20 vs. lvl 9 table shows that the overall shape of the curve stays the same, compared with the wiki formula prediction. It's simply squeezed to fit below 1. Note that the change in slope at 12 mastery is because the Attacker is level 20; the kink will be at different mastery levels depending on the applicable threshold.


Discussion[edit]

From the observations, it is clear that the "wiki formula" does not describe the full variable range very well. However, within certain variable ranges it is actually a close to perfect predictor. As a rule of thumb, the ranges within which the wiki formula is a very good predictor are the standard conditions where the strike level would be around 1, i.e. Attacker & Targets levels 20, Mastery 12. This makes the wiki formula useful for calculating PvP scenarios.

I tried to find the formula that's actually used by the game. While it is possible to find a formula by simply fitting to observed data, the expression becomes complicated and very unlikely to have been implemented by any developer.
A more logical form for the formula can be found by noticing the sigmoidal shape that keeps probabilities below 1 (for example, the one observed while varying Target level). There is a simple mathematical transformation that can be applied to exponential curves like the wiki formula, to make it sigmoidal, which is to make it logistic. In fact, the wiki formula hints that this is what the developers wanted to use, because the expressions for defining the minimum and maximum probability values are already there: the (1-[Mastery]%) + [Mastery]% define the range. For example, at 12 Mastery, the minimum would be 12% and the range would be 88%, for a maximum of 100%.
However, one thing is still missing to make it logistic: a +1 factor in the denominator, which will give diminishing growth.

General form for logistic growth. The (variables) are the (8x[AttackerLvl]...etc) part of the wiki formula, and the slope is the number 40 in the wiki formula.

To the right is a possible expression of this logistic wiki formula. The variables part would stay the same as in the wiki formula, and the slope is the factor 1/40 which is also already present in the wiki formula. The minimum and maximum are also already present.

After some experimenting, it turns out that this form of the formula actually describes all my observations pretty well when you change the slope from 40 to 30. The only real difference with the wiki formula is that I see no place for the factor 0.5.
This logistic formula predicts almost all observations with an error of about 1%, which sometimes still falls outside the confidence limits of the observations. Especially for 2 standard setups of lvl 20 vs lvl 20 with 0 mastery and 12 mastery, for which I collected a lot of data, the prediction is off by 0.3-0.4%, while the wiki formula is spot on.


In conclusion, my observations show that the wiki formula is not the one used by the game, but it does describe certain circumstances correctly. I found a formula that is a much better predictor of the whole possible range of variables, but it is also not the one used by the game. Just to be clear, I've written out the full formula below.


My recommendations are:

  • If you need accurate predictions for PvP, use the wiki formula
  • If you need predictions for PvE and can tolerate a 1-2% uncertainty, use my logistic formula
  • If you want to try some variations on my formula to get a better fit, start by changing the slope
  • Let me know if you find improvements!


Critical Hit Probability calculation for caster weapons[edit]

For casters, there is no Mastery factor. In damage calculation, the factor replacing mastery is Attacker level. In critical hit probability calculation, there is no replacement. Mastery is simply 0, and you can use the same formulae as for martial weapons.

Here are my observations. I don't give a confidence interval, but there are enough data for each variable set to be fairly confident. Predictions for the 2 different formulae discussed above are shown.

As for the case with martial weapons, it appears that the wiki formula is more accurate at lower probabilities, and the logistic formula more accurate overall.