# esizzle/2dversealpha architecture

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

- Interactive diagram: https://gitdiagram.com/esizzle/2dversealpha
- Repository: https://github.com/esizzle/2dversealpha

## Overview

2dverse is a real-time 2D cell-evolution game. The player interacts through the game loop, which accepts input, updates the world and cells, and renders the world and HUD; cells gain or lose resources, mutate, move, and divide. The graph also preserves environmental simulation, multicellular behavior, plant defense, audio, settings, and mutation history. Main-loop orchestration is clear from the excerpts and source index; some internal call details are unsampled, so only supported relationships are drawn.

Main entry points: [`main.py`](https://github.com/esizzle/2dversealpha/blob/main2/main.py) (Game loop), [`cell.py`](https://github.com/esizzle/2dversealpha/blob/main2/cell.py) (Cells and genomes), [`world_grid.py`](https://github.com/esizzle/2dversealpha/blob/main2/world_grid.py) (World grid), [`colors.py`](https://github.com/esizzle/2dversealpha/blob/main2/colors.py) (Color palette)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Game runtime"]
  node_game["Game loop<br/>[main.py]"]
  node_camera["Camera<br/>[camera.py]"]
  node_audio["Audio manager<br/>[audio.py]"]
  node_resources["Resource paths<br/>[resources.py]"]
  node_clock["Simulation clock<br/>[sim_clock.py]"]
  node_profiler["Runtime profiler<br/>[profiler.py]"]
end

subgraph group_simulation["World simulation"]
  node_world["World grid<br/>[world_grid.py]"]
  node_environment["Environment features<br/>[env_features.py]"]
  node_physics["Physics objects<br/>[physics_object.py]"]
  node_constants["Simulation tuning"]
end

subgraph group_organisms["Cell biology"]
  node_cell["Cells and genomes<br/>[cell.py]"]
  node_decisions["Decision models<br/>[decision_models.py]"]
  node_multicell["Multicellular links<br/>[multicell.py]"]
  node_plant_defense["Plant defense<br/>[plant_defense.py]"]
end

subgraph group_interface["Player interface"]
  node_player_control["Player control<br/>[player.py]"]
  node_settings["Settings panel<br/>[settings.py]"]
  node_journal["Mutation journal<br/>[journal.py]"]
  node_colors["Color palette<br/>[colors.py]"]
end

node_player_actor(("Player"))

node_player_actor -->|"plays"| node_game
node_game -->|"updates and draws"| node_world
node_game -->|"uses"| node_camera
node_game -->|"routes input"| node_player_control
node_game -->|"configures"| node_settings
node_game -->|"records mutations"| node_journal
node_game -->|"uses"| node_audio
node_game -->|"uses"| node_clock
node_game -->|"uses"| node_profiler
node_game -->|"uses"| node_plant_defense
node_audio -->|"loads assets"| node_resources
node_player_control -->|"controls"| node_cell
node_cell -->|"queries environment"| node_world
node_cell -->|"uses"| node_decisions
node_cell -->|"manages links"| node_multicell
node_cell -->|"creates bodies"| node_physics
node_world -->|"creates colliders"| node_physics
node_world -->|"builds snapshots"| node_environment
node_world -->|"uses"| node_colors
node_decisions -->|"queries"| node_world
node_multicell -->|"uses tuning"| node_constants
node_plant_defense -->|"uses tuning"| node_constants
node_journal -->|"renders with"| node_colors
node_settings -->|"renders with"| node_colors
node_cell -->|"uses"| node_colors

click node_game "https://github.com/esizzle/2dversealpha/blob/main2/main.py"
click node_camera "https://github.com/esizzle/2dversealpha/blob/main2/camera.py"
click node_audio "https://github.com/esizzle/2dversealpha/blob/main2/audio.py"
click node_resources "https://github.com/esizzle/2dversealpha/blob/main2/resources.py"
click node_clock "https://github.com/esizzle/2dversealpha/blob/main2/sim_clock.py"
click node_world "https://github.com/esizzle/2dversealpha/blob/main2/world_grid.py"
click node_environment "https://github.com/esizzle/2dversealpha/blob/main2/env_features.py"
click node_physics "https://github.com/esizzle/2dversealpha/blob/main2/physics_object.py"
click node_cell "https://github.com/esizzle/2dversealpha/blob/main2/cell.py"
click node_decisions "https://github.com/esizzle/2dversealpha/blob/main2/decision_models.py"
click node_multicell "https://github.com/esizzle/2dversealpha/blob/main2/multicell.py"
click node_plant_defense "https://github.com/esizzle/2dversealpha/blob/main2/plant_defense.py"
click node_player_control "https://github.com/esizzle/2dversealpha/blob/main2/player.py"
click node_settings "https://github.com/esizzle/2dversealpha/blob/main2/settings.py"
click node_journal "https://github.com/esizzle/2dversealpha/blob/main2/journal.py"
click node_colors "https://github.com/esizzle/2dversealpha/blob/main2/colors.py"
click node_constants "https://github.com/esizzle/2dversealpha/blob/main2/global_constants.py"
click node_profiler "https://github.com/esizzle/2dversealpha/blob/main2/profiler.py"

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_game,node_camera,node_audio,node_resources,node_clock,node_profiler toneBlue
class node_world,node_environment,node_physics,node_constants toneAmber
class node_cell,node_decisions,node_multicell,node_plant_defense toneMint
class node_player_control,node_settings,node_journal,node_colors toneRose
class node_player_actor toneIndigo
```

## Components

### Game runtime

- [Game loop](https://github.com/esizzle/2dversealpha/blob/main2/main.py): `main.py`
- [Camera](https://github.com/esizzle/2dversealpha/blob/main2/camera.py): `camera.py`
- [Audio manager](https://github.com/esizzle/2dversealpha/blob/main2/audio.py): `audio.py`
- [Resource paths](https://github.com/esizzle/2dversealpha/blob/main2/resources.py): `resources.py`
- [Simulation clock](https://github.com/esizzle/2dversealpha/blob/main2/sim_clock.py): `sim_clock.py`
- [Runtime profiler](https://github.com/esizzle/2dversealpha/blob/main2/profiler.py): `profiler.py`

### World simulation

- [World grid](https://github.com/esizzle/2dversealpha/blob/main2/world_grid.py): `world_grid.py`
- [Environment features](https://github.com/esizzle/2dversealpha/blob/main2/env_features.py): `env_features.py`
- [Physics objects](https://github.com/esizzle/2dversealpha/blob/main2/physics_object.py): `physics_object.py`
- [Simulation tuning](https://github.com/esizzle/2dversealpha/blob/main2/global_constants.py): `global_constants.py`

### Cell biology

- [Cells and genomes](https://github.com/esizzle/2dversealpha/blob/main2/cell.py): `cell.py`
- [Decision models](https://github.com/esizzle/2dversealpha/blob/main2/decision_models.py): `decision_models.py`
- [Multicellular links](https://github.com/esizzle/2dversealpha/blob/main2/multicell.py): `multicell.py`
- [Plant defense](https://github.com/esizzle/2dversealpha/blob/main2/plant_defense.py): `plant_defense.py`

### Player interface

- [Player control](https://github.com/esizzle/2dversealpha/blob/main2/player.py): `player.py`
- [Settings panel](https://github.com/esizzle/2dversealpha/blob/main2/settings.py): `settings.py`
- [Mutation journal](https://github.com/esizzle/2dversealpha/blob/main2/journal.py): `journal.py`
- [Color palette](https://github.com/esizzle/2dversealpha/blob/main2/colors.py): `colors.py`

### Other components

- **Player**

## Connections

- Player → Game loop: plays (evidence: `main.py`)
- Game loop → World grid: updates and draws (evidence: `main.py`)
- Game loop → Camera: uses (evidence: `main.py`)
- Game loop → Player control: routes input (evidence: `main.py`)
- Game loop → Settings panel: configures (evidence: `main.py`)
- Game loop → Mutation journal: records mutations (evidence: `main.py`)
- Game loop → Audio manager: uses (evidence: `main.py`)
- Game loop → Simulation clock: uses (evidence: `main.py`)
- Game loop → Runtime profiler: uses (evidence: `main.py`)
- Game loop → Plant defense: uses (evidence: `main.py`)
- Audio manager → Resource paths: loads assets (evidence: `audio.py`)
- Player control → Cells and genomes: controls (evidence: `player.py`)
- Cells and genomes → World grid: queries environment (evidence: `cell.py`)
- Cells and genomes → Decision models: uses (evidence: `cell.py`)
- Cells and genomes → Multicellular links: manages links (evidence: `cell.py`)
- Cells and genomes → Physics objects: creates bodies (evidence: `cell.py`)
- World grid → Physics objects: creates colliders (evidence: `world_grid.py`)
- World grid → Environment features: builds snapshots (evidence: `world_grid.py`)
- World grid → Color palette: uses (evidence: `world_grid.py`)
- Decision models → World grid: queries (evidence: `decision_models.py`)
- Multicellular links → Simulation tuning: uses tuning (evidence: `multicell.py`)
- Plant defense → Simulation tuning: uses tuning (evidence: `plant_defense.py`)
- Mutation journal → Color palette: renders with (evidence: `journal.py`)
- Settings panel → Color palette: renders with (evidence: `settings.py`)
- Cells and genomes → Color palette: uses (evidence: `cell.py`)
