D&D 5E Trivantage Simulator

G

Guest 6801328

Guest
If you have an intractable error, I find constructing a simpler case, whose purpose is to confirm base assumptions/design, can be very helpful.

Your code has many references to specific class/weapons (which is good in terms of features), but may obfuscate the core mechanisms under test - an additional layer may help that encapsulate core mechanisms (if any, and it may be present I just missed it). Of course, I am 5 years late to the 5e party, so please take my thoughts with a good dose of skepticism.

Consider enumerative solutions in some situations, and the best computational thinkers of our age will also have mastery of analytical methods (imo). One can inform the other, and who doesn't love party tricks with statistics?

--CodeFlayer

added note - not a js person, but is was fun to look around !

Yeah I started off with a simple model with essentially no options and tested/tuned it for a while and am pretty sure it was solid, then started adding in the specific rules/options I wanted to test.

I didn't write unit tests along the way, though, so in addition to having possibly mis-implemented those features, I may have inadvertently broken something else.

If js didn't have such an annoying object model I would have written something more modular.

(I'm not a js person either. Hate it. But it was the tool for the job in this case.)
 

log in or register to remove this ad


G

Guest 6801328

Guest
Seems like a solid analysis 🤣

@Charlaquin to be less glib...

I should have (and will...) put a key and some axis titles up. But basically:
  • The blue dots/line are straight rogue, the red is 1 level of Fighter dip, and the yellow is 3 levels of Fighter (Champion) dip.
  • The x-axis is level
  • The y-axis is dpr.
  • If you mouse over a dot, it will tell you what level(s) the dot represents, and what the dpr is.
 

G

Guest 6801328

Guest
Ok, converted to analytical. Makes a lot more sense.

Note: somebody check my logic on calculating criticals. It occurred to me that computing the chance as 1 - (chance of not critical)^3 is true across all cases, but not in individual cases. For example, if you need to roll a natural 20 to hit, 100% of your hits will be criticals, Since you'll only hit 5% of the time, that means you'll do 10% avg weapon damage. Note that multiplying 5% weapon damage * 1.05 does not give you the correct value.

So I don't want to just take 1 - (19/20)^3 and increase all damage by that amount, against all ACs.

Instead, what I did was this:
  • Let's say you need to roll a 12 to hit. That is, 12 + your attack bonus == the target ac.
  • That means there are 9 possible die results that would hit, 8 of which would be a non-crit. So normally 8/9 times you hit you won't crit. (Or 7/9 with Champion 3 dip.)
  • But this is trivantage, so it's really (8/9)^3 times you won't crit. Or 1 - (8/9)^3 you will crit.
  • So after I compute average damage from dice, I increase it by that amount.
  • Then I add damage modifiers (like dex bonus, or dueling, or sharpshooter damage), then multiply that total by the chance you have to hit, which in this example is 1 - (11/20)^3.
Does that make sense?

EDIT: Or.....is this all just arithmetically identical to:
  1. Compute expected crit damage as 1 - (19/20)^3 times average damage, but hold that number for now...
  2. Multiply average damage by chance of hitting
  3. Add number from step 1 back in
I think it is.
 
Last edited by a moderator:

FrogReaver

As long as i get to be the frog
EDIT: Or.....is this all just arithmetically identical to:
  1. Compute expected crit damage as 1 - (19/20)^3 times average damage, but hold that number for now...
  2. Multiply average damage by chance of hitting
  3. Add number from step 1 back in
I think it is.

That's the easier way. Just remember crit damage isn't actually average damage. It's just your die damage. You'll lose out on mod which will be slightly less than average damage for a rogue.
 


NotAYakk

Legend
Yes, the easy way to calculate crit in DPR is to split it off.

a) Hit chance * Average dams=age from normal hit
b) Crit chance * Bonus damage from a crit
c) Sum of a and b is average damage

Note that crits are hits, so Hit#=max(2, min(Crit#,AC-ATK)),

Hit%=1-((Hit#-1)/20)^3
Crit%=1-((Crit#-1)/20)^3

You can include Hit# and Crit# in tooltips to help with validation and debugging.
 




Remove ads

Top