# bioerrorlog/tierra architecture

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

- Interactive diagram: https://gitdiagram.com/bioerrorlog/tierra
- Repository: https://github.com/bioerrorlog/tierra

## Overview

Tierra is an artificial-life simulator: users start a run from a configuration and observe its evolving population and statistics. Beagle Explorer is a separate monitoring client, documented as connecting to a local Tierra run; the repository also includes a stdio client. The source index shows the main simulation, Beagle server, protocol, and client modules, but most implementation excerpts are absent. Accordingly, the graph captures documented product relationships and leaves unsampled internal wiring unasserted.

Main entry points: [`tierra/micromon.c`](https://github.com/bioerrorlog/tierra/blob/main/tierra/micromon.c) (Simulation Engine), [`Bgl-GUI_X11/beagleGUI.c`](https://github.com/bioerrorlog/tierra/blob/main/Bgl-GUI_X11/beagleGUI.c) (X11 Explorer), [`Bglclnt/beagleMessageMgr.c`](https://github.com/bioerrorlog/tierra/blob/main/Bglclnt/beagleMessageMgr.c) (Message Manager), [`Bglclnt/beagleMain.c`](https://github.com/bioerrorlog/tierra/blob/main/Bglclnt/beagleMain.c) (Beagle Client)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_sim["Tierra Simulation"]
  node_setup["Run Setup<br/>[tsetup.c]"]
  node_engine["Simulation Engine<br/>[micromon.c]"]
  node_instructions["Genome Instructions<br/>[instruct.c]"]
end

subgraph group_state["Population and Analysis"]
  node_globals["Simulation State<br/>[globals.h]"]
  node_memory["Population Memory<br/>[rambank.c]"]
  node_gene["Gene Bank<br/>[genio.c]"]
  node_analysis["Thread Analysis<br/>[thrdana.c]"]
end

subgraph group_monitor["Beagle Monitoring"]
  node_beagle_server["Beagle Server<br/>[tbgl_proc.c]"]
  node_server_comm["Server Communication<br/>[tbgl_com.c]"]
end

subgraph group_client["Beagle Clients"]
  node_gui["X11 Explorer<br/>[beagleGUI.c]"]
  node_gui_overview["Overview Window"]
  node_gui_query["Size Query Window"]
  node_stdio["Stdio Client<br/>[bglstd_main.c]"]
  node_client_main["Beagle Client<br/>[beagleMain.c]"]
end

subgraph group_protocol["Communication"]
  node_manager["Message Manager<br/>[beagleMessageMgr.c]"]
  node_socket["Socket Manager"]
  node_messages["Message Handlers<br/>[beagleMessage_Ov.c]"]
  node_wire["Wire Encoding<br/>[bgl_dat_xdr.c]"]
end

node_operator(("Operator"))

node_operator -->|"configures"| node_setup
node_operator -->|"starts run"| node_engine
node_operator -->|"launches"| node_gui
node_operator -.->|"uses"| node_stdio
node_gui -->|"monitors run"| node_engine
node_engine -.->|"serves monitoring"| node_beagle_server
node_engine -.->|"executes"| node_instructions
node_engine -.->|"updates population"| node_memory
node_engine -.->|"uses gene bank"| node_gene
node_engine -.->|"collects analysis"| node_analysis
node_engine -.->|"uses state"| node_globals
node_gui -.->|"presents overview"| node_gui_overview
node_gui -.->|"opens query"| node_gui_query
node_gui_query -->|"requests sizes"| node_manager
node_client_main -.->|"selects interface"| node_gui
node_client_main -.->|"selects interface"| node_stdio
node_manager -.->|"dispatches messages"| node_messages
node_manager -.->|"uses connections"| node_socket
node_messages -.->|"encodes data"| node_wire
node_beagle_server -.->|"handles communication"| node_server_comm
node_server_comm -.->|"exchanges data"| node_wire

click node_setup "https://github.com/bioerrorlog/tierra/blob/main/tierra/tsetup.c"
click node_engine "https://github.com/bioerrorlog/tierra/blob/main/tierra/micromon.c"
click node_instructions "https://github.com/bioerrorlog/tierra/blob/main/tierra/instruct.c"
click node_globals "https://github.com/bioerrorlog/tierra/blob/main/tierra/globals.h"
click node_memory "https://github.com/bioerrorlog/tierra/blob/main/tierra/rambank.c"
click node_gene "https://github.com/bioerrorlog/tierra/blob/main/tierra/genio.c"
click node_analysis "https://github.com/bioerrorlog/tierra/blob/main/tierra/thrdana.c"
click node_beagle_server "https://github.com/bioerrorlog/tierra/blob/main/Bglserv/tbgl_proc.c"
click node_server_comm "https://github.com/bioerrorlog/tierra/blob/main/Bglserv/tbgl_com.c"
click node_gui "https://github.com/bioerrorlog/tierra/blob/main/Bgl-GUI_X11/beagleGUI.c"
click node_gui_overview "https://github.com/bioerrorlog/tierra/blob/main/Bgl-GUI_X11/beagleGUI_OverviewWindow.c"
click node_gui_query "https://github.com/bioerrorlog/tierra/blob/main/Bgl-GUI_X11/beagleGUI_QueryWindow.c"
click node_stdio "https://github.com/bioerrorlog/tierra/blob/main/Bgl-UI_stdio/bglstd_main.c"
click node_client_main "https://github.com/bioerrorlog/tierra/blob/main/Bglclnt/beagleMain.c"
click node_manager "https://github.com/bioerrorlog/tierra/blob/main/Bglclnt/beagleMessageMgr.c"
click node_socket "https://github.com/bioerrorlog/tierra/blob/main/Bglclnt/beagleUTIL_SockMgr.c"
click node_messages "https://github.com/bioerrorlog/tierra/blob/main/Bglclnt/beagleMessage_Ov.c"
click node_wire "https://github.com/bioerrorlog/tierra/blob/main/Bglcom/bgl_dat_xdr.c"

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_setup,node_engine,node_instructions toneBlue
class node_globals,node_memory,node_gene,node_analysis toneAmber
class node_beagle_server,node_server_comm toneMint
class node_gui,node_gui_overview,node_gui_query,node_stdio,node_client_main toneRose
class node_manager,node_socket,node_messages,node_wire,node_operator toneIndigo
```

## Components

### Tierra Simulation

- [Run Setup](https://github.com/bioerrorlog/tierra/blob/main/tierra/tsetup.c): `tierra/tsetup.c`
- [Simulation Engine](https://github.com/bioerrorlog/tierra/blob/main/tierra/micromon.c): `tierra/micromon.c`
- [Genome Instructions](https://github.com/bioerrorlog/tierra/blob/main/tierra/instruct.c): `tierra/instruct.c`

### Population and Analysis

- [Simulation State](https://github.com/bioerrorlog/tierra/blob/main/tierra/globals.h): `tierra/globals.h`
- [Population Memory](https://github.com/bioerrorlog/tierra/blob/main/tierra/rambank.c): `tierra/rambank.c`
- [Gene Bank](https://github.com/bioerrorlog/tierra/blob/main/tierra/genio.c): `tierra/genio.c`
- [Thread Analysis](https://github.com/bioerrorlog/tierra/blob/main/tierra/thrdana.c): `tierra/thrdana.c`

### Beagle Monitoring

- [Beagle Server](https://github.com/bioerrorlog/tierra/blob/main/Bglserv/tbgl_proc.c): `Bglserv/tbgl_proc.c`
- [Server Communication](https://github.com/bioerrorlog/tierra/blob/main/Bglserv/tbgl_com.c): `Bglserv/tbgl_com.c`

### Beagle Clients

- [X11 Explorer](https://github.com/bioerrorlog/tierra/blob/main/Bgl-GUI_X11/beagleGUI.c): `Bgl-GUI_X11/beagleGUI.c`
- [Overview Window](https://github.com/bioerrorlog/tierra/blob/main/Bgl-GUI_X11/beagleGUI_OverviewWindow.c): `Bgl-GUI_X11/beagleGUI_OverviewWindow.c`
- [Size Query Window](https://github.com/bioerrorlog/tierra/blob/main/Bgl-GUI_X11/beagleGUI_QueryWindow.c): `Bgl-GUI_X11/beagleGUI_QueryWindow.c`
- [Stdio Client](https://github.com/bioerrorlog/tierra/blob/main/Bgl-UI_stdio/bglstd_main.c): `Bgl-UI_stdio/bglstd_main.c`
- [Beagle Client](https://github.com/bioerrorlog/tierra/blob/main/Bglclnt/beagleMain.c): `Bglclnt/beagleMain.c`

### Communication

- [Message Manager](https://github.com/bioerrorlog/tierra/blob/main/Bglclnt/beagleMessageMgr.c): `Bglclnt/beagleMessageMgr.c`
- [Socket Manager](https://github.com/bioerrorlog/tierra/blob/main/Bglclnt/beagleUTIL_SockMgr.c): `Bglclnt/beagleUTIL_SockMgr.c`
- [Message Handlers](https://github.com/bioerrorlog/tierra/blob/main/Bglclnt/beagleMessage_Ov.c): `Bglclnt/beagleMessage_Ov.c`
- [Wire Encoding](https://github.com/bioerrorlog/tierra/blob/main/Bglcom/bgl_dat_xdr.c): `Bglcom/bgl_dat_xdr.c`

### Other components

- **Operator**

## Connections

- Operator → Run Setup: configures
- Operator → Simulation Engine: starts run
- Operator → X11 Explorer: launches
- Operator → Stdio Client: uses
- X11 Explorer → Simulation Engine: monitors run
- Simulation Engine → Beagle Server: serves monitoring
- Simulation Engine → Genome Instructions: executes
- Simulation Engine → Population Memory: updates population
- Simulation Engine → Gene Bank: uses gene bank
- Simulation Engine → Thread Analysis: collects analysis
- Simulation Engine → Simulation State: uses state (evidence: `tierra/micromon.c`)
- X11 Explorer → Overview Window: presents overview
- X11 Explorer → Size Query Window: opens query
- Size Query Window → Message Manager: requests sizes (evidence: `Bgl-GUI_X11/beagleGUI_QueryWindow.c`)
- Beagle Client → X11 Explorer: selects interface
- Beagle Client → Stdio Client: selects interface
- Message Manager → Message Handlers: dispatches messages
- Message Manager → Socket Manager: uses connections
- Message Handlers → Wire Encoding: encodes data
- Beagle Server → Server Communication: handles communication
- Server Communication → Wire Encoding: exchanges data
