# evel7/game architecture

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

- Interactive diagram: https://gitdiagram.com/evel7/game
- Repository: https://github.com/evel7/game

## Overview

ENDLESS DRIFT is a browser-based 3D driving game with an optional online service. The player selects a car, map and mode, then drives through generated tracks or open-field arenas; the game simulates vehicle physics, renders the world and records results and progression. Online play adds matchmaking, rooms, shared vehicle state, accounts, ratings and leaderboards. The graph preserves README capabilities and indexed core modules. Several client connections are inferred from the main-module role, so those edges are dashed; sampled excerpts do not expose their call sites.

Main entry points: [`src/main.js`](https://github.com/evel7/game/blob/main/src/main.js) (Game orchestration), [`src/maps.js`](https://github.com/evel7/game/blob/main/src/maps.js) (Maps and scenery), [`server/index.js`](https://github.com/evel7/game/blob/main/server/index.js) (Room server), [`src/track.js`](https://github.com/evel7/game/blob/main/src/track.js) (Procedural tracks)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Game runtime"]
  node_game["Game orchestration<br/>[main.js]"]
  node_controls["Input handling<br/>[input.js]"]
  node_effects["Audio and effects<br/>[audio.js]"]
  node_visualfx["Visual effects<br/>[fx.js]"]
end

subgraph group_world["World and vehicles"]
  node_vehicle["Vehicle physics<br/>[vehicle.js]"]
  node_cars["Car specifications<br/>[cars.js]"]
  node_car_model["Car models<br/>[carmodel.js]"]
  node_track["Procedural tracks<br/>[track.js]"]
  node_maps["Maps and scenery<br/>[maps.js]"]
  node_field["Open-field arenas<br/>[field.js]"]
  node_ai["Racing opponents<br/>[ai.js]"]
end

subgraph group_online["Online service"]
  node_browser_api["Cloud API client<br/>[api.js]"]
  node_network["Match networking<br/>[net.js]"]
  node_server["Room server<br/>[index.js]"]
  node_accounts["Accounts and rankings<br/>[accounts.js]"]
end

subgraph group_persistence["Player data"]
  node_progress["Progress and tuning<br/>[progress.js]"]
  node_store[("Server data store<br/>[store.js]")]
end

node_player(("Player"))

node_player -->|"plays"| node_game
node_game -.->|"reads input"| node_controls
node_game -.->|"simulates"| node_vehicle
node_game -.->|"selects cars"| node_cars
node_game -->|"renders cars"| node_car_model
node_game -.->|"builds tracks"| node_track
node_game -.->|"uses maps"| node_maps
node_game -.->|"builds arenas"| node_field
node_game -.->|"runs opponents"| node_ai
node_game -.->|"plays audio"| node_effects
node_game -.->|"renders effects"| node_visualfx
node_game -.->|"updates progress"| node_progress
node_game -.->|"syncs races"| node_network
node_game -.->|"requests cloud data"| node_browser_api
node_track -->|"builds props"| node_maps
node_maps -->|"uses vegetation"| node_field
node_progress -->|"simulates tuning"| node_vehicle
node_browser_api -.->|"sends requests"| node_server
node_network -.->|"exchanges race state"| node_server
node_server -.->|"uses accounts"| node_accounts
node_accounts -->|"reads and writes"| node_store

click node_game "https://github.com/evel7/game/blob/main/src/main.js"
click node_controls "https://github.com/evel7/game/blob/main/src/input.js"
click node_effects "https://github.com/evel7/game/blob/main/src/audio.js"
click node_visualfx "https://github.com/evel7/game/blob/main/src/fx.js"
click node_vehicle "https://github.com/evel7/game/blob/main/src/vehicle.js"
click node_cars "https://github.com/evel7/game/blob/main/src/cars.js"
click node_car_model "https://github.com/evel7/game/blob/main/src/carmodel.js"
click node_track "https://github.com/evel7/game/blob/main/src/track.js"
click node_maps "https://github.com/evel7/game/blob/main/src/maps.js"
click node_field "https://github.com/evel7/game/blob/main/src/field.js"
click node_ai "https://github.com/evel7/game/blob/main/src/ai.js"
click node_progress "https://github.com/evel7/game/blob/main/src/progress.js"
click node_browser_api "https://github.com/evel7/game/blob/main/src/api.js"
click node_network "https://github.com/evel7/game/blob/main/src/net.js"
click node_server "https://github.com/evel7/game/blob/main/server/index.js"
click node_accounts "https://github.com/evel7/game/blob/main/server/accounts.js"
click node_store "https://github.com/evel7/game/blob/main/server/store.js"

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_game,node_controls,node_effects,node_visualfx toneBlue
class node_vehicle,node_cars,node_car_model,node_track,node_maps,node_field,node_ai toneAmber
class node_browser_api,node_network,node_server,node_accounts toneMint
class node_progress,node_store toneRose
class node_player toneIndigo
```

## Components

### Game runtime

- [Game orchestration](https://github.com/evel7/game/blob/main/src/main.js): `src/main.js`
- [Input handling](https://github.com/evel7/game/blob/main/src/input.js): `src/input.js`
- [Audio and effects](https://github.com/evel7/game/blob/main/src/audio.js): `src/audio.js`
- [Visual effects](https://github.com/evel7/game/blob/main/src/fx.js): `src/fx.js`

### World and vehicles

- [Vehicle physics](https://github.com/evel7/game/blob/main/src/vehicle.js): `src/vehicle.js`
- [Car specifications](https://github.com/evel7/game/blob/main/src/cars.js): `src/cars.js`
- [Car models](https://github.com/evel7/game/blob/main/src/carmodel.js): `src/carmodel.js`
- [Procedural tracks](https://github.com/evel7/game/blob/main/src/track.js): `src/track.js`
- [Maps and scenery](https://github.com/evel7/game/blob/main/src/maps.js): `src/maps.js`
- [Open-field arenas](https://github.com/evel7/game/blob/main/src/field.js): `src/field.js`
- [Racing opponents](https://github.com/evel7/game/blob/main/src/ai.js): `src/ai.js`

### Online service

- [Cloud API client](https://github.com/evel7/game/blob/main/src/api.js): `src/api.js`
- [Match networking](https://github.com/evel7/game/blob/main/src/net.js): `src/net.js`
- [Room server](https://github.com/evel7/game/blob/main/server/index.js): `server/index.js`
- [Accounts and rankings](https://github.com/evel7/game/blob/main/server/accounts.js): `server/accounts.js`

### Player data

- [Progress and tuning](https://github.com/evel7/game/blob/main/src/progress.js): `src/progress.js`
- [Server data store](https://github.com/evel7/game/blob/main/server/store.js): `server/store.js`

### Other components

- **Player**

## Connections

- Player → Game orchestration: plays (evidence: `README.md`)
- Game orchestration → Input handling: reads input (evidence: `src/main.js`)
- Game orchestration → Vehicle physics: simulates (evidence: `src/main.js`)
- Game orchestration → Car specifications: selects cars (evidence: `src/main.js`)
- Game orchestration → Car models: renders cars (evidence: `src/main.js`)
- Game orchestration → Procedural tracks: builds tracks (evidence: `src/main.js`)
- Game orchestration → Maps and scenery: uses maps (evidence: `src/main.js`)
- Game orchestration → Open-field arenas: builds arenas (evidence: `src/main.js`)
- Game orchestration → Racing opponents: runs opponents (evidence: `src/main.js`)
- Game orchestration → Audio and effects: plays audio (evidence: `src/main.js`)
- Game orchestration → Visual effects: renders effects (evidence: `src/main.js`)
- Game orchestration → Progress and tuning: updates progress (evidence: `src/main.js`)
- Game orchestration → Match networking: syncs races (evidence: `src/main.js`)
- Game orchestration → Cloud API client: requests cloud data (evidence: `src/main.js`)
- Procedural tracks → Maps and scenery: builds props (evidence: `src/track.js`)
- Maps and scenery → Open-field arenas: uses vegetation (evidence: `src/maps.js`)
- Progress and tuning → Vehicle physics: simulates tuning (evidence: `src/progress.js`)
- Cloud API client → Room server: sends requests
- Match networking → Room server: exchanges race state
- Room server → Accounts and rankings: uses accounts (evidence: `server/index.js`)
- Accounts and rankings → Server data store: reads and writes (evidence: `server/accounts.js`)
