# oliverromhagen/vrigstad-joyride architecture

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

- Interactive diagram: https://gitdiagram.com/oliverromhagen/vrigstad-joyride
- Repository: https://github.com/oliverromhagen/vrigstad-joyride

## Overview

Vrigstad Joyride is a browser open-world driving game, accompanied by an interactive 3D map of the same village. Players explore on foot or in cars, evade police, and use the kiosk and scrapyard/garage for money, purchases, repairs, tuning, and paint; the README documents these gameplay capabilities, but sampled game wiring is incomplete. The map constructs roads, buildings, water, and streetscape from shared world data. Edges are limited to calls visible in excerpts, indexed references, or documented page entry points; unsampled gameplay links are omitted rather than inferred.

Main entry points: [`src/map/main.ts`](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/map/main.ts) (Map runtime), [`src/world/roads.ts`](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/roads.ts) (Road network), [`src/game/main.ts`](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/game/main.ts) (Game runtime), [`src/world/streetscape.ts`](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/streetscape.ts) (Street layout)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Game runtime"]
  node_gameruntime["Game runtime<br/>[main.ts]"]
  node_settings["Game settings<br/>[settings.svelte.ts]"]
  node_groundtexture["Ground texture<br/>[ground-texture.ts]"]
  node_commands["Game commands<br/>[commands.ts]"]
end

subgraph group_world["World model"]
  node_worlddata["Village data model<br/>[data.ts]"]
  node_heightfield["Elevation field<br/>[heightfield.ts]"]
  node_roads["Road network<br/>[roads.ts]"]
  node_buildings["Building index<br/>[buildings.ts]"]
  node_streetrules["Street classification"]
  node_streetscape["Street layout<br/>[streetscape.ts]"]
  node_furnituredefs["Furniture definitions<br/>[definitions.ts]"]
  node_furnitureplacement["Furniture placement<br/>[placement.ts]"]
  node_vegetation["Vegetation renderer"]
  node_treemodels["Tree models<br/>[tree-models.ts]"]
  node_random["Seeded randomness<br/>[random.ts]"]
  node_geometry["Polygon geometry<br/>[polygon.ts]"]
end

subgraph group_map["Interactive map"]
  node_mapruntime["Map runtime<br/>[main.ts]"]
end

subgraph group_business["Economy and garage"]
  node_economy["Wallet and economy<br/>[economy.ts]"]
  node_garage["Garage choices<br/>[garage.ts]"]
  node_garagehud["Garage HUD<br/>[garage-hud.ts]"]
  node_skroten["Scrapyard business<br/>[skroten.ts]"]
end

node_player(("Player"))

node_player -->|"plays"| node_gameruntime
node_player -->|"opens map"| node_mapruntime
node_gameruntime -->|"configures"| node_settings
node_gameruntime -->|"creates"| node_groundtexture
node_garagehud -->|"draws"| node_garage
node_garage -->|"formats prices"| node_economy
node_garage -->|"queries services"| node_skroten
node_mapruntime -->|"creates"| node_roads
node_mapruntime -->|"creates"| node_buildings
node_mapruntime -->|"classifies"| node_streetrules
node_mapruntime -->|"builds"| node_streetscape
node_roads -->|"samples elevation"| node_heightfield
node_roads -->|"reads"| node_worlddata
node_heightfield -->|"reads"| node_worlddata
node_buildings -->|"reads"| node_worlddata
node_streetscape -->|"uses road geometry"| node_roads
node_streetrules -->|"classifies roads"| node_roads
node_furnitureplacement -->|"uses definitions"| node_furnituredefs
node_vegetation -->|"uses models"| node_treemodels
node_treemodels -->|"uses seeded choices"| node_random
node_streetscape -->|"measures segments"| node_geometry

click node_gameruntime "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/game/main.ts"
click node_settings "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/game/settings.svelte.ts"
click node_groundtexture "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/game/render/ground-texture.ts"
click node_commands "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/game/commands.ts"
click node_economy "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/game/economy.ts"
click node_garage "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/game/garage.ts"
click node_garagehud "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/game/garage-hud.ts"
click node_skroten "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/game/skroten.ts"
click node_worlddata "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/data.ts"
click node_heightfield "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/heightfield.ts"
click node_roads "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/roads.ts"
click node_buildings "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/buildings.ts"
click node_streetrules "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/streetscape-rules.ts"
click node_streetscape "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/streetscape.ts"
click node_furnituredefs "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/furniture/definitions.ts"
click node_furnitureplacement "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/furniture/placement.ts"
click node_mapruntime "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/map/main.ts"
click node_vegetation "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/mesh/vegetation-renderer.ts"
click node_treemodels "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/mesh/tree-models.ts"
click node_random "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/random.ts"
click node_geometry "https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/polygon.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_gameruntime,node_settings,node_groundtexture,node_commands toneBlue
class node_worlddata,node_heightfield,node_roads,node_buildings,node_streetrules,node_streetscape,node_furnituredefs,node_furnitureplacement,node_vegetation,node_treemodels,node_random,node_geometry toneAmber
class node_mapruntime toneMint
class node_economy,node_garage,node_garagehud,node_skroten toneRose
class node_player toneIndigo
```

## Components

### Game runtime

- [Game runtime](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/game/main.ts): `src/game/main.ts`
- [Game settings](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/game/settings.svelte.ts): `src/game/settings.svelte.ts`
- [Ground texture](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/game/render/ground-texture.ts): `src/game/render/ground-texture.ts`
- [Game commands](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/game/commands.ts): `src/game/commands.ts`

### World model

- [Village data model](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/data.ts): `src/world/data.ts`
- [Elevation field](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/heightfield.ts): `src/world/heightfield.ts`
- [Road network](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/roads.ts): `src/world/roads.ts`
- [Building index](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/buildings.ts): `src/world/buildings.ts`
- [Street classification](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/streetscape-rules.ts): `src/world/streetscape-rules.ts`
- [Street layout](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/streetscape.ts): `src/world/streetscape.ts`
- [Furniture definitions](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/furniture/definitions.ts): `src/world/furniture/definitions.ts`
- [Furniture placement](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/furniture/placement.ts): `src/world/furniture/placement.ts`
- [Vegetation renderer](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/mesh/vegetation-renderer.ts): `src/world/mesh/vegetation-renderer.ts`
- [Tree models](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/mesh/tree-models.ts): `src/world/mesh/tree-models.ts`
- [Seeded randomness](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/random.ts): `src/world/random.ts`
- [Polygon geometry](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/world/polygon.ts): `src/world/polygon.ts`

### Interactive map

- [Map runtime](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/map/main.ts): `src/map/main.ts`

### Economy and garage

- [Wallet and economy](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/game/economy.ts): `src/game/economy.ts`
- [Garage choices](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/game/garage.ts): `src/game/garage.ts`
- [Garage HUD](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/game/garage-hud.ts): `src/game/garage-hud.ts`
- [Scrapyard business](https://github.com/oliverromhagen/vrigstad-joyride/blob/main/src/game/skroten.ts): `src/game/skroten.ts`

### Other components

- **Player**

## Connections

- Player → Game runtime: plays (evidence: `README.md`)
- Player → Map runtime: opens map (evidence: `README.md`)
- Game runtime → Game settings: configures (evidence: `src/game/main.ts`)
- Game runtime → Ground texture: creates (evidence: `src/game/main.ts`)
- Garage HUD → Garage choices: draws (evidence: `src/game/garage-hud.ts`)
- Garage choices → Wallet and economy: formats prices (evidence: `src/game/garage.ts`)
- Garage choices → Scrapyard business: queries services (evidence: `src/game/garage.ts`)
- Map runtime → Road network: creates (evidence: `src/map/main.ts`)
- Map runtime → Building index: creates (evidence: `src/map/main.ts`)
- Map runtime → Street classification: classifies (evidence: `src/map/main.ts`)
- Map runtime → Street layout: builds (evidence: `src/map/main.ts`)
- Road network → Elevation field: samples elevation (evidence: `src/world/roads.ts`)
- Road network → Village data model: reads (evidence: `src/world/roads.ts`)
- Elevation field → Village data model: reads (evidence: `src/world/heightfield.ts`)
- Building index → Village data model: reads (evidence: `src/world/buildings.ts`)
- Street layout → Road network: uses road geometry (evidence: `src/world/streetscape.ts`)
- Street classification → Road network: classifies roads (evidence: `src/world/streetscape-rules.ts`)
- Furniture placement → Furniture definitions: uses definitions (evidence: `src/world/furniture/placement.ts`)
- Vegetation renderer → Tree models: uses models (evidence: `src/world/mesh/vegetation-renderer.ts`)
- Tree models → Seeded randomness: uses seeded choices (evidence: `src/world/mesh/tree-models.ts`)
- Street layout → Polygon geometry: measures segments (evidence: `src/world/streetscape.ts`)
