Give me Monsters! (Part 6)

It’s been a while since I posted any update in this series, but we are back! Besides life and work getting in the way, I also needed to give some thought on where I wanted to take this next. We have a reasonable draft model to represent Monsters at that point, but I feel it’s time to take a slightly different direction.

The driving question behind this whole project was, how can we check if an encounter between Adventurers and Monsters is balanced? To do this, I think the easiest approach is to simulate encounters. Put together some Monsters and Adventurers, let them fight it out, repeatedly, and see what happens.

This requires two distinct pieces:

  • an engine responsible for enforcing the rules, to determine what actions a creatures can take, and resolve what the results are,
  • some form of AI, to make reasonable decisions for the creatures, so we can simulate how an encounter might unfold.

The engine modeling the game itself is a prerequisite to build the AI system, so that is what we will start with. Once we have that piece in place, we should be able to deal with the AI part, and hopefully refactor the code we wrote so far to plug it in.


Give me Monsters! (Part 5)

Let’s face it, one of the main purposes of Monsters in D&D is to serve as battle fodder for Adventurers. It’s time to explore the bottom section of the Monster stats, and talk Weapons and Combat.

Warning: I have tried my best to make the contents of this series understandable without too much knowledge of the D&D 5e rules. This post goes into more arcane details than the previous ones, because the rules of combat are pretty intricate, and the details matter. I guess that is unavoidable: anything non trivial domain modeling effort will require diving into nitty-gritty details at some point.

Goblin Stat Block

From a domain modeling standpoint, this part is a bit messy. We have a sub-section labeled “Actions”, but the items listed there are not actions - a Scimitar or a Shortbow are weapons. To make things even more confusing, right above, we have a section that isn’t even labeled, but contains actions - Nimble Escape allows the Goblin to take special Bonus Actions, Disengage or Hide.

So… what should we make of this?


Give me Monsters! (Part 4)

In our previous episode, we took at stab at modeling Hit Points, which lead us to exploring the representation of dice rolls as expressions. Today, we’ll relax a bit, and finish up the missing parts of the top section of the Monster description:

Goblin Stat Block

What are we missing at that point? The creature type (“small humanoid”), Alignment (“neutral evil”), the Armor Class, and Speed. Let’s add that in, and improve our Markdown renderer in the process.


Give me Monsters! (Part 3)

Now that we have a reasonably working Abilities block, let’s take a stab at a slightly more challenging section of the Stat Block, the Hit Points.

Goblin Stat Block

Hit Points represent the “life force” of a creature, so to speak. Mechanically, this is how much damage a creature can take until it dies, and is expressed in dice rolls (2d6 for a Goblin), and a default average number, if one doesn’t want to roll the dice (7 for a Goblin). What this means is that, when creating a Goblin, you could either give him 7 hit points, or roll and add 2 6-sided dice, which would result in hit points between 2 and 12.

Things can get a tad more complicated - for instance, Constitution influences hit points. A creature with high CON will get a bonus (more on this later), resulting in expressions likes 4d10+8, which translates to roll 4 10-sided dice, sum them, and add 8 to the result.

Beyond Hit Points, dice rolls play a central role in D&D, and show up everywhere (see for instance the Hit description for the Goblin’s Scimitar and Shortbow, under Actions). We need a reasonably general way to model them.


Give me Monsters! (Part 2)

Time to start creating monsters! We will begin with the Abilities section of the Stat Block.

Goblin Stat Block

First, what are Abilities? Every creature is described by 6 Ability Scores, which describe by a number from 1 to 20 (or possibly more) how able the creature is, across 6 dimensions:

  • STR (Strength)
  • DEX (Dexterity)
  • CON (Constitution)
  • INT (Intelligence)
  • WIS (Wisdom)
  • CHA (Charisma)

Ability scores have a dual usage: as raw scores, and as Ability Modifiers, which indicate a bonus or malus for that ability (see the rules for details). As an example, the Goblin has an INT score of 10, which is perfectly average and gives a modifier of 0; his DEX is 14, giving him a +2 bonus, and a CHA of 8, with a malus of -1.