{"schemaVersion":1,"record":{"key":"path/npc-behavior","type":"path","id":"npc-behavior","lang":"en","title":"NPC behavior","summary":"What a character knows, how it selects an action and how it reaches a destination.","updatedAt":"2026-10-20","status":"active","url":"https://gamemechanics.pro/en/learn/npc-behavior/","jsonUrl":"https://gamemechanics.pro/api/v1/knowledge/en/path/npc-behavior.json","markdownUrl":"https://gamemechanics.pro/content/knowledge/en/path/npc-behavior.md","aliases":[],"tags":[],"sourceIds":[],"sources":[],"sections":[{"id":"prerequisites","title":"Before you start","body":"- [The game loop and time](https://gamemechanics.pro/en/lessons/game-loop/)\n- [States and transitions](https://gamemechanics.pro/en/lessons/state-machines/)\n- [Collision fundamentals](https://gamemechanics.pro/en/lessons/collision-basics/)"},{"id":"sequence","title":"Lesson sequence","body":"1. [NPC perception and target memory](https://gamemechanics.pro/en/lessons/npc-perception/)\n2. [How an NPC selects an action](https://gamemechanics.pro/en/lessons/npc-action-selection/)\n3. [Pathfinding and following a route](https://gamemechanics.pro/en/lessons/npc-pathfinding/)"},{"id":"practice","title":"Put it into practice","body":"Shared Workshop helps define roles and resource conflicts. Maintenance Patrol connects perception, selection and route following into a verifiable system.\n\n- [The shared workshop](https://gamemechanics.pro/en/practice/#shared-workshop)\n- [Maintenance patrol](https://gamemechanics.pro/en/practice/#maintenance-patrol)"},{"id":"outcome","title":"Outcome","body":"A robot with observations, memory, action selection and verified route following."},{"id":"checks","title":"Completion checks","body":"- The log explains every decision.\n- Lost targets and closing doors are handled explicitly."}],"relations":[{"type":"contains","direction":"outgoing","label":"Path materials","key":"lesson/npc-perception","title":"NPC perception and target memory","url":"https://gamemechanics.pro/en/lessons/npc-perception/","jsonUrl":"https://gamemechanics.pro/api/v1/knowledge/en/lesson/npc-perception.json","markdownUrl":"https://gamemechanics.pro/content/knowledge/en/lesson/npc-perception.md"},{"type":"contains","direction":"outgoing","label":"Path materials","key":"lesson/npc-action-selection","title":"How an NPC selects an action","url":"https://gamemechanics.pro/en/lessons/npc-action-selection/","jsonUrl":"https://gamemechanics.pro/api/v1/knowledge/en/lesson/npc-action-selection.json","markdownUrl":"https://gamemechanics.pro/content/knowledge/en/lesson/npc-action-selection.md"},{"type":"contains","direction":"outgoing","label":"Path materials","key":"lesson/npc-pathfinding","title":"Pathfinding and following a route","url":"https://gamemechanics.pro/en/lessons/npc-pathfinding/","jsonUrl":"https://gamemechanics.pro/api/v1/knowledge/en/lesson/npc-pathfinding.json","markdownUrl":"https://gamemechanics.pro/content/knowledge/en/lesson/npc-pathfinding.md"},{"type":"requires","direction":"outgoing","label":"Before you start","key":"lesson/game-loop","title":"The game loop and time","url":"https://gamemechanics.pro/en/lessons/game-loop/","jsonUrl":"https://gamemechanics.pro/api/v1/knowledge/en/lesson/game-loop.json","markdownUrl":"https://gamemechanics.pro/content/knowledge/en/lesson/game-loop.md"},{"type":"requires","direction":"outgoing","label":"Before you start","key":"lesson/state-machines","title":"States and transitions","url":"https://gamemechanics.pro/en/lessons/state-machines/","jsonUrl":"https://gamemechanics.pro/api/v1/knowledge/en/lesson/state-machines.json","markdownUrl":"https://gamemechanics.pro/content/knowledge/en/lesson/state-machines.md"},{"type":"requires","direction":"outgoing","label":"Before you start","key":"lesson/collision-basics","title":"Collision fundamentals","url":"https://gamemechanics.pro/en/lessons/collision-basics/","jsonUrl":"https://gamemechanics.pro/api/v1/knowledge/en/lesson/collision-basics.json","markdownUrl":"https://gamemechanics.pro/content/knowledge/en/lesson/collision-basics.md"},{"type":"practices","direction":"outgoing","label":"Put it into practice","key":"practice/shared-workshop","title":"The shared workshop","url":"https://gamemechanics.pro/en/knowledge/practice/shared-workshop/","jsonUrl":"https://gamemechanics.pro/api/v1/knowledge/en/practice/shared-workshop.json","markdownUrl":"https://gamemechanics.pro/content/knowledge/en/practice/shared-workshop.md"},{"type":"practices","direction":"outgoing","label":"Put it into practice","key":"practice/maintenance-patrol","title":"Maintenance patrol","url":"https://gamemechanics.pro/en/knowledge/practice/maintenance-patrol/","jsonUrl":"https://gamemechanics.pro/api/v1/knowledge/en/practice/maintenance-patrol.json","markdownUrl":"https://gamemechanics.pro/content/knowledge/en/practice/maintenance-patrol.md"},{"type":"reviews","direction":"outgoing","label":"Review through a lens","key":"lens/schell-028","title":"The State Machine","url":"https://gamemechanics.pro/en/knowledge/lens/schell-028/","jsonUrl":"https://gamemechanics.pro/api/v1/knowledge/en/lens/schell-028.json","markdownUrl":"https://gamemechanics.pro/content/knowledge/en/lens/schell-028.md"},{"type":"reviews","direction":"outgoing","label":"Review through a lens","key":"lens/schell-031","title":"Action","url":"https://gamemechanics.pro/en/knowledge/lens/schell-031/","jsonUrl":"https://gamemechanics.pro/api/v1/knowledge/en/lens/schell-031.json","markdownUrl":"https://gamemechanics.pro/content/knowledge/en/lens/schell-031.md"},{"type":"reviews","direction":"outgoing","label":"Review through a lens","key":"lens/schell-062","title":"Transparency","url":"https://gamemechanics.pro/en/knowledge/lens/schell-062/","jsonUrl":"https://gamemechanics.pro/api/v1/knowledge/en/lens/schell-062.json","markdownUrl":"https://gamemechanics.pro/content/knowledge/en/lens/schell-062.md"}],"placements":[],"supersededBy":[],"attributes":{"lessons":[{"id":"npc-perception","url":"https://gamemechanics.pro/en/lessons/npc-perception/","markdownUrl":"https://gamemechanics.pro/content/en/npc-perception.md"},{"id":"npc-action-selection","url":"https://gamemechanics.pro/en/lessons/npc-action-selection/","markdownUrl":"https://gamemechanics.pro/content/en/npc-action-selection.md"},{"id":"npc-pathfinding","url":"https://gamemechanics.pro/en/lessons/npc-pathfinding/","markdownUrl":"https://gamemechanics.pro/content/en/npc-pathfinding.md"}],"prerequisites":[{"id":"game-loop","url":"https://gamemechanics.pro/en/lessons/game-loop/","markdownUrl":"https://gamemechanics.pro/content/en/game-loop.md"},{"id":"state-machines","url":"https://gamemechanics.pro/en/lessons/state-machines/","markdownUrl":"https://gamemechanics.pro/content/en/state-machines.md"},{"id":"collision-basics","url":"https://gamemechanics.pro/en/lessons/collision-basics/","markdownUrl":"https://gamemechanics.pro/content/en/collision-basics.md"}],"practice":[{"id":"shared-workshop","url":"https://gamemechanics.pro/en/practice/#shared-workshop"},{"id":"maintenance-patrol","url":"https://gamemechanics.pro/en/practice/#maintenance-patrol"}],"lenses":[{"id":"schell-028","url":"https://gamemechanics.pro/en/lenses/#schell-028"},{"id":"schell-031","url":"https://gamemechanics.pro/en/lenses/#schell-031"},{"id":"schell-062","url":"https://gamemechanics.pro/en/lenses/#schell-062"}]},"endsAt":null,"provenance":"Original gamemechanics.pro material. Check illustrative examples in your own project.","license":"CC-BY-4.0","codeLicense":"MIT","attribution":"gamemechanics.pro contributors"}}