# coppersalts/html5b architecture

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

- Interactive diagram: https://gitdiagram.com/coppersalts/html5b
- Repository: https://github.com/coppersalts/html5b

## Overview

#### Purpose and Entry Points
HTML5b is a browser-only JavaScript/HTML5 port of the Flash game BFDIA 5b. It implements gameplay, level creation, and level exploration without a server runtime. The primary launch document is `index.html`; the main application/game implementation is concentrated in `5b.js`. `authredirect.html` appears to support an external authorization/redirect flow.

#### Application Shell and Runtime
`index.html` establishes the browser page and loads the game assets/runtime. `style.css` supplies the UI presentation layer. The game runs directly in the client browser using DOM, canvas/media capabilities, and JavaScript rather than a framework or backend service.
- `index.html`
- `5b.js`
- `style.css`

#### Core Game and Editor Engine
`5b.js` is the architecture-defining application module: based on the repository’s compact structure and README, it contains the translated ActionScript-derived mechanics for level execution, entities, collision/interaction behavior, UI state, the level creator, and explore workflows. It is the primary control-flow owner from initialization through input handling, simulation, rendering, and screen transitions.
- `5b.js`

#### Level Data Boundary
Levels are stored as static repository data rather than fetched from an application API. The runtime reads level definitions from `data/levels.txt`, likely parsing them into the in-memory structures consumed by both gameplay and the creator/explorer features. This file forms the key persistence/content boundary for playable maps.
- `data/levels.txt`
- `5b.js`

#### Asset Loading and Rendering
Visual content is organized under `visuals/` by rendering role: backgrounds, blocks, entities, body parts, effects, borders, shadows, and UI components. The runtime maps game state to these static image assets, while `data/images6.json` likely provides image metadata or an asset manifest used during loading/rendering.
- `visuals/bg`
- `visuals/blocks`
- `visuals/entities`
- `visuals/ui`
- `data/images6.json`

#### Audio and Media
Gameplay audio is delivered as a static browser-playable WAV asset. There is no evidence of streaming, media processing, or an audio service; audio is packaged alongside game data and controlled by the client runtime.
- `data/the fiber 16x loop.wav`
- `5b.js`

#### External/Offline Boundaries
The repository has no visible backend, database, package manifest, or deployment infrastructure. Browser hosting is sufficient. `authredirect.html` is the only visible integration-oriented boundary and may handle redirects for an external identity or hosting-related authorization process; its exact provider is not represented in the supplied tree.
- `authredirect.html`
- `index.html`

Main entry points: [`5b.js`](https://github.com/coppersalts/html5b/blob/master/5b.js) (Canvas and UI rendering), [`index.html`](https://github.com/coppersalts/html5b/blob/master/index.html) (Main launch page), [`data/levels.txt`](https://github.com/coppersalts/html5b/blob/master/data/levels.txt) (Level definitions), [`authredirect.html`](https://github.com/coppersalts/html5b/blob/master/authredirect.html) (Authorization redirect)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_shell["Browser Shell"]
  node_index["Main launch page<br/>HTML entry<br/>[index.html]"]
  node_styles["UI styles<br/>CSS<br/>[style.css]"]
  node_authredirect["Authorization redirect<br/>HTML integration<br/>[authredirect.html]"]
end

subgraph group_runtime["Game Runtime"]
  node_game["Game and editor engine<br/>browser JavaScript<br/>[5b.js]"]
  node_gameplay["Gameplay simulation<br/>engine layer<br/>[5b.js]"]
  node_creator["Creator and explorer<br/>engine layer<br/>[5b.js]"]
  node_renderer["Canvas and UI rendering<br/>engine layer<br/>[5b.js]"]
end

subgraph group_content["Static Content"]
  node_levels["Level definitions<br/>static level data<br/>[levels.txt]"]
  node_image_manifest["Image metadata<br/>asset manifest<br/>[images6.json]"]
  node_audio["Gameplay audio loop<br/>WAV asset"]
end

subgraph group_visuals["Visual Assets"]
  node_backgrounds["Background images<br/>image assets"]
  node_blocks["Block images<br/>image assets"]
  node_entities["Entity images<br/>image assets"]
  node_ui_assets["UI images<br/>image assets"]
end

node_index -->|"applies"| node_styles
node_index -->|"loads"| node_game
node_authredirect -.->|"returns to"| node_index
node_game -->|"runs"| node_gameplay
node_game -->|"runs"| node_creator
node_game -->|"drives"| node_renderer
node_game -->|"reads"| node_levels
node_creator -->|"uses level content"| node_levels
node_gameplay -->|"produces game state"| node_renderer
node_renderer -->|"uses metadata"| node_image_manifest
node_renderer -->|"renders"| node_backgrounds
node_renderer -->|"renders"| node_blocks
node_renderer -->|"renders"| node_entities
node_renderer -->|"renders"| node_ui_assets
node_game -->|"controls playback"| node_audio

click node_index "https://github.com/coppersalts/html5b/blob/master/index.html"
click node_styles "https://github.com/coppersalts/html5b/blob/master/style.css"
click node_authredirect "https://github.com/coppersalts/html5b/blob/master/authredirect.html"
click node_game "https://github.com/coppersalts/html5b/blob/master/5b.js"
click node_gameplay "https://github.com/coppersalts/html5b/blob/master/5b.js"
click node_creator "https://github.com/coppersalts/html5b/blob/master/5b.js"
click node_renderer "https://github.com/coppersalts/html5b/blob/master/5b.js"
click node_levels "https://github.com/coppersalts/html5b/blob/master/data/levels.txt"
click node_image_manifest "https://github.com/coppersalts/html5b/blob/master/data/images6.json"
click node_audio "https://github.com/coppersalts/html5b/blob/master/data/the%20fiber%2016x%20loop.wav"
click node_backgrounds "https://github.com/coppersalts/html5b/tree/master/visuals/bg"
click node_blocks "https://github.com/coppersalts/html5b/tree/master/visuals/blocks"
click node_entities "https://github.com/coppersalts/html5b/tree/master/visuals/entities"
click node_ui_assets "https://github.com/coppersalts/html5b/tree/master/visuals/ui"

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_index,node_styles,node_authredirect toneBlue
class node_game,node_gameplay,node_creator,node_renderer toneAmber
class node_levels,node_image_manifest,node_audio toneMint
class node_backgrounds,node_blocks,node_entities,node_ui_assets toneRose
```

## Components

### Browser Shell

- [Main launch page](https://github.com/coppersalts/html5b/blob/master/index.html): HTML entry · `index.html`
- [UI styles](https://github.com/coppersalts/html5b/blob/master/style.css): CSS · `style.css`
- [Authorization redirect](https://github.com/coppersalts/html5b/blob/master/authredirect.html): HTML integration · External redirect boundary; provider is unspecified. · `authredirect.html`

### Game Runtime

- [Game and editor engine](https://github.com/coppersalts/html5b/blob/master/5b.js): browser JavaScript · Owns initialization, screens, input, simulation, rendering, and editor/explorer workflows. · `5b.js`
- [Gameplay simulation](https://github.com/coppersalts/html5b/blob/master/5b.js): engine layer · Level execution, entities, collisions, and interactions. · `5b.js`
- [Creator and explorer](https://github.com/coppersalts/html5b/blob/master/5b.js): engine layer · Creates and explores level content within the client runtime. · `5b.js`
- [Canvas and UI rendering](https://github.com/coppersalts/html5b/blob/master/5b.js): engine layer · Maps runtime state to browser visual output. · `5b.js`

### Static Content

- [Level definitions](https://github.com/coppersalts/html5b/blob/master/data/levels.txt): static level data · `data/levels.txt`
- [Image metadata](https://github.com/coppersalts/html5b/blob/master/data/images6.json): asset manifest · `data/images6.json`
- [Gameplay audio loop](https://github.com/coppersalts/html5b/blob/master/data/the%20fiber%2016x%20loop.wav): WAV asset · `data/the fiber 16x loop.wav`

### Visual Assets

- [Background images](https://github.com/coppersalts/html5b/tree/master/visuals/bg): image assets · `visuals/bg`
- [Block images](https://github.com/coppersalts/html5b/tree/master/visuals/blocks): image assets · `visuals/blocks`
- [Entity images](https://github.com/coppersalts/html5b/tree/master/visuals/entities): image assets · `visuals/entities`
- [UI images](https://github.com/coppersalts/html5b/tree/master/visuals/ui): image assets · `visuals/ui`

## Connections

- Main launch page → UI styles: applies
- Main launch page → Game and editor engine: loads
- Authorization redirect → Main launch page: returns to
- Game and editor engine → Gameplay simulation: runs
- Game and editor engine → Creator and explorer: runs
- Game and editor engine → Canvas and UI rendering: drives
- Game and editor engine → Level definitions: reads
- Creator and explorer → Level definitions: uses level content
- Gameplay simulation → Canvas and UI rendering: produces game state
- Canvas and UI rendering → Image metadata: uses metadata
- Canvas and UI rendering → Background images: renders
- Canvas and UI rendering → Block images: renders
- Canvas and UI rendering → Entity images: renders
- Canvas and UI rendering → UI images: renders
- Game and editor engine → Gameplay audio loop: controls playback
