• NOW LIVE! Into the Woods--new character species, eerie monsters, and haunting villains to populate the woodlands of your D&D games.

Monte Carlo versus "The Math"

A Hard Day's Night

As I've mentioned, I don't think "the math" is so much about rounds per combat or damage per round as it is about resource consumption. Now that the dwarf actually has daily resources (healing surges and his level 1 daily power), I was able to simulate it. I had the poor creature fight until he died, and then I recorded how many rounds he survived.

This is where I'm planning on going with the rest of the simulations: looking at how long a particular build can survive. I think this is the most accurate and holistic metric we can use, although I'm happy to try something else if I'm wrong.

I went ahead and ran this for the complete range of DMG-recommended encounters, from level +0 to level +5. Enjoy... future posts will be less frequent--this is as far as I've gotten with the program, so far.

(Oh, I also changed the short rest AI to spend a surge even if half of it would be lost. This led to better survivability.)

Edit: As Elric mentions below, the monster to-hit probability is way too low in these simulations. The correct results are in a post below.

Code:
Avg rounds: 3.1
  1  (8.0%): ================
  2 (40.5%): ===================================================================
  3 (64.0%): ================================================
  4 (82.9%): =======================================
  5 (93.1%): =====================
  6 (98.3%): ==========
  7 (99.5%): ==

Avg fights survived: 6.8
  0  (3.1%): =================
  1  (8.2%): ============================
  2 (14.0%): ================================
  3 (19.9%): =================================
  4 (26.6%): =====================================
  5 (34.9%): ==============================================
  6 (45.1%): =========================================================
  7 (57.0%): ===================================================================
  8 (67.9%): =============================================================
  9 (77.2%): ====================================================
 10 (84.9%): ===========================================
 11 (90.4%): ===============================
 12 (94.6%): =======================
 13 (97.0%): =============
 14 (98.4%): =======
 15 (99.1%): ===
 16 (99.6%): ==
 17 (99.8%): =

Daily used: 86.6%
Code:
LEVEL 2 SOLDIER VS. DWARF GREATWEAPON FIGHTER
Days simulated: 10000

Avg rounds: 4.0
  1  (1.8%): ====
  2 (17.5%): ==========================================
  3 (42.4%): ===================================================================
  4 (63.3%): ========================================================
  5 (82.3%): ==================================================
  6 (93.2%): =============================
  7 (97.5%): ===========
  8 (99.3%): =====
  9 (99.8%): =

Avg fights survived: 3.8
  0  (8.9%): ==========================================
  1 (21.5%): ============================================================
  2 (34.4%): ==============================================================
  3 (46.7%): ==========================================================
  4 (59.4%): =============================================================
  5 (73.2%): ===================================================================
  6 (84.5%): ======================================================
  7 (92.0%): ===================================
  8 (96.7%): ======================
  9 (98.6%): =========
 10 (99.4%): ===
 11 (99.8%): =

Daily used: 82.0%
Code:
LEVEL 3 SOLDIER VS. DWARF GREATWEAPON FIGHTER
Days simulated: 10000

Avg rounds: 5.0
  1  (1.3%): ====
  2  (4.6%): ==========
  3 (21.0%): ==================================================
  4 (42.8%): ===================================================================
  5 (63.4%): ===============================================================
  6 (79.6%): =================================================
  7 (91.0%): ===================================
  8 (96.5%): ================
  9 (98.6%): ======
 10 (99.5%): ==

Avg fights survived: 2.5
  0 (16.5%): ===================================================
  1 (38.2%): ===================================================================
  2 (57.1%): ==========================================================
  3 (71.0%): ==========================================
  4 (82.9%): ====================================
  5 (91.6%): ==========================
  6 (97.0%): ================
  7 (99.0%): ======
  8 (99.8%): ==

Daily used: 78.2%
Code:
LEVEL 4 SOLDIER VS. DWARF GREATWEAPON FIGHTER
Days simulated: 10000

Avg rounds: 5.6
  1  (0.4%): =
  2  (2.5%): ======
  3 (12.5%): ===============================
  4 (30.9%): =========================================================
  5 (52.2%): ===================================================================
  6 (70.8%): ==========================================================
  7 (84.3%): ==========================================
  8 (92.4%): =========================
  9 (97.1%): ==============
 10 (99.0%): =====
 11 (99.6%): ==

Avg fights survived: 1.1
  0 (38.5%): ===================================================================
  1 (72.6%): ===========================================================
  2 (88.1%): ==========================
  3 (95.5%): ============
  4 (98.8%): =====
  5 (99.8%): =

Daily used: 70.9%
Code:
LEVEL 5 SOLDIER VS. DWARF GREATWEAPON FIGHTER
Days simulated: 10000

Avg rounds: 6.3
  2  (1.2%): ===
  3  (7.8%): ========================
  4 (20.6%): ==============================================
  5 (38.3%): ================================================================
  6 (56.8%): ===================================================================
  7 (72.7%): =========================================================
  8 (84.9%): ============================================
  9 (92.1%): ==========================
 10 (96.3%): ===============
 11 (98.5%): ========
 12 (99.5%): ===
 13 (99.8%): =

Avg fights survived: 0.7
  0 (52.2%): ===================================================================
  1 (85.2%): ==========================================
  2 (95.8%): =============
  3 (98.9%): ===
  4 (99.8%): =

Daily used: 65.6%
Code:
LEVEL 6 SOLDIER VS. DWARF GREATWEAPON FIGHTER
Days simulated: 10000

Avg rounds: 6.6
  2  (0.8%): ===
  3  (6.8%): =======================
  4 (18.9%): ===============================================
  5 (35.6%): =================================================================
  6 (52.8%): ===================================================================
  7 (68.0%): ===========================================================
  8 (80.3%): ================================================
  9 (88.6%): ================================
 10 (94.1%): =====================
 11 (97.2%): ===========
 12 (98.7%): =====
 13 (99.6%): ===
 14 (99.8%): =

Avg fights survived: 0.3
  0 (73.3%): ===================================================================
  1 (96.0%): ====================
  2 (99.6%): ===

Daily used: 58.0%
One of the notable things about these results is that the daily usage goes down as the level of the opponent goes up, but as I said in my lost post, that's skewed because it's a reliable power. The "Daily Used" line only checks to see if the power was consumed, not if it was tried. Presumably, the poor dwarf is trying it but missing a lot.

(Source code to follow. I've got to run now and won't be able to post for a while.)
 
Last edited:

log in or register to remove this ad


Same characters as before, but I added some new stats to the sim:

PC AC: 17
PC HP: 27
Monster attack bonus: 3
Monster damage: 1d10 + 3

This is a low for the monster's attack bonus. Even a typical Brute would have +4 to hit vs. AC at level 1 (going by the 'high damage expression' table in the DMG, it would do about 9.5 damage on a hit).

If the monster is intended to represent a soldier on offense as well as defense, it should have more like a +7 vs. AC attack (DMG guidelines would say +8, but I find that soldiers are sometime below and almost never above this amount) for a bit less damage (1d8+3, maybe). Note that soldiers are generally considered one of the hardest monster types and brutes one of the easiest; you could even try to test this.

As I've mentioned, I don't think "the math" is so much about rounds per combat or damage per round as it is about resource consumption. Now that the dwarf actually has daily resources (healing surges and his level 1 daily power), I was able to simulate it. I had the poor creature fight until he died, and then I recorded how many rounds he survived.

This is where I'm planning on going with the rest of the simulations: looking at how long a particular build can survive. I think this is the most accurate and holistic metric we can use, although I'm happy to try something else if I'm wrong.

Clearly there's no perfect metric here. How many fights a build survives on average seems to weight durability too much. For example, ignoring daily powers for a second, if a build had infinite healing surges and had a probability of X to lose each fight (which doesn’t change across fights because you never lose daily resources), the average number of fights it survives is (1-X)/X by a simple formula. A build with infinite surges and a 90% chance to win each fight (X=0.1) averages surviving 9 fights.

Suppose that your day is always five fights long. In your level +0 example, the Dwarf Fighter survives these five fights 1-0.349 ~= 65% of the time.

By comparison, the infinite surge build survives five fights with probability (the chance it wins one fight)^5 = 0.9^5 ~= 59%. So you can see that with more realistic assumptions about the number of fights in a day the dwarf fighter is slightly favored, even though the average number of fights survived metric he looks far inferior (the dwarf averages 6.8 fights survived). This suggests that the metric ought to be more like “if the character faces a random number of fights in a day drawn from a particular distribution (e.g., even chances of 3-6 fights), what’s the chance he’ll survive the day?”

This is good and interesting work so far. Still, before you go much further with this project, seriously consider whether a Monte Carlo simulation will be able to get at actual D&D combat as experienced by a typical group.
 

This is a low for the monster's attack bonus. Even a typical Brute would have +4 to hit vs. AC at level 1 (going by the 'high damage expression' table in the DMG, it would do about 9.5 damage on a hit).

Oh, damn. At some point I took out the hard-coded monster attack bonus and replaced it with a calculation by level... and I totally muffed it. I was looking at the text for calculating the primary attack stat rather than the table. Doh. Thanks for catching that.

The old calculation: att_bonus = 3 + (MONSTER_LEVEL / 2)

The new calculation: att_bonus = MONSTER_LEVEL + 7

Naturally, this completely invalidates my previous results.

If the monster is intended to represent a soldier on offense as well as defense, it should have more like a +7 vs. AC attack (DMG guidelines would say +8, but I find that soldiers are sometime below and almost never above this amount) for a bit less damage (1d8+3, maybe). Note that soldiers are generally considered one of the hardest monster types and brutes one of the easiest; you could even try to test this.

The damage matches the DMG guidelines (see p.184, point #9). Whether it's appropriate is another question--I figure at some point I'll program in actual monsters and see how things change. However, I figure the DMG guidelines are more likely to match the assumptions made in developing the game's math, so that's why I'm starting there.

Clearly there's no perfect metric here. How many fights a build survives on average seems to weight durability too much. For example, ignoring daily powers for a second, if a build had infinite healing surges and had a probability of X to lose each fight (which doesn’t change across fights because you never lose daily resources), the average number of fights it survives is (1-X)/X by a simple formula. A build with infinite surges and a 90% chance to win each fight (X=0.1) averages surviving 9 fights.

I didn't understand this, so I tried it. I created an infinite surge build (actually, 100 surges, but I verified that no simulation actually used all 100 surges) with no dailies. It came out like this:

Code:
LEVEL 1 SOLDIER VS. DWARF GREATWEAPON FIGHTER
Days simulated: 100000

Avg fights survived: 4.1
  0 (11.8%): ===============================================
  1 (28.5%): ===================================================================
  2 (43.7%): =============================================================
  3 (56.3%): ==================================================
  4 (66.1%): =======================================
  5 (74.0%): ===============================
  6 (80.1%): ========================
  7 (84.6%): ==================
  8 (88.1%): =============
  9 (90.8%): ===========
 10 (92.9%): ========
 11 (94.6%): ======
 12 (95.9%): =====
 13 (96.8%): ===
 14 (97.4%): ==
 15 (98.1%): ==
 16 (98.5%): =
 17 (98.9%): =
 18 (99.1%): =
I also ran a version that ran exactly five encounters.

Code:
LEVEL 1 SOLDIER VS. DWARF GREATWEAPON FIGHTER
Days simulated: 100000

Death: 66.3%
This is good and interesting work so far. Still, before you go much further with this project, seriously consider whether a Monte Carlo simulation will be able to get at actual D&D combat as experienced by a typical group.

I doubt it will ever get at actual D&D combat as experienced by a typical group. But it doesn't need to. If it can give us some insights into how the math is balanced, and I have fun doing it, that's good enough for me.
 

Corrected Daily Simulations

As Elric pointed out in his post above, my to-hit probability on the soldier was way too low. I've fixed the error (his to-hit is now 8, per DMG guidelines), and re-run the simulations. Here are the results for level + 0 to level + 5:

Code:
LEVEL 1 SOLDIER VS. DWARF GREATWEAPON FIGHTER
Days simulated: 100000

Avg rounds: 3.0
  1  (8.1%): ================
  2 (40.9%): ===================================================================
  3 (67.5%): ======================================================
  4 (86.7%): =======================================
  5 (95.5%): ==================
  6 (99.0%): =======
  7 (99.8%): =

Avg fights survived: 3.3
  0 (11.2%): ===============================================
  1 (27.0%): ===================================================================
  2 (41.9%): ===============================================================
  3 (54.9%): =======================================================
  4 (68.6%): ==========================================================
  5 (81.9%): ========================================================
  6 (91.5%): ========================================
  7 (96.6%): =====================
  8 (98.8%): =========
  9 (99.6%): ===
 10 (99.9%): =

Daily used: 79.2%
Code:
LEVEL 2 SOLDIER VS. DWARF GREATWEAPON FIGHTER
Days simulated: 100000

Avg rounds: 3.8
  1  (1.3%): ==
  2 (16.8%): ==================================
  3 (46.7%): ===================================================================
  4 (71.7%): ========================================================
  5 (89.1%): ======================================
  6 (96.6%): ================
  7 (99.0%): =====
  8 (99.8%): =

Avg fights survived: 1.7
  0 (25.2%): ===========================================================
  1 (53.8%): ===================================================================
  2 (73.1%): =============================================
  3 (85.6%): =============================
  4 (94.4%): ====================
  5 (98.5%): =========
  6 (99.7%): ==

Daily used: 73.9%
Code:
LEVEL 3 SOLDIER VS. DWARF GREATWEAPON FIGHTER
Days simulated: 100000

Avg rounds: 4.4
  2  (2.9%): =====
  3 (26.5%): ===================================================
  4 (57.3%): ===================================================================
  5 (80.3%): =================================================
  6 (92.6%): ==========================
  7 (97.7%): ===========
  8 (99.4%): ===

Avg fights survived: 0.8
  0 (45.3%): ===================================================================
  1 (80.2%): ===================================================
  2 (93.4%): ===================
  3 (98.2%): =======
  4 (99.7%): ==

Daily used: 68.1%
Code:
LEVEL 4 SOLDIER VS. DWARF GREATWEAPON FIGHTER
Days simulated: 100000

Avg rounds: 4.5
  2  (2.3%): ====
  3 (23.4%): ===========================================
  4 (55.9%): ===================================================================
  5 (80.4%): ==================================================
  6 (92.9%): =========================
  7 (97.8%): ==========
  8 (99.4%): ===

Avg fights survived: 0.3
  0 (72.8%): ===================================================================
  1 (96.7%): ======================
  2 (99.7%): ==

Daily used: 59.9%
Code:
LEVEL 5 SOLDIER VS. DWARF GREATWEAPON FIGHTER
Days simulated: 100000

Avg rounds: 4.6
  2  (1.0%): =
  3 (19.6%): ====================================
  4 (53.8%): ===================================================================
  5 (79.7%): ==================================================
  6 (92.9%): =========================
  7 (97.9%): =========
  8 (99.5%): ===

Avg fights survived: 0.1
  0 (87.9%): ===================================================================
  1 (99.6%): ========

Daily used: 53.2%
Code:
LEVEL 6 SOLDIER VS. DWARF GREATWEAPON FIGHTER
Days simulated: 100000

Avg rounds: 4.5
  3 (19.2%): =================================
  4 (57.5%): ===================================================================
  5 (83.4%): =============================================
  6 (94.9%): ====================
  7 (98.6%): ======
  8 (99.7%): =

Avg fights survived: 0.0
  0 (96.0%): ===================================================================
  1(100.0%): ==

Daily used: 45.5%
So... if you want to make sure your solo dwarf greatweapon fighter doesn't survive the night, throw a level + 5 soldier at him.

I'm looking forward to seeing how a full party (with healing!) changes the mix.
 
Last edited:

The damage matches the DMG guidelines (see p.184, point #9). Whether it's appropriate is another question--I figure at some point I'll program in actual monsters and see how things change. However, I figure the DMG guidelines are more likely to match the assumptions made in developing the game's math, so that's why I'm starting there.

I don't like using 1d10+3 (8.5) damage for a first level monster. First, using the same damage total for every group of 3 levels (as is true in the DMG) doesn't make sense. I see why they didn't write a different expression for every level, but when doing analysis you should make this measure more continuous.

Second, if you take the average damage and associate it with the middle level for each group and fit a best-fit line to it, you get a lower result at the bottom than 8.5. Differences in the rate damage goes up in this table seem fairly random; there's a low correlation between the 'high damage' expression increasing more and the 'medium damage' expression increasing more; if the damage was set based on players getting stronger at certain levels then there should be a high correlation here (this is a reason to average out to avoid these discrepancies). Third, I think 8.5 is somewhat higher than actual level 1 monster damage.

I'd modify this Dwarf fighter so he had higher Constitution, by the way. 18 Str/13 Con/13 Wis pre-racial seems like a good choice, as he'll want high Con for hit points, surges, and Axe/Hammer feats, and Wisdom for increasing OA to-hit and maybe other abilities (pit fighter pp) as well.

I didn't understand this, so I tried it. I created an infinite surge build (actually, 100 surges, but I verified that no simulation actually used all 100 surges) with no dailies. It came out like this:

Code:
LEVEL 1 SOLDIER VS. DWARF GREATWEAPON FIGHTER
Days simulated: 100000

Avg fights survived: 4.1
  0 (11.8%): ===============================================
  1 (28.5%): ===================================================================
  2 (43.7%): =============================================================
  3 (56.3%): ==================================================
  4 (66.1%): =======================================
  5 (74.0%): ===============================
  6 (80.1%): ========================
  7 (84.6%): ==================
  8 (88.1%): =============
  9 (90.8%): ===========
 10 (92.9%): ========
 11 (94.6%): ======
 12 (95.9%): =====
 13 (96.8%): ===
 14 (97.4%): ==
 15 (98.1%): ==
 16 (98.5%): =
 17 (98.9%): =
 18 (99.1%): =
[/quote].

Something's not right with these results.  The most likely exact outcome in this framework for number of fights won should be 0 fights and it should steadily decrease from there (here the most common is exactly 1 fight).  If you're not having this character heal himself all the way to 27 hit points, he's not taking proper advantage of his infinite surges :)  You also might have left the daily power in; either of these could account for this discrepancy.
 

Something's not right with these results. The most likely exact outcome in this framework for number of fights won should be 0 fights and it should steadily decrease from there (here the most common is exactly 1 fight). If you're not having this character heal himself all the way to 27 hit points, he's not taking proper advantage of his infinite surges :) You also might have left the daily power in; either of these could account for this discrepancy.

It's true he wasn't healing all the way at the short rest. I fixed it, but it didn't change the shape of the curve. Keep in mind the rest of the random factors are still in place--it's not a simple 10% chance of death.

Code:
LEVEL 1 SOLDIER VS. DWARF GREATWEAPON FIGHTER
Days simulated: 100000

Avg fights survived: 4.5
  0 (11.6%): ===================================================
  1 (26.9%): ===================================================================
  2 (40.9%): ==============================================================
  3 (53.0%): ====================================================
  4 (62.4%): =========================================
  5 (70.1%): =================================
  6 (76.2%): ==========================
  7 (81.2%): =====================
  8 (85.0%): =================
  9 (88.2%): =============
 10 (90.5%): ==========
 11 (92.4%): ========
 12 (94.0%): ======
 13 (95.2%): =====
 14 (96.2%): ====
 15 (97.0%): ===
 16 (97.6%): ==
 17 (98.1%): ==
 18 (98.5%): =
 19 (98.8%): =
 20 (99.1%): =
 

If the Dwarf goes into every fight fresh, then Elric is right, the data should show the most results at zero. Is the dwarf at the start of the second encounter impaired in any way he's not at the start?
 

I kind of fear that by the time you get to something approaching the level of complexity of a level 1 party fighting a level 1 encounter with some typical monsters the number of guestimations required to do that "effects of tactics" is going to be large and nobody will ever know how accurate it is, except by actually collecting data from real combats.

And I think that is really the ultimate key. This is an area where nothing is going to beat real world data. Still, it could shed some light on certain very specific questions. I just think people would have to go back and do some sanity checking against real world data all the same.
What is needed is
1) the conversion of 4E into a faithful MMO
2) collecting the results of a few million fights

That is, not basing your conclusions on any pure AI vs AI input, but only on real players vs AI input.

Because that's what you see at tables - while it wouldn't be too unreasonable to simplify a live DM's actions into an AI, it is definitely too simplistic to reduce a group of five live brains into an AI.

I guess if the RPGA demanded detailed summaries of all the LFR combats that would do nicely too.
 

Okay, so the purpose of this thread is to do a stochastic analysis of the 4e math, using something called a Monte-Carlo simulation. Basically, what we do is write a program that simulates a 4e fight, random dice rolls and all, and we run it a few hundred thousand times. From that, we get a complete view of everything that can happen. Not just the average case, but full range of possibilities. Because it's a simulation, we can incorporate a lot more variables than the typical DPR calculation.
Good luck! A word of caution before you get your hopes up, though: I foresee most forum-goers taking a programmed sim of a D&D fight no more seriously than anecdotal or simple mathematical evidence, even if it supposedly creates a complete view of combat. These feat taxes are one of those issues that people tend to argue about based on attitude and belief rather than evidence that comes through impersonal forums: If you tend to believe that WotC has your back, you'll likely argue that feat taxes don't exist no matter what; if you tend to believe in basic design goals and basic math you'll likely argue that feat taxes suck no matter what.
 

Into the Woods

Remove ads

Top