Non-Player
Characters
You contend with NPCs much as
you contend with PC controls, except that the
game engine handles all aspects of an NPC’s controls. This difference creates
some
tough design and programming situations, and you must develop an artificial
intelligence
system that can mimic believable behavior.
Reviewing the characters’
aspects, you can see that even NPCs need quite a bit of
managing:
■ Navigation. Although not as
complicated as PCs, NPCs do need to get
around in the world. With the help of scripting, this becomes much easier,
but problems still arise because of terrain obstacles and PC interaction.
■ Conversation. Again, although
not at the same level as PCs, NPCs need to
act “human,” and part of acting human is using communication skills.
■ Combat. NPCs make up the
majority of characters against whom PCs do
combat, so the NPCs need to be worthy adversaries. Even the lowliest NPC
has self-preservation skills and needs to exhibit them in a battle to the death!
Other major control aspects,
such as resource management, don’t apply to NPCs.
The items that NPCs carry are written into the design of the characters. Rarely
do
they have free choice of what they carry or use. Also, because the players do
not
control most NPCs, they have their “entire lives” to develop, so character
building
doesn’t affect them either.
Because it applies only to MCs
(and not all NPCs), leave combat at this point and
turn your attention to navigation and conversation, which have a great effect on
NPCs. These two actions require a plausible artificial intelligence in order for
the
characters to become semi-sentient beings in a game. Actually, NPCs only need to
appear intelligent. Under all the fluff, they follow a small set of instructions
and
rules that govern their actions.
For example, Phantasy Star
Online, a popular game created by Sega, uses minimal
NPC interactions. It has a couple of shopkeepers who sell items, a bank to hold
money and other items, a healer to cure wounds, and a guild to embark on quests.
The game’s monsters are dumb by many standards; they simply walk around until
they see the PC, at which point they home in for an attack. This group of NPC
control
aspects is perfect for fast-action role-playing games, but not good enough for
more serious gamers.
On the other hand, a game such
as Origin’s Ultima Online is packed with NPCs.
How do these two games compare? The NPCs in Ultima Online are limited in terms
of their artificial intelligence—they can only wander around, follow a
character,
remain still, attack, heal, guard, or act as a banker or shopkeeper. In Ultima
Online,
the scripts that the NPCs use are their real magic. Each NPC can have a script
attached that enables the NPC to perform additional actions. For example,
talking
to an NPC yields nothing special until the player gives the NPC a special item,
at
which point the NPC bequeaths the player a magic sword.
Which is the way to go? If you
want a super complex artificial intelligence, so be it,
but your gaming world can be literally packed with hundreds of NPCs, so the
easier
it is to handle them, the better.
I model the Ultima Online NPC
control scheme. NPCs are assigned
specific movements and are allowed to utilize scripts. To keep things simple, a
PC
must interact with an NPC before a script is activated.
Monster
Characters
Monster characters are really
NPCs in disguise. An MC is programmed just like an
NPC, but with monsters, they take on an additional form of intelligence—hunting
and attacking PCs.
Monsters can wander around,
follow, evade, follow a route, and even stand still—
just like normal NPCs. However, when a PC comes within range of a monster’s
attack range (physical or magical), that player becomes fair game. The monster
will consistently attack nearby PCs until either the PCs are dead or the PCs
leave
the monster’s attack range.
Monsters also have a sense of
self-preservation. If a monster loses half its health
points and has the ability to perform a healing spell, it will attempt to heal
itself
using the healing spell. Likewise, if a monster has an ailment, it will attempt
to dispel
the ailment. Finally, a monster will attempt to enhance itself by casting
beneficial
status ailment spells upon itself.
Monsters are the only type of character that a PC can attack (or should be able
to
attack for that matter). Because a PC gains experience only by killing monsters,
you
want to provide your game with a sufficient number of monsters.