J-Moravec / BGNRRG

Baldur's Gate: Enhanced Edition Non Random Roll Generator
5 stars 2 forks source link

Dice Probability Statistics and Monte Carlo simulations? #3

Closed bknowles closed 7 years ago

bknowles commented 7 years ago

I've been doing some dice probability statistics for rolling 18d6 (using the AnyDice calculator, see http://anydice.com/program/9be), and combining that with a really horribly badly kit-bashed script to do some Monte Carlo simulations.

I've got some interesting numbers I'd like to share with you, if you're interested. However, I'm not sure where/how you would want me to provide this information -- would you want a MarkDown format file provided as part of a pull request, or should I add this to the wiki, or would you want me to just share it directly with you?

bknowles commented 7 years ago

So, here's a spreadsheet that I did, based on the information from the AnyDice calculator link shown above. See https://docs.google.com/spreadsheets/d/1sn0tMsmPUKh1LciFrYyZKpG35lpRxqP3S5Lui28orXE/edit?usp=sharing

Note that 63 is the mode and the median for this chart, but what I find interesting is how much longer it would be expected to take to roll up a character that added up to 80 or above versus 90 or above.

For 80, you have a 50% cumulative chance if you're rolling ten times a second to get your desired result in 4.6 seconds.

But for 90, it's over 670 seconds or 11.23 minutes.

For 95, it's almost twenty-six thousand seconds, or over seven hours. That's about the farthest I'd be willing to go, by letting the thing run over night.

And that's just for a 50% cumulative probability. If the numbers don't go your way, obviously it could take a lot more time!

bknowles commented 7 years ago

Oh, and I'm sure you could do a much nicer chart in something like R. ;)

J-Moravec commented 7 years ago

Hi, sorry for not responding earlier. 3D6 roll is useless as BG automatically remove results that do not correspond with minimal stats for given class. In the old DnD rules, you first threw dice and then picked your class in accordance with minimal required attributes for each class (i.e., if I remember correctly, minimal charisma for Paladin is 14). In BG, you first pick class and then BG throws 3D6 and throws away any results that do not have said minimal attributes. This is done internally and is thus very fast, so you can't notice it. This is why average for classes like Paladin, Ranger or Bard is higher than for thief and you have higher chance rolling bigger result for said classes.

Anyway, I don't know how relevant it is to BGNRRG

bknowles commented 7 years ago

Well, it's not just 3d6. Without having more details as to the exact algorithm that is used by BG to generate the stats, all I can do is use probability and statistics based on random (or pseudo-random) dice rolls, but the key number I'm looking at is the total of all the eighteen dice that are rolled and not any one individual stat.

If you can give me more details on the exact algorithm that BG uses to generate stats for different classes, then I can make appropriate adjustments to the table.

Otherwise, I think it's pretty accurate relative to what actual dice would generate, and shouldn't be too far off from what we actually see with BG, assuming that the developers didn't go too crazy.

At least, with regards to the higher numbers like 80, 85, 90, 95, etc... I don't think you'd see a material difference.

All that said, if you're not interested in linking to this page or information from it, I totally understand. Your program is what kicked me into doing that analysis, and I'll certainly share that information elsewhere. I just wanted to share this information with you and give you a chance to decide whether or not it was useful to you.

Thanks again!

J-Moravec commented 7 years ago

Well, it's not just 3d6.

I just wrote that. If I rewrite it in pseudocode:

for all stats roll 3d6
if any stats less than minimum_stats(current_class)
  repeat

which obviously remove chunk of probability space from this multidimensional distribution.

Although other people report that it does not throw away results, but add to minimum stats: https://forums.beamdog.com/discussion/34126/max-total-roll

i.e.:

for all stats roll3d6
if stat in stats less than minimum_stat(current_class):
  stat = minimum_stat(current_class)

Which skews probability space quite differently.

Anyway, this is really not a place to discuss it. I suggest you open thread in reddit or some forum with BG community. I am sure this was investigated before and people would gladly give you links. You can also investigate it yourself by collecting numbers from BG (i.e., by modifying BGNNRG to remember all rolls) and statistically testing them against various theories.

bknowles commented 7 years ago

Fair enough. Thanks again!