# texnist/pixeldot architecture

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

- Interactive diagram: https://gitdiagram.com/texnist/pixeldot
- Repository: https://github.com/texnist/pixeldot

## Overview

PixelDot is a Godot Mono plugin for building chunked 2D sandbox worlds. The documented scene workflow configures BlockMap with a generator and block properties, adds TileMap layers, and optionally attaches fluid simulation and CPU lighting. The sampled code shows BlockData generating and retaining visible chunk data, then updating layers; fluid and lighting read that shared data and produce their respective visual effects. Generator hooks and the documented shader-based lighting are included, but BlockMap's implementation was not sampled, so its orchestration links are documented rather than inferred from source.

Main entry points: [`src/BlockMap.gd`](https://github.com/texnist/pixeldot/blob/main/src/BlockMap.gd) (BlockMap), [`src/BlockData.cs`](https://github.com/texnist/pixeldot/blob/main/src/BlockData.cs) (Chunk data), [`src/BlockFluid.cs`](https://github.com/texnist/pixeldot/blob/main/src/BlockFluid.cs) (Fluid simulation), [`src/Lighting.cs`](https://github.com/texnist/pixeldot/blob/main/src/Lighting.cs) (CPU lighting)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_world["World data"]
  node_blockmap["BlockMap<br/>[BlockMap.gd]"]
  node_blockdata[("Chunk data<br/>[BlockData.cs]")]
end

subgraph group_render["Terrain rendering"]
  node_blocklayer["Block layers<br/>[BlockLayer.cs]"]
end

subgraph group_simulation["World effects"]
  node_fluid["Fluid simulation<br/>[BlockFluid.cs]"]
  node_lighting["CPU lighting<br/>[Lighting.cs]"]
  node_lighting_shader["Lighting shader<br/>[lighting.shader]"]
end

subgraph group_integration["Generation integration"]
  node_generator["Generator script"]
end

node_developer(("Godot user"))

node_developer -->|"configures scene"| node_blockmap
node_developer -->|"provides script"| node_generator
node_blockmap -.->|"sets up"| node_blockdata
node_blockdata -->|"calls generation hooks"| node_generator
node_blockdata -->|"reports generated chunks"| node_blockmap
node_blockdata -->|"updates tile chunks"| node_blocklayer
node_blockmap -->|"hosts layers"| node_blocklayer
node_blockmap -->|"hosts fluid child"| node_fluid
node_fluid -->|"reads layer ID"| node_blocklayer
node_fluid -->|"reads and changes blocks"| node_blockdata
node_blockmap -->|"hosts lighting child"| node_lighting
node_lighting -->|"reads blocks"| node_blockdata
node_lighting -->|"configures shader"| node_lighting_shader

click node_blockmap "https://github.com/texnist/pixeldot/blob/main/src/BlockMap.gd"
click node_blockdata "https://github.com/texnist/pixeldot/blob/main/src/BlockData.cs"
click node_generator "https://github.com/texnist/pixeldot/blob/main/templates/GeneratorTemplate.gd"
click node_blocklayer "https://github.com/texnist/pixeldot/blob/main/src/BlockLayer.cs"
click node_fluid "https://github.com/texnist/pixeldot/blob/main/src/BlockFluid.cs"
click node_lighting "https://github.com/texnist/pixeldot/blob/main/src/Lighting.cs"
click node_lighting_shader "https://github.com/texnist/pixeldot/blob/main/shaders/lighting.shader"

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_blockmap,node_blockdata,node_developer toneBlue
class node_blocklayer toneAmber
class node_fluid,node_lighting,node_lighting_shader toneMint
class node_generator toneRose
```

## Components

### World data

- [BlockMap](https://github.com/texnist/pixeldot/blob/main/src/BlockMap.gd): `src/BlockMap.gd`
- [Chunk data](https://github.com/texnist/pixeldot/blob/main/src/BlockData.cs): `src/BlockData.cs`

### Terrain rendering

- [Block layers](https://github.com/texnist/pixeldot/blob/main/src/BlockLayer.cs): `src/BlockLayer.cs`

### World effects

- [Fluid simulation](https://github.com/texnist/pixeldot/blob/main/src/BlockFluid.cs): `src/BlockFluid.cs`
- [CPU lighting](https://github.com/texnist/pixeldot/blob/main/src/Lighting.cs): `src/Lighting.cs`
- [Lighting shader](https://github.com/texnist/pixeldot/blob/main/shaders/lighting.shader): `shaders/lighting.shader`

### Generation integration

- [Generator script](https://github.com/texnist/pixeldot/blob/main/templates/GeneratorTemplate.gd): `templates/GeneratorTemplate.gd`

### Other components

- **Godot user**

## Connections

- Godot user → BlockMap: configures scene (evidence: `README.md`)
- Godot user → Generator script: provides script (evidence: `README.md`)
- BlockMap → Chunk data: sets up (evidence: `README.md`)
- Chunk data → Generator script: calls generation hooks (evidence: `src/BlockData.cs`)
- Chunk data → BlockMap: reports generated chunks (evidence: `src/BlockData.cs`)
- Chunk data → Block layers: updates tile chunks (evidence: `src/BlockData.cs`)
- BlockMap → Block layers: hosts layers (evidence: `README.md`)
- BlockMap → Fluid simulation: hosts fluid child (evidence: `README.md`)
- Fluid simulation → Block layers: reads layer ID (evidence: `src/BlockFluid.cs`)
- Fluid simulation → Chunk data: reads and changes blocks (evidence: `src/BlockFluid.cs`)
- BlockMap → CPU lighting: hosts lighting child (evidence: `README.md`)
- CPU lighting → Chunk data: reads blocks (evidence: `src/Lighting.cs`)
- CPU lighting → Lighting shader: configures shader (evidence: `src/Lighting.cs`)
