[Pathfinder 2e] Monster AI | Designing Soldier

This is an example of “soldier” combat style creature. Developing monster AI for this type of creature involves several decision makings. Hobgoblin soldier is chosen here as it was suggested as good example for the creature falling under soldier combat style tactics.

Introduction

For the full instruction of how to make Monster AI for Pathfinder 2E system, please refer to article here.

Disclaimer: I am new to Pathfinder 2e world or even to the entire tabletop RPG genre. I have never done GM amongst the group session because I play these games in solo. Therefore, the actual decisions I made in this article to create combat tactics for this creature is unlikely to be the optimal.

I put quite a bit of thinking process and several trial and error myself here, but due to my inexperience in this game system itself, this may not be the best version of Monster AI for this creature. In which case, I hope this article still provides you an example of making monster AI process. In fact, if you are the experienced GM and have a better idea to make this AI better tactically, please share it in the comment section.

Soldier

In contrast to the brute or skirmish creatures, soldier creatures are thematically more sophisticated in its combat tactics and this is reflected in the stat block with more than one mode of attack options. Therefore, creation of monster AI for this category of creatures involve more decisions and naturally more complex.

In video games, these creatures are “tanks”. These are primary melee combatant but rather than going for the highest damage per turn of its own, it put itself next to target to absorb damage for the team.

Reaction ability like attack of opportunity and high AC are its defining features.

Melee vs. Ranged Attack Tactics

Although the basic/core attack mode for soldier creatures are melee, these creatures often have ranged attack option in addition. Since monster AI is not complete without including everything in the stat block, we need to decide when these creatures use their ranged attack option.

In Pathfinder 2E, switching from one weapon to another will costs two actions (ref). So if the monster’s attacks are based on weapons, situation like wielded longsword to shortbow takes two actions. This means switching weapon give only 1 productive action during the turn.

For this reason, I have decided that creatures to stick with their chosen attack tactics until PC forces them to change.

The trigger/determination factor for choosing one role vs. another is unsurprisingly the distance between the monster and the target PC.

Since there is melee to ranged and ranged to melee switching, we need to pick two distance thresholds.

One assumption is that creature starts with proper weapon wielded at the beginning of encounter.

Two triggering scenarios are:

  1. PC closes the distance with the ranged attack mode creature so the distance becomes too close.
  2. PC retreats/becomes invisible/unconscious from the melee attack mode creature so the distance to target PC becomes too far.

In order to decide the threshold distance, I’ve looked at productive (non-movement, non-weapon swap) action economy for the monster. Based on the Monster AI golden rule #1, we are looking this from monster’s perspective. As a monster, it wants to have higher productive actions each turn.

Ranged to Melee

The question to be answered here is “how close is too close to continue ranged attack tactics?”.

The extreme case is wait until the PC completely close the gap i.e. melee position with the monster. In this case, the monster has one productive action with melee attack after switching weapon.

If the monster still tries to keep ranged combat, it needs to retreat. Usually, optimal ranged attack position is 2 strides distance. So retreating takes up 2 actions, and it gives 1 attack action. One could consider an option of keep using ranged weapon in melee combat. In Pathfinder 2E, there is no universal/default penalty of using ranged weapon in melee combat. However, generally if the monster has both types of weapons, especially as a solider, melee weapon has higher damage potential. Melee is preferred primary combat mode in soldier.

Should the creature try to recognize/predict PC closing gap and preemptively switch to melee style before the PC fully reaches it?

Let’s pick less than 1 stride distance as the threshold. The monster uses 1 stride to reach to the PC and swap its weapon. This turn it has 0 productive action.

Therefore, from ranged weapon to melee weapon switch, the most efficient action economy is wait until PC completely close the distance.

From ranged weapon to melee weapon switch, the most efficient action economy is wait until PC completely close the distance.

This can be coded as followings.

If in melee combat:
  Swap to longsword (2 actions)
  Use melee attack tactics

Melee to Ranged

The question to be answered here is “how far is too far to keep trying melee combat tactics?”

When the distance to target becomes > 2 strides, the monster needs to use all 3 actions for strides to do melee combat. This makes 0 productive action turn.

In contrast, if it switches to ranged attack mode, 2 actions for swap and still have 1 ranged attack chance. If the distance is to the target is under the weapon’s range, it gets full potential of the weapon. Even with beyond the range, Pathfinder 2e rule allows reduced chance but still attack capability. This switch will give 1 productive action.

So when the distance between the monster and target becomes greater than 2 strides distance, it should switch to ranged combat style.

So when the distance between the monster and target becomes >2 strides distance, it should switch to ranged combat style.

2 stride distance = 2 * Speed + 5ft

So for average 25ft speed, this is 55ft.

This part of switch can be coded as following.

If distance to 🎯 > 55 ft:
	Swap to shortbow (2 actions)
	Use ranged attack tactics

No more arrows

Lastly, special situation where running out of shortbow should be addressed. Once all ammunitions are used up, independent of the distance, it is forced to be switched into melee combat tactics.

In fact, ranged weapon like shortbow becomes useless at this point. So instead of un-wielding, the creature can just drop it to ground, which saves an action.

If no more arrows:
   Drop shortbow (free action)
   Use melee attack tactics

Examples

Hobgoblin Soldier

For the hobgoblin soldier stat block, please refer to Archives of Nethys.

This is a prototypical monster for soldier combat style category. Stat block shows high to extreme armor class and attack of opportunity ability. Although “moderate” rather than “high” strength does not perfectly fit the soldier combat style stat contour this should still fall unequivocally soldier combat style.

Basic tactics – Raising Shield as top priority action

As a damage absorber, I interpret further boosting its AC is top in priority. This means it should”use shield” whenever possible and absorb damage for the team.

RAISE A SHIELD [one-action]

Requirements You are wielding a shield.

You position your shield to protect yourself. When you have Raised a Shield, you gain its listed circumstance bonus to AC. Your shield remains raised until the start of your next turn.

Core Rulebook 2e – Raise a Shield

The rule clearly states you have to raise the shield each turn to be able to use shield block reaction.

Until this reaches to 🎯: 👣 (stride)
While action is available:
 	3️⃣ If shield is available: Raise shield
	⚔️ longsword

Above code block elegantly covers various situations.

  • Move up to all 3 strides until target is reached.
  • Starting at melee position, attack-attack-raise shield
  • If shield is no longer available, it will use all actions for longsword attack.
  • Move-attack-raise shield
  • Move-Move-Raise shield

The last scenario is by design choice. I chose raising shield is more important than attacking. If one prefers attacking over raising shield if there is only one non-move action available for the turn, you can code as below.

While action is available:
 	3️⃣ If shield is available & used ≥ 1 longsword: Raise shield
	⚔️ longsword

Additional interpretation/translation

Formation stat block trait

Hobgoblins have passive ability reflecting how hobgoblins work as a team. Since formation gives its bonus when the monster is next to two other allies, choosing target and specific melee positioning need to have extra-coding.

Specifically, “In range” and “gather” syntax for this purpose for target.

🎯 X gather – This monster and X gathers on the same target. E.g. “Up to 2 other melee allies gather” means choose a target that up to 2 other allies are melee attacking.

Monster AI components
🎯 In 2 strides range > up to 2 other allies gather > Most wounded > Closest

The code above is a good example of using In range syntax. By having the In 2 strides range, all allies within such range are treated as valid target. This piece allows to gather on one target. Otherwise, gather target could potentially be out of reach.

Once the target is reached, monsters have choice on which adjacent square. Normally, it is irrelevant but in this case formation triggers only when adjacent to allies. This therefore coded as specific position for melee.

📍[melee] {Adjacent to ≥ 2 allies} > flanking

In this case, I’ve decided to add personal interpretation of Hobgoblin soldier to use flanking if there is only one another ally to take tactical advantage.

Skeleton Guard

For skeleton guard stat block, please refer to Archives of Nethys.

Despite lacking attack of opportunity, its high to extreme AC and multiple resistance makes skeleton guard soldier combat style creature. In fact, I was able to use most of Hobgoblin soldier as a template.

When there are more than one attack option, it is always worth analyzing each attack to find out which option has the highest average damage potential per turn.

Average damage per turn = SUM (% hit x average damage from the attack action) where average damage for 1dX is X/2 and % hit is (10+modifier)/20

One of interesting game mechanics in Pathfinder 2E is multiattack penalty. This is important part of equation as each additional attack decreases 25% hit chance for non-agile attacks, and 20% for agile attacks.

So basically scimitar and shortbow are identical but with claw as a second melee attack option, melee can do overall better average damage.

It is important to note that claw is not a weapon so it does not require switching weapon.

The best melee combination is scimitar, claw then scimitar. Any other combination including different order will result in less overall average damage potential.

This will be coded as following.

Until this reaches to 🎯: 👣(stride)
⚔️ scimitar
⚔️ claw
⚔️ scimitar

As a user of this monster AI, one has to know where to stop. If there was one move action, then only one scimitar and claw, and the last scimitar won’t be executed.

Reference