A non-player character (NPC), sometimes known as a non-person character or non-playable character, in a game is any character that is not controlled by a player. In video games, this usually means a character controlled by the computer through artificial intelligence. In traditional tabletop role-playing games the term applies to characters controlled by the gamemaster or referee, rather than another player.
In a traditional tabletop role-playing game such as Dungeons & Dragons, an NPC is a fictional character portrayed by the gamemaster. If player characters form the narrative's protagonists, non-player characters can be thought of as the "supporting cast" or "extras" of a roleplaying narrative. Non-player characters populate the fictional world of the game, and can fill any role not occupied by a player character (PC). Non-player characters might be allies, bystanders or competitors to the PCs. NPCs can also be traders that trade currency for things such as equipment or gear. NPCs thus vary in their level of detail. Some may be only a brief description ("You see a man in a corner of the tavern"), while others may have complete game statistics and backstories of their own.
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 defined NPCs are in any given RPG, but it is 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 their 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.
In less traditional RPGs, narrative control is less strictly separated between gamemaster and players. In this case, the line between PC and NPC can be vague.
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.
The term non-player character is also used in video games to describe entities not under the direct control of a player. The term carries a connotation that the character is not hostile towards players; 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, triggered by certain actions or dialogue with the player characters. In certain multi-player 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 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 which drive a continuing storyline (as in Myst Online: Uru Live).
In early and less advanced RPGs, NPCs only had monologue. 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 development of the player character.
More advanced RPGs feature interactive dialogue, or branching dialogue (dialogue trees). A good example are 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.
Ultima is an example of a game series that has advanced from non-branching (Ultima III and earlier) to branching dialogue (from Ultima IV and on). Other role-playing games with branching dialogues include Cosmic Soldier, Megami Tensei, Fire Emblem, Metal Max, Langrisser, SaGa, Ogre Battle, Chrono, Star Ocean, Sakura Wars, Mass Effect, Dragon Age, Radiant Historia, and several Dragon Quest and Final Fantasy games.
Certain video game genres revolve almost entirely around interactions with non-player characters, including visual novels such as Ace Attorney and dating sims such as Tokimeki Memorial, usually featuring complex branching dialogues and often presenting the player's possible responses word-for-word as the player character would say them. Games revolving around relationship-building, including visual novels, dating sims such as Tokimeki Memorial, and some role-playing games such as Shin Megami Tensei: Persona, often give choices that have a different number of associated "mood points" which influence a player character's relationship and future conversations with a non-player character. These games often feature a day-night cycle with a time scheduling system that provides context and relevance to character interactions, allowing players to choose when and if to interact with certain characters, which in turn influences their responses during later conversations. Other examples of such games include Portopia Serial Murder Case, Sound Novels, J.B. Harold Murder Club, Snatcher, Policenauts, Tokimeki Memorial, To Heart, Kanon, Shenmue, Shadow of Memories, Ace Attorney, Fate/stay night, Clannad, Fahrenheit, and Heavy Rain.