# facepunch/sbox-public architecture

> Architecture diagram of the GitHub repository facepunch/sbox-public, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-25). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/facepunch/sbox-public
- Repository: https://github.com/facepunch/sbox-public

## Overview

s&box is a Source 2/.NET game engine with an editor and game runtime. A creator’s broad workflow is to open the editor, work with project content and tools, and run a game; the README establishes those product capabilities, while the tree identifies their principal subsystems. The sampled engine loop explicitly ticks and renders game, menu, and tools DLLs. Most subsystem wiring was not sampled, so the graph shows only documented product relationships and direct calls visible in source; it does not claim a complete execution pipeline.

Main entry points: [`engine/Sandbox.Engine/Core/EngineLoop.cs`](https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Core/EngineLoop.cs) (Engine loop), [`engine/Launcher/SboxDev/Launcher.cs`](https://github.com/facepunch/sbox-public/blob/master/engine/Launcher/SboxDev/Launcher.cs) (Editor launcher), [`engine/Launcher/Sbox/Launcher.cs`](https://github.com/facepunch/sbox-public/blob/master/engine/Launcher/Sbox/Launcher.cs) (Game launcher), [`engine/Sandbox.Engine/EditorSystem.cs`](https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/EditorSystem.cs) (Editor system)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_launch["Launch and loop"]
  node_editor_entry["Editor launcher<br/>[Launcher.cs]"]
  node_game_entry["Game launcher<br/>[Launcher.cs]"]
  node_engine_loop["Engine loop<br/>[EngineLoop.cs]"]
end

subgraph group_editor["Editor and tools"]
  node_editor_system["Editor system<br/>[EditorSystem.cs]"]
  node_tool_catalog["Native tools<br/>[EngineTools.cs]"]
  node_panel_gallery["Panel gallery"]
  node_scene_gizmos["Scene gizmos<br/>[Gizmo.cs]"]
end

subgraph group_runtime["Game runtime"]
  node_game_api["Game API<br/>[Game.cs]"]
  node_scene_runtime["Scene runtime<br/>[DooEngine.cs]"]
  node_terrain["Terrain resources<br/>[TerrainStorage.cs]"]
  node_clutter["Clutter storage"]
end

subgraph group_content["Content and compilation"]
  node_compiler["Project compiler<br/>[Compiler.cs]"]
  node_code_upgrade["Code upgrader<br/>[Assembly.cs]"]
  node_mount_host["Mount host<br/>[MountHost.cs]"]
  node_game_mounts["Game format mounts<br/>[QuakeMount.cs]"]
end

subgraph group_platform["Platform services"]
  node_access_control["Code access rules<br/>[AccessControl.cs]"]
  node_filesystem["Engine filesystems"]
  node_keybindings["Key bindings"]
  node_workshop_query["Workshop queries<br/>[Storage.Query.cs]"]
end

node_creator(("Creator"))
node_steam{{"Steam Workshop"}}

node_creator -->|"launches editor"| node_editor_entry
node_creator -->|"runs game"| node_game_entry
node_engine_loop -->|"ticks tools"| node_editor_system
node_engine_loop -->|"ticks game"| node_game_api
node_engine_loop -->|"runs scene scripts"| node_scene_runtime
node_editor_entry -.->|"starts engine"| node_engine_loop
node_game_entry -.->|"starts engine"| node_engine_loop
node_editor_system -.->|"opens native tools"| node_tool_catalog
node_steam -.->|"provides query results"| node_workshop_query
node_workshop_query -.->|"queries items"| node_steam
node_filesystem -->|"provides file access"| node_keybindings

click node_editor_entry "https://github.com/facepunch/sbox-public/blob/master/engine/Launcher/SboxDev/Launcher.cs"
click node_game_entry "https://github.com/facepunch/sbox-public/blob/master/engine/Launcher/Sbox/Launcher.cs"
click node_engine_loop "https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Core/EngineLoop.cs"
click node_editor_system "https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/EditorSystem.cs"
click node_tool_catalog "https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Tools/EngineTools.cs"
click node_panel_gallery "https://github.com/facepunch/sbox-public/blob/master/engine/Launcher/PanelGallery/PanelGalleryAppSystem.cs"
click node_scene_gizmos "https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Editor/Gizmos/Gizmo.cs"
click node_game_api "https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Game/Game/Game.cs"
click node_scene_runtime "https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Systems/Doo/DooEngine.cs"
click node_terrain "https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Resources/Terrain/TerrainStorage.cs"
click node_clutter "https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Scene/GameObjectSystems/ClutterGridSystem.Storage.cs"
click node_compiler "https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Compiling/Compiler/Compiler.cs"
click node_code_upgrade "https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.CodeUpgrader/Assembly.cs"
click node_mount_host "https://github.com/facepunch/sbox-public/blob/master/engine/Mounting/Sandbox.Mounting/MountHost/MountHost.cs"
click node_game_mounts "https://github.com/facepunch/sbox-public/blob/master/engine/Mounting/Sandbox.Mounting.Quake/QuakeMount.cs"
click node_access_control "https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Access/AccessControl.cs"
click node_filesystem "https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Systems/Filesystem/EngineFileSystem.cs"
click node_keybindings "https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Systems/Input/KeyBindings.Storage.cs"
click node_workshop_query "https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Systems/Filesystem/Storage/Storage.Query.cs"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_editor_entry,node_game_entry,node_engine_loop toneBlue
class node_editor_system,node_tool_catalog,node_panel_gallery,node_scene_gizmos toneAmber
class node_game_api,node_scene_runtime,node_terrain,node_clutter toneMint
class node_compiler,node_code_upgrade,node_mount_host,node_game_mounts toneRose
class node_access_control,node_filesystem,node_keybindings,node_workshop_query,node_creator,node_steam toneIndigo
```

## Components

### Launch and loop

- [Editor launcher](https://github.com/facepunch/sbox-public/blob/master/engine/Launcher/SboxDev/Launcher.cs): `engine/Launcher/SboxDev/Launcher.cs`
- [Game launcher](https://github.com/facepunch/sbox-public/blob/master/engine/Launcher/Sbox/Launcher.cs): `engine/Launcher/Sbox/Launcher.cs`
- [Engine loop](https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Core/EngineLoop.cs): `engine/Sandbox.Engine/Core/EngineLoop.cs`

### Editor and tools

- [Editor system](https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/EditorSystem.cs): `engine/Sandbox.Engine/EditorSystem.cs`
- [Native tools](https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Tools/EngineTools.cs): `engine/Sandbox.Tools/EngineTools.cs`
- [Panel gallery](https://github.com/facepunch/sbox-public/blob/master/engine/Launcher/PanelGallery/PanelGalleryAppSystem.cs): `engine/Launcher/PanelGallery/PanelGalleryAppSystem.cs`
- [Scene gizmos](https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Editor/Gizmos/Gizmo.cs): `engine/Sandbox.Engine/Editor/Gizmos/Gizmo.cs`

### Game runtime

- [Game API](https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Game/Game/Game.cs): `engine/Sandbox.Engine/Game/Game/Game.cs`
- [Scene runtime](https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Systems/Doo/DooEngine.cs): `engine/Sandbox.Engine/Systems/Doo/DooEngine.cs`
- [Terrain resources](https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Resources/Terrain/TerrainStorage.cs): `engine/Sandbox.Engine/Resources/Terrain/TerrainStorage.cs`
- [Clutter storage](https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Scene/GameObjectSystems/ClutterGridSystem.Storage.cs): `engine/Sandbox.Engine/Scene/GameObjectSystems/ClutterGridSystem.Storage.cs`

### Content and compilation

- [Project compiler](https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Compiling/Compiler/Compiler.cs): `engine/Sandbox.Compiling/Compiler/Compiler.cs`
- [Code upgrader](https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.CodeUpgrader/Assembly.cs): `engine/Sandbox.CodeUpgrader/Assembly.cs`
- [Mount host](https://github.com/facepunch/sbox-public/blob/master/engine/Mounting/Sandbox.Mounting/MountHost/MountHost.cs): `engine/Mounting/Sandbox.Mounting/MountHost/MountHost.cs`
- [Game format mounts](https://github.com/facepunch/sbox-public/blob/master/engine/Mounting/Sandbox.Mounting.Quake/QuakeMount.cs): `engine/Mounting/Sandbox.Mounting.Quake/QuakeMount.cs`

### Platform services

- [Code access rules](https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Access/AccessControl.cs): `engine/Sandbox.Access/AccessControl.cs`
- [Engine filesystems](https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Systems/Filesystem/EngineFileSystem.cs): `engine/Sandbox.Engine/Systems/Filesystem/EngineFileSystem.cs`
- [Key bindings](https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Systems/Input/KeyBindings.Storage.cs): `engine/Sandbox.Engine/Systems/Input/KeyBindings.Storage.cs`
- [Workshop queries](https://github.com/facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Systems/Filesystem/Storage/Storage.Query.cs): `engine/Sandbox.Engine/Systems/Filesystem/Storage/Storage.Query.cs`

### Other components

- **Creator**
- **Steam Workshop**

## Connections

- Creator → Editor launcher: launches editor
- Creator → Game launcher: runs game
- Engine loop → Editor system: ticks tools
- Engine loop → Game API: ticks game
- Engine loop → Scene runtime: runs scene scripts
- Editor launcher → Engine loop: starts engine
- Game launcher → Engine loop: starts engine
- Editor system → Native tools: opens native tools
- Steam Workshop → Workshop queries: provides query results
- Workshop queries → Steam Workshop: queries items
- Engine filesystems → Key bindings: provides file access
