Things you might take into account are how much ammo you have, which enemy is the most dangerous, which enemy is healing others, which enemies have the biggest impact of health to damage so you can take out smaller enemies first, dodging attacks, buffing allies, using special abilities, hitting levers and other level-specific objects, and so on.
It's no wonder that creating an AI is difficult, and not only that, but different enemies may have different priorities and abilities! The slow-but-sturdy enemy isn't going to try and sneak by you to flank you, whereas the rocket launcher mob isn't going to run into melee.
When you look at a game like WoW, the grand majority of AI is relatively simple. Based on a stat called aggro, you decide who you're going to attack. Then, based on your abilities, you choose an ability. Melee? Run up and hit them. Caster? Stay back and cast (some enemies will even run away a bit and cast). Use your most powerful ability that isn't on cooldown. Bosses often have complex choreography which are basically scripted patterns rather than any sort of intelligent decision making, which makes many bosses in MMOs more of a puzzle rather than a dynamic fight.
|The Heigan Dance is the ultimate example of an extremely scripted battle.|
I enjoyed it, but intelligent behaviour it was not.
However, the beauty in a game like D&D or in PvP is that there is actual intelligence on the other side of the playing field. A DM who's coordinating the enemy party, or the other arena team who have their own goals, strategies, ideas, and human nature.
So, how do you make enemies smarter? By making them take more criteria into account, and by giving them more options. This isn't easy, or cheap in developer time, though.
Threat is a popular mechanic because it's easy to implement, and (relatively) clear to communicate. Players perform actions, they generate threat. Whoever has the most threat, or passes some threshold, now has the enemy's attention. Some players can generate threat at an accelerated rate (tanks, usually) to hold the monsters' attention. Maybe in one game, healing generates four times as much threat as damage, so the healer is constantly in danger of getting attacked. It's basically a calculated heuristic to emulate in D&D when your Ranger crits the boss, the boss is going to turn around and deal with them because they're currently the biggest threat.
But what are some other criteria we could use?
Proximity is one that could be used. Some enemies are just fodder, and used to hold the front line, so they'll go engage the closest player. Maybe you want to have a rogue NPC skulk around the outside of the battlefield, so they'll choose the furthest player. Or if a player starts casting spells, perhaps you want your archer enemies to focus on them first. Or you have a dual-wielder who goes after whichever player has the weakest armor so they can do the most damage.
In WoW, some of my favourite fights were ones that eschewed the traditional threat mechanic. Take the Faction Champions in Trial of the Crusader, who usually targeted whoever was at the lowest percentage health; or Garalon in Heart of Fear, who chased whoever was affected by the Pheremones debuff.
|Garalon, also known as the PUG breaker. Hell, he was a raid breaker before he got nerfed.|
It's not just targeting who, though, it's also about what powers you want to use. Given a list of powers, it's easy to say, well, pick the most powerful one that's not on cooldown. Basically, a priority queue not unlike most DPS classes in WoW today. But maybe they also have a power that's a stun, and they want to turn and stun the person on their back before turning around and beating on their target. You could build a feedback loop between target selection and power availability to help make something that really has a good idea about the best thing it can do.
Which all leads back to the player, who needs some way to counter that thought. Aggro and threat in most MMOs are simple, because combat is simple. Players and enemies can walk through each other; throwing down impediments to movement exist, but outright barriers often do not. Thinking back to the Warhammer MMO, where tanks were tanks because they literally blocked enemies from passing.
This sort of thing allowed for more complex behaviour, because if the enemy can just choose the one in the dress and walk through everyone to get there unimpeded, you either need to be able to kill the enemy before they arrive, block the enemy, or grab its attention (or, I suppose, make yourself untargetable either via invulnerability or invisibility or the like). Otherwise the player will feel that the enemy is being unfair. Taunting enemies gives players the ability to have some control over the battlefield when other game mechanics cannot.
|When you can't influence the battlefield as a party and the enemy is coming straight at the healer.|
Arguably--and most MMO games would likely agree with me given their own designs--player agency is more important than super smart AI. But if you can grant players agency, having the enemies also able to use those mechanics makes for really interesting combat.