# daolyap/tonights-the-night architecture

> Architecture diagram of the GitHub repository daolyap/tonights-the-night, 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/daolyap/tonights-the-night
- Repository: https://github.com/daolyap/tonights-the-night
- Video tour (about a minute): https://gitdiagram.com/daolyap/tonights-the-night/video

## Overview

Tonight’s The Night is a configurable GTA V riot mod. The player opens the in-game menu, selects a mode and settings, then the Director runs the simulation: factions and spawn profiles define the crowds, while gameplay systems handle escalation, pursuit, infection, ambience and other effects. Configuration and profiles make the experience customizable and persistent. The Director excerpt confirms orchestration of several systems; README-described capabilities are included, but links to unsampled implementations are omitted where their wiring cannot be verified.

Main entry points: [`src/TonightsTheNight/Core/Director.cs`](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Director.cs) (Riot Director), [`src/TonightsTheNight/Factions/Faction.cs`](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Factions/Faction.cs) (Faction Model), [`src/TonightsTheNight/Menu/RiotMenu.cs`](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Menu/RiotMenu.cs) (In-Game Menu), [`src/TonightsTheNight/Config/Profiles.cs`](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Config/Profiles.cs) (Saved Profiles)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Runtime Control"]
  node_director["Riot Director<br/>[Director.cs]"]
  node_registry["Entity Registry<br/>[EntityRegistry.cs]"]
end

subgraph group_modes["Modes and Factions"]
  node_modes["Stock Modes<br/>[StockModes.cs]"]
  node_faction["Faction Model<br/>[Faction.cs]"]
  node_mode_library["Mode Library<br/>[ModeLibrary.cs]"]
  node_relationships["Faction Relations"]
  node_spawn_profile["Spawn Profiles<br/>[SpawnProfile.cs]"]
  node_weapons["Weapon Presets<br/>[WeaponPresets.cs]"]
end

subgraph group_simulation["Gameplay Simulation"]
  node_spawner["Crowd Spawner<br/>[Spawner.cs]"]
  node_escalation["Escalation<br/>[Escalation.cs]"]
  node_contagion["Infection Spread<br/>[Contagion.cs]"]
  node_pursuit["Vehicle Pursuit<br/>[Pursuit.cs]"]
  node_hunter["Hunter Encounter<br/>[Hunter.cs]"]
  node_ambience["World Ambience<br/>[Ambience.cs]"]
  node_riot_zone["Riot Zones<br/>[RiotZone.cs]"]
  node_hud["HUD and Timer<br/>[Hud.cs]"]
  node_looting["Looting<br/>[Looting.cs]"]
end

subgraph group_settings["Settings and UI"]
  node_menu["In-Game Menu<br/>[RiotMenu.cs]"]
  node_config["Config Store<br/>[ConfigStore.cs]"]
  node_defaults["Default Settings<br/>[DefaultConfig.cs]"]
  node_profiles["Saved Profiles<br/>[Profiles.cs]"]
  node_json["JSON Utilities<br/>[Json.cs]"]
end

node_player(("Player"))
node_game["GTA V Runtime"]

node_player -->|"opens F6 menu"| node_menu
node_menu -->|"edits settings"| node_config
node_menu -->|"saves or loads"| node_profiles
node_profiles -->|"imports and exports"| node_config
node_profiles -->|"parses and writes"| node_json
node_defaults -->|"builds values"| node_json
node_mode_library -->|"loads mode data"| node_modes
node_modes -->|"defines factions"| node_faction
node_faction -->|"sets spawn rules"| node_spawn_profile
node_faction -->|"defines loadouts"| node_weapons
node_director -->|"tracks entities"| node_registry
node_director -->|"ends pursuits"| node_pursuit
node_director -->|"ends looting"| node_looting
node_director -->|"runs riot simulation"| node_spawner
node_director -->|"sets faction relations"| node_relationships
node_director -->|"controls game entities"| node_game
node_spawner -->|"creates peds and vehicles"| node_game
node_hunter -->|"runs encounter"| node_game
node_pursuit -->|"tasks chase vehicles"| node_game
node_ambience -->|"changes world effects"| node_game
node_player -->|"plays simulation"| node_game

click node_director "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Director.cs"
click node_registry "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/EntityRegistry.cs"
click node_menu "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Menu/RiotMenu.cs"
click node_config "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Config/ConfigStore.cs"
click node_defaults "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Config/DefaultConfig.cs"
click node_profiles "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Config/Profiles.cs"
click node_modes "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Factions/StockModes.cs"
click node_faction "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Factions/Faction.cs"
click node_mode_library "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Factions/ModeLibrary.cs"
click node_relationships "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Factions/RelationshipMatrix.cs"
click node_spawn_profile "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Factions/SpawnProfile.cs"
click node_weapons "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Factions/WeaponPresets.cs"
click node_spawner "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Spawner.cs"
click node_escalation "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Escalation.cs"
click node_contagion "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Contagion.cs"
click node_pursuit "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Pursuit.cs"
click node_hunter "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Hunter.cs"
click node_ambience "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Ambience.cs"
click node_riot_zone "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/RiotZone.cs"
click node_hud "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Hud.cs"
click node_looting "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Looting.cs"
click node_json "https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Util/Json.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_director,node_registry toneBlue
class node_modes,node_faction,node_mode_library,node_relationships,node_spawn_profile,node_weapons toneAmber
class node_spawner,node_escalation,node_contagion,node_pursuit,node_hunter,node_ambience,node_riot_zone,node_hud,node_looting toneMint
class node_menu,node_config,node_defaults,node_profiles,node_json toneRose
class node_player,node_game toneIndigo
```

## Components

### Runtime Control

- [Riot Director](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Director.cs): `src/TonightsTheNight/Core/Director.cs`
- [Entity Registry](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/EntityRegistry.cs): `src/TonightsTheNight/Core/EntityRegistry.cs`

### Modes and Factions

- [Stock Modes](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Factions/StockModes.cs): `src/TonightsTheNight/Factions/StockModes.cs`
- [Faction Model](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Factions/Faction.cs): `src/TonightsTheNight/Factions/Faction.cs`
- [Mode Library](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Factions/ModeLibrary.cs): `src/TonightsTheNight/Factions/ModeLibrary.cs`
- [Faction Relations](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Factions/RelationshipMatrix.cs): `src/TonightsTheNight/Factions/RelationshipMatrix.cs`
- [Spawn Profiles](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Factions/SpawnProfile.cs): `src/TonightsTheNight/Factions/SpawnProfile.cs`
- [Weapon Presets](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Factions/WeaponPresets.cs): `src/TonightsTheNight/Factions/WeaponPresets.cs`

### Gameplay Simulation

- [Crowd Spawner](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Spawner.cs): `src/TonightsTheNight/Core/Spawner.cs`
- [Escalation](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Escalation.cs): `src/TonightsTheNight/Core/Escalation.cs`
- [Infection Spread](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Contagion.cs): `src/TonightsTheNight/Core/Contagion.cs`
- [Vehicle Pursuit](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Pursuit.cs): `src/TonightsTheNight/Core/Pursuit.cs`
- [Hunter Encounter](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Hunter.cs): `src/TonightsTheNight/Core/Hunter.cs`
- [World Ambience](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Ambience.cs): `src/TonightsTheNight/Core/Ambience.cs`
- [Riot Zones](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/RiotZone.cs): `src/TonightsTheNight/Core/RiotZone.cs`
- [HUD and Timer](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Hud.cs): `src/TonightsTheNight/Core/Hud.cs`
- [Looting](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Core/Looting.cs): `src/TonightsTheNight/Core/Looting.cs`

### Settings and UI

- [In-Game Menu](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Menu/RiotMenu.cs): `src/TonightsTheNight/Menu/RiotMenu.cs`
- [Config Store](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Config/ConfigStore.cs): `src/TonightsTheNight/Config/ConfigStore.cs`
- [Default Settings](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Config/DefaultConfig.cs): `src/TonightsTheNight/Config/DefaultConfig.cs`
- [Saved Profiles](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Config/Profiles.cs): `src/TonightsTheNight/Config/Profiles.cs`
- [JSON Utilities](https://github.com/daolyap/tonights-the-night/blob/main/src/TonightsTheNight/Util/Json.cs): `src/TonightsTheNight/Util/Json.cs`

### Other components

- **Player**
- **GTA V Runtime**

## Connections

- Player → In-Game Menu: opens F6 menu
- In-Game Menu → Config Store: edits settings
- In-Game Menu → Saved Profiles: saves or loads
- Saved Profiles → Config Store: imports and exports
- Saved Profiles → JSON Utilities: parses and writes
- Default Settings → JSON Utilities: builds values
- Mode Library → Stock Modes: loads mode data
- Stock Modes → Faction Model: defines factions
- Faction Model → Spawn Profiles: sets spawn rules
- Faction Model → Weapon Presets: defines loadouts
- Riot Director → Entity Registry: tracks entities
- Riot Director → Vehicle Pursuit: ends pursuits
- Riot Director → Looting: ends looting
- Riot Director → Crowd Spawner: runs riot simulation
- Riot Director → Faction Relations: sets faction relations
- Riot Director → GTA V Runtime: controls game entities
- Crowd Spawner → GTA V Runtime: creates peds and vehicles
- Hunter Encounter → GTA V Runtime: runs encounter
- Vehicle Pursuit → GTA V Runtime: tasks chase vehicles
- World Ambience → GTA V Runtime: changes world effects
- Player → GTA V Runtime: plays simulation
