I don't need to test my programs. I have an error-correcting modem.

Legacy:NPC Support

From Unreal Wiki, The Unreal Engine Documentation Site
Jump to: navigation, search

This page is a hub for support of Non-Player Characters (NPCs): any artificially intelligent agent or character that is not meant to act as a player. NPCs can be ambient creatures, various animals, character "extras", neutral individuals, helpful characters, etc. NPCs use a custom AI construct that will serve their unique goals and tasks, whether that be self-preservation, conversation, navigation, etc.

Monsters can be easily considered a specific variety of NPC whose sole purpose is to hunt down and attack players. See Monster Support. This page, however, will focus on custom non-monster NPCs.

The NPC is created to support the game world, to enrich it and either give the player a stronger sense of realism within it or to support the player in their game objectives. For this reason, each NPC class is a product of the game world it lives in; a unique entity whose purpose is directly tied to that world.

Design[edit]

Purpose[edit]

The NPC must have a reason to exist in the game. They may provide the players with information, inventory or immersion in the game. The purpose is normally dictated by the gameplay itself; the goals of the game, the theme, the rules, etc. Keep in mind those elements and concepts of gameplay, such as Balance and Chance, as you design the NPC.

Immersion[edit]

This purpose is simply to support the believability of the game world by existing within it. The NPC "lives" in this world and therefore adds to the illusion that this game world is a real one that the player live in as well. Ambient creatures and other animals can serve this purpose well as they will follow their own rules within this world and largely ignore the goals of the player, but still give the player plenty of opportunity for interaction. But, another common example is citizen NPCs that live out their own lives, but do not interact with the players in a way that impact their gameplay.

Information[edit]

Here the NPC's reason to exist is loosely tied to the goals of the player. Through some combonation of conditions, the player may recieve information from this NPC that will impact their gameplay. Some common examples of this are the "guide" characters that provide the novice player with the most basic instructions for this particular game (where to buy food or weapons in town, who can heal you, how to save your progress), or the character who will give you critical information to allow progress in the game (after paying them a bribe, they tell you where to find the entrance to the dungeon).

Inventory[edit]

This purpose is directly tied to the player's gameplay, where the NPC is to give the player a key piece of inventory, which gives them extra ability. A very common example of this might be the storekeeper who sells you weapons for a price. Another example could be the "sage" character, who can give you a special item that can protect you during the next stage of the game or a key that unlocks the next series of tasks to perform.

Behavior[edit]

The NPC behavior will be designed to serve it's unique purpose. Their behavior may be simple, as in the actions of a song bird, or complex, as in a mentor who directs the player's progress from beginner through mastery. Designing the behavior for your NPC can be difficult, as all possible conditions and posibilities should be considered and factored into the design. Common ways to keep it simple include limiting the behavior to it's essential purpose and limiting the conditions the NPC will have to face. For example, a barkeep who tells local gossip for a price might be a great NPC to give your players information about their game world, but designing a behavior that would be able to believably answer any question the player might ask is virutally impossible. The barkeep's behavior can be limited to just talking about the most probable questions it will be asked. The conditions that the barkeep will engage in conversation can be limited as well by telling the player, "I'm busy right now, come back later.", or, "Hey, I'm just a simple barkeep, I don't know everything."

Self-Preservation[edit]

The most basic NPC behavior to consider is self-preservation. Animals, characters, and just about every other living thing is capable of this behavior. A defense mechanism such as stealth, evasion, or protection should be considered first. Is this the type of creature to run if startled or will it roll up into a ball and show spikes on it's back for defense? Offensive behavior is common, most creatures have some means of attacking in self-defense, even herbavores. Does this character throw a punch if backed into a corner?

Navigation[edit]

The Unreal engine already has a well-designed method of allowing AI agents to navigate: the bot path network. (See also Bot Pathing) However, because the bot path network is designed for bot players, many NPCs will have a purpose that dictates they use another way to navigate; away from the combat or one that allows movement to any space, not just spaces defined by the mapper. While it is possible to design a new method of intelligent navigation; one that doesn't use the bot path network, it will most likely be much more work than the rest of the behavior. It's recommended that navigation behavior be simplified, using any existing methods (such as the bot path network or some simple variation) as much as possible.

Conversation[edit]

As mentioned above, this can be an incredibly complex behavior to design, if all possible situations and conditions are accounted for. The design should be complex enough to carry the illusion of intelligent speech with the NPC, but simple enough that the designer isn't wasting effort on situations or conditions that are rarely met or will not yield a relevant result. For example, you'll want a damsel in distress to yell, "Help!", at the appropriate time, as the train approaches, and to say, "My hero!", once saved by the player, but you'd want to avoid designing her behavior to account for her her response to an obscure question like, "What kind of music do you like?". Again, by limiting the NPC's behavior and at the same time limiting the conditions the NPC will have to face, you avoid having to design too much. Once the damsel is saved, she may insist that she run home, which conveniently avoids any further conversation.

Special Behavior[edit]

This is a unique task this NPC performs. It will most likely be tied directly to the story of the game and the main purpose for this NPC to exist. Perhaps this NPC character is the catburglar that the player is supposed to track down, so their unique behavior is to sneak around at night, steal stuff and leave clues. Maybe this NPC critter is a pack rat that steals a key item from the player at a critical point in the game. The special behavior is less likely to be as simplified as the other major (more common) behaviors, and that's to be expected. The designer may spend the most time developing this behavior.

Appearance[edit]

This is the visual design of the NPC. It should be in line with the overall visual design of the game, the player characters and the other NPCs. It's best to have the tone of the visual design suggest the NPCs purpose and behavior. For example, a simple forest creature's visual design might be basic, with no extra-ordinary consideration, while a unique NPC, critical to the advancement of the game, such as the hostage character the player is to escort through enemy territory, should appear obviously unarmed or hurt, have distinctive facial features or clothing and should generally stand out from the look of other NPCs, player characters and enemies.

Movement and Sound[edit]

The movement and sound design is the acting of the NPC. Will it act like a real animal? Does this NPC character call attention to himself by having an odd voice or moving in a unique way or do they blend into the crowd? Is this NPC subtle, like the bluffing gambler in the saloon, or over the top, like the cartoonish side-kick robot that gives you game hints when the player is stuck. The movement and sound design will be closely tied it's visual design and should likewise suggest both the NPC's purpose and behavior.

Effects, Props and Vehicles[edit]

It is possible for an NPC to have unique effects, props or vehicles in addition to their base design. These are extra pieces to the design, parts that are separate from the NPC itself. By in large, these elements will be spawned or emitted from the NPC (effect), attached to the NPC (prop) or the NPC will be attached to the object (vehicle). Any abilities that the NPC gains by these items would be dependent on their availablity. A gunslinger might have a black hat that falls off once the player has killed him. An ogre may carry an oversized club that he lays down when he sleeps. A gnome may ride a cat or bird. A Egyptian god may drive a charriot made of gold mist. While it's concievable that a player may also use these props or vehicles, by making them unique to the NPC (either too small, too large or otherwise unavailble to the player), the designer can avoid the extra work of creating new player items that may also throw off the game balance.

Construction[edit]

Once a design is formulated, it's time to begin to bring it to life. The physical appearance is achieved through modeling, the acting is achieved through animation and the behavior and special actions are achieved through coding.

Modeling[edit]

Modeling is the process of creating a Mesh or Skeletal Mesh for a character design. This will be the visual representation of that character and the basis for its animations. The model is made up of several triangle polygons (or Faces) that are oriented in 3D space to make up the whole shape of the character. That polygon Mesh also contains the information necessary to properly display one or more Skins (or materials, textures) over the surface of the character model, which is typically called UV mapping.

There are several Third-Party Applications that can handle creation of the polygon model and it's UV mapping, including MayaPLE, a free Personal Learning Edition of a professional 3D modeling and animation program, which is included with Unreal Tournament 2003 and beyond.

See also Player Modeling and Unreal Modeling FAQ.

Rigging[edit]

Rigging is the process of setting up the polygonal model for animation. Depending on the animation requirements of the character's design, each model will have unique rigging requirements with varying levels of complexity. Generally, a character model will be rigged using a Skeleton deformer (sometimes called, Joints, Bones, etc.) to deform the polygon mesh as if it had an internal skeletal structure with hinged connections. A Skeletal deformer allows basic character model manipulation, such as bending of arms and legs, as well as complex manipulation, such as a tail or spine. The individual joints (or bones) of the Skeleton deformer can be connected to create an overal skeletal hierachy, with each appendage (and sub-appendages) recieving inherited movement from it's parent joint.

Rigging models can also use other deformer tools such as Shape deformers, Spline deformers, Lattice deformers, etc., depending on the tools available in the Third-Party Application used. The common element in all these deformer tools is that they will move the individual points that make up the connecting polygonal faces, thereby changing the shape of the overall model.

Animating[edit]

Animating is the process of manipulating the rigging of the character model within a timeline to create a series of sequences that represent various actions the character can make. Typically, the character rigging (skeletal hierarchy or the like) will be positioned and "keyed" at various points in the timeline, just like the keys of a Mover. As the animator moves (or "scrubs") along the timeline, the keyed animation will be played back and the model's rigging will animate the character.

Although the basic premise is the same, depending on the Third-Party Application used, the process of keying positions and saving animated sequences will differ slightly. The main idea is to make sure that the character model moves appropriately in terms of timing, attitude and acting for each animation sequence. Once animation is completed, these series of sequences, that represent each possible action the character can make, will be exported from the Third-Party Application to the Unreal Editor's Animation Browser.

See also Animation.

Coding[edit]

Based on the design of the character's behavior and the character's abilities, the coding will entail a unique degree of complexity, in order to believably represent the chatacter's Artificial Intelligence as well as it's movements, combat abilities, special effects, etc. Once the character animations are available to the Unreal Editor, various Object classes can be created to use those sequences to display the character's existance and behavior. Typically, simple characters can use one class, a Pawn subclass, to represent that character. The Pawn classes are specifically designed to represent characters in the Unreal gamespace, handling Movement, Damage, Dying and other typical character functions as well as the inherited Animation, Physics and Sound functions from Actor. More complex characters (like Player Characters) will require extra Object classes to complete their behavior and potential actions, such as Controllers, Weapons, InventoryAttachments, etc.

Controllers[edit]

UT2003 introduced the use of Controllers in collaboration with Pawns to represent all characters, including AI controlled entities, whereas UT used ScriptedPawns alone (or in conjunction with a ScriptedSequence for special control of individual characters per map). Controller classes are used to dictate the actions of a Pawn and handle it's non-physical elements. While the Pawn is the visual and physical representation of a character, the Controller is the "mind" or "soul" of the character; both the decision making element and the entity that persists if that character Pawn is killed and respawned.

See also Controller Overview.

Testing and Integration[edit]

Once your NPC is available, begin to itegrate it into the game world and among the other players and NPCs. Test it thoroughly to ensure it will serve it's purpose adequately, behave properly under all possible considitions and situations it might face, and will appear, move and sound appropriate to it's purpose and behavior.

Tutorials[edit]

Examples[edit]

  • Nali and Cow – Stock non-Monster NPCs for UT
  • TankVictim – A stock NPC for UT200x found in DM-Insidious
  • The ROOs – Kangaroo Non-Player Characters for UT2004 mappers. And the ROOtator : A mutator designed to populate any map with ROOs; also includes the Australian RooLette and RooHunt minigames.

Related Topics[edit]

Custom Content[edit]

Discussion[edit]

SuperApe: This page is in progress. It will contain information on creating custom NPCs in the unreal engine. (critters, neutral individuals, helpful NPCs, etc.) The idea will be to give general concepts (not a tutorial) and to link to any relevant pages. Working...

SuperApe: The structure of this page is complete. Please give your thoughts here.