A Non-Player Character, or non-playable character often shortened to NPC, is a character who is usually a part of the program (game), and not controlled by a human but rather by artificial intelligence (AI).
In a traditional role-playing game (RPG) such as Dungeons & Dragons, an NPC is controlled by the gamemaster. Non-player characters populate the fictional world of the game and can fill any role not occupied by a playable character (PC). Non-player characters might be allies, bystanders or competitors to the PCs.
NPCs vary greatly in importance, from the NPC innkeeper seen once by the player characters, to the NPC arch-nemesis who comes back time-after-time again for an entire campaign. While every inhabitant of the game's world except the PC's is NPC's, very few are given any detail by the gamemaster (GM). In fact, most of the minor ones are invented on the spot as needed—doing this well is, in a matter of fact, one of the hallmarks of a good GM. There is some debate about how much work a gamemaster should put into an important NPC's statistics; some players prefer to have every NPC completely defined with stats, skills, and gear, while others define only what is immediately necessary and fill in the rest as the game proceeds. There is also some discussion as to just how important fully fleshed-out NPCs are in any given RPG, but it is a general consensus that the more "real" the NPCs feel, the more fun players will have interacting with them in character.
In some games and in some circumstances, a player who is without a player character of his or her own can temporarily take control of an NPC. Reasons for this vary, but often arise from the player not maintaining a PC within the group and playing the NPC for a session or from the player's PC being unable to act for some time (for example, because they are injured or in another location). Although these characters are still designed and normally controlled by the gamemaster when players are given the opportunity to temporarily control these non-player characters it gives them another perspective on the plot of the game. Some systems, such as Nobilis, encourage this in their rules.
Many game systems have rules for characters sustaining positive allies in the form of NPC followers; hired hands or other dependent stature to the PC. Characters may sometimes help in the design, recruitment, or development of NPCs.
In the Champions game (and related games using the Hero System), a character may have a DNPC, or "dependent non-player character". This is a character controlled by the GM, but for which the Player Character is responsible in some way, and who may be put in harm's way by the PC's choices.
Computer and video games
The term non-player character is also used in console and computer role-playing games to describe entities, not under the direct control of players. Nearly always the connotation is that an NPC is allied with, or at least neutral toward, the player, while hostile characters are referred to as enemies, mobs or creeps. In video games, NPC is sometimes expanded as "non-playable character" or "non-player class".
NPC behavior in computer games is usually scripted and automatic (artificial intelligence), triggered by certain actions or dialogue with the player character(s). In certain multiplayer games, (Neverwinter Nights and Vampire: the Masquerade series, for example), a player that acts as the GM can "possess" both player and non-player characters, controlling their actions in order to further the storyline. More complex games, such as the aforementioned Neverwinter Nights, allow the player to customize the NPCs' behavior by modifying their default scripts or creating entirely new ones.
In some online games, such as Massively Multi-playing Online Role-Playing Games (MMORPGs), NPCs may be entirely unscripted and are essentially regular character avatars controlled by employees of the game company. These "non-players" are often distinguished from player characters by avatar appearance or other visual designation and often serve as in-game support for new players. In other cases, these "live" NPCs are virtual actors, playing regular characters that drive a continuing storyline (as in Myst Online: Uru Live).
In early and less advanced RPGs, NPCs have the only monologue. The code directs the appearance of a dialogue box, floating text, cutscene, or other means of displaying the NPCs' speech or reaction to the player. NPC speeches of this kind are often designed to give an instant impression of the character of the speaker, providing character vignettes, but they may also advance the story or illuminate the world around the PC. Similar to this is the most common form of storytelling, non-branching dialogue, in which the means of displaying NPC speech are the same as above, but the Player Character or avatar responds to or initiates speech with NPCs. In addition to the purposes listed above, this enables the development of the player character.
More advanced RPGs feature interactive dialogue or branching dialogue (dialogue trees). A good example is the games produced by Black Isle Studios and White Wolf, Inc.; every one of their games is multiple-choice roleplaying. When talking to an NPC, the player is presented with a list of dialogue options and may choose between them. Each choice may result in a different response from the NPC. These choices may affect the course of the game, as well as the conversation. At the least, they provide a reference point to the player of his or her relationship with the game world. True dialogues with NPCs are usually very complex, however after you talk with an NPC and turn right back around to talk with them again, no matter how many times you do this, usually they will give you the same exact conversation.