Series Info...Building Stories, Telling Games #68:

Monsters, Part 2

by Travis Casey

So, having talked about four kinds of monsters last time, what is there to do with monsters?

Well, what distinguishes monsters from other types of objects in a game? For the most part, objects in a game exist to be acted on; they do not take any action on their own. Monsters, however, do take action -- sometimes in a reactive fashion, but some of them proactively.

Taking action effectively involves the ability of a monster to make decisions -- which brings us at least onto the verges of artificial intelligence, and if we want the monster to get "smart", smack-dab into it.

Richard Bartle wrote an excellent series on AI for monsters (or "mobiles", in the terminology he was using). He focused particularly on plans and goals. I'm not going to try to compete with him, so I'd suggest going and reading his articles if you're interested in monsters having goals and making plans to achieve them.

So what am I going to talk about? Let's start from the beginning; what are the problems with monsters that we want to solve using AI? We can sum up all the problems in one simple way: they're stupid. Monsters' stupidity makes them both less challenging as opponents, and boring to interact with.

Making monsters more challenging as opponents requires tactics and strategy. You could create AI of some sort and have the monsters use it to try to come up with optimal tactics and strategies... but sometimes the best way to do AI is just to fake it. How do you fake it? Simple -- watch the strategies the players use, then (a) program monsters to do the same sort of thing as much as possible, and (b) program monsters to take countermeasures against the players' tactics and strategies. These "programs" can in some cases be simple reactive scripts -- "if a player does X, do A, B, and C". In other cases, they may involve multiple reactions, and/or communication with other monsters.

Intelligent setups should also be made. How often have you seen a "guard" in a game who seems to exist purely for the player characters to kill? The supposed "guard" may stop people from going in while there, but doesn't make any attempt to raise an alarm or summon help if attacked. Changing this doesn't require any real AI on the part of the guard, but it does require putting "hooks" for such things into the game system, and for scenario designers to do more work in using them.

Similarly, such things as making monsters run away when heavily damaged, use healing magic and items, and help each other when attacked don't really take much in terms of "AI" -- but they go a long way towards making monsters seem "smart". Going a step farther, having monsters loot the dead bodies of PCs they've defeated, fall back to a "safe" area when heavily wounded, and do other such things gives a great impression of intelligence. These are more difficult to achieve, but still don't require anything like "real" AI.

A personal guideline that I've always used is that anything which the players can use, the monsters should be able to use as well. This should be a guiding principle at the design stage -- when thinking about whether an element should be added to the game, consider "how will I make the monsters take advantage of it?" If that looks to be too difficult, then perhaps it needs to be rethought or omitted. (Of course, some things the monsters don't need to take advantage of, like an internal bulletin board system... although making them able to use one would definitely startle players!)

Making monsters more interesting to interact with is... well, more difficult. A goal system for monsters is definitely a good step -- it's hard for monsters to make any conversation of interest if they don't have anything to talk about. Another possible step is to give monsters access to interesting information -- if a player can stop a passing peasant in the street and ask, "Where's the castle?" then they might actually do so. Being able to ask an innkeeper, "Has so-and-so been here today?" is another good one.

Of course, for this to happen, monsters need to have some sort of memory, populated with things that they know. This definitely starts to get into AI territory, and into the realm known as "world knowledge" -- which can be a very unwieldy place to go. Doing it as described above -- with players asking questions -- also gets into the realm of natural language processing.

The second problem can be shorn off by using a different system for interacting with monsters -- e.g., a menu-based system which restricts what you can ask them. This can have two advantages -- first, it removes the natural language problem, and second, it allows you to easily restrict what kinds of questions can be asked. Goals have to be kept in mind -- is it really necessary for a player to be able to have his/her character stand on the street and chat about the weather with a monster? Even if they could, how many players would?

One major component of many AI systems is learning -- but as Bartle mentioned in his articles, this can be dropped for most monsters. And a good thing too, since it's one of the more difficult things to do. What can be useful, though, are specialized "learning" systems where monsters pick up facts -- e.g., the bartender mentioned above, who remembers who's been in the bar today.

General facts which aren't going to change can be pre-programmed in... and shared among many monsters. After all, having every one of, say, 100 monsters who "live in" a city have their own private internal "map" of it is wasteful. Better to have one shared map with the things "everyone knows", then add specific things to it as needed for individual monsters or small groups. Doing this requires a way to have monsters have "pointers" to bodies of knowledge that they know... but that also simplifies certain things a great deal. If a new fact is generated that all of a particular group of monsters should know, it can be added to their shared "knowledge store". It might also be desirable to have a way to mark a fact as "urgent", indicating that monsters receiving it may want to stop what they're doing and react to it. (For a concrete example, the guard mentioned above yelling that the castle is under attack might insert a new "urgent" fact ["we're under attack"] into the knowledge store shared by all the guards, or all castle residents.)

In summary, although AI is often the first thing that comes up when people talk about making monsters "smarter", there's a lot that can be done which doesn't require "real" AI, and intelligent use (intelligent on the part of the game designer, that is!) of a limited selection of AI tools, coupled with consideration of what the actual goal at hand is, can go a long way.

And now for a special announcement -- this is the last column in this series for the present. Those of you who read the forums probably already know that Skotos is losing money. Skotos has been paying me to write this column, but they're having to make cuts, and can't afford to keep it up. I've been told that they've been glad to have me, and do have interest in bringing me back when they're on their financial feet, but right now, they need the money more for other things.

So for now, this is the last column. I'm thinking of it as "on hiatus", myself, but only time will tell.

[ <— #67: Monsters (or, Dragons and Orcs and Unicorns, Oh My!) ]

Recent Discussions on Building Stories, Telling Games: