Sandbox: NPC system — Schedule, Task, and Layer architecture
NPC System — Schedule, Task, and Layer Architecture The Sandbox NPC system uses a layered architecture: Layers handle continuous behaviours (navigation, senses,…
s&box BaseNpcLayer: NPC behavior layer base
Abstract base class for NPC behavior layers. Layers provide specific services (navigation, senses, speech) for tasks to use. Properties Methods Usage Inherit fr…
s&box NpcConVars: Global NPC AI settings
NpcConVars Static Class NpcConVars is a static class that defines console variables controlling global NPC AI behavior in s&box. These ConVars can be set via co…
s&box SpeechLayer: NPC speech and subtitles
NPC behavior layer that manages speech state, plays sound files, and renders subtitle text above the NPC's head. Properties Methods Behavior Resolves a random s…
s&box ScheduleBase: NPC schedule base class
Abstract base class for NPC schedules. A schedule executes a sequence of tasks with cancellation support. Properties Methods Behavior Executes tasks sequentiall…
s&box CombatNpc: Combat NPC
CombatNpc Class API Reference CombatNpc is a combat NPC that searches for players, advances on them, fires in bursts, and repositions. When friendly, follows pl…
s&box TaskBase: NPC task base class
Abstract base class for NPC tasks. Tasks are executed as part of a Schedule and return a TaskStatus to indicate their state. Properties Methods TaskStatus Enum …
s&box ScientistNpc: Fear-based NPC
ScientistNpc Class API Reference ScientistNpc is an NPC with a fear system that flees when damaged. When not afraid, wanders or inspects nearby props. Implement…
s&box NavigationLayer: NPC navigation
NPC behavior layer that handles navigation using NavMeshAgent. Provides movement commands and status tracking. Properties Methods Behavior Uses NavMeshAgent for…
s&box RollermineNpc: Physics-driven NPC
RollermineNpc Class API Reference RollermineNpc is a physics-driven NPC that chases players, leaps at them, and bounces off dealing damage on contact. Implement…
s&box SensesLayer: NPC environmental scanning
NPC behavior layer that handles awareness and environmental scanning. Caches visible/audible objects by tag for efficient querying. Properties Methods Behavior …
Sandbox: Full codebase architecture — systems, player components, weapons, tools, NPCs
Sandbox Codebase Architecture Overview The Facepunch Sandbox game is a large reference implementation. Here's a map of the major systems and how they connect. C…
NPC Ragdoll Creation with Clothing Preservation
NPC Ragdoll Creation with Clothing Pattern for creating ragdolls from NPCs including clothing preservation and bone merging. Key APIs **** — copies model, mater…
s&box TaskStatus: NPC task status enum
TaskStatus Enum API Reference TaskStatus is an enum returned by task execution in the NPC system to indicate the current state of a task. Type Signature Values …
Randomized Clothing for NPC Citizens using Dresser.Randomize() on Prefabs
Overview This demonstrates how to create NPC citizen prefabs with randomized clothing using the built-in component. Each time the prefab spawns or is enabled, i…
ModelPhysics — ragdolls and per-bone physics simulation
ModelPhysics — Ragdolls and Per-Bone Physics drives physics simulation per bone on a skinned model. Use it for ragdolls, destructible characters, and physics-dr…
s&box IKillSource: Kill feed attacker interface
IKillSource Interface API Reference IKillSource is an interface for Components that can appear as an attacker in the kill feed. Implement on Player, Npc, explos…
s&box BaseCarryable.IEvent: World model events
BaseCarryable.IEvent Interface API Reference BaseCarryable.IEvent is an interface for receiving world model lifecycle events on carryable objects (weapons, item…
Scene.Trace: Raycasting, Shape Sweeps, Tag Filters, SceneTraceResult Fields, and FindInPhysics
Scene.Trace: Raycasting and Shape Sweeps in s&box is the entry point for all physics traces in s&box. It returns a builder that uses a fluent API. Basic Usage F…
DamageInfo: The Standard Damage Payload — Properties, Usage, and Custom Types
DamageInfo: The Standard Damage Payload is a class (not a struct) used to pass damage information between game systems. It is intentionally a class so games can…