An NPC (non-player character) is a character in a game that is controlled by the game's code rather than by a person. Shopkeepers, quest givers, enemies, pedestrians and companions are typical examples.
Why it matters
NPCs make a game world feel populated and give players goals, information and opposition. Their behavior can be as simple as a scripted dialogue line or as complex as a decision system using behavior trees, state machines or pathfinding. Because every NPC consumes CPU time and memory, game engines often simplify distant NPCs or disable them until the player is near.
Example
A basic guard NPC can be described as a small state machine:
Patrol -> sees player -> Chase
Chase -> player in range -> Attack
Chase -> loses sight for 5s -> Patrol
Each state runs a few rules every frame or at fixed intervals, which is cheap enough to run for dozens of characters.
Common mistakes
- Assuming NPC means "enemy". Many NPCs are friendly or neutral.
- Thinking every NPC uses artificial intelligence in the modern sense. Most use hand-written rules.
- Using the term for other human players; players controlled by bots are normally called bots.
Related
Get notified when this term updates
Plus occasional practical tips on uptime and monitoring, nothing else. Unsubscribe anytime.
यह पेज सामान्य जानकारी है, जिसे हमारी संपादकीय टीम ने लिखा है और दस्तावेज़ीकरण बदलने पर अपडेट किया जाता है। सर्वर और प्रदाता अलग-अलग होते हैं, इसलिए बदलाव पहले सुरक्षित तरीके से जाँचें। देखें: संपादकीय नीति और अस्वीकरण.