# eatfears/blocks architecture

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

- Interactive diagram: https://gitdiagram.com/eatfears/blocks
- Repository: https://github.com/eatfears/blocks

## Overview

Blocks is a real-time voxel-world game. The player provides keyboard and mouse input through GLUT callbacks; Engine handles the game loop and rendering, using World and Character state, while chunks supply block geometry and lighting. The tree also identifies terrain generation, materials, platform logic, statistics, shaders, and texture assets as product subsystems. The README is empty and several source files were not sampled, so uncertain subsystem wiring is omitted rather than inferred.

Main entry points: [`source/lib/engine/engine.cpp`](https://github.com/eatfears/blocks/blob/master/source/lib/engine/engine.cpp) (Engine Loop), [`source/lib/engine/chunk.cpp`](https://github.com/eatfears/blocks/blob/master/source/lib/engine/chunk.cpp) (World Chunks), [`source/bin/blocks/main.cpp`](https://github.com/eatfears/blocks/blob/master/source/bin/blocks/main.cpp) (Application Entry), [`source/lib/engine/world.cpp`](https://github.com/eatfears/blocks/blob/master/source/lib/engine/world.cpp) (World State)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Game Runtime"]
  node_main["Application Entry<br/>[main.cpp]"]
  node_engine["Engine Loop<br/>[engine.cpp]"]
end

subgraph group_world["Voxel World"]
  node_worldstate["World State<br/>[world.cpp]"]
  node_character["Character<br/>[character.cpp]"]
  node_landscape["Landscape<br/>[landscape.cpp]"]
  node_chunk[("World Chunks<br/>[chunk.cpp]")]
  node_noise["Perlin Noise<br/>[perlin_noise.cpp]"]
  node_primes["Prime Generator<br/>[primes.cpp]"]
end

subgraph group_render["Rendering"]
  node_light["Voxel Lighting<br/>[light.cpp]"]
  node_materials["Materials<br/>[material.cpp]"]
  node_shaders["Shader Sources"]
  node_textures["Texture Assets"]
end

subgraph group_support["Game Support"]
  node_platform["Platform Logic<br/>[platform.cpp]"]
  node_statistics["Game Statistics<br/>[statistics.cpp]"]
  node_logger["Logging<br/>[logger.cpp]"]
end

node_player(("Player"))
node_glut["GLUT"]
node_filesystem[("Local Files")]

node_player -->|"provides input"| node_glut
node_glut -->|"dispatches callbacks"| node_main
node_main -->|"starts and dispatches"| node_engine
node_main -->|"loads sources"| node_shaders
node_engine -->|"updates and reads"| node_worldstate
node_engine -->|"handles input"| node_character
node_engine -->|"renders chunks"| node_chunk
node_engine -->|"uses textures"| node_materials
node_engine -->|"updates stats"| node_statistics
node_worldstate -->|"holds player"| node_character
node_worldstate -->|"manages chunks"| node_chunk
node_landscape --> node_noise
node_noise -->|"initializes noise"| node_primes
node_chunk -->|"looks up blocks"| node_worldstate
node_chunk -->|"queries lighting"| node_light
node_chunk -->|"loads and saves"| node_filesystem
node_materials -->|"uses assets"| node_textures
node_main -->|"logs startup"| node_logger

click node_main "https://github.com/eatfears/blocks/blob/master/source/bin/blocks/main.cpp"
click node_engine "https://github.com/eatfears/blocks/blob/master/source/lib/engine/engine.cpp"
click node_worldstate "https://github.com/eatfears/blocks/blob/master/source/lib/engine/world.cpp"
click node_character "https://github.com/eatfears/blocks/blob/master/source/lib/engine/character.cpp"
click node_landscape "https://github.com/eatfears/blocks/blob/master/source/lib/engine/landscape.cpp"
click node_chunk "https://github.com/eatfears/blocks/blob/master/source/lib/engine/chunk.cpp"
click node_noise "https://github.com/eatfears/blocks/blob/master/source/lib/noise/perlin_noise.cpp"
click node_primes "https://github.com/eatfears/blocks/blob/master/source/lib/noise/primes.cpp"
click node_light "https://github.com/eatfears/blocks/blob/master/source/lib/engine/light.cpp"
click node_materials "https://github.com/eatfears/blocks/blob/master/source/lib/engine/material.cpp"
click node_shaders "https://github.com/eatfears/blocks/tree/master/working_dir/shaders"
click node_textures "https://github.com/eatfears/blocks/tree/master/working_dir/textures"
click node_platform "https://github.com/eatfears/blocks/blob/master/source/lib/engine/platform.cpp"
click node_statistics "https://github.com/eatfears/blocks/blob/master/source/lib/engine/statistics.cpp"
click node_logger "https://github.com/eatfears/blocks/blob/master/source/lib/logger/logger.cpp"

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_engine toneBlue
class node_worldstate,node_character,node_landscape,node_chunk,node_noise,node_primes,node_filesystem toneAmber
class node_light,node_materials,node_shaders,node_textures toneMint
class node_platform,node_statistics,node_logger toneRose
class node_player,node_glut toneIndigo
```

## Components

### Game Runtime

- [Application Entry](https://github.com/eatfears/blocks/blob/master/source/bin/blocks/main.cpp): `source/bin/blocks/main.cpp`
- [Engine Loop](https://github.com/eatfears/blocks/blob/master/source/lib/engine/engine.cpp): `source/lib/engine/engine.cpp`

### Voxel World

- [World State](https://github.com/eatfears/blocks/blob/master/source/lib/engine/world.cpp): `source/lib/engine/world.cpp`
- [Character](https://github.com/eatfears/blocks/blob/master/source/lib/engine/character.cpp): `source/lib/engine/character.cpp`
- [Landscape](https://github.com/eatfears/blocks/blob/master/source/lib/engine/landscape.cpp): `source/lib/engine/landscape.cpp`
- [World Chunks](https://github.com/eatfears/blocks/blob/master/source/lib/engine/chunk.cpp): `source/lib/engine/chunk.cpp`
- [Perlin Noise](https://github.com/eatfears/blocks/blob/master/source/lib/noise/perlin_noise.cpp): `source/lib/noise/perlin_noise.cpp`
- [Prime Generator](https://github.com/eatfears/blocks/blob/master/source/lib/noise/primes.cpp): `source/lib/noise/primes.cpp`

### Rendering

- [Voxel Lighting](https://github.com/eatfears/blocks/blob/master/source/lib/engine/light.cpp): `source/lib/engine/light.cpp`
- [Materials](https://github.com/eatfears/blocks/blob/master/source/lib/engine/material.cpp): `source/lib/engine/material.cpp`
- [Shader Sources](https://github.com/eatfears/blocks/tree/master/working_dir/shaders): `working_dir/shaders`
- [Texture Assets](https://github.com/eatfears/blocks/tree/master/working_dir/textures): `working_dir/textures`

### Game Support

- [Platform Logic](https://github.com/eatfears/blocks/blob/master/source/lib/engine/platform.cpp): `source/lib/engine/platform.cpp`
- [Game Statistics](https://github.com/eatfears/blocks/blob/master/source/lib/engine/statistics.cpp): `source/lib/engine/statistics.cpp`
- [Logging](https://github.com/eatfears/blocks/blob/master/source/lib/logger/logger.cpp): `source/lib/logger/logger.cpp`

### Other components

- **Player**
- **GLUT**
- **Local Files**

## Connections

- Player → GLUT: provides input
- GLUT → Application Entry: dispatches callbacks
- Application Entry → Engine Loop: starts and dispatches
- Application Entry → Shader Sources: loads sources
- Engine Loop → World State: updates and reads
- Engine Loop → Character: handles input
- Engine Loop → World Chunks: renders chunks
- Engine Loop → Materials: uses textures
- Engine Loop → Game Statistics: updates stats
- World State → Character: holds player
- World State → World Chunks: manages chunks
- Landscape → Perlin Noise
- Perlin Noise → Prime Generator: initializes noise
- World Chunks → World State: looks up blocks
- World Chunks → Voxel Lighting: queries lighting
- World Chunks → Local Files: loads and saves
- Materials → Texture Assets: uses assets
- Application Entry → Logging: logs startup
