Menu
News
All News
Dungeons & Dragons
Level Up: Advanced 5th Edition
Pathfinder
Starfinder
Warhammer
2d20 System
Year Zero Engine
Industry News
Reviews
Dragon Reflections
White Dwarf Reflections
Columns
Weekly Digests
Weekly News Digest
Freebies, Sales & Bundles
RPG Print News
RPG Crowdfunding News
Game Content
ENterplanetary DimENsions
Mythological Figures
Opinion
Worlds of Design
Peregrine's Nest
RPG Evolution
Other Columns
From the Freelancing Frontline
Monster ENcyclopedia
WotC/TSR Alumni Look Back
4 Hours w/RSD (Ryan Dancey)
The Road to 3E (Jonathan Tweet)
Greenwood's Realms (Ed Greenwood)
Drawmij's TSR (Jim Ward)
Community
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions, OSR, & D&D Variants
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Resources
Wiki
Pages
Latest activity
Media
New media
New comments
Search media
Downloads
Latest reviews
Search resources
EN Publishing
Store
EN5ider
Adventures in ZEITGEIST
Awfully Cheerful Engine
What's OLD is NEW
Judge Dredd & The Worlds Of 2000AD
War of the Burning Sky
Level Up: Advanced 5E
Events & Releases
Upcoming Events
Private Events
Featured Events
Socials!
EN Publishing
Twitter
BlueSky
Facebook
Instagram
EN World
BlueSky
YouTube
Facebook
Twitter
Twitch
Podcast
Features
Top 5 RPGs Compiled Charts 2004-Present
Adventure Game Industry Market Research Summary (RPGs) V1.0
Ryan Dancey: Acquiring TSR
Q&A With Gary Gygax
D&D Rules FAQs
TSR, WotC, & Paizo: A Comparative History
D&D Pronunciation Guide
Million Dollar TTRPG Kickstarters
Tabletop RPG Podcast Hall of Fame
Eric Noah's Unofficial D&D 3rd Edition News
D&D in the Mainstream
D&D & RPG History
About Morrus
Log in
Register
What's new
Search
Search
Search titles only
By:
Forums & Topics
Forum List
Latest Posts
Forum list
*Dungeons & Dragons
Level Up: Advanced 5th Edition
D&D Older Editions, OSR, & D&D Variants
*TTRPGs General
*Pathfinder & Starfinder
EN Publishing
*Geek Talk & Media
Search forums
Chat/Discord
Menu
Log in
Register
Install the app
Install
Upgrade your account to a Community Supporter account and remove most of the site ads.
Community
General Tabletop Discussion
*Pathfinder & Starfinder
Monte Carlo versus "The Math"
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Truename" data-source="post: 4983260" data-attributes="member: 78255"><p><strong>Monte Carlo vs. DPR</strong></p><p></p><p>Let's start by looking at the difference between a stochastic analysis and a DPR analysis. For this one, we'll start very simply. The question we're analyzing: How many rounds does it take for a PC to kill a monster?</p><p></p><p><strong>The PC</strong>: a level 1 dwarf great-weapon fighter, using Character Builder's recommended stats, wielding a maul. No feats or powers yet--just basic attacks.</p><p></p><p>PC Attack bonus: 7 (4 stat + 2 maul + 1 greatweapon)</p><p>PC Dmg dice: 2d6 (maul) + 4 (stat)</p><p></p><p>[sblock=Character Builder summary]</p><p>====== Created Using Wizards of the Coast D&D Character Builder ======</p><p>Dwarf-Fighter, level 1</p><p>Dwarf, Fighter</p><p></p><p>FINAL ABILITY SCORES</p><p>Str 18, Con 12, Dex 14, Int 10, Wis 13, Cha 8.</p><p></p><p>STARTING ABILITY SCORES</p><p>Str 18, Con 10, Dex 14, Int 10, Wis 11, Cha 8.</p><p></p><p></p><p>AC: 17 Fort: 16 Reflex: 12 Will: 11</p><p>HP: 27 Surges: 10 Surge Value: 6</p><p></p><p>TRAINED SKILLS</p><p></p><p></p><p>UNTRAINED SKILLS</p><p>Acrobatics +2, Arcana, Bluff -1, Diplomacy -1, Dungeoneering +3, Endurance +3, Heal +1, History, Insight +1, Intimidate -1, Nature +1, Perception +1, Religion, Stealth +2, Streetwise -1, Thievery +2, Athletics +4</p><p></p><p>FEATS</p><p></p><p>POWERS</p><p></p><p>ITEMS</p><p>Scale Armor, Adventurer's Kit, Maul</p><p>====== Copy to Clipboard and Press the Import Button on the Summary Tab ======</p><p>[/sblock]</p><p></p><p><strong>The Monster</strong>: a generic level 1 soldier, created using p184 of the DMG.</p><p></p><p>Monster AC: 17 (1 level + 16 soldier)</p><p>Monster HP: 29 (8 soldier + 13 con + (1 level * 8 soldier)</p><p></p><p>A DPR analysis of this fight says the monster lasts <strong>4.6 rounds</strong> on average.</p><p></p><p>[sblock=DPR breakdown]</p><p>Avergae damage for maul: 2d6+4 = ((2 + 12) / 2) + 4 = 11</p><p>Crit damage for maul: 2d6+4 = 12 + 4 = 16</p><p>Roll to hit = 17 AC - 7 att bonus = 10</p><p></p><p>Chance to roll miss = (roll to hit - 1) / 20 = 45%</p><p>Chance to roll crit hit = 1 / 20 = 5%</p><p>Chance to roll normal hit = 1 - miss chance - crit chance = 1 - 45% - 5% = 50%</p><p></p><p>Average crit damage = crit chance * crit dmg = 5% * 16 = 0.8</p><p>Average hit damage = normal hit chance * normal dmg = 50% * 11 = 5.5</p><p></p><p>DPR = 0.8 + 4.95 = 5.75</p><p>Avg rounds = 29 HP / 5.75 DPR = 4.6 rounds</p><p>[/sblock]</p><p></p><p>The stochastic analysis shows us something <em>completely</em> different. It says the average fight lasts <strong>5.5 rounds</strong>, not 4.6. That's a significant difference... big enough that, if correct, pretty much invalidates DPR as a trustworthy approach.</p><p></p><p>[sblock=Source code (in Ruby)]</p><p>[code]</p><p>REPS = 1000000</p><p>PRECISION = 1</p><p>DISPLAY_WIDTH = 75</p><p></p><p>MONSTER_LEVEL = 1</p><p>MONSTER_CON = 13</p><p></p><p>PC_ATT_BONUS = 7</p><p>PC_DMG_BONUS = 4</p><p></p><p>class Monster</p><p> def initialize</p><p> @ac = MONSTER_LEVEL + 16</p><p> @hp = 8 + MONSTER_CON + (MONSTER_LEVEL * 8)</p><p> end</p><p> </p><p> def dead?</p><p> return @hp <= 0</p><p> end</p><p> </p><p> def defend(att, dmg)</p><p> @hp -= dmg if att >= @ac</p><p> end</p><p>end</p><p></p><p>class Pc</p><p> def attack(monster)</p><p> att_roll = die(20)</p><p> att = (att_roll + PC_ATT_BONUS)</p><p> dmg = damage(att_roll)</p><p> </p><p> monster.defend(att, dmg)</p><p> end</p><p> </p><p> def damage(att_roll)</p><p> dmg_dice = die(6) + die(6)</p><p> dmg_dice = 12 if att_roll == 20</p><p> return dmg_dice + PC_DMG_BONUS</p><p> end</p><p>end</p><p></p><p>def die(size)</p><p> return 1 + rand(size)</p><p>end</p><p></p><p>def fight</p><p> monster = Monster.new</p><p> pc = Pc.new</p><p> round = 0</p><p> until monster.dead?</p><p> round += 1</p><p> pc.attack(monster)</p><p> end</p><p> </p><p> return round</p><p>end</p><p></p><p></p><p>def analyze</p><p> results = {}</p><p> total_rounds = 0</p><p> max_value = 0</p><p> REPS.times do</p><p> rounds = fight</p><p> results[rounds] = 0 unless results[rounds]</p><p> new_value = results[rounds] += 1</p><p> max_value = new_value if new_value > max_value</p><p> total_rounds += rounds</p><p> end</p><p> </p><p> results.keys.sort.each do |key|</p><p> value = ""</p><p> </p><p> ticks = (results[key].to_f / max_value.to_f * DISPLAY_WIDTH).to_i</p><p> ticks.times do</p><p> value += "="</p><p> end</p><p> puts "#{key.to_s.rjust(2)}: #{value}" if value != ""</p><p> end</p><p> </p><p> avg_rounds = total_rounds.to_f / REPS</p><p> format = "%.#{PRECISION}f"</p><p> puts "Fights simulated: #{REPS}"</p><p> puts "Average # of rounds per fight: #{format % avg_rounds}"</p><p>end</p><p> </p><p>analyze</p><p>[/code][/sblock]</p><p></p><p>Why the difference? I'm not entirely sure. (Hopefully it's not a bug! That's why I included the source code.) I think it's partly because, in a real fight, some damage is "wasted" after the monster hits zero HP.</p><p></p><p>The Monte Carlo analysis also gives us a histogram that summarizes all of the fights. For this simulation, I ran a million fights. 'Cause I could.</p><p></p><p>[code]</p><p>LEVEL 1 SOLDIER VS. DWARF GREATWEAPON FIGHTER (no feats, no powers)</p><p> 2 (2.3%): =======</p><p> 3 (18.0%): ==================================================</p><p> 4 (38.7%): ===================================================================</p><p> 5 (57.8%): =============================================================</p><p> 6 (72.6%): ===============================================</p><p> 7 (83.0%): =================================</p><p> 8 (89.8%): =====================</p><p> 9 (94.0%): =============</p><p> 10 (96.6%): ========</p><p> 11 (98.1%): ====</p><p> 12 (99.0%): ==</p><p> 13 (99.4%): =</p><p>Fights simulated: 1000000</p><p>Average # of rounds per fight: 5.5</p><p>[/code]So, although the average # of rounds is 5.5, the majority of fights take 4 rounds. Over 80% of fights take 7 rounds or less to complete, although a very small fraction of this simulation's fights dragged on and on, presumably due to lots of bad rolls.</p><p></p><p>You can see how the Monte Carlo simulation gives us a much richer, more accurate analysis than the DPR approach. And we're just barely getting started. Next up: feats, powers, and monsters that actually fight back!</p></blockquote><p></p>
[QUOTE="Truename, post: 4983260, member: 78255"] [b]Monte Carlo vs. DPR[/b] Let's start by looking at the difference between a stochastic analysis and a DPR analysis. For this one, we'll start very simply. The question we're analyzing: How many rounds does it take for a PC to kill a monster? [B]The PC[/B]: a level 1 dwarf great-weapon fighter, using Character Builder's recommended stats, wielding a maul. No feats or powers yet--just basic attacks. PC Attack bonus: 7 (4 stat + 2 maul + 1 greatweapon) PC Dmg dice: 2d6 (maul) + 4 (stat) [sblock=Character Builder summary] ====== Created Using Wizards of the Coast D&D Character Builder ====== Dwarf-Fighter, level 1 Dwarf, Fighter FINAL ABILITY SCORES Str 18, Con 12, Dex 14, Int 10, Wis 13, Cha 8. STARTING ABILITY SCORES Str 18, Con 10, Dex 14, Int 10, Wis 11, Cha 8. AC: 17 Fort: 16 Reflex: 12 Will: 11 HP: 27 Surges: 10 Surge Value: 6 TRAINED SKILLS UNTRAINED SKILLS Acrobatics +2, Arcana, Bluff -1, Diplomacy -1, Dungeoneering +3, Endurance +3, Heal +1, History, Insight +1, Intimidate -1, Nature +1, Perception +1, Religion, Stealth +2, Streetwise -1, Thievery +2, Athletics +4 FEATS POWERS ITEMS Scale Armor, Adventurer's Kit, Maul ====== Copy to Clipboard and Press the Import Button on the Summary Tab ====== [/sblock] [B]The Monster[/B]: a generic level 1 soldier, created using p184 of the DMG. Monster AC: 17 (1 level + 16 soldier) Monster HP: 29 (8 soldier + 13 con + (1 level * 8 soldier) A DPR analysis of this fight says the monster lasts [B]4.6 rounds[/B] on average. [sblock=DPR breakdown] Avergae damage for maul: 2d6+4 = ((2 + 12) / 2) + 4 = 11 Crit damage for maul: 2d6+4 = 12 + 4 = 16 Roll to hit = 17 AC - 7 att bonus = 10 Chance to roll miss = (roll to hit - 1) / 20 = 45% Chance to roll crit hit = 1 / 20 = 5% Chance to roll normal hit = 1 - miss chance - crit chance = 1 - 45% - 5% = 50% Average crit damage = crit chance * crit dmg = 5% * 16 = 0.8 Average hit damage = normal hit chance * normal dmg = 50% * 11 = 5.5 DPR = 0.8 + 4.95 = 5.75 Avg rounds = 29 HP / 5.75 DPR = 4.6 rounds [/sblock] The stochastic analysis shows us something [I]completely[/I] different. It says the average fight lasts [B]5.5 rounds[/B], not 4.6. That's a significant difference... big enough that, if correct, pretty much invalidates DPR as a trustworthy approach. [sblock=Source code (in Ruby)] [code] REPS = 1000000 PRECISION = 1 DISPLAY_WIDTH = 75 MONSTER_LEVEL = 1 MONSTER_CON = 13 PC_ATT_BONUS = 7 PC_DMG_BONUS = 4 class Monster def initialize @ac = MONSTER_LEVEL + 16 @hp = 8 + MONSTER_CON + (MONSTER_LEVEL * 8) end def dead? return @hp <= 0 end def defend(att, dmg) @hp -= dmg if att >= @ac end end class Pc def attack(monster) att_roll = die(20) att = (att_roll + PC_ATT_BONUS) dmg = damage(att_roll) monster.defend(att, dmg) end def damage(att_roll) dmg_dice = die(6) + die(6) dmg_dice = 12 if att_roll == 20 return dmg_dice + PC_DMG_BONUS end end def die(size) return 1 + rand(size) end def fight monster = Monster.new pc = Pc.new round = 0 until monster.dead? round += 1 pc.attack(monster) end return round end def analyze results = {} total_rounds = 0 max_value = 0 REPS.times do rounds = fight results[rounds] = 0 unless results[rounds] new_value = results[rounds] += 1 max_value = new_value if new_value > max_value total_rounds += rounds end results.keys.sort.each do |key| value = "" ticks = (results[key].to_f / max_value.to_f * DISPLAY_WIDTH).to_i ticks.times do value += "=" end puts "#{key.to_s.rjust(2)}: #{value}" if value != "" end avg_rounds = total_rounds.to_f / REPS format = "%.#{PRECISION}f" puts "Fights simulated: #{REPS}" puts "Average # of rounds per fight: #{format % avg_rounds}" end analyze [/code][/sblock] Why the difference? I'm not entirely sure. (Hopefully it's not a bug! That's why I included the source code.) I think it's partly because, in a real fight, some damage is "wasted" after the monster hits zero HP. The Monte Carlo analysis also gives us a histogram that summarizes all of the fights. For this simulation, I ran a million fights. 'Cause I could. [code] LEVEL 1 SOLDIER VS. DWARF GREATWEAPON FIGHTER (no feats, no powers) 2 (2.3%): ======= 3 (18.0%): ================================================== 4 (38.7%): =================================================================== 5 (57.8%): ============================================================= 6 (72.6%): =============================================== 7 (83.0%): ================================= 8 (89.8%): ===================== 9 (94.0%): ============= 10 (96.6%): ======== 11 (98.1%): ==== 12 (99.0%): == 13 (99.4%): = Fights simulated: 1000000 Average # of rounds per fight: 5.5 [/code]So, although the average # of rounds is 5.5, the majority of fights take 4 rounds. Over 80% of fights take 7 rounds or less to complete, although a very small fraction of this simulation's fights dragged on and on, presumably due to lots of bad rolls. You can see how the Monte Carlo simulation gives us a much richer, more accurate analysis than the DPR approach. And we're just barely getting started. Next up: feats, powers, and monsters that actually fight back! [/QUOTE]
Insert quotes…
Verification
Post reply
Community
General Tabletop Discussion
*Pathfinder & Starfinder
Monte Carlo versus "The Math"
Top