# nekzisis/platformer architecture

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

- Interactive diagram: https://gitdiagram.com/nekzisis/platformer
- Repository: https://github.com/nekzisis/platformer

## Overview

This is a browser-based platform game: the browser starts a fixed-step game loop, which updates the player and camera and renders the scene to canvases. Keyboard input drives platforming movement and collision against a generated world; settings can pause and resume gameplay. The graph follows the sampled JavaScript and file tree. The README is empty, so capabilities beyond those visible in source are not inferred.

Main entry points: [`scripts/game.js`](https://github.com/nekzisis/platformer/blob/main/scripts/game.js) (Game coordinator), [`scripts/main.js`](https://github.com/nekzisis/platformer/blob/main/scripts/main.js) (Canvas setup), [`scripts/Player.js`](https://github.com/nekzisis/platformer/blob/main/scripts/Player.js) (Player movement), [`scripts/settings-main.js`](https://github.com/nekzisis/platformer/blob/main/scripts/settings-main.js) (Settings controls)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game runtime"]
  node_bootstrap["Canvas setup<br/>[main.js]"]
  node_loop["Game loop<br/>[main.js]"]
  node_game["Game coordinator<br/>[game.js]"]
end

subgraph group_world["World and rendering"]
  node_world_setup["World geometry<br/>[game.js]"]
  node_player["Player movement<br/>[Player.js]"]
  node_background["Background cache<br/>[Background.js]"]
  node_camera["Camera and viewport<br/>[game.js]"]
end

subgraph group_controls["Controls and settings"]
  node_input["Keyboard input<br/>[InputHandler.js]"]
  node_settings["Settings controls<br/>[settings-main.js]"]
end

node_browser(("Browser"))
node_page["Game page<br/>[index.html]"]

node_browser -->|"starts"| node_bootstrap
node_bootstrap -->|"gets canvases"| node_page
node_bootstrap -->|"creates"| node_game
node_loop -->|"updates"| node_game
node_loop -->|"renders"| node_game
node_game -->|"creates geometry"| node_world_setup
node_game -->|"updates and draws"| node_player
node_game -->|"creates and draws"| node_background
node_game -->|"tracks player"| node_camera
node_player -->|"reads controls"| node_input
node_player -->|"checks collisions"| node_world_setup
node_settings -->|"dispatches pause events"| node_loop
node_browser -->|"accepts settings input"| node_settings

click node_bootstrap "https://github.com/nekzisis/platformer/blob/main/scripts/main.js"
click node_loop "https://github.com/nekzisis/platformer/blob/main/scripts/main.js"
click node_game "https://github.com/nekzisis/platformer/blob/main/scripts/game.js"
click node_world_setup "https://github.com/nekzisis/platformer/blob/main/scripts/game.js"
click node_player "https://github.com/nekzisis/platformer/blob/main/scripts/Player.js"
click node_background "https://github.com/nekzisis/platformer/blob/main/scripts/Background.js"
click node_camera "https://github.com/nekzisis/platformer/blob/main/scripts/game.js"
click node_input "https://github.com/nekzisis/platformer/blob/main/scripts/InputHandler.js"
click node_settings "https://github.com/nekzisis/platformer/blob/main/scripts/settings-main.js"
click node_page "https://github.com/nekzisis/platformer/blob/main/index.html"

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_bootstrap,node_loop,node_game,node_browser toneBlue
class node_world_setup,node_player,node_background,node_camera toneAmber
class node_input,node_settings toneMint
class node_page toneTeal
```

## Components

### Game runtime

- [Canvas setup](https://github.com/nekzisis/platformer/blob/main/scripts/main.js): `scripts/main.js`
- [Game loop](https://github.com/nekzisis/platformer/blob/main/scripts/main.js): `scripts/main.js`
- [Game coordinator](https://github.com/nekzisis/platformer/blob/main/scripts/game.js): `scripts/game.js`

### World and rendering

- [World geometry](https://github.com/nekzisis/platformer/blob/main/scripts/game.js): `scripts/game.js`
- [Player movement](https://github.com/nekzisis/platformer/blob/main/scripts/Player.js): `scripts/Player.js`
- [Background cache](https://github.com/nekzisis/platformer/blob/main/scripts/Background.js): `scripts/Background.js`
- [Camera and viewport](https://github.com/nekzisis/platformer/blob/main/scripts/game.js): `scripts/game.js`

### Controls and settings

- [Keyboard input](https://github.com/nekzisis/platformer/blob/main/scripts/InputHandler.js): `scripts/InputHandler.js`
- [Settings controls](https://github.com/nekzisis/platformer/blob/main/scripts/settings-main.js): `scripts/settings-main.js`

### Other components

- **Browser**
- [Game page](https://github.com/nekzisis/platformer/blob/main/index.html): `index.html`

## Connections

- Browser → Canvas setup: starts (evidence: `scripts/main.js`)
- Canvas setup → Game page: gets canvases (evidence: `scripts/main.js`)
- Canvas setup → Game coordinator: creates (evidence: `scripts/main.js`)
- Game loop → Game coordinator: updates (evidence: `scripts/main.js`)
- Game loop → Game coordinator: renders (evidence: `scripts/main.js`)
- Game coordinator → World geometry: creates geometry (evidence: `scripts/game.js`)
- Game coordinator → Player movement: updates and draws (evidence: `scripts/game.js`)
- Game coordinator → Background cache: creates and draws (evidence: `scripts/game.js`)
- Game coordinator → Camera and viewport: tracks player (evidence: `scripts/game.js`)
- Player movement → Keyboard input: reads controls (evidence: `scripts/Player.js`)
- Player movement → World geometry: checks collisions (evidence: `scripts/Player.js`)
- Settings controls → Game loop: dispatches pause events (evidence: `scripts/settings-main.js`)
- Browser → Settings controls: accepts settings input (evidence: `scripts/settings-main.js`)
