[D&D] 5E Monster AI – Target & Attack Adaptation

I primarily use Keith Ammann’s The Monsters Know what They’re Doing website and corresponding book series for my Monster AI creation. However, there are monsters that are not covered in his site/books as well as vagueness for direct translation into Monster AI. This is particularly, true for selecting “target” and “action” during each turn. In this article, I am specifically focusing on what’s Keith call “ability contour” for semi-automated Monster AI translation.

Version Alpha

Table of Content

Introduction

Background

This specific topic came to my attention while I was playing an encounter after my player character, Mugen, became lycanthrope, specifically a wererat. Initially, I thought it was a terrible thing that my hero became a lycanthrope. I thought I would just retry the encounter. However, it turned out to be the best thing happened during entire campaign from the gameplay point of view.

Lycanthropes in 5E have near complete physical damage immunity. So suddenly, Mugen became immune to all types of Monster’s physical attacks. This was fun at first. I even convinced myself, it is actually thematically cool to have a hero fighting against its own inner evil while that trait giving him, super-hero level of power in the world.

However, this feeling didn’t last too long. Quickly, most combats became worthless because monsters can never damage Mugen, it is just matter of rolling Mugen’s attacks. I might as well just skip the whole process and say Mugen wins and move on to read next section.

The thing is I have not changed the way I make Monster AI, and previously, they were working fine. Generally, I had monster’s target selection to be choose the closest foe. This is a standard practice in the adventure board games.

The issue here is having Mugen frontline character, Monsters surround him and make melee attacks, but none of them are capable of damaging Mugen. This could still be acceptable if the encountered monsters have no other option. In which case, I would still feel thematic concordance and just think Mugen as super-hero in those combats.

I play solo 5E as if I am watching favorite TV series. In this case, I felt like monsters are the dumbest and the story never has a moment of danger.

From AI perspective, this is analogous to a robot that is programmed to walk. If there is a single block of obstacle on its way, it does not how to handle it so keep trying to work go through it and simply bouncing back from the obstacle.

The wrong answer is “if an obstacle, take a side step, and continue moving the same direction as before” This would work for the above scenario, but what if there is two obstacle side by side? Programming for the very specific case is not a solution for AI.

One specific example from my experience is an encounter against an Anchorite of Talos accompanied by 4 Orcs. My party consists of two player parties, Mugen and Jin. Mugen is a lycanthrope fighter, now having essential full physical damage immunity. Jin is a mage spellcaster sidekick.

Orc’s Perspective

Let’s first look from an orc’s perspective.

It has only two melee attack options. Therefore, it does not have any damage inflicting attack action against Mugen.

Now it could be unintelligent enough to not know about that and could keep attacking Mugen, thinking whenever its attack is a hit, it thinks doing something to it.

This is acceptable if it is based on the unintelligence of the monster.

However, what if it were a bit more intelligent?

One point it should recognize that it can’t damage Mugen, but there is another player character that it can try attacking.

So reasonably intelligent creature should switch its target to Jin or maybe just flee. Otherwise, they are just a punching bag.

Anchorite of Talos’ Perspective

Next, let’s take from the Anchorite of Talos perspective. The situation is a bit different. It possesses spellcasting attacks that can damage Mugen.

The created Monster AI incorporates specific situations where it uses each types of relevant spell attacks, but the situations were defined such that when there are 2 or more targets, it attempts the spellcasting.

I could change it such that it always use the highest damage lightning bolt on first, then thunderwaves, and when all are used up move to melee attack option. Such AI would have worked better against my current party, but what if Mugen had thunder damage immunity? To make it even worth, what if it were cantrip and the monster can keep using it? The situation becomes the same. In such hypothetical situation, the monster will keep using ineffective thunderwaves while not using alternative method.

What if I created a line like “if target is immune to Clawed Gauntlet: lightening bolt”? To make the AI generic and applicable, I need to create all other situations e.g. “if target is immune to lightening bolt”, “if target is immune to thunderwave.”

This may work for Anchorite for this particular situation, but what about the orc? How do I choose between switching attack type and target? What about resistance to the attack rather than immunity?

I call this is an adaptation to a specific combat situation. I felt this is more of generic adaptation of monsters than the specific to each individual monster’s personality/trait.

Basically, my goal here is to build a generic monster AI component rule building for this adaptation because the same situation could happen to any monster.

Making of Adaptation System/Rule

This section explains the process of making the latest version of Monster AI adaptation rule. If you want to just know my version of the rule, feel free to jump to the rule section. Otherwise, feel free to use the section to build your own version. If you do so, I would truly appreciate you to share why you doing the way you do. As with all the part of Monster AI making, my goal is to come up with a generic system so 5E player community can use it and the monster AI creation becomes cloud outsourcing type effort. Therefore, in the end we as a player all can benefit from it.

The monsters know series writer, Keith Ammann specifically addresses about selection of target and attack adaptation using Intelligence and Wisdom ability scores. So I am using them as a core of making Monster AI version.

Wisdom Ability Scores = Gut feel target selection

Wisdom ability score essentially determines the monster’s “gut feel” target selection. “I can take that guy down.” “That one seems a bit too strong for me.”

Wisdom ScoreMonsters Know Description
<=7Wait too long for flee
8-11Knows when to flee
Indiscriminate target to attack
>=12Select target carefully
Favor of parley if outmatched
>=14Fights only when its sure it will wins
Willing to bargain, bully or bluff
Ammann, Keith. The Monsters Know What They’re Doing: Combat Tactics for Dungeon Masters (The Monsters Know What They’re Doing Book 1) (pp.2-3). Gallery / Saga Press. Kindle Edition.

If the monster is not wise enough (WIS < 8), it indiscriminately choose a target. This is a typical “closest” target type of selection.

If the monster is wise (WIS >= 12), it selects “target carefully”. This is a vague statement and left me quite a bit of space to interpret.

As a monster, I felt natural inclination is to “choose a target that looks to be the weakest.” This still remained vague. Should the weakness be based on character level, hit point, or other ability scores?

Although character level could be a good use, the applicability is low because party members usually have the same level.

The combination of various parameters like Armor class, immunity/resistance/vulnerability, remaining hit points are real combat tactics. If I were manually controlling and able to see all those stats, I’d use them. Combination of various parameters requires assigning weights to each parameter and results in complex formula creation and calculation for every monster. Fortunately(?), creatures in the world of 5E don’t see each others as numbers anyway and so this approach would not make sense anyways.

If I were to choose one single stat parameter to decide who is the weakest from Monster’s perspective, most of us should agree “hit points”.

However, this would make spellcaster classes nearly always the best target. I can see some monsters use it as tactics, but I felt “target spellcaster” should be more of Monster’s character/personality than global target selection rule.

Again, thematically, monsters nor player characters know exactly how many HP each creature has at the given moment. In fact, I have read many DMs won’t share players how many more hit points the damaged monster has left. Instead, the DM may say the monster is “seriously wounded”.

Keith Ammann defines degree of wounded creature into 3 categories in his book.

Wounded Category% max HP
Lightly wounded10%
Moderately wounded30%
Seriously wounded60%
Ammann, Keith. The Monsters Know What They’re Doing: Combat Tactics for Dungeon Masters (The Monsters Know What They’re Doing Book 1) (p.3). Gallery / Saga Press. Kindle Edition.

This made a perfect thematic sense and also I felt works well for defining “weakest character”. So I’ve decided translate “select target carefully” as to “choose most wounded target”.

Now, this doesn’t mean the monster chose the best target it could have chosen. For example, moderately wounded level 5 fighter still has 30+ HP; while unwounded, mage spellcaster sidekick has under 30 HP.

But this is exactly what I want. The monsters would not know the exact detail. It just sees the fighter is bleeding and the spellcaster isn’t.

Therefore, I use following conversion table when setting target section of Monster AI.

CategoryWIS ScoreDescription
Indiscriminate< 12Follow standard rule without situational adjustment
Most wounded>=12Most wounded.

Outmatch

Kieth talks about “favor of parley if outmatched” and “fights only when its sure it will wins.” As far as applicability to Monster AI (Combat), I could imagine something like “outmatched target” is excluded from the target list. If all foes are outmatched, then “flee.”

The issue at least for me right now is “how to determine outmatch.” One can use challenge rating or XP like described in Dungeon Master’s guide chapter 3, but this would not include wounded characters. Also calculating XP based party strength comparison requires for every match and that’s felt a bit tedious.

So for now, I’ve decided to ignore this section. But in the future if I come up with better approach I may add this element.

Intelligence Ability Score = Attack Adaptation

Intelligence ScoreMonsters Know Description
<= 7Wholly from instinct
1 modus operation
Can’t adjust it if it stops working
8-11Unsophisticated tactics, no strategy
Can tell when things are going wrong and adjust to some degree
12-13Good plan
Coordinate with others
Probably has multiple ways of attacking and/or defending and knows which works better in which situation
>=14Accurately assess its enemies’ weaknesses and target accordingly.
> 18Even find hidden weakness
Ammann, Keith. The Monsters Know What They’re Doing: Combat Tactics for Dungeon Masters (The Monsters Know What They’re Doing Book 1) (pp.2-3). Gallery / Saga Press. Kindle Edition.

Intelligence determines attack type adaptation. Similar to the Wisdom section, Keith’s book/website categorize things well but remains to be vague to be directly usable in Monster AI.

In fact, figuring this section out took me the most amount of time. Even though it is just one person’s interpretation and not necessary official guide, I really wanted to incorporate Monsters Know system. It divides into intelligence score into 5 categories.

Two extreme cases were easy to translate.

Those monster who acts with instinct has no adaptation capability. It does not realize its attack is a vain attempt. Perhaps, it feels satisfaction when attack is a hit even though giving zero damage as it is too unintelligent to notice its not damaging the PC.

The other extreme, of able to target weaknesses simply translates to use the best available damage option every turn. For example, if a target PC has vulnerability to specific type of attack and the monster possess such attack option, use it all the time.

The middle three categories with description of “adjusting some degree”, “knows which works better in which situation” and “accurately assess its enemies weaknesses” needed to be distinct from each other as well as the other two categories.

The 5e rule that could potentially be usable for these distinction came to my mind are immunity, resistance and vulnerability mechanics.

If average intelligent monster notice its attack is not giving any sign of damage to PC, it should switch attack method or target. But it may not notice resistance as some of damage is still going through, and may just think it has twice more hit points.

A bit more intelligent monster notice even resistance as something is not right. So it would seek for the better damage option and if it finds it, use it.

Assessing Weakness

Let’s start with the simpler one. The forth category “assess for weakness.”

The challenge is here is to clearly distinguish “assessing weakness” vs. “notice hidden weakness.” To me the difference is the timing when the monster identifies the target’s weakness.

The superpower monster that is capable of detecting even the hidden weakness knows it from the start and keep targeting it from the very first turn.

Those requiring to assess for the weakness, it needs sometime.

Initially, I thought upon the first hit, it learns the weakness, but that felt a bit too random as sometime it may be the very first turn but the other case, it may take several turns due to high AC of the PC. It just felt unrealistic.

Then I thought about upon each hit, the monster switches its attack pattern randomly and progressively finds target’s weakness including vulnerability if exists. This system felt a bit too hard to develop because if original attack was normal damage, then switching randomly to find out resistance/immunity felt going the opposite direction, and simply inefficient way to find out.

The third option was to use give a specific time i.e. rounds. After X rounds, the Monster knows enough about the character and at that point, it starts to use the best damage attack option. I felt this is thematically fitting.

In fact, this particular category coincidentally encompassed 5 intelligence score levels from 14 to 18. So I’ve decided to even incorporate this wide range as a part of rule.

A number of turns take to figure out weakness = 19 – Intelligence

Almost supernaturally intelligent creature at intelligence of 18 will figure out the target’s weakness in just 1 turn. The other extreme may take up to 5 turns. Even the latter case is still technically only 30 seconds in real time equivalent, so I felt perfectly reasonable.

Unsophisticated vs. Appropriate

The distinction between unsophisticated and appropriate tactics were really ambiguous. Here I’ve decide to use immunity and resistance as a trigger event.

Unsophisticated category monsters will notice immunity as mentioned about, but not resistance. Appropriate creature will even notice resistance is an issue.

Once these monsters notice their current attack is “not right”, it triggers “adapt.”

So at this point, the intelligence ability score system translates in Monster AI as followings:

CategoryINT ScoreDescription
No adaptation<=7Fixed
Unsophisticated8-11If attack is a hit & target has an immunity, adapt.
Appropriate12-13If attack is a hit & target has an immunity or resistance, adapt.
Weakness14-18After (19-INT) turns, start using the best total damage option.
Instant adaptation>18Use the best total damage option every turn.

Adapt

Now, I need to define “adapt” in AI language.

When an unsophisticated or appropriate category monster finds out its current tactics not working, it has several options.

First is decide what to switch, is it action or target?

  • Switch target
  • Switch action

Then for each, it can decide whether to do it in randomly, systematically or intelligently.

  • Randomly
  • Systematically
  • Intelligently (the best choice)

Intelligent adaptation refers to the situation where the monster switches immediately to the best alternative. For example, its basic melee attack fails to damage the target PC, so it switches to alternative attack but not just randomly switching it chooses the best option e.g. attack that gives vulnerability benefit against it.

This seems to overlap to the higher intelligent monsters where it targets weakness, and could even be better than them as usually most Monsters don’t have that many alternative attack options. So I have decided to “intelligent adaptation” is not an option.

Target vs. Action Switch

Wisdom scores are already defined to determine the target selection. There are certainly creatures that have combination of low wisdom/high intelligence and high wisdom/low intelligence. So I have to be careful here as to avoid intelligence score overtaking the wisdom and make Wisdom score irrelevant.

One option I thought about is keeping the intelligence to purely define action selections and not affect any target choice. However, that could result in a scenario like a monster just keep hitting PC when it has no way to damage it while there are other potential PC targets i.e. Orcs vs. Mugen & Jin’s situation.

So what I have decided here is, monsters use their intelligence to determine better attack option. Only after it fails to fine any, it switches target.

However, the switching target is just a trigger and once it is trigger “normal target selection process” takes place. The only difference is when choosing new target, it excludes already tried and failed targets. This system keeps the target selection still relying on Wisdom score remain in place.

Random vs. Systematic Action Adaptation

Since target switch is just trigger or not trigger, the last piece I need to fill is how action adaptation process should work.

Random action adaptation could use something like a dice roll to determine. One of the thing I am trying to do with creation of Monster AI system is to avoid unnecessary dice roll. In 5E, we rely heavily on dice roll and that’s the part of fun and core game mechanics, but I understand requesting avoidable dice rolls negatively impact game’s overall flow. So I felt this isn’t a good option.

So this left me the need of creating some type of systematic action adaptation system. It is a system where try A, if fails, then B and then C.

Simple way of developing this is to just go from top to bottom in special attack entry order, but I felt this may potentially introduce unexpected/unintended situation where monster switch from melee attack to ranged attack and then back to melee. Such movement will result in unnecessary opportunity attacks.

Then I thought about explicitly adding adaptation attack orders. For example, Anchorite of Talos in humanoid have 3 potential damage inflicting action options: Lightning bolt, Thunderwave, and Clawed Gauntlet.

With explicit adaptation order approach, I would write something

Adaptation: Clawed Gauntlet > Lightning bolt > Thunderwave

This system should work for sure but it felt to crowd the Monster AI sheet.

So finally, I came up with the combination approach. Only specify, the preferred order of attack type for adaptation. Then monsters always exhaust the same attack type category first, then use the order to determine which attack type to try next. Within each attack type, it uses top to bottom approach.

There are three types of attack types: melee, ranged and spellcasting. The last one can be technically divided into melee spell attack and ranged spell attack.

For me, thematically this approach also made a sense. If a monster is in melee combat, it should first try other melee combat options before moving away from the PC.

Adaptation Order: ⚔️ > 🪄

In above depiction, melee (⚔️) attack is preferred over the spellcasting (🪄).

Scenario 1: Target with immunity against slashing damage.

If the Clawed Gauntlet fails and adaptation is required, it moves to spellcasting (🪄). Based on the Monster AI special tactics entry order, lightening bolt is next choice.

Scenario 2: Target with immunity against thunder damage.

If the first thunderwave fails, it switches to lightening bolt first because it is also spellcasting attack. Only if the lightening bolt fails or no longer available, it tries the melee attack option.

Monster AI – Adaptation Rule

My current version of Monster AI uses Wisdom and Intelligence stat block ability scores to determine Monster’s target and attack adaptation capabilities. .

Rule 1: Target Adaptation

  • Use Wisdom Ability score value of 12 as cut-off.
CategoryWIS ScoreDescription
Indiscriminate< 12Follow standard rule without situational adjustment
Most wounded>=12Most wounded.

If target category is “most wounded”, add “most wounded” to target selection list.

E.g. 🎯 Most wounded > closest

The degree of wound is based on the Monsters Know categorization, but I’ve decided to add one more category to it. The addition of “critically wounded” category makes the system symmetric.

Category% max HP
Lightly wounded10%
Moderately wounded30%
Seriously wounded60%
Critically wounded90%
Based on Ammann, Keith. The Monsters Know What They’re Doing: Combat Tactics for Dungeon Masters (The Monsters Know What They’re Doing Book 1) (p.3). Gallery / Saga Press. Kindle Edition.

Rule 2: Attack Adaptation

When a monster has more than 1 attack option, adaptation category should be defined in the general strategy section, under the Adaptation entry.

E.g. Adaptation: Immunity, Resistance

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.

The middle three category names are based on the trigger damage traits for intuitiveness.

Other than the none or instant categories, adapt triggers only with the successful hit. Thematically, monsters should not know if PC is immune or resistant to the specific damage type until it hit with it.

Vulnerability seeking monsters will use the best total damage attack option against the target once it finds out the weakness of the PC. In most cases, this would be vulnerability listed damage type but not all monster possess the option so rather than saying always hit with vulnerability type damage, it is defined to use the best total damage option for the each turn.

Vulnerability category monster takes (19 – intelligence ability score) turns to identify the weakness. Until it discovers the weakness, it uses resistance category adaptation rule. Once the weakness is identified, the monster switches to best total damage option.

Rule 3: Adapt Order

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

E.g. 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.

Monster AI section

In general section,

Add Adaptation section with Adaptation Type | Order

E.g. Adaptation: Immunity | ⚔️ > 🏹 > 🪄

🎯 : Optionally add “most wounded” if WIS >= 12.

Examples

WIS = 15: Most wounded added to target; INT = 9: Adaptation Immunity added.
WIS = 11: No target wounded modifier; INT = 7: No Adaptation

WIS = 15: Most wounded added just before closest, which is where I felt most fitting in the order of target selection; INT = 10: Qualifies for immunity adaptation. Although the invisible stalker lacks alternative attack, this will still allow invisible stalker to move on to another target that it can potentially damage.