# uncodem/frassa architecture

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

- Interactive diagram: https://gitdiagram.com/uncodem/frassa
- Repository: https://github.com/uncodem/frassa

## Overview

Frassa is a browser-based, first-person maze game with a map editor. Players start a run, navigate floors, evade pursuing bots, collect items, and use teleporters; the frame loop handles simulation and rendering. The editor is a distinct authoring workflow with map editing, entity properties, undo/redo, and a live preview. The graph includes the sampled runtime layers and README-independent editor capability; unsampled UI details and asset files limit some relationship evidence.

Main entry points: [`src/game.ts`](https://github.com/uncodem/frassa/blob/master/src/game.ts) (Game loop), [`src/renderer.ts`](https://github.com/uncodem/frassa/blob/master/src/renderer.ts) (Canvas renderer), [`src/player.ts`](https://github.com/uncodem/frassa/blob/master/src/player.ts) (Player movement), [`src/editor.ts`](https://github.com/uncodem/frassa/blob/master/src/editor.ts) (Map authoring)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game runtime"]
  node_main["Startup<br/>[main.ts]"]
  node_game["Game loop<br/>[game.ts]"]
  node_ui["Game UI<br/>[ui.ts]"]
end

subgraph group_world["World and entities"]
  node_maps["Floor maps"]
  node_loader["Map loader<br/>[loader.ts]"]
  node_level["Tile level<br/>[level.ts]"]
  node_player["Player movement<br/>[player.ts]"]
  node_bot["Bot pursuit<br/>[bot.ts]"]
  node_navigation["Navigation grid<br/>[nav.ts]"]
  node_entities["Sprites and pickups<br/>[sprite.ts]"]
  node_entity["Entity collision<br/>[entity.ts]"]
end

subgraph group_rendering["Rendering"]
  node_camera["Camera<br/>[camera.ts]"]
  node_raycaster["Raycaster<br/>[raycaster.ts]"]
  node_renderer["Canvas renderer<br/>[renderer.ts]"]
  node_assets["Texture assets<br/>[asset.ts]"]
end

subgraph group_authoring["Map editor"]
  node_editor["Map authoring<br/>[editor.ts]"]
end

node_player_actor(("Player"))
node_browser(("Browser input"))

node_main -->|"loads assets"| node_assets
node_main -->|"imports maps"| node_maps
node_main -->|"parses and spawns"| node_loader
node_main -->|"creates and starts"| node_game
node_main -->|"initializes UI"| node_ui
node_browser -->|"provides input"| node_main
node_player_actor -.->|"plays"| node_game
node_game -->|"moves"| node_player
node_game -->|"updates and checks"| node_bot
node_game -->|"computes paths"| node_navigation
node_game -->|"collects and teleports"| node_entities
node_game -->|"gets frame hits"| node_raycaster
node_game -->|"draws frame"| node_renderer
node_loader -->|"constructs"| node_level
node_loader -->|"spawns"| node_player
node_loader -->|"spawns"| node_bot
node_loader -->|"spawns"| node_entities
node_player -->|"inherits collision"| node_entity
node_player -->|"turns and exposes"| node_camera
node_bot -->|"follows distances"| node_navigation
node_bot -->|"targets"| node_player
node_bot -->|"extends sprite"| node_entities
node_raycaster -->|"reads tiles"| node_level
node_raycaster -->|"casts view"| node_camera
node_renderer -->|"consumes hits"| node_raycaster
node_renderer -->|"projects view"| node_player
node_renderer -->|"reads tile data"| node_level
node_renderer -->|"draws sprites"| node_entities
node_renderer -->|"reads textures"| node_assets
node_level -->|"uses texture IDs"| node_assets
node_entities -->|"inherits collision"| node_entity
node_editor -->|"loads and previews"| node_assets
node_editor -->|"builds preview level"| node_level
node_editor -->|"creates preview caster"| node_raycaster
node_editor -->|"renders preview"| node_renderer
node_editor -->|"moves preview player"| node_player
node_editor -->|"creates preview sprites"| node_entities

click node_main "https://github.com/uncodem/frassa/blob/master/src/main.ts"
click node_game "https://github.com/uncodem/frassa/blob/master/src/game.ts"
click node_ui "https://github.com/uncodem/frassa/blob/master/src/ui.ts"
click node_maps "https://github.com/uncodem/frassa/tree/master/src/maps"
click node_loader "https://github.com/uncodem/frassa/blob/master/src/loader.ts"
click node_level "https://github.com/uncodem/frassa/blob/master/src/level.ts"
click node_player "https://github.com/uncodem/frassa/blob/master/src/player.ts"
click node_bot "https://github.com/uncodem/frassa/blob/master/src/bot.ts"
click node_navigation "https://github.com/uncodem/frassa/blob/master/src/nav.ts"
click node_entities "https://github.com/uncodem/frassa/blob/master/src/sprite.ts"
click node_entity "https://github.com/uncodem/frassa/blob/master/src/entity.ts"
click node_camera "https://github.com/uncodem/frassa/blob/master/src/camera.ts"
click node_raycaster "https://github.com/uncodem/frassa/blob/master/src/raycaster.ts"
click node_renderer "https://github.com/uncodem/frassa/blob/master/src/renderer.ts"
click node_assets "https://github.com/uncodem/frassa/blob/master/src/asset.ts"
click node_editor "https://github.com/uncodem/frassa/blob/master/src/editor.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_main,node_game,node_ui,node_browser toneBlue
class node_maps,node_loader,node_level,node_player,node_bot,node_navigation,node_entities,node_entity toneAmber
class node_camera,node_raycaster,node_renderer,node_assets toneMint
class node_editor toneRose
class node_player_actor toneIndigo
```

## Components

### Game runtime

- [Startup](https://github.com/uncodem/frassa/blob/master/src/main.ts): `src/main.ts`
- [Game loop](https://github.com/uncodem/frassa/blob/master/src/game.ts): `src/game.ts`
- [Game UI](https://github.com/uncodem/frassa/blob/master/src/ui.ts): `src/ui.ts`

### World and entities

- [Floor maps](https://github.com/uncodem/frassa/tree/master/src/maps): `src/maps`
- [Map loader](https://github.com/uncodem/frassa/blob/master/src/loader.ts): `src/loader.ts`
- [Tile level](https://github.com/uncodem/frassa/blob/master/src/level.ts): `src/level.ts`
- [Player movement](https://github.com/uncodem/frassa/blob/master/src/player.ts): `src/player.ts`
- [Bot pursuit](https://github.com/uncodem/frassa/blob/master/src/bot.ts): `src/bot.ts`
- [Navigation grid](https://github.com/uncodem/frassa/blob/master/src/nav.ts): `src/nav.ts`
- [Sprites and pickups](https://github.com/uncodem/frassa/blob/master/src/sprite.ts): `src/sprite.ts`
- [Entity collision](https://github.com/uncodem/frassa/blob/master/src/entity.ts): `src/entity.ts`

### Rendering

- [Camera](https://github.com/uncodem/frassa/blob/master/src/camera.ts): `src/camera.ts`
- [Raycaster](https://github.com/uncodem/frassa/blob/master/src/raycaster.ts): `src/raycaster.ts`
- [Canvas renderer](https://github.com/uncodem/frassa/blob/master/src/renderer.ts): `src/renderer.ts`
- [Texture assets](https://github.com/uncodem/frassa/blob/master/src/asset.ts): `src/asset.ts`

### Map editor

- [Map authoring](https://github.com/uncodem/frassa/blob/master/src/editor.ts): `src/editor.ts`

### Other components

- **Player**
- **Browser input**

## Connections

- Startup → Texture assets: loads assets (evidence: `src/main.ts`)
- Startup → Floor maps: imports maps (evidence: `src/main.ts`)
- Startup → Map loader: parses and spawns (evidence: `src/main.ts`)
- Startup → Game loop: creates and starts (evidence: `src/main.ts`)
- Startup → Game UI: initializes UI (evidence: `src/main.ts`)
- Browser input → Startup: provides input (evidence: `src/main.ts`)
- Player → Game loop: plays
- Game loop → Player movement: moves (evidence: `src/game.ts`)
- Game loop → Bot pursuit: updates and checks (evidence: `src/game.ts`)
- Game loop → Navigation grid: computes paths (evidence: `src/game.ts`)
- Game loop → Sprites and pickups: collects and teleports (evidence: `src/game.ts`)
- Game loop → Raycaster: gets frame hits (evidence: `src/game.ts`)
- Game loop → Canvas renderer: draws frame (evidence: `src/game.ts`)
- Map loader → Tile level: constructs (evidence: `src/loader.ts`)
- Map loader → Player movement: spawns (evidence: `src/loader.ts`)
- Map loader → Bot pursuit: spawns (evidence: `src/loader.ts`)
- Map loader → Sprites and pickups: spawns (evidence: `src/loader.ts`)
- Player movement → Entity collision: inherits collision (evidence: `src/player.ts`)
- Player movement → Camera: turns and exposes (evidence: `src/player.ts`)
- Bot pursuit → Navigation grid: follows distances (evidence: `src/bot.ts`)
- Bot pursuit → Player movement: targets (evidence: `src/bot.ts`)
- Bot pursuit → Sprites and pickups: extends sprite (evidence: `src/bot.ts`)
- Raycaster → Tile level: reads tiles (evidence: `src/raycaster.ts`)
- Raycaster → Camera: casts view (evidence: `src/raycaster.ts`)
- Canvas renderer → Raycaster: consumes hits (evidence: `src/renderer.ts`)
- Canvas renderer → Player movement: projects view (evidence: `src/renderer.ts`)
- Canvas renderer → Tile level: reads tile data (evidence: `src/renderer.ts`)
- Canvas renderer → Sprites and pickups: draws sprites (evidence: `src/renderer.ts`)
- Canvas renderer → Texture assets: reads textures (evidence: `src/renderer.ts`)
- Tile level → Texture assets: uses texture IDs (evidence: `src/level.ts`)
- Sprites and pickups → Entity collision: inherits collision (evidence: `src/sprite.ts`)
- Map authoring → Texture assets: loads and previews (evidence: `src/editor.ts`)
- Map authoring → Tile level: builds preview level (evidence: `src/editor.ts`)
- Map authoring → Raycaster: creates preview caster (evidence: `src/editor.ts`)
- Map authoring → Canvas renderer: renders preview (evidence: `src/editor.ts`)
- Map authoring → Player movement: moves preview player (evidence: `src/editor.ts`)
- Map authoring → Sprites and pickups: creates preview sprites (evidence: `src/editor.ts`)
