Folks have asked me, both here and in person, why the monsters couldn’t just use the combat AI that I’ve already written for the players. And the reason is a philosophical one. See, in an MMORPG, players always try to optimise their combat strategy. They’re inventive, social, and combine things in unexpected ways (which I’ll talk about more, some other time). Monsters, on the other hand, typically don’t have good AI; they just do things naively, as commanded by the game designer. They’re really just a simple obstacle, erected to allow players to do quests and earn experience. Monsters in MMORPGs are typically run by exceedingly simplistic scripts; either doing their attacks in a scripted sequence, or else simply selected randomly.
Back when I played World of Warcraft, I used to solo my way through heroic Sethekk Halls once per day in order to fight Anzu, in the hopes of earning the ultra-rare Raven Lord mount. I eventually stopped trying after twenty or thirty runs; I just got bored. Anzu followed precisely the same attack script every time; once I’d learned how to reliably handle that attack sequence, fighting him got really dull. And even so, World of Warcraft’s bosses are typically far more interesting and elaborate than its more usual monsters.
In MMORPG Tycoon 2, I’ve set up monsters to execute all of their available attacks one at a time, in order. If a monster has run out of attacks which it can use from its current position (that is, if they’re all on cooldown), then it will come closer, until it’s within range of its currently available attacks, or until its longer-ranged attacks recharge.
I’ve also fixed things so that when you’ve taken control of an in-game character, you can be killed by monsters. You respawn at a graveyard, just like the regular subscribers do. (Previously, you were sent to the graveyard, then immediately teleported back to where you had been when you died)
Finally, I’ve hooked things up so that players can use healing abilities on themselves, if they’re in danger of dying. In the event that players have two or more health-like attributes (ones which result in bad things happening if they run out — typically death), then they’ll prioritise their healing based upon which attribute is nearer to running out. Just like with the attacks, they’ll select the stronger and faster healing abilities, when available.
Note that currently, the player AI is operating in a very simplistic fashion; a player goes into one of two “modes”; either “I want to heal”, or “I want to attack”. Player AI is not yet smart enough to choose to use a “drain life” sort of move which sucks health from an enemy into himself, when he could instead use a dedicated healing ability which would heal himself more quickly, or a dedicated attack which would deal damage more quickly. Similarly, it’s not yet smart enough to correctly handle a healing spell which drains one “health” value in order to heal a different “health” value. I’m not aware of any MMOs which actually have this type of ability (although plenty have abilities which convert health into mana), but it’s easily possible to do in MT2. It will take a little more work to build a more holistic AI which is capable of advancing toward multiple goals simultaneously (“I want to damage the enemy as much as possible, while also healing myself if necessary”), instead of the current state-based one.
But honestly, the state-based one is probably good enough for everyone except for me, so I’ll go with it at least for the next milestone. :)
Incidentally, watching the players and monsters mutually attacking each other for the very first time (shown in the screenshot above) was kind of amusing; all the combat abilities were still set as Damage-Over-Time attacks, and so regardless of which (player or monster) died first, the other would die a few seconds later, as the stacked DoT effects continued to deal damage long after the fight had ended.