September 10, 2002

And I’m thrilled to notice thought-provoking new entries on both Saalon Muyo! and p1k3, after long droughts on both sites. Excellent.

12:41 a.m.

Non-Player Characters, Part 3

Okay, I can write all about this system that will generate NPCs, but how exactly will that be done?

I plan to use what I call computer-aided human creativity. A human will lay out all of the interesting bits, such as places for NPCs to work. The computer will take care of the mundane details, like the NPC’s eye color and family history, though the human can always override the computer’s choices.

This will all be driven by the concept of jobs. What jobs are needed in the world? If a human has created a bar, does it have a bartender? An NPC generator will check the world for available jobs, and create NPCs to fill those jobs.

However — and this is important — the system will also generate reports on the NPCs that exist in the world, so that humans can check the NPC generator’s work. A human can spot inconsistencies that weren’t programmed into the NPC generator, such as having way too many rich people for the economy to support (or no rich people at all).

But people don’t always live where they work; they’ll live in an apartment, for example. So, each NPC will have both a workplace and a residence, and will commute back and forth between those two (plus, perhaps, a bar in the evening). The NPC generator will tie a new NPC to a job and a residence. The NPC generation is based on the availability of a job, so that’s guaranteed. Availability of a residence is not, so we’ll have to make sure there are plenty of residences. A high-rise apartment complex, perhaps?

[Ragnarok image]

Non-Player Characters, Part 2

How do we go about creating realistic non-player characters (NPCs)? We want NPCs that have a certain amount of independence, but that also present interesting dramatic situations to the player.

Here’s how I’m approaching the situation. For each NPC, you must define the following four things:

  1. Actions (common to all NPCs)
  2. Attributes
  3. Goals
  4. Behaviors

First, it’s very important to delineate exactly how big an NPC’s world is, so to speak. Can an NPC engage in sex? Probably not. So, what can an NPC do? That can be a surprisingly small list. The first stage involves figuring out exactly what actions an NPC can take, especially those actions that are visible to players.

Each character is defined by a set of attributes which defines how that character is different from other characters. How old is the NPC? What gender? Is he or she wealthy? Is he or she charismatic? These attributes can be generated by a program pretty easily, and that program can have some common sense about different combinations of attributes (such as making sure that a nine-year-old has no children).

Now things get interesting. We’ve defined the actions that all our NPCs can take, and we’ve defined physical and psychological attributes of each NPC. How do we make them dramatically interesting? We do that by defining goals for each NPC.

[Ragnarok image]

The scale of the goals is important. Very big goals — “Take over the world,” “Get rich,” “Achieve spiritual enlightenment,” etc. — are difficult to translate into simple, concrete actions, and are often practically impossible for NPCs to accomplish. Very small goals — “Walk home,” “Eat a meal” — will be accomplished very quickly, and will be dramatically uninteresting. We have to strike a balance: Goals that will take some time to complete, but won’t take a lifetime. So, we have goals such as “Make $1,000,” “Rescue my kidnapped brother,” or “Find the Mystic Book of La-La Rue.”

Once we’ve defined these goals for an NPC — and an NPC can have multiple goals at once — the NPC must then have some way of achieving these goals. I define this with what I call behaviors, which are mini-programs that the NPC follows to achieve some goal. There may be many different behaviors that can achieve a particular goal, so the system must pick one.

All right, so here’s how it works in overview: First off, we define all the actions that NPCs can take. For each NPC we create, we define the attributes that make that NPC unique, we assign goals to that NPC, and we pick an appropriate behavior for each of those goals and assign that behavior to the NPC. The NPC will follow those behaviors in his or her everyday life.

Leave a Reply

I work for Amazon. The content on this site is my own and doesn’t necessarily represent Amazon’s position.