[D&D] Making of 5E Monster AI

As a solo 5E player, one of the critical piece for me is to have a Monster AI. The 5E world have hundreds of interesting monsters with unique traits and characters. So when playing against them without dungeon master, I want to have the thematic feel for each one of them.

Today, I would like to share is my attempt to make a general Monster AI system for D&D 5th Edition. I aspire this can inspire thousands of DM-less players out there so either this system or something alike, or entirely different to evolve. So all DM-less player community can benefit.

Change log

  • 8-19-2023: Editing for Youtube video creation purpose.
  • 12-26-2021: Adaptation Rules added.
  • 12-14-2021: Gather keyword added to the target section. Emoji section updated.
  • 12-13-2021: Ranged Attack Position added.

Table of Contents

Background

No Monster AI will be able to match the intelligence and wisdom of the experienced Dungeon Masters. However, there is a way to make Monster AI for 5E such that each Monster acts as if they have their own personality and provide unique experience for players. This could be even to the point perhaps no other adventure board games with Monster AI could match.

This is because sheer number of monsters, amount of detail each monster has on its stat block, and availability of each monster’s traits/background. This is only possible in a game with 50 years of history with continued evolution.

As an adventure board gamer, I am grateful that I got a chance to play D&D 5E in solo mode. This has opened up a whole new world for me.

Monster AI is one of the most core element in adventure board game design; hence, I believe this is crucial when playing 5E in Dungeon Master (DM) less mode.

There are 4 elements to be a good Monster AI system:

  1. Automation
  2. Personality
  3. Encounter specific modifier (optional)
  4. Unpredictability to allow surprise element (optional)

Automation

This part is self-explanatory. If you have DM who is willing to put all thoughts into each monster, you don’t need artificial intelligence. You got a real intelligence for the session. However, when you want to play a game without DM, automation of the monster is required; otherwise, you may feel cheating the game because you might be making the game subconsciously too easy or too hard.

Personality

Variance in board game and Tabletop RPG is one of the main attraction to the game genre. If all monsters act the same way or so it feels like, players will quickly get bored due to repetitive nature of the game.

Establishing a monster’s personality or general combat pattern has an additional benefit. As a player becomes more experienced, the player starts to develop specific strategy against a given monster. This is nothing but rewarding player’s skill. More you play, better you become.

Encounter specific modifier

The encounter specific modifier is another layer of giving variance to each monster.

Let’s say you have played against Goblins multiple times with each utilized generic Goblin Monster AI. At one point, you get a good sense of how goblins act during the combat.

However, in one particular encounter, the goblin could have a different agenda. For example, they may be ordered by hobgoblin. Despite against their will, goblins maybe ordered to attack a particular character in melee combat rather than their typical ranged fighting style.

Supporting such type of modifier in a given AI system provides a variation in game play experience even with same type of monster fighting. To give a real world example, the very first combat in the lost mine of Phandelver campaign says:

When the time comes for the goblins to act, two of them rush forward and make melee attacks while two goblins stand 30 feet away from the party and make ranged attacks.

Lost Mine of Phandelver Part I: Goblin Arrows

My intent is to make a system/template that is comprehensive and versatile. So I had put thought into this. There were two approaches I can think of.

First was to add a section just like any other special tactics in Monster AI for this and make unique monster AI for each encounters.

Second is to keep Monster AI as a generic and have a separate memo or card. In another word, create a quest or encounter card that is separate from monster AI card.

My current approach is the latter so I won’t have so many goblin AI sheets.

Unpredictability

The forth point, unpredictability can be an optional. This has pros and cons.

This does not mean complete randomness for monster’s action. I do not think it’s a good idea to have complete randomness in monster’s actions unless it is part of the monster’s personality or trait. Otherwise, such randomness will dilute monster’s personality.

However, some element of unpredictability can make overall game experience positive. Many of the epic and memorable moments of adventure board games come from the unpredictability within the game system.

Having said this, 5E rule has already built in intrinsic randomness. Initiative order, attack and damage rolls are all built in randomness within the game.

How about a situation like an ultimate attack of a monster that it can only do it so often? As a player, you may feel more tension during the combat if you don’t know exactly when the attack is coming.

I think such case is already covered by 5E keyword like Recharge.

Recharge X–Y. The notation “Recharge X–Y” means a monster can use a special ability once and that the ability then has a random chance of recharging during each subsequent round of combat. At the start of each of the monster’s turns, roll a d6. If the roll is one of the numbers in the recharge notation, the monster regains the use of the special ability. The ability also recharges when the monster finishes a short or long rest.

For example, “Recharge 5–6” means a monster can use the special ability once. Then, at the start of the monster’s turn, it regains the use of that ability if it rolls a 5 or 6 on a d6.

Basic Rule Chapter 12: Monsters

So I feel 5e rule has enough built-in random element. Therefore, I’ve decided to not add any more in the Monster AI. Having said this, if there is any need, we can always roll a die to determine the fate.

For example, if monster has two equal target choice that meets every defined criteria, just have a die play oracle.

In summary, my design decision for the Monster AI for 5e is that they need automation and personality. Encounter specific element can be implemented as their own quest/encounter card. No need to add any additional unpredictability.

Monster AI – Components

Now let’s take a look at how Monster AI looks like.

The current version of Monster AI consists of 3 sections/components:

  1. General Strategy
  2. Special Tactics
  3. Basic Tactics

General Flow

When reading the Monster AI, the general flow is

  1. start with Special Tactics section and read from top to bottom

    Continue to next subsection until the monster’s all available turn actions are consumed i.e. 1 action, move and +/- bonus action/reaction.
  2. If Special Tactics section does not complete the monster’s turn, then move to Basic Tactics section and follow top to bottom.

    Refer back to general strategy section whenever appropriate e.g. look for default target, default movement pattern or AI defined keyword etc.

If there are more than one option, a player makes the choice based on the preferred difficulty level.

Easier – Player’s benefit

Harder – Monster’s benefit

Oracle (random) – Roll a die to determine (personal preference)

Now let’s take a closer look at each components.

General Strategy

This section defines the general strategy of the monster. Usually, more specific so I call tactics are provided in following sections and that will override this section.

Adaptation

This section specifies adaptation capability of the monster when encountering the target playable character (PC) having immunity, resistance or vulnerability against the monster’s attack.

Adaptation section will have Adaptation category and optionally order of adaptation.

Adaptation category is determined based on the Monster’s intelligence ability score as detailed in the table below.

For detail of this section, please refer to the dedicated article.

CategoryINT ScoreDescription
None<=7Fixed
Immunity8-11If this attack is a hit & target has an immunity to the attack, adapt.
Immunity, Resistance12-13If this attack is a hit & target has an immunity or resistance to the damage, adapt.
Immunity, Resistance, Vulnerability14-18If this attack is a hit & target has an immunity or resistance to the attack, adapt.
After (19-INT) turns, start using the best total damage option.
Instant>18Use the best total damage option every turn.

Adapt order

Under general strategy section, adaptation entry specify the order of action type preference from melee (⚔️), ranged (🏹) and spellcasting (🪄).

Adaptation: Immunity, Resistance, Vulnerability | ⚔️ > 🏹 > 🪄

Order of adaptation

  1. Top to bottom in special tactics section entry for the failed attack’s action type.
  2. Move to the highest available attack action type specified in the adaptation section
  3. Switch target excluding the current and previously determined to be unable to damage target(s).

First, try the same the same action type from top to bottom order in the special tactics entry. If this option is exhausted, then switch to the available highest action type preference.

For example, if a PC is immune to a specific type of ranged attack, the monster tries another ranged attack option that shows up in the special tactics section if available. If that’s also fails and there is no more ranged attack option, the monster moves to the next type of action option based on the adaptation defined order. If the order is ⚔️ > 🏹 > 🪄, then the monster moves to melee attack as it is preferred over spellcasting.

Switch target

If all types of attack options are exhausted and none can damage the PC, it starts to search for alternative target. For the actual choice of another target, follow the regular target selection rule with failed target(s) excluded from the list.

Target

🎯section refers to the default combat target choice of the monster.

Examples:

🎯Closest – the closest foe in the attack range from the monster.

🎯Most wounded – If the monster’s Wisdom ability score is >= 12, add this. The monster preferentially select higher wounded target. The wounded category are defined based on the table below.

Category% max HP
Lightly wounded10%
Moderately wounded30%
Seriously wounded60%
Critically wounded90%

🎯Most number of foes – the most number of foes the area of effect (AoE) attack can damage.

🎯Lowest/highest AC – the lowest/highest armor class foe in the attack range.

🎯Gather A (X) – Choose the same target as the A up to X numbers. E.g. Gather friendly goblin (2) means choose a target that two goblins can attack together.

🎯Random – roll a die to determine the target

The target may be specified with combination of above with the order of priority being left to right with the left being the highest priority.

🎯 closest > lowest hit point foe in the range.

In this example, the closest foe from the monster (distance in feet) is chosen as the attack target. If there are two or more foes that are at the equal distance, then use the second criteria to break a tie, in this case choose the lowest hit point foe.

🎯 lowest hit point > the closet foe in the range.

On the contrary, the reversing the order means the monster targets the lowest hit point foe that is reachable by the monster’s attack type. If two or more foe’s are at the same lowest hit points, then choose the closer one.

*If there are still tie after checking all criteria, a player needs to make own choice. For harder experience, think from Monster’s perspective i.e. what would benefit the monster the most. For easier experience, think from player’s perspective. For true randomness, roll a die. My personal preference is the last one to minimize subjectivity in Monster AI.

Position for ranged attack

Unlike melee attack, ranged attack will require more information than just target. These additional information include distance from target, preference/priority of cover, and sometimes even a distance relative to the friendly monsters. 

📍 X-Y ft – The actual distance from the target (🎯) with X being more preferred/ideal distance than the Y. 30-40 ft means the best is 30ft, if not possible 35 and 40ft is ok. On the contrary, 40-30 ft prefers 40 ft distance over 30 ft if there is a choice.

📍 [X]cover – Prefers a position with cover. X may specify degree of cover e.g. half vs. 3/4. If unspecified, any cover.

📍Converge with X – Choose a position is closest to the X. E.g. Converge with friendly goblins with the same 🎯. Each goblin targeting the same PC will gather together in one area i.e. attack the target from same directions.

📍 Diverge from X – Choose a position that spread furthest from X. E.g. Diverge friendly goblins with the same 🎯. Each goblin targeting the same PC will to position furthest from each other i.e. attack the target from multiple directions.

The target may be specified with combination of above with the order of priority being left to right with the left being the highest.

Example: 

📍 30-40ft > Cover

In this example, the monster will try to position itself 30ft from the target. If there is a choice of cover, it choose the position with cover. 

📍 Diverge from friendly goblins with the same 🎯 > 30-40ft

In this example, the monster will first choose the position where it can be furthest from other friendly goblins attacking the same target. If there is options to choose, then it prefers 30-40 ft distance. 

Movement

👣 section refers to the default movement strategy of the monster.

Examples:

👣Safest – The path with the least damaging potential to the monster i.e. avoid inciting opportunity attack and dangerous terrain that can damage the monster.

👣Shortest – The path with shortest distance, which accounts/adjusts for difficult terrain. If difficult terrain path requires total 25 feet travel distance and going around the difficult terrain has 20 feet, shortest path option uses 20 feet option.

👣Direct – The path is near [linear] direction even if there is difficult or dangerous terrain. 

👣Diverge X – Choose a path that spread furthest from X. E.g. Diverge friendly goblins. Each goblin tries to move away from the other.

As in the target section, the priority is defined from left to right.

👣 Safest > shortest path keeping at least 40 feet distance.

In this example, the safest path refers to the monster avoiding to go through the area inciting foe’s opportunity attack or terrain effects that can damage it. Amongst those path, it chooses the shortest path to reach to the target.

Additional Notes

In the end of this section, additional relevant information may be placed.

This includes Monster AI specific keyword for cleaner referencing within the other sections of AI. For example, if the monster has specific way to “flee” and this sequence of actions happen more than once in the combat AI, defining once here can keep the rest of combat AI cleaner.

Special Tactics

This section defines trigger based response of the monster.

The general format is

At/If/When [Event/Condition/Trigger]

Detail of the actions

Example of event/trigger can be

  • If HP <= 2 – Triggers if the monster’s hit point becomes lower than or equal to 2
  • If in melee combat – Triggers if the monster is being involved in melee combat i.e. one or more foe is next to the monster
  • If leader/boss is slayed – Triggers if the leader/boss is slayed.

Let’s take a specific examples.

If HP <= 2:

Flee

This means if the monster’s hit point reaches 2 or below, the monster flees.

At vs. If vs. when

I have decided to use “at”, “if” and “when” to differentiate the timing of the special tactics trigger.

  • At – Used when a very specific timing used to trigger the entry e.g. At the beginning/end of turn.
  • If – This condition is checked during the Monster’s own turn.
  • When – This condition triggers as soon as the condition is met e.g. reaction.

When it takes the first damage:

Ash Puff (ability)

In the example above, as soon as the Monster takes the first damage, the Ash Puff triggers.

Subcategories

You can consider switch condition type format from programming language when applicable to keep the design cleaner.

In above case, as a player we see the trigger is low HP, but within the low HP scenario there are two conditions 3 or 4 HP vs. less than or equal to 2 HP.

Top to bottom execution

Properly ordered special tactics section entries should allow top to bottom flow. In another word, if one of the entry trigger but did not end the Monster’s turn, keep moving on to subsequent entries.

Using the example above, if Monster’s HP is at 4, it changes target from default target selection defined in the general strategy section; however, this does not end the monsters turn, so AI reading should continue to subsequent sections. If nothing else applies in the Special Tactics section, then it will roll into the basics tactics section but using the different target.

On the other hand, if the Monster’s HP is at 2, it flees. If flee was defined such as dash (action + movement), the monster complete its turn at this point. So anything below this section will be ignored.

Basic Tactics

If no special tactics applied, or special tactics did not complete the monster’s turn, “Basic Tactics” section will define the actions for the monster during its turn.

This is essentially a default sequence of actions for the monster and in many cases most frequently used section.

This section could still have [event/trigger/condition] actions format if there are more than one equal likelihood sequence of actions the particular monster can take.

Shortcut Emoji

As I continue to make more Monster AIs, I quickly realize there are common terms used in many Monsters. For some of the most commonly used terms, I felt having shortcut icon/emoji would be helpful to keep Monster AI cleaner.

Followings are list of icons I use.

⚔️ = melee attack

🏹 = ranged attack

🪄= spell casting

🎯 = target

👣 = move/movement

📍= position

A ➡️ B = First perform A then B. In contrast, A + B means A ➡️ B or B ➡️ A changed based on each situation. This notation allows single line multi-step actions.

Monster AI – Creation

There are 5 basic steps:

  1. Gather the monster’s trait
  2. Interpret monster’s traits to combat related terms using monster’s stat block
  3. Translate interpretation into Monster AI language
  4. Organize/fill the monster AI sections
  5. Verify that the Monster AI works

Step 1: Gather

For the best play experience, you absolutely want to feel character/personality of each monster types. The key to incorporate the character in Monster AI is to understand Monster’s traits.

The two recommended resources are:

  1. Monster Manual ($27.49 Amazon.com or $29.99 D&D Beyond) – One of the official 5E core books
  2. Monsters & Creatures: A young adventurer’s guide ($7.99 Amazon.com), I call baby Monster Manual.

Example:

Zombies take the most direct route to any foe, unable to comprehend obstacles, tactics, or dangerous terrain. A zombie might stumble into a fast-flowing river to reach foes on a far shore, clawing at the surface as it is battered against rocks and destroyed. To reach a foe below it, a zombie might step out of an open window. Zombies stumble through roaring infernos, into pools of acid, and across fields littered with caltrops without hesitation.

Monster Manual – Zombie

The key information gathered from above paragraph is “Zombies take the most direct route to any foe.

Step 2: Interpret

In this step, I try to convert gathered traits into more simpler, direct scheme of how the monster should be controlled.

Example:

Traits

Zombies take the most direct route to any foe, unable to comprehend obstacles, tactics, or dangerous terrain.

Interpretation

Once a zombie identifies a target, it tries to reach to the target in a direct straight linear path even if it were through difficult or dangerous terrains.

The interpretation step also requires you to understand and interpret the Monster’s stat block.

For example, goblin’s stat block consists of two types of action. One for melee and the other for ranged combat. So both has to be utilized on Monster AI.

Some of goblin’s traits from Monster’s Manuals are “goblins are cowardly” and prefers “hit and run”. If you look at the stat block, goblin has Nimble Escape bonus action to support such tactics. Although both attack types have same probability of hit and damage amount, coward creature who can hide each turn should prefer ranged attack whenever possible.

You can see how nicely traits and stat block of the goblin ties and support each other and properly built Monster AI should reflect this.

Some of stat block element may be more subjective than the other.

For instance, if you see a monster with high intelligence, naturally such monster should move its position to attack player character from uncovered side if such option is available. But what is high enough intelligence? Which type of cover is worth avoiding?

This is where Monsters Know reference comes in handy.

Monsters Know What They’re Doing.

I am having fun time with these exercise myself, but you may not have Monster’s Manual or do not want to spend time gathering and interpreting.

In such case, there is an excellent free website. The Monsters Know What They’re Doing. It has many monsters with very detailed interpretation about how each type of monsters should act. I believe everything is on the website, but those of you interested can also purchase a physical or digital book.

I have personally purchased kindle version, mainly to support the author.

With monsters know reference, the first two steps i.e. gather and interpret are completed by the author, Keith Ammann.

In fact, Keith uses monster’s stat block so well, and of course references Monster Manual, his interpretation goes above and beyond most of us can do.

For instance, there is no where in Monster’s Manual reference states Goblin should stalk target who wounded it if the Goblin’s health become 3 or 4, or flee when hit points become 2 or below. However, such interpretation makes each goblin more dynamic as goblin shifts its tactics rather than keep doing the same thing throughout the combat.

So my personal recommendation is use Monsters Know for Step 1 & 2 replacement whenever possible. By this, you want to gather monster’s traits from the site or book rather than Monster Manuals.

Then as a supplement and perhaps also exercise, you can do own gathering and interpretation from Monsters Manual. As there may be times you need to make Monster AI from scratch. This could prepare you when such time comes.

Step 3: Translate

In this step, interpretation of each traits are translated into Monster AI compatible format. The difference is that interpreted traits in step 2 including Monsters Know site info are more of schema how one would control the Monster if there were Dungeon Master. This leaves option/flexibility to the DM, but automated AI needs explicit guide rather than abstract scheme.

Let’s take a look at some examples.

Interpretation

Once it identifies a target, it tries to reach to the target in a direct straight line even if it were through difficult terrain or dangerous terrain.

AI Mechanics Translation

👣 Direct

In this case, Movement “Direct” is a keyword I defined. Direct movement means the monster goes straight, as linear path independent of if it is through difficult or dangerous terrain. The reason for creating a keyword here is because I expect this type of movement to appear a few times across different monsters.

Another example is using interpretation from Monsters Know website.

Interpretation

A goblin reduced to 1 or 2 hp will flee. A goblin reduced to 3 or 4 hp will stalk the PC who wounded it.

AI Mechanics Translation

If low HP:
3 or 4 HP: Change target to the PC who last wounded it.
1 or 2 HP: Flee

The translation puts into easy to look format for Monster AI. Also, rather than stalking, I have explicitly stated that the target changes. The more specific you can be, the better it is for Monster AI as there should really be no interpretation/translation happening once Monster AI is created, and all user of AI should know exactly what to do in each situation.

Step 4: Organize/Fill

After the translation step, I should have all required pieces for Monster AI creation. At this step, I put each into an organized format using Monster AI format.

First decide where each information goes.

  • General Strategy
  • Special Tactics
  • Basic Tactics

It is then important to remember the flow from Special to Basic Tactics and also within in each section, top to bottom. With this, the order of entries most likely need adjustment and sometimes I may be able to simplify certain entry or perhaps add new entry.

For example, I noticed using “flee” couple times in the given AI, but each flee action consists two individual actions. So I decided to create a keyword for it in general strategy section.

Fleeing monster decision should come before any of monster attacking events, so flee action containing entries come top on the Monster AI and so on.

Step 5: Verify

The last step is to verify or confirm the Monster AI working as intended. This step consists of 3 parts:

  1. Stat block check
  2. Quick imaginary test run
  3. Play test

Stat block check

All the core information of given monster’s stat block should be on the Monster AI. This includes each type of actions and combat relevant abilities/skills. If any of the component is not covered on Monster AI, I feel the Monster AI is incomplete. In which case, I go back to interpretation/translation steps for the missing stat block entry.

For example, goblin has Shortbow and Scimitar attacks for the action. If Monster AI only has Shortbow and nothing about Scimitar then it is incomplete. It is perfectly acceptable that Monster AI has Shortbow attack as basic tactics and the monster uses it whenever possible, but there should still be a situation that require the goblin to use Scimitar.

Quick imaginary test run

At this step, I run a few imaginary situations to make sure Monster AI works as intended. Some good sample tests are:

  1. Start of combat i.e. Monster & Player Characters are still distant apart
  2. Ranged attack scenario
  3. Melee attack scenario
  4. Each of special tactics cases

The special tactics cases will flow from top to bottom so you may need to adjust the order while quick testing.

Play Test

Now, I play with the monster in actual campaign. If I catch something is not working well, I may edit monster AI at that point or just keep playing and edit later. Creating monster AI is an art and skill of its own, so it will take time to master it.

Examples

Ash Zombie

Ash Zombie is a variant of Zombie that appear in the D&D starter kit, lost mine of Phandelver adventure. There is no specific entry for this monster in the Monster Manuals nor on the Monster Knows website.

However, this is a just simple variant of Zombie with one extra trigger ability, Ash Puff. Zombie is also one of the simplest monster to make Monster AI. So let’s take a look.

Step 1: Gather the monster’s traits

The magic animating a zombie imbues it with evil, so left without purpose, it attacks any living creature it encounters.

Mindless Soldiers. Zombies take the most direct route to any foe, unable to comprehend obstacles, tactics, or dangerous terrain.

A zombie can follow simple orders and distinguish friends from foes, but its ability to reason is limited to shambling in whatever direction it is pointed, pummeling any enemy in its path.

A zombie armed with a weapon uses it, but the zombie won’t retrieve a dropped weapon or other tool until told to do so.

Monster Manual

There are not many combat related traits about the zombie, but it is ok because Zombie only has a single action, slam and it lacks intelligence and wisdom.

Step 2 & 3: Interpret & Translate

Here given relative simplicity, I do step 2 and 3 in one line.

Trait

Mindless Soldier attacking any living creature it encounters

+

A zombie can follow simple orders and distinguish friends from foes

Interpretation

A zombie will just attack nearest foe/enemy that it can see.

Mechanics

🎯Closest foe

Trait

Zombies take the most direct route to any foe, unable to comprehend obstacles, tactics, or dangerous terrain.

Interpretation

Once it identifies a target, it tries to reach to the target in a direct straight line even if it were through difficult terrain or dangerous terrain.

Mechanics

👣 Direct

Trait

Can use equipped weapon but won’t retrieve a dropped weapon or other tool until told to do so.

Interpretation

Default Ash Zombie or Zombie statblock does not come with equipment. However, this is explicitly stated in the Monster’s manual so I thought it would be worth adding it in case.

Mechanics

⚔️ Can use equipped weapon but won’t retrieve a dropped weapon or other tool until told to do so.

When the proper and comprehensive translation is done, Monster AI should incorporate everything on the statblock. If not, the AI is incomplete and not fully unleashing the potential of the monster.

In the case of Ash Zombie, there are two trigger abilities that are relevant during the combat.

Stat block ability

Undead Fortitude

Interpretation

This ability triggers when the zombie’s hit points reduces to 0, so it is a special tactics.

Mechanics

Special Tactics:

Trigger = When the hit points becomes 0.

Action = Undead Fortitude

Statblock ability

Ash Puff

Interpretation

This ability triggers when the zombie takes first damage,

Mechanics

Special Tactics:

Trigger = When it takes the first damage

Action = Ash Puff

Step 4: Organize/Fill

The next step is organize and put each pieces into the Monster AI format.

I have personally used Apple Pages to create this, but you can do it on Photoshop, Microsoft Word or any other apps you choose.

Put each of above translated elements into proper section of Monster AI.

Step 5: Verify

The last step is to make sure the Monster AI flow in full (or near-full) automation.

Stat block check

First, compare Monster AI and stat block side by side to confirm that each of the stat block components are covered in the Monster AI.

Ash Zombie has two combat related, triggering abilities and one action. Therefore, the monster AI needs to include all three.

Test Run

At this step, running a few imaginary situations in head looking at Monster AI card is good idea. In case of Ash Zombie, at beginning of combat where PCs are still too far, it selects a target based on the closest distance. Then use Basic Tactics, which starts with move, and that is direct path. If it is out of reach slam can’t be used so the turn ends. I just continue this imaginary situation for a few different scenario, but it is easiest to think as if you are having real combat.

Then, the real test would be playing the actual game. If something is not working, you need to come back and keep adjusting.

Goblin (Plain Form)

Goblin is not just a paradigmatic first encounter monster in D&D 5E, they serve well for Monster AI creation. The stat block has several parts and the creature certainly has interesting traits and a personality.

Step 1: Gather the monster’s traits

In the case of Goblin, the monster’s traits that could affect in the combat are better outlined in what I call baby Monster’s Manual, Monsters & Creatures: A young adventurer’s guide than the official Monster’s Manual.

They prefer ambushes and hit-and-run attacks over straightforward battle.

When alone, they are more likely to run away than challenge a stronger foe

Goblins are cowardly and often run away once their strongest fighter is defeated.

Goblins favor ambushes and sneak attacks from behind

Zub, Jim; King, Stacy; Wheeler, Andrew; Official Dungeons & Dragons Licensed. Monsters & Creatures (Dungeons & Dragons) (Dungeons & Dragons Young Adventurer’s Guides) (p.13). Clarkson Potter/Ten Speed. Kindle Edition.

Step 2: Interpret and Translate Traits using Stat block

Trait

Prefer ambushes

Interpretation

Tries to surprise attack when possible.

This trait is well supported by the Goblin’s skill having Stealth +6.

Mechanics

Surprise attack when possible

🎯Closest foe

Trait

Hit and Run Attack

Interpretation

Using Scimitar, run part will need Disengage to avoid inciting opportunity attack from the adjacent foe, but this is nicely depicted by Nimble Escape bonus action ability.

Mechanics

Scimitar, Nimble Escape (Disengage) then Move

Trait

Sneak attack from behind

Interpretation

Sneak attack from behind to me means attack from hide position. This is well supported by Nimble Escape ability of the Goblin, which allows a bonus hide action. Furthermore, +6 Stealth skill supports this trait.

Since diengage is used for melee combat, hide should be usable during ranged.

Adding Hit and Run attack to ranged attack on top, short bow, run and hide makes perfect turn move for Goblin.

Cowardly monster who tries to sneak attack should prefer ranged attack over the melee.

Mechanics

Shortbow, Move then Nimble Escape (Hide)

End its turn hiding whenever possible

⚔️ Prefers ranged attack whenever possible

Trait

Cowardly

Interpretation

Cowardly monster who tries to sneak attack should prefer ranged attack over the melee.

Also, hiding appears as a core tactics/combat skill for Goblin given its Skill bonus and bonus action ability, so this is worth mentioning as general strategy for Goblin.

Mechanics

⚔️ Prefers ranged attack whenever possible

End its turn hiding whenever possible

Trait

When alone, they are more likely to run away

+

often run away once their strongest fighter is defeated.

Interpretation

These define events that triggers Goblin to run away (flee).

Mechanics

[Event/Trigger] If the leader is slain or the goblin becomes alone,

[Action] Flee

Flee

If you’d like to have fleeing monster to have actual movement to succeed, it requires explicit sequence of actions.

Dash action could result in inciting opportunity attacks. Some monster may choose this, but Goblin has Nimble escape, so it should use Disengage and Dash. If disengage is unnecessary, it can dash and hide for better protection.

At this point, you would notice we have not defined Goblin’s target nor movement pattern because gathered trait has no specific criteria to determine these. So I’d use the defaults here.

Trait

Target

Interpretation

No relevant trait is defined to specifically say something about unique target. So I’d just use default.

Mechanics

Nearest > Lowest HP

Trait

Move

Interpretation

No relevant trait is defined to specifically say something about unique movement. So I’d just use default.

Mechanics

Safest > Shortest

Distance

In you try to play a game with the movement and attack AI as above, you will immediately notice “move” for ranged attack is too vague. For the case of melee combat, target dictates the direction and destination of the monster’s movement; however, ranged attack needs the destination because target foe itself is not a destination. In another word, how far away from the target?

Since short bow has a range of 80 feet, it should be under 80ft; otherwise, the following Goblin’s turn may require “move before attack”. This will breaks hit and run scheme.

Since most characters have 30ft move, goblin’s target could change its position +/- 30ft from the goblin independent of goblin’s choice before its subsequent turn.

So if goblin wants to maximize the chance most foes stay under 80 feet distance when its next turn comes, the goblin needs to keep the distance less than or equal to 50 feet from the target.

In order to avoid getting into a melee range, the goblin needs minimum 40 feet.

So in the end, goblin prefers to position itself between 40 and 50 feet from foes.

Trait

Keep distance

Interpretation

Keep 40-50 feet distance from the foes

Mechanics

Keep 40-50 feet distance from the foes

Step 4: Organize/Fill

Now, it is time to organize all the pieces.

This is a plain form of Goblin AI. If you were to literally translates Monster’s Manuals information, this is most likely what you will end up getting.

Step 5: Verify

Properly created Monster AI should incorporate everything on the stat block. If not, the AI is incomplete and not fully depicting the monster’s personality.

In this case, at the minimum, Nimble Escape, and both Scimitar and Shortbow actions must be covered. Additionally, stealth + 6 is a unique part of Goblin. So this has to be incorporated in some form.

All are addressed in the Monster AI with Stealth +6 part reflected in Goblin’s tendency to try hiding and attempts surprise attack whenever possible.

Next I run imaginary AI.

  1. Beginning of combat – Goblin is still far away. None of special tactics triggers. Basic tactics section is used. Shortbow attack may be still too far. In which case, ignored. Then Goblin moves toward a target, which is defined in the General Strategy section as closest foe. The path goblin take is also defined in this section as the safest and shortest.
  2. After combat initiates, PC may come towards goblin and ends up taking into melee range. At this point, the [If] In melee combat special tactics section triggers. So goblin attacks back using Scimitar, then disengage and move away.
  3. Third turn, goblin may be close to PC but still not in melee combat. Then Basic tactics but this time, movement will put goblin away from PC to establish the 40-50 feet distance.

After the quick imaginary test, the real test is to play the game.

Goblin (Monsters Know Version)

The third example is once again, the same Goblin as above, but this time, I used Monsters Know website/book.

Step 1 & 2: Gather & Interpret

Extracting traits from Monsters know means you are gathering interpreted information because Kieth has gathered traits from Monster Manual and interpreted them using Statblock and adding his own take.

Goblins attack from hiding as much as possible

A typical goblin combat turn goes Shortbow (action), move, Hide (bonus action).

optimal distance from the targets of their ambush is about 40 feet, no closer—and they don’t want to move farther from the PCs than 80 feet,

If PC does manage to close with one of them, the goblin Disengages (bonus action) first. Then, depending on how great a threat the PC poses, it either Dashes (action) out of reach—forcing the PC to use a Dash action as well if they want to catch up—or, if it thinks it may be able to finish the PC off, moves its full distance to a place of cover then Hides (action) again, preparing to attack with advantage on its next turn.

Goblins trying to goad the PCs into splitting up [rather than staying together].

A goblin reduced to just 1 or 2 hp flees

Moderately wounded goblin (3 or 4 hp) stalks the PC who wounded it, first retreating to a safe distance, then Hiding and moving with Stealth until it can get back to around 40 feet from its quarry, at which point it returns to its Shortbow/move/Hide sniping tactic.

They won’t waste arrows on a target that’s behind three-quarters cover. Instead, a goblin stealthily repositions itself alongside or behind its target before shooting and giving its own position away.

A goblin that finishes off its target doesn’t immediately go hunting after other targets. If another is already in view, it attacks that one. If not, the greedy goblin first ransacks the body of its victim for anything valuable.

only time a goblin willingly engages in melee combat is when it has some other overwhelming advantage, such as a combination of numbers, darkness, and the ability to flank,

If three goblins surround a PC in the dark, the chances are very good that they’ll land three hits and not have to worry about retaliation. That being said, if those three hits don’t finish the PC off, the goblins will realize that they’ve bitten off more than they can chew, and on their next turn, they’ll Disengage (bonus action), go scampering off into the darkness (movement), and Hide (action) someplace where they may later be able to land a surprise hit on a wounded foe.

goblins can tell the difference between a creature that’s lost in the dark and one that has darkvision. They won’t attack the latter close up if they can avoid it; instead, they’ll prefer to shoot with their shortbows.

Another circumstance, they engage in melee combat is when commanded

Ammann, Keith. The Monsters Know What They’re Doing: Combat Tactics for Dungeon Masters (The Monsters Know What They’re Doing Book 1) (p.15-18). Gallery / Saga Press. Kindle Edition.

You can get the same information free: The Monster Knows What They’re Doing – Goblin Tactics

You can already see how much more depth of information we have. If all can be converted into Monster AI format, one can certainly see the Goblin has a real personality.

Step 3: Translate

Interpretation

Goblins attack from hiding as much as possible

Monster AI Mechanics

Whenever possible, the goblin ends its turn hidden.

Interpretation

A typical goblin combat turn goes Shortbow (action), move, Hide (bonus action).

+

optimal distance from the targets of their ambush is about 40 feet, no closer—and they don’t want to move farther from the PCs than 80 feet

Monster AI Mechanics

Basic Tactics

1. Shortbow attack

2. Move to keep 40-50 feet distance

3. Nimble Escape – Hide

So far, they look identical to my plain form of interpretation. This is where thing gets more exciting and also a bit trickier.

If PC does manage to close with one of them, the goblin Disengages (bonus action) first. Then, depending on how great a threat the PC poses, it either Dashes (action) out of reach—forcing the PC to use a Dash action as well if they want to catch up—or, if it thinks it may be able to finish the PC off, moves its full distance to a place of cover then Hides (action) again, preparing to attack with advantage on its next turn.

Ammann, Keith. The Monsters Know What They’re Doing: Combat Tactics for Dungeon Masters (The Monsters Know What They’re Doing Book 1) (p.15-18). Gallery / Saga Press. Kindle Edition.

The statement above contains judgment call by a dungeon master. As an AI, this needs to be explicitly translated.

What does it mean by “if it thinks it may be able to finish the PC off?” The Monsters Know book defines degree of creature wound. His definition is 60% or more of hit point loss is considered severely wounded. So I translated “able to finish the PC off = if PC is severely wounded”

Interpretation

If PC does manage to close with one of them, the goblin Disengages (bonus action) first. Then, depending on how great a threat the PC poses, it either Dashes (action) out of reach—forcing the PC to use a Dash action as well if they want to catch up—or, if it thinks it may be able to finish the PC off, moves its full distance to a place of cover then Hides (action) again, preparing to attack with advantage on its next turn.

Monster AI Mechanics

If a PC is <= 10ft from the goblin:
1. Retreat
2. If the PC has <= 40% HP: Hide (action)
    else: Dash (action)


Interpretation

Goblins trying to goad the PCs into splitting up [rather than staying together].

Monster AI Mechanics

👣safest > shortest > diverge friendly goblins while keeping 40-50 feet distance

Interpretation

A goblin reduced to just 1 or 2 hp flees

Monster AI Mechanics

If <= 2 HP: Flee

Moderately wounded goblin (3 or 4 hp) stalks the PC who wounded it, first retreating to a safe distance, then Hiding and moving with Stealth until it can get back to around 40 feet from its quarry, at which point it returns to its Shortbow/move/Hide sniping tactic.

Ammann, Keith. The Monsters Know What They’re Doing: Combat Tactics for Dungeon Masters (The Monsters Know What They’re Doing Book 1) (p.15-18). Gallery / Saga Press. Kindle Edition.

Very interesting interpretation by Kieth. With Monster AI, I believe this part can be really simplified to change target to the PC dealt the last damage. This is because, order of sequence should execute retreating when necessary and when ready Basic Tactics (Shortbow/move Hide). But this would be certainly something, I need to check keep in mind when filling Monster AI sheet and confirm it works as intended at the verification step.

Interpretation

Moderately wounded goblin (3 or 4 hp) stalks the PC who wounded it, first retreating to a safe distance, then Hiding and moving with Stealth until it can get back to around 40 feet from its quarry, at which point it returns to its Shortbow/move/Hide sniping tactic.

Monster AI Mechanics

If <= 4 HP: Change 🎯 to the PC dealt the last damage

They won’t waste arrows on a target that’s behind three-quarters cover. Instead, a goblin stealthily repositions itself alongside or behind its target before shooting and giving its own position away.

Ammann, Keith. The Monsters Know What They’re Doing: Combat Tactics for Dungeon Masters (The Monsters Know What They’re Doing Book 1) (p.15-18). Gallery / Saga Press. Kindle Edition.

I had a bit difficulty translating this into Monster AI. Condition part is simple, but “stealthily reposition alongside or behind its target” felt a bit confusing at first. So rather than thinking as a whole, I tried to purely translate this sentence into AI format.

Stealthily reposition = Nimble Escape (Hide)

Alongside = Melee distance

Behind = Keeping ranged distance but find <= 1/2 cover

With above interpretation, I was able to fully translate.

Interpretation

They won’t waste arrows on a target that’s behind three-quarters cover. Instead, a goblin stealthily repositions itself alongside or behind its target before shooting and giving its own position away.

Monster AI Mechanics

If 🎯 is behind 3/4 cover:
1. Hide (Nimble Escape)
If ≤ 1/2 cover attack option available: 👣 + ⚔️ Shortbow
else 👣 + ⚔️ Scimitar

A goblin that finishes off its target doesn’t immediately go hunting after other targets. If another is already in view, it attacks that one. If not, the greedy goblin first ransacks the body of its victim for anything valuable.

Ammann, Keith. The Monsters Know What They’re Doing: Combat Tactics for Dungeon Masters (The Monsters Know What They’re Doing Book 1) (p.15-18). Gallery / Saga Press. Kindle Edition.

At first, I ignored this statement as I felt like it is just for thematic purpose but has no direct impact on game play. However, I was wrong. Reading the book second time, this is another clever interpretation by Kieth.

If this is a trait of goblin, another PC can potentially take it as an advantage as it knows what will the goblin does.

Interpretation

A goblin that finishes off its target doesn’t immediately go hunting after other targets. If another is already in view, it attacks that one. If not, the greedy goblin first ransacks the body of its victim for anything valuable.

Monster AI Mechanics

If 🎯 is slain:
If new 🎯 is in line of sight: change 🎯
else: 👣 to slain target body and spend a turn.

Interpretation

only time a goblin willingly engages in melee combat is when it has some other overwhelming advantage, such as a combination of numbers, darkness, and the ability to flank

+

If three goblins surround a PC in the dark, the chances are very good that they’ll land three hits and not have to worry about retaliation. That being said, if those three hits don’t finish the PC off, the goblins will realize that they’ve bitten off more than they can chew, and on their next turn, they’ll Disengage (bonus action), go scampering off into the darkness (movement), and Hide (action) someplace where they may later be able to land a surprise hit on a wounded foe.

+

goblins can tell the difference between a creature that’s lost in the dark and one that has darkvision. They won’t attack the latter close up if they can avoid it; instead, they’ll prefer to shoot with their shortbows.

Monster AI Mechanics


If in dark & 🎯 has no darkvision &  ≥3 goblin melee the same 🎯:
👣 then ⚔️ Scimitar
Next Turn:Retreat+Hide (action)

Translation of above took a bit more understanding of 5E rule myself. Let’s start with flanking.

Flanking on Squares. When a creature and at least one of its allies are adjacent to an enemy and on opposite sides or corners of the enemy’s space, they flank that enemy, and each of them has advantage on melee attack rolls against that enemy.

Dungeon Master’s Guide Chapter 8: Running the Game – Optional Rule Flanking

“Flanking” is an optional rule described in Dungeon Master’s guide. It is interesting rule, and those of us who play adventure board games, this is probably familiar rule.

Both flanking and darkness give potential advantage attack roll to goblins but advantage won’t stack. So why not just flanking as a requirement, which could work in non dark area? When I think about this, I get more confused. Because if I were to take the definition of flaking literally only 2 out of 3 goblins can benefit, but not only that the first goblin that approaches to the target won’t get the flanking benefit yet. So the first turn, only 1 out of 3 goblins can get flanking benefit. However, the next turn they supposed to retreat.

So I’ve decided to drop flanking here entirely, and things started to make sense.

The condition part basically contains 3 individual conditions and all must be met for this section to trigger, which makes sense as Melee combat is something a goblin rather wants to avoid by all means.

Interpretation

Another circumstance, they engage in melee combat is when commanded 

Monster AI Mechanics

None

I could have easily create a line If commanded by leader: Melee combat. The issue is that would be fairly obvious in adventure campaign book, and I see it as rather more of an encounter specific rule than the general monster tactics.

Lastly, I’d still add inevitable melee combat circumstance. This case could happen in situation like Goblin is cornered by PCs and no other place to go.

Trait

Hit and Run Attack

Interpretation

Using Scimitar, run part will need Disengage to avoid inciting opportunity attack from the adjacent foe, but this is nicely depicted by Nimble Escape bonus action ability.

Mechanics

Scimitar, Nimble Escape (Disengage) then Move

Step 4: Fill

You can see how much more information this version has. The reality is in many cases most of special tactics section won’t trigger at all so the plain form of goblin AI and Monsters Know (MK) version may act the same way. It took me much longer to make MK version. MK version may look more confusing to players at the first glance.

There is of course somewhere in between version. One can strip off rare situations. It comes down to one’s preference and of course there is no right or wrong answer.

Step 5: Verify

Once again, it is important to compare statblock and final Monster AI ensuring everything in the statblock is depicted in the Monster AI. However, using Monsters Know interpretation, this part should be very well covered.

The harder part is quick imaginary testing of various situations. With so many special tactics, I have to make sure top to bottom flow is working.

The easy example is the low HP sections. If <=4 HP were above the <= 2 HP section then when a goblin is 2 HP, both section triggers. In this case, changing target does not consume any action so it has no real effect, but narratively and thematically unnecessary and does not make sense.

The other part is, the last special tactics, “in melee combat”. I would not have added this if I hadn’t played actual game and remember the specific situation I cornered goblin. Without the last line, if Goblin AI was strictly followed, the goblin will use Basic Tactics which will give it disadvantage of Shortbow attack in melee combat. Obviously, this makes zero sense as Goblin has melee combat weapon.

Now you can play test.

Conclusion

Monster AI is required part for DM-less play. However, I believe properly built Monster AI should aid even Dungeon Masters. New DM can use them as a guide. Experienced DM may be able to use them to save from mental fatigue. I personally enjoy the making process as it gives me insight into the monster and appreciate sophistication of the D&D 5E game design. This is an art of its own. More you do it, better you’d become. If you end up making one, have better generic design suggestion, please be sure to share it in comment section. My goal/hope is someday either this system, another system inspired by this, or completely different system (really doesn’t matter to me) will have a big enough community support. So there will be Monster AI for every D&D 5E monsters, and we as a player can all enjoy the benefit.