# b-poignant/cv-game architecture

> Architecture diagram of the GitHub repository b-poignant/cv-game, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/b-poignant/cv-game
- Repository: https://github.com/b-poignant/cv-game

## Overview

Headhunted is an interactive CV presented as an isometric multiplayer game. A visitor chooses a recruiter identity, explores the CV districts, opens buildings or finds a chest to collect intel, then catches Ben and pitches him a job; a successful pitch reveals contact details. The client renders movement and UI while a Colyseus room validates movement, tracks shared state, and handles the chase and pitch. The README describes the product workflow; several UI, scene, and server connections are supported by the SOURCE INDEX, though their source was not excerpted.

Main entry points: [`src/scenes/MainScene.ts`](https://github.com/b-poignant/cv-game/blob/main/src/scenes/MainScene.ts) (World scene), [`server/rooms/CvRoom.ts`](https://github.com/b-poignant/cv-game/blob/main/server/rooms/CvRoom.ts) (Game room), [`src/game/Game.ts`](https://github.com/b-poignant/cv-game/blob/main/src/game/Game.ts) (Game setup), [`shared/world.ts`](https://github.com/b-poignant/cv-game/blob/main/shared/world.ts) (World and collisions)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Game client"]
  node_entry["Client entry<br/>[main.ts]"]
  node_game["Game setup<br/>[Game.ts]"]
  node_scene["World scene<br/>[MainScene.ts]"]
  node_map["Isometric map<br/>[Map.ts]"]
  node_player["Local movement<br/>[Player.ts]"]
  node_buildings["Building objects<br/>[Building.ts]"]
  node_themes["Theme palettes<br/>[themes.ts]"]
  node_themesource["Theme selection<br/>[ThemeCycle.ts]"]
end

subgraph group_content["CV and interactions"]
  node_cvdata["CV content<br/>[cv.ts]"]
  node_cvpanel["CV panels<br/>[CvPanel.ts]"]
  node_identity["Recruiter identity<br/>[IdentityPanel.ts]"]
  node_intel["Intel collection<br/>[LocalIntel.ts]"]
  node_pitchui["Pitch interface<br/>[PitchFlow.ts]"]
end

subgraph group_network["Multiplayer runtime"]
  node_multiplayer["Room client"]
  node_remoteplayers["Remote visitors"]
  node_pitchchannel["Pitch events<br/>[PitchChannel.ts]"]
  node_room["Game room<br/>[CvRoom.ts]"]
  node_roomstate[("Synchronized state<br/>[CvRoomState.ts]")]
  node_wanderer["Dev movement<br/>[DevWanderer.ts]"]
end

subgraph group_rules["Shared game rules"]
  node_pitchrules["Pitch scoring<br/>[pitch.ts]"]
  node_intelrules["Intel rules<br/>[intel.ts]"]
  node_worldrules["World and collisions<br/>[world.ts]"]
  node_buildingrules["Building layout<br/>[buildings.ts]"]
  node_recruiterrules["Identity rules<br/>[recruiters.ts]"]
end

node_visitor(("Visitor"))

node_visitor -->|"opens game"| node_entry
node_entry -->|"starts"| node_game
node_game -->|"creates"| node_scene
node_game -->|"loads"| node_cvdata
node_game -->|"creates"| node_cvpanel
node_game -->|"creates"| node_identity
node_game -->|"creates"| node_pitchui
node_game -->|"uses"| node_themesource
node_scene -->|"creates"| node_map
node_scene -->|"creates"| node_buildings
node_scene -.->|"hosts"| node_player
node_scene -->|"connects"| node_multiplayer
node_scene -->|"creates"| node_remoteplayers
node_scene -->|"creates"| node_intel
node_scene -->|"creates"| node_pitchchannel
node_scene -->|"opens section"| node_cvpanel
node_multiplayer -->|"joins room"| node_room
node_remoteplayers -->|"observes"| node_roomstate
node_pitchchannel -->|"observes"| node_roomstate
node_room -->|"updates"| node_roomstate
node_room -->|"moves dev"| node_wanderer
node_room -->|"scores offer"| node_pitchrules
node_room -->|"validates collection"| node_intelrules
node_room -->|"builds collisions"| node_worldrules
node_room -->|"validates identity"| node_recruiterrules
node_worldrules -->|"uses footprints"| node_buildingrules
node_scene -->|"renders layout"| node_buildingrules
node_scene -->|"checks reach"| node_intelrules
node_player -->|"checks movement"| node_worldrules
node_visitor -->|"chooses identity"| node_identity
node_visitor -->|"explores districts"| node_scene
node_visitor -->|"makes offer"| node_pitchui
node_room -.->|"returns reward"| node_visitor
node_themesource -.->|"selects palette"| node_themes

click node_entry "https://github.com/b-poignant/cv-game/blob/main/src/main.ts"
click node_game "https://github.com/b-poignant/cv-game/blob/main/src/game/Game.ts"
click node_scene "https://github.com/b-poignant/cv-game/blob/main/src/scenes/MainScene.ts"
click node_map "https://github.com/b-poignant/cv-game/blob/main/src/game/Map.ts"
click node_player "https://github.com/b-poignant/cv-game/blob/main/src/game/Player.ts"
click node_buildings "https://github.com/b-poignant/cv-game/blob/main/src/game/entities/Building.ts"
click node_cvdata "https://github.com/b-poignant/cv-game/blob/main/src/content/cv.ts"
click node_cvpanel "https://github.com/b-poignant/cv-game/blob/main/src/ui/CvPanel.ts"
click node_identity "https://github.com/b-poignant/cv-game/blob/main/src/ui/IdentityPanel.ts"
click node_intel "https://github.com/b-poignant/cv-game/blob/main/src/network/LocalIntel.ts"
click node_pitchui "https://github.com/b-poignant/cv-game/blob/main/src/ui/PitchFlow.ts"
click node_themes "https://github.com/b-poignant/cv-game/blob/main/src/config/themes.ts"
click node_multiplayer "https://github.com/b-poignant/cv-game/blob/main/src/network/MultiplayerClient.ts"
click node_remoteplayers "https://github.com/b-poignant/cv-game/blob/main/src/network/RemotePlayersManager.ts"
click node_pitchchannel "https://github.com/b-poignant/cv-game/blob/main/src/network/PitchChannel.ts"
click node_room "https://github.com/b-poignant/cv-game/blob/main/server/rooms/CvRoom.ts"
click node_roomstate "https://github.com/b-poignant/cv-game/blob/main/server/rooms/CvRoomState.ts"
click node_wanderer "https://github.com/b-poignant/cv-game/blob/main/server/rooms/DevWanderer.ts"
click node_pitchrules "https://github.com/b-poignant/cv-game/blob/main/shared/pitch.ts"
click node_intelrules "https://github.com/b-poignant/cv-game/blob/main/shared/intel.ts"
click node_worldrules "https://github.com/b-poignant/cv-game/blob/main/shared/world.ts"
click node_buildingrules "https://github.com/b-poignant/cv-game/blob/main/shared/buildings.ts"
click node_recruiterrules "https://github.com/b-poignant/cv-game/blob/main/shared/recruiters.ts"
click node_themesource "https://github.com/b-poignant/cv-game/blob/main/src/game/ThemeCycle.ts"

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_entry,node_game,node_scene,node_map,node_player,node_buildings,node_themes,node_themesource toneBlue
class node_cvdata,node_cvpanel,node_identity,node_intel,node_pitchui toneAmber
class node_multiplayer,node_remoteplayers,node_pitchchannel,node_room,node_roomstate,node_wanderer toneMint
class node_pitchrules,node_intelrules,node_worldrules,node_buildingrules,node_recruiterrules toneRose
class node_visitor toneIndigo
```

## Components

### Game client

- [Client entry](https://github.com/b-poignant/cv-game/blob/main/src/main.ts): `src/main.ts`
- [Game setup](https://github.com/b-poignant/cv-game/blob/main/src/game/Game.ts): `src/game/Game.ts`
- [World scene](https://github.com/b-poignant/cv-game/blob/main/src/scenes/MainScene.ts): `src/scenes/MainScene.ts`
- [Isometric map](https://github.com/b-poignant/cv-game/blob/main/src/game/Map.ts): `src/game/Map.ts`
- [Local movement](https://github.com/b-poignant/cv-game/blob/main/src/game/Player.ts): `src/game/Player.ts`
- [Building objects](https://github.com/b-poignant/cv-game/blob/main/src/game/entities/Building.ts): `src/game/entities/Building.ts`
- [Theme palettes](https://github.com/b-poignant/cv-game/blob/main/src/config/themes.ts): `src/config/themes.ts`
- [Theme selection](https://github.com/b-poignant/cv-game/blob/main/src/game/ThemeCycle.ts): `src/game/ThemeCycle.ts`

### CV and interactions

- [CV content](https://github.com/b-poignant/cv-game/blob/main/src/content/cv.ts): `src/content/cv.ts`
- [CV panels](https://github.com/b-poignant/cv-game/blob/main/src/ui/CvPanel.ts): `src/ui/CvPanel.ts`
- [Recruiter identity](https://github.com/b-poignant/cv-game/blob/main/src/ui/IdentityPanel.ts): `src/ui/IdentityPanel.ts`
- [Intel collection](https://github.com/b-poignant/cv-game/blob/main/src/network/LocalIntel.ts): `src/network/LocalIntel.ts`
- [Pitch interface](https://github.com/b-poignant/cv-game/blob/main/src/ui/PitchFlow.ts): `src/ui/PitchFlow.ts`

### Multiplayer runtime

- [Room client](https://github.com/b-poignant/cv-game/blob/main/src/network/MultiplayerClient.ts): `src/network/MultiplayerClient.ts`
- [Remote visitors](https://github.com/b-poignant/cv-game/blob/main/src/network/RemotePlayersManager.ts): `src/network/RemotePlayersManager.ts`
- [Pitch events](https://github.com/b-poignant/cv-game/blob/main/src/network/PitchChannel.ts): `src/network/PitchChannel.ts`
- [Game room](https://github.com/b-poignant/cv-game/blob/main/server/rooms/CvRoom.ts): `server/rooms/CvRoom.ts`
- [Synchronized state](https://github.com/b-poignant/cv-game/blob/main/server/rooms/CvRoomState.ts): `server/rooms/CvRoomState.ts`
- [Dev movement](https://github.com/b-poignant/cv-game/blob/main/server/rooms/DevWanderer.ts): `server/rooms/DevWanderer.ts`

### Shared game rules

- [Pitch scoring](https://github.com/b-poignant/cv-game/blob/main/shared/pitch.ts): `shared/pitch.ts`
- [Intel rules](https://github.com/b-poignant/cv-game/blob/main/shared/intel.ts): `shared/intel.ts`
- [World and collisions](https://github.com/b-poignant/cv-game/blob/main/shared/world.ts): `shared/world.ts`
- [Building layout](https://github.com/b-poignant/cv-game/blob/main/shared/buildings.ts): `shared/buildings.ts`
- [Identity rules](https://github.com/b-poignant/cv-game/blob/main/shared/recruiters.ts): `shared/recruiters.ts`

### Other components

- **Visitor**

## Connections

- Visitor → Client entry: opens game (evidence: `README.md`)
- Client entry → Game setup: starts (evidence: `src/main.ts`)
- Game setup → World scene: creates (evidence: `src/game/Game.ts`)
- Game setup → CV content: loads (evidence: `src/game/Game.ts`)
- Game setup → CV panels: creates (evidence: `src/game/Game.ts`)
- Game setup → Recruiter identity: creates (evidence: `src/game/Game.ts`)
- Game setup → Pitch interface: creates (evidence: `src/game/Game.ts`)
- Game setup → Theme selection: uses (evidence: `src/game/Game.ts`)
- World scene → Isometric map: creates (evidence: `src/scenes/MainScene.ts`)
- World scene → Building objects: creates (evidence: `src/scenes/MainScene.ts`)
- World scene → Local movement: hosts (evidence: `src/scenes/MainScene.ts`)
- World scene → Room client: connects (evidence: `src/scenes/MainScene.ts`)
- World scene → Remote visitors: creates (evidence: `src/scenes/MainScene.ts`)
- World scene → Intel collection: creates (evidence: `src/scenes/MainScene.ts`)
- World scene → Pitch events: creates (evidence: `src/scenes/MainScene.ts`)
- World scene → CV panels: opens section (evidence: `README.md`)
- Room client → Game room: joins room (evidence: `README.md`)
- Remote visitors → Synchronized state: observes (evidence: `src/network/RemotePlayersManager.ts`)
- Pitch events → Synchronized state: observes (evidence: `src/network/PitchChannel.ts`)
- Game room → Synchronized state: updates (evidence: `server/rooms/CvRoom.ts`)
- Game room → Dev movement: moves dev (evidence: `server/rooms/CvRoom.ts`)
- Game room → Pitch scoring: scores offer (evidence: `server/rooms/CvRoom.ts`)
- Game room → Intel rules: validates collection (evidence: `server/rooms/CvRoom.ts`)
- Game room → World and collisions: builds collisions (evidence: `server/rooms/CvRoom.ts`)
- Game room → Identity rules: validates identity (evidence: `server/rooms/CvRoom.ts`)
- World and collisions → Building layout: uses footprints (evidence: `shared/world.ts`)
- World scene → Building layout: renders layout (evidence: `src/scenes/MainScene.ts`)
- World scene → Intel rules: checks reach (evidence: `src/scenes/MainScene.ts`)
- Local movement → World and collisions: checks movement (evidence: `src/game/Player.ts`)
- Visitor → Recruiter identity: chooses identity (evidence: `README.md`)
- Visitor → World scene: explores districts (evidence: `README.md`)
- Visitor → Pitch interface: makes offer (evidence: `README.md`)
- Game room → Visitor: returns reward
- Theme selection → Theme palettes: selects palette
