Any Math Experts Out There?

OOC General Discussion

Moderators: Forum Moderators, Active DMs

Post Reply
User avatar
Twily
Arelith Supporter
Arelith Supporter
Posts: 1120
Joined: Mon Sep 08, 2014 3:30 pm

Any Math Experts Out There?

Post by Twily » Sat Jan 13, 2018 8:00 am

As a high-school drop out whose best certification is a GED, I don't claim to be a math expert, so there may be some errors with this formula.

I'm trying to create a math formula that can calculate average damage per hit including Chance to Hit/Miss, ThreatRange and ThreatRolls.

This is the best I've gotten so far, and I was wondering if anyone more qualified could look it over and give feedback. (I think the math is right..? *fingers crossed*)


[D×(20-T-N) + (D×T×{N×5÷100}) + (D×M×T×{H×5÷100})] ÷ 20
^NormalHits^ . ^ Crits that fail ^ . ^ Crits that Succeed ^

D= Average Damage per Hit
T= Number of Rolls that Crit
M= Multiplier
H= Number of Rolls that Hit
N= Number of Rolls that Miss


Example:
AttackerAB = 20
EnemyAC = 30
Crits = 18-20/x2
Avg.Damage = 10 (for simplicity sake)

T=3
H=11
N=9



[D×(20-T-N)+(D×T×{N×5÷100})+(D×M×T×{H×5÷100})]÷20

[10×(20-3-9)+(10×3×{9×5÷100})+(10×2×3×{11×5÷100})]÷20
[10×(8)+(30×.45)+(60×.55)]÷20
[80+13.5+33]÷20
126.5÷20
6.325 avg damage per hit, including misses, crits, threat rolls, etc.


.. Did I do this right, or did I mess up horribly at some point?
Last edited by Twily on Sat Jan 13, 2018 8:36 am, edited 4 times in total.

User avatar
The Rambling Midget
Arelith Supporter
Arelith Supporter
Posts: 3293
Joined: Mon Sep 08, 2014 2:02 am
Location: Wandering Aimlessly in the Wiki

Re: Any Math Experts Out There?

Post by The Rambling Midget » Sat Jan 13, 2018 8:11 am

I think this is what you're looking for.
The Beginner's Guide to Factions
New to Arelith? Read this!
This is not a single player game. -Mithreas
You have enemies? Good. That means you've stood up for something, sometime in your life. -Winston Churchill

User avatar
Twily
Arelith Supporter
Arelith Supporter
Posts: 1120
Joined: Mon Sep 08, 2014 3:30 pm

Re: Any Math Experts Out There?

Post by Twily » Sat Jan 13, 2018 8:13 am

I've tried multiple websites, apps, etc like that before(including that one), and I notice there's often inconsistencies between the results on various ones.
I've gotten to a point where I don't really trust any of them, and want to be able to just do the math myself.

Thank you though! :)

User avatar
afreshstart
Posts: 150
Joined: Thu Nov 16, 2017 11:16 pm

Re: Any Math Experts Out There?

Post by afreshstart » Sat Jan 13, 2018 10:59 am

I think you made a mistake. Because you include number of rolls that are successful and the probability of them happening.Assuming that AB is bigger than AC and the diffrence between them is 19 maximum. The formula should be:

Hit_Chance= (AC-AB)/20

Average=Hit_Chance*Hit_Dmg*((1-crit_chance)+cirt_multiplier*crit_chance)

It should be something like this if I didn't make any mistakes.

Poolbrain
Arelith Silver Supporter
Arelith Silver Supporter
Posts: 114
Joined: Mon Jul 24, 2017 11:33 pm

Re: Any Math Experts Out There?

Post by Poolbrain » Sat Jan 13, 2018 1:22 pm

Look into statistic. You could probably make a useful normal distribution tabel between various ab vs various ac. You could program it easily through some program like matlab to quickly make bew tables depending onthe values

User avatar
Twily
Arelith Supporter
Arelith Supporter
Posts: 1120
Joined: Mon Sep 08, 2014 3:30 pm

Re: Any Math Experts Out There?

Post by Twily » Sat Jan 13, 2018 7:27 pm

afreshstart wrote:I think you made a mistake.
It's definitely possible I got something wrong, so here's how I proofed it. I was going to save this for when someone said it's off, as to not clutter the original post with extra info.

If I messed up in this, the formula is almost definitely wrong.

As for the formula you gave, I'm still messing with it...


[D×(20-T-N)+(D×T×{N×5÷100})+(D×M×T×{H×5÷100})]÷20

D×(20-T-N) is the number of rolls that are normal hits.

H is the number of rolls aren't a miss.
(20-T-N) and H, are always different, to be more exact, (20-T-N)+T = H

(D×T×{N×5÷100})+(D×M×T×{H×5÷100}) just figures out what percentage of damage is from successful vs. unsuccessful crits.
{N×5÷100}+{H×5÷100} always equals 1.0, or 100%.


Proof:

19-20 with threat rolls and 20 without threat rolls are the same IF there's a 50% chance to hit

Proof:
19-20 = 10% chance
20 = 5% chance
.10 × .50* = .05, or 5%
*the percentage of of successful crits


So I used this to say that instead of failing crits 50% of the time with a 19-20/x2, I instead have a 20/x2 with guaranteed crit. This removes threat rolls as a factor for the sake of simplicity while proofing.

Lets say you roll 20 times, and roll each roll once (which is the average outcome of 20 rolls; this is what my formula should be doing)

AB 9
AC 20
Chance to Hit: 50%
Weapon: 10damage 19-20/x2 (although using 20/x2 guaranteed crit instead, to remove threat rolls as a factor)

10×9= 90 damage from the 9 normal hits, in those 20 rolls
0×10= 0 damage from the 10 misses, in those 20 rolls
10×2×1=20 damage from the 1 guaranteed crit
9(hits)+10(misses)+1(crit)=20 rolls

90+0+30 = 110
110÷20 = 5.5


Now if instead of calculating this manually; I use my formula and factor in threat range.

AB 9
AC 20
Chance to Hit/Miss: 50%, or 10 rolls each on the die.
Weapon: 10damage 19-20/x2
10% chance to crit

[D×(20-T-N)+(D×T×{N×5÷100})+(D×M×T×{H×5÷100})]÷20

D×(20-T-N)
10 × (20-2-10)
10 × 8 = 80

D×T×{N×5÷100}
10×2×{10×5÷100}
10×2×.5 = 10

D×M×T×{H×5÷100}
10×2×2×{10×5÷100}
10×2×2×.5
40×.5 = 20


(80+10+20)÷20 = 5.5


If you see a mistake in this, Please let me know.

Reviewing what you told me did make me realize one small error, which is that if the AB exceeds the AC, N needs to be different for the first and second segment of the formula.
1 being a miss on the attack roll, but not being an auto failure on the threat roll.

I'm not sure how to easily fix this, though.

Poolbrain
Arelith Silver Supporter
Arelith Silver Supporter
Posts: 114
Joined: Mon Jul 24, 2017 11:33 pm

Re: Any Math Experts Out There?

Post by Poolbrain » Sat Jan 13, 2018 11:36 pm

Well. You cant really solve this with high school math. You came up with clever a way though to by pass the need of using percentage and reach a part of the way. Its hard to follow what youve done though. For example multiplying your full amount of misses with your missed crit percentage.

I think the easiest way, i think, is to code an equation that can easily transform depending on the values to incorperate 1s and 20s if your ab gets too low or high. especially since every attack after the first one has 5 less ab etc. Was a almost a year ago i finished my statistic course though so dont remember this stuff too well... Theres a lot of helpful formulas you could find though, not too complicated, that helps dealing with random variables with multiple outcomes. I wish i had my statistic book here.

Check the web! Math is fun :)

User avatar
Opustus
Posts: 817
Joined: Tue Jun 13, 2017 9:07 pm

Re: Any Math Experts Out There?

Post by Opustus » Sun Jan 14, 2018 1:03 am

You can solve stuff with high school maths, which is something I found out at the uni!

Basically, sophisticated formulae call for a good sense of mathematical theory, i.e. how numerical stuff works, which is a combination of knowledge and having a trained mind for calculus. However, if you can stay organised with your calculations, you can divide your calculations into several hypotheses; it is especially handy with probability calculations such as these.

The gist of it is to have conditions: If -> then
If the attack roll is 19 and hits, then -> [insert basic damage calculation for critical hit damage]
If the attack roll is 19 and misses, then -> 0 damage

In this situation, it's pretty moot as there is only one other possibility for critical besides the 20, meaning if it's not a hit, then only the 20 roll is a hit. With more critical range, you could use the hypothesis to organise your calculations.

Breaking down your calculations into these "hypotheses" or "conditions" will save you the trouble of coming up with an intricate formula to account for all the variance involved. Even if the problem were easier to solve with some advanced formula, it requires way too much studying to actually be used those because one basic rule of maths is that you have to know what the hell you are doing so you can account for mistakes/uncertainties/etc.

Basically, the way I would start solving your conundrum would be to have two columns, one for AB, the other for AC. A basic summation of these would produce the hit/miss result, leaving you with only the mean of critical hit damage and basic hit damage. This kind of reflection of NWN is super interesting, because you understand, among other things, that x3 critical weapons are more powerful against very high AC enemies, and so on. The basic mechanics of NWN is just full of contingencies and circumstances, which makes it an interesting game.
Characters: all poor babies suffering from neglect

Post Reply