# dgreenheck/tidewater architecture

> Architecture diagram of the GitHub repository dgreenheck/tidewater, 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/dgreenheck/tidewater
- Repository: https://github.com/dgreenheck/tidewater

## Overview

Tidewater is a browser-based WebGPU island fishing game. The player explores on foot or by boat, fishes in location- and time-dependent water, fights and records catches, then sells fish and buys gear. The runtime also builds a detailed island, ocean, sky and wildlife scene, with audio and post-processing. The graph follows the documented capabilities and sampled startup/rendering code; some game and world wiring is documented in the README but its implementation was not sampled.

Main entry points: [`src/App.js`](https://github.com/dgreenheck/tidewater/blob/main/src/App.js) (Game orchestrator), [`src/main.js`](https://github.com/dgreenheck/tidewater/blob/main/src/main.js) (Browser entry), [`src/game/Game.js`](https://github.com/dgreenheck/tidewater/blob/main/src/game/Game.js) (Fishing and trade), [`src/world/WorldLayout.js`](https://github.com/dgreenheck/tidewater/blob/main/src/world/WorldLayout.js) (Island world)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Gameplay"]
  node_player["Player and boat<br/>[Player.js]"]
  node_boat["Boat physics<br/>[BoatController.js]"]
  node_game["Fishing and trade<br/>[Game.js]"]
  node_game_state["Game progress<br/>[GameState.js]"]
end

subgraph group_environment["Island and ocean"]
  node_fish["Fish and species<br/>[Fish.js]"]
  node_world["Island world<br/>[WorldLayout.js]"]
  node_terrain["Terrain<br/>[Terrain.js]"]
  node_water["Ocean surface<br/>[WaterSurface.js]"]
  node_water_query["Water queries<br/>[WaterQuery.js]"]
  node_ocean_sim["Ocean simulation<br/>[OceanFFT.js]"]
  node_shore["Shore and wakes<br/>[ShoreSim.js]"]
  node_sky["Sky and clouds<br/>[Sky.js]"]
  node_wildlife["Wildlife<br/>[Wildlife.js]"]
end

subgraph group_graphics["Rendering engine"]
  node_app["Game orchestrator<br/>[App.js]"]
  node_engine["WebGPU engine<br/>[Engine.js]"]
  node_renderer["Scene renderer<br/>[SceneRenderer.js]"]
  node_post["Post-processing<br/>[PostFX.js]"]
end

subgraph group_presentation["UI and audio"]
  node_main["Browser entry<br/>[main.js]"]
  node_ui["Game UI<br/>[UI.js]"]
  node_app_ui["Settings UI<br/>[AppUI.js]"]
  node_audio["Soundscape<br/>[SoundScape.js]"]
end

node_player_actor(("Player"))
node_browser(("Browser GPU"))

node_player_actor -->|"controls"| node_player
node_main -->|"starts"| node_app
node_main -->|"creates"| node_ui
node_main -->|"creates"| node_app_ui
node_app -->|"initializes"| node_engine
node_engine -->|"requests WebGPU"| node_browser
node_app -->|"creates"| node_game
node_app -->|"creates"| node_audio
node_app -->|"creates"| node_post
node_app -->|"creates"| node_water
node_app -->|"renders scene"| node_renderer
node_app -->|"sets up"| node_sky
node_app -->|"sets up"| node_world
node_app -->|"sets up"| node_shore
node_app -->|"sets up"| node_ocean_sim
node_water -->|"samples"| node_ocean_sim
node_water_query -->|"queries surface"| node_water
node_water_query -->|"reads seabed"| node_terrain
node_boat -->|"reads water state"| node_water_query
node_player -->|"controls"| node_boat
node_game -->|"uses species"| node_fish
node_game -->|"tracks progress"| node_game_state
node_world -->|"builds on"| node_terrain
node_world -->|"includes"| node_wildlife
node_renderer -->|"feeds post chain"| node_post
node_audio -.->|"plays audio"| node_browser

click node_player "https://github.com/dgreenheck/tidewater/blob/main/src/player/Player.js"
click node_boat "https://github.com/dgreenheck/tidewater/blob/main/src/player/BoatController.js"
click node_game "https://github.com/dgreenheck/tidewater/blob/main/src/game/Game.js"
click node_game_state "https://github.com/dgreenheck/tidewater/blob/main/src/game/GameState.js"
click node_fish "https://github.com/dgreenheck/tidewater/blob/main/src/world/Fish.js"
click node_world "https://github.com/dgreenheck/tidewater/blob/main/src/world/WorldLayout.js"
click node_terrain "https://github.com/dgreenheck/tidewater/blob/main/src/world/Terrain.js"
click node_water "https://github.com/dgreenheck/tidewater/blob/main/src/ocean/WaterSurface.js"
click node_water_query "https://github.com/dgreenheck/tidewater/blob/main/src/ocean/WaterQuery.js"
click node_ocean_sim "https://github.com/dgreenheck/tidewater/blob/main/src/ocean/OceanFFT.js"
click node_shore "https://github.com/dgreenheck/tidewater/blob/main/src/ocean/ShoreSim.js"
click node_sky "https://github.com/dgreenheck/tidewater/blob/main/src/sky/Sky.js"
click node_wildlife "https://github.com/dgreenheck/tidewater/blob/main/src/world/wildlife/Wildlife.js"
click node_app "https://github.com/dgreenheck/tidewater/blob/main/src/App.js"
click node_engine "https://github.com/dgreenheck/tidewater/blob/main/src/engine/Engine.js"
click node_renderer "https://github.com/dgreenheck/tidewater/blob/main/src/engine/render/SceneRenderer.js"
click node_post "https://github.com/dgreenheck/tidewater/blob/main/src/post/PostFX.js"
click node_main "https://github.com/dgreenheck/tidewater/blob/main/src/main.js"
click node_ui "https://github.com/dgreenheck/tidewater/blob/main/src/ui/UI.js"
click node_app_ui "https://github.com/dgreenheck/tidewater/blob/main/src/ui/AppUI.js"
click node_audio "https://github.com/dgreenheck/tidewater/blob/main/src/audio/SoundScape.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_player,node_boat,node_game,node_game_state,node_browser toneBlue
class node_fish,node_world,node_terrain,node_water,node_water_query,node_ocean_sim,node_shore,node_sky,node_wildlife toneAmber
class node_app,node_engine,node_renderer,node_post toneMint
class node_main,node_ui,node_app_ui,node_audio toneRose
class node_player_actor toneIndigo
```

## Components

### Gameplay

- [Player and boat](https://github.com/dgreenheck/tidewater/blob/main/src/player/Player.js): `src/player/Player.js`
- [Boat physics](https://github.com/dgreenheck/tidewater/blob/main/src/player/BoatController.js): `src/player/BoatController.js`
- [Fishing and trade](https://github.com/dgreenheck/tidewater/blob/main/src/game/Game.js): `src/game/Game.js`
- [Game progress](https://github.com/dgreenheck/tidewater/blob/main/src/game/GameState.js): `src/game/GameState.js`

### Island and ocean

- [Fish and species](https://github.com/dgreenheck/tidewater/blob/main/src/world/Fish.js): `src/world/Fish.js`
- [Island world](https://github.com/dgreenheck/tidewater/blob/main/src/world/WorldLayout.js): `src/world/WorldLayout.js`
- [Terrain](https://github.com/dgreenheck/tidewater/blob/main/src/world/Terrain.js): `src/world/Terrain.js`
- [Ocean surface](https://github.com/dgreenheck/tidewater/blob/main/src/ocean/WaterSurface.js): `src/ocean/WaterSurface.js`
- [Water queries](https://github.com/dgreenheck/tidewater/blob/main/src/ocean/WaterQuery.js): `src/ocean/WaterQuery.js`
- [Ocean simulation](https://github.com/dgreenheck/tidewater/blob/main/src/ocean/OceanFFT.js): `src/ocean/OceanFFT.js`
- [Shore and wakes](https://github.com/dgreenheck/tidewater/blob/main/src/ocean/ShoreSim.js): `src/ocean/ShoreSim.js`
- [Sky and clouds](https://github.com/dgreenheck/tidewater/blob/main/src/sky/Sky.js): `src/sky/Sky.js`
- [Wildlife](https://github.com/dgreenheck/tidewater/blob/main/src/world/wildlife/Wildlife.js): `src/world/wildlife/Wildlife.js`

### Rendering engine

- [Game orchestrator](https://github.com/dgreenheck/tidewater/blob/main/src/App.js): `src/App.js`
- [WebGPU engine](https://github.com/dgreenheck/tidewater/blob/main/src/engine/Engine.js): `src/engine/Engine.js`
- [Scene renderer](https://github.com/dgreenheck/tidewater/blob/main/src/engine/render/SceneRenderer.js): `src/engine/render/SceneRenderer.js`
- [Post-processing](https://github.com/dgreenheck/tidewater/blob/main/src/post/PostFX.js): `src/post/PostFX.js`

### UI and audio

- [Browser entry](https://github.com/dgreenheck/tidewater/blob/main/src/main.js): `src/main.js`
- [Game UI](https://github.com/dgreenheck/tidewater/blob/main/src/ui/UI.js): `src/ui/UI.js`
- [Settings UI](https://github.com/dgreenheck/tidewater/blob/main/src/ui/AppUI.js): `src/ui/AppUI.js`
- [Soundscape](https://github.com/dgreenheck/tidewater/blob/main/src/audio/SoundScape.js): `src/audio/SoundScape.js`

### Other components

- **Player**
- **Browser GPU**

## Connections

- Player → Player and boat: controls
- Browser entry → Game orchestrator: starts
- Browser entry → Game UI: creates
- Browser entry → Settings UI: creates
- Game orchestrator → WebGPU engine: initializes
- WebGPU engine → Browser GPU: requests WebGPU
- Game orchestrator → Fishing and trade: creates
- Game orchestrator → Soundscape: creates
- Game orchestrator → Post-processing: creates
- Game orchestrator → Ocean surface: creates
- Game orchestrator → Scene renderer: renders scene
- Game orchestrator → Sky and clouds: sets up
- Game orchestrator → Island world: sets up
- Game orchestrator → Shore and wakes: sets up
- Game orchestrator → Ocean simulation: sets up
- Ocean surface → Ocean simulation: samples
- Water queries → Ocean surface: queries surface
- Water queries → Terrain: reads seabed
- Boat physics → Water queries: reads water state
- Player and boat → Boat physics: controls
- Fishing and trade → Fish and species: uses species
- Fishing and trade → Game progress: tracks progress
- Island world → Terrain: builds on
- Island world → Wildlife: includes
- Scene renderer → Post-processing: feeds post chain
- Soundscape → Browser GPU: plays audio
