# hhaider3/project-magellan architecture

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

- Interactive diagram: https://gitdiagram.com/hhaider3/project-magellan
- Repository: https://github.com/hhaider3/project-magellan

## Overview

Endless Drive is a browser-based, procedurally generated driving, boating, and flight game. The player controls the ATLAS through keyboard or touch input; the simulation uses a seeded world and vehicle state, while a worker builds terrain and scenery data for streamed regions. The README also documents weather, day/night, audio, settings, and environmental features. Edges below reflect explicit imports or README-described behavior; worker-to-renderer dispatch and several UI integrations are not shown in the excerpts.

Main entry points: [`world.mjs`](https://github.com/hhaider3/project-magellan/blob/main/world.mjs) (Seeded World), [`game.mjs`](https://github.com/hhaider3/project-magellan/blob/main/game.mjs) (Game Runtime), [`world-worker.mjs`](https://github.com/hhaider3/project-magellan/blob/main/world-worker.mjs) (World Worker), [`flight-motion.mjs`](https://github.com/hhaider3/project-magellan/blob/main/flight-motion.mjs) (Flight Motion)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_play["Game and Controls"]
  node_game["Game Runtime<br/>[game.mjs]"]
  node_vehicle_asset["Vehicle Model<br/>[vehicle-model.mjs]"]
  node_nature_library["Nature Library<br/>[nature-models.mjs]"]
  node_tree_breakage["Tree Breakage<br/>[tree-breakage.mjs]"]
  node_vehicle_controls["Control Axes<br/>[controls.mjs]"]
end

subgraph group_simulation["World Simulation"]
  node_world["Seeded World<br/>[world.mjs]"]
  node_roads["Road Network<br/>[roads.mjs]"]
  node_lakes["Lakes<br/>[lakes.mjs]"]
  node_rivers["Rivers<br/>[rivers.mjs]"]
  node_amphibious["Boat Motion"]
  node_flight["Flight Motion<br/>[flight-motion.mjs]"]
end

subgraph group_generation["World Generation"]
  node_worker["World Worker<br/>[world-worker.mjs]"]
  node_terrain["Terrain<br/>[terrain.mjs]"]
  node_grass_data["Grass Data<br/>[grass-data.mjs]"]
  node_water_data["Water Data<br/>[water-data.mjs]"]
  node_bridges["Bridge Data<br/>[bridge-data.mjs]"]
  node_roadside["Roadside Data<br/>[roadside-data.mjs]"]
end

subgraph group_presentation["Visuals and Audio"]
  node_weather["Weather<br/>[weather.mjs]"]
  node_weather_effects["Weather Effects"]
  node_daylight["Daylight<br/>[daylight.mjs]"]
  node_sky["Sky<br/>[sky.mjs]"]
  node_water_visuals["Water Rendering<br/>[water.mjs]"]
  node_audio["Vehicle Audio<br/>[vehicle-audio.mjs]"]
end

node_player(("Player"))

node_player -->|"controls"| node_game
node_game -->|"creates world"| node_world
node_game -->|"loads model"| node_vehicle_asset
node_game -->|"loads library"| node_nature_library
node_game -->|"creates breakage"| node_tree_breakage
node_world -->|"uses roads"| node_roads
node_world -->|"uses lakes"| node_lakes
node_world -->|"uses rivers"| node_rivers
node_world -->|"steps motion"| node_amphibious
node_world -->|"uses axes"| node_vehicle_controls
node_world -->|"steps flight"| node_flight
node_flight -->|"samples waves"| node_lakes
node_flight -->|"uses axes"| node_vehicle_controls
node_worker -->|"creates world"| node_world
node_worker -->|"builds terrain"| node_terrain
node_worker -->|"builds grass"| node_grass_data
node_worker -->|"builds water"| node_water_data
node_worker -->|"builds bridges"| node_bridges
node_worker -->|"builds roadside"| node_roadside
node_water_visuals -->|"samples waves"| node_lakes
node_weather -.-> node_weather_effects
node_daylight -.-> node_sky
node_game -.-> node_weather
node_game -.-> node_audio

click node_game "https://github.com/hhaider3/project-magellan/blob/main/game.mjs"
click node_vehicle_asset "https://github.com/hhaider3/project-magellan/blob/main/vehicle-model.mjs"
click node_nature_library "https://github.com/hhaider3/project-magellan/blob/main/nature-models.mjs"
click node_tree_breakage "https://github.com/hhaider3/project-magellan/blob/main/tree-breakage.mjs"
click node_vehicle_controls "https://github.com/hhaider3/project-magellan/blob/main/controls.mjs"
click node_world "https://github.com/hhaider3/project-magellan/blob/main/world.mjs"
click node_roads "https://github.com/hhaider3/project-magellan/blob/main/roads.mjs"
click node_lakes "https://github.com/hhaider3/project-magellan/blob/main/lakes.mjs"
click node_rivers "https://github.com/hhaider3/project-magellan/blob/main/rivers.mjs"
click node_amphibious "https://github.com/hhaider3/project-magellan/blob/main/amphibious-motion.mjs"
click node_flight "https://github.com/hhaider3/project-magellan/blob/main/flight-motion.mjs"
click node_worker "https://github.com/hhaider3/project-magellan/blob/main/world-worker.mjs"
click node_terrain "https://github.com/hhaider3/project-magellan/blob/main/terrain.mjs"
click node_grass_data "https://github.com/hhaider3/project-magellan/blob/main/grass-data.mjs"
click node_water_data "https://github.com/hhaider3/project-magellan/blob/main/water-data.mjs"
click node_bridges "https://github.com/hhaider3/project-magellan/blob/main/bridge-data.mjs"
click node_roadside "https://github.com/hhaider3/project-magellan/blob/main/roadside-data.mjs"
click node_weather "https://github.com/hhaider3/project-magellan/blob/main/weather.mjs"
click node_weather_effects "https://github.com/hhaider3/project-magellan/blob/main/weather-effects.mjs"
click node_daylight "https://github.com/hhaider3/project-magellan/blob/main/daylight.mjs"
click node_sky "https://github.com/hhaider3/project-magellan/blob/main/sky.mjs"
click node_water_visuals "https://github.com/hhaider3/project-magellan/blob/main/water.mjs"
click node_audio "https://github.com/hhaider3/project-magellan/blob/main/vehicle-audio.mjs"

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_vehicle_asset,node_nature_library,node_tree_breakage,node_vehicle_controls toneBlue
class node_world,node_roads,node_lakes,node_rivers,node_amphibious,node_flight toneAmber
class node_worker,node_terrain,node_grass_data,node_water_data,node_bridges,node_roadside toneMint
class node_weather,node_weather_effects,node_daylight,node_sky,node_water_visuals,node_audio toneRose
class node_player toneIndigo
```

## Components

### Game and Controls

- [Game Runtime](https://github.com/hhaider3/project-magellan/blob/main/game.mjs): `game.mjs`
- [Vehicle Model](https://github.com/hhaider3/project-magellan/blob/main/vehicle-model.mjs): `vehicle-model.mjs`
- [Nature Library](https://github.com/hhaider3/project-magellan/blob/main/nature-models.mjs): `nature-models.mjs`
- [Tree Breakage](https://github.com/hhaider3/project-magellan/blob/main/tree-breakage.mjs): `tree-breakage.mjs`
- [Control Axes](https://github.com/hhaider3/project-magellan/blob/main/controls.mjs): `controls.mjs`

### World Simulation

- [Seeded World](https://github.com/hhaider3/project-magellan/blob/main/world.mjs): `world.mjs`
- [Road Network](https://github.com/hhaider3/project-magellan/blob/main/roads.mjs): `roads.mjs`
- [Lakes](https://github.com/hhaider3/project-magellan/blob/main/lakes.mjs): `lakes.mjs`
- [Rivers](https://github.com/hhaider3/project-magellan/blob/main/rivers.mjs): `rivers.mjs`
- [Boat Motion](https://github.com/hhaider3/project-magellan/blob/main/amphibious-motion.mjs): `amphibious-motion.mjs`
- [Flight Motion](https://github.com/hhaider3/project-magellan/blob/main/flight-motion.mjs): `flight-motion.mjs`

### World Generation

- [World Worker](https://github.com/hhaider3/project-magellan/blob/main/world-worker.mjs): `world-worker.mjs`
- [Terrain](https://github.com/hhaider3/project-magellan/blob/main/terrain.mjs): `terrain.mjs`
- [Grass Data](https://github.com/hhaider3/project-magellan/blob/main/grass-data.mjs): `grass-data.mjs`
- [Water Data](https://github.com/hhaider3/project-magellan/blob/main/water-data.mjs): `water-data.mjs`
- [Bridge Data](https://github.com/hhaider3/project-magellan/blob/main/bridge-data.mjs): `bridge-data.mjs`
- [Roadside Data](https://github.com/hhaider3/project-magellan/blob/main/roadside-data.mjs): `roadside-data.mjs`

### Visuals and Audio

- [Weather](https://github.com/hhaider3/project-magellan/blob/main/weather.mjs): `weather.mjs`
- [Weather Effects](https://github.com/hhaider3/project-magellan/blob/main/weather-effects.mjs): `weather-effects.mjs`
- [Daylight](https://github.com/hhaider3/project-magellan/blob/main/daylight.mjs): `daylight.mjs`
- [Sky](https://github.com/hhaider3/project-magellan/blob/main/sky.mjs): `sky.mjs`
- [Water Rendering](https://github.com/hhaider3/project-magellan/blob/main/water.mjs): `water.mjs`
- [Vehicle Audio](https://github.com/hhaider3/project-magellan/blob/main/vehicle-audio.mjs): `vehicle-audio.mjs`

### Other components

- **Player**

## Connections

- Player → Game Runtime: controls
- Game Runtime → Seeded World: creates world (evidence: `game.mjs`)
- Game Runtime → Vehicle Model: loads model (evidence: `game.mjs`)
- Game Runtime → Nature Library: loads library (evidence: `game.mjs`)
- Game Runtime → Tree Breakage: creates breakage (evidence: `game.mjs`)
- Seeded World → Road Network: uses roads (evidence: `world.mjs`)
- Seeded World → Lakes: uses lakes (evidence: `world.mjs`)
- Seeded World → Rivers: uses rivers (evidence: `world.mjs`)
- Seeded World → Boat Motion: steps motion (evidence: `world.mjs`)
- Seeded World → Control Axes: uses axes (evidence: `world.mjs`)
- Seeded World → Flight Motion: steps flight (evidence: `world.mjs`)
- Flight Motion → Lakes: samples waves (evidence: `flight-motion.mjs`)
- Flight Motion → Control Axes: uses axes (evidence: `flight-motion.mjs`)
- World Worker → Seeded World: creates world (evidence: `world-worker.mjs`)
- World Worker → Terrain: builds terrain (evidence: `world-worker.mjs`)
- World Worker → Grass Data: builds grass (evidence: `world-worker.mjs`)
- World Worker → Water Data: builds water (evidence: `world-worker.mjs`)
- World Worker → Bridge Data: builds bridges (evidence: `world-worker.mjs`)
- World Worker → Roadside Data: builds roadside (evidence: `world-worker.mjs`)
- Water Rendering → Lakes: samples waves (evidence: `water.mjs`)
- Weather → Weather Effects
- Daylight → Sky
- Game Runtime → Weather
- Game Runtime → Vehicle Audio
