# aidanmorgan/tim architecture

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

- Interactive diagram: https://gitdiagram.com/aidanmorgan/tim
- Repository: https://github.com/aidanmorgan/tim

## Overview

Curious Contraptions is a 3D contraption-puzzle game: players place and connect parts in a workshop, run a machine, and try to satisfy a level goal. The workshop also supports editing, undo, and local save/load; the README describes a progressively taught campaign and electrical, mechanical, optical, rope, airflow, and other contraption mechanics. The graph emphasizes those product stages and the simulation’s part/network layers. Some relationships are documented only at a broad level; dashed, uncited links mark unverified integration rather than inspected call paths.

Main entry points: [`engine/MachineWorld.cs`](https://github.com/aidanmorgan/tim/blob/main/engine/MachineWorld.cs) (Machine world), [`ui/Workshop.cs`](https://github.com/aidanmorgan/tim/blob/main/ui/Workshop.cs) (Workshop UI), [`engine/WorldGeometry.cs`](https://github.com/aidanmorgan/tim/blob/main/engine/WorldGeometry.cs) (World geometry), [`engine/MachinePart.cs`](https://github.com/aidanmorgan/tim/blob/main/engine/MachinePart.cs) (Part runtime)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workshop["Workshop"]
  node_workshop_ui["Workshop UI<br/>[Workshop.cs]"]
  node_workshop_guidance["Editing guidance"]
  node_saved_machine["Saved machine<br/>[MachineData.cs]"]
end

subgraph group_gameplay["Puzzles"]
  node_campaign["Campaign content<br/>[Program.cs]"]
end

subgraph group_simulation["Simulation"]
  node_machine_world["Machine world<br/>[MachineWorld.cs]"]
  node_part_catalog["Contraption parts"]
  node_machine_part["Part runtime<br/>[MachinePart.cs]"]
  node_connection_ports["Typed connections<br/>[ConnectionPort.cs]"]
  node_mechanical["Mechanical network"]
  node_electrical["Electrical network"]
  node_optical["Optical network<br/>[OpticalNetwork.cs]"]
  node_rope["Rope network<br/>[RopeNetwork.cs]"]
  node_airflow["Airflow network<br/>[AirflowNetwork.cs]"]
  node_world_geometry["World geometry<br/>[WorldGeometry.cs]"]
  node_physics_world["Physics solver<br/>[PhysicsWorld.cs]"]
  node_physics_body["Physics bodies<br/>[PhysicsBody.cs]"]
end

subgraph group_presentation["Visuals"]
  node_workshop_visuals["Workshop visuals<br/>[WorkshopIcons.cs]"]
  node_optical_visuals["Optical path visuals"]
end

node_player(("Player"))

node_player -->|"edits machine"| node_workshop_ui
node_workshop_ui -->|"edits and runs"| node_machine_world
node_workshop_ui -->|"saves snapshot"| node_saved_machine
node_workshop_ui -->|"selects level"| node_campaign
node_workshop_ui -->|"uses guidance"| node_workshop_guidance
node_workshop_ui -->|"uses icons"| node_workshop_visuals
node_machine_world -->|"manages parts"| node_machine_part
node_machine_world -->|"creates parts"| node_part_catalog
node_machine_part -->|"declares ports"| node_connection_ports
node_machine_world -->|"updates network"| node_mechanical
node_machine_world -->|"updates network"| node_electrical
node_machine_world -->|"updates network"| node_optical
node_machine_world -->|"updates network"| node_rope
node_machine_world -->|"updates network"| node_airflow
node_machine_world -->|"refreshes paths"| node_optical_visuals
node_machine_world -.->|"uses collision geometry"| node_world_geometry
node_world_geometry -->|"queries bodies"| node_physics_body
node_world_geometry -.->|"uses physics geometry"| node_physics_world
node_physics_world -->|"steps bodies"| node_physics_body

click node_workshop_ui "https://github.com/aidanmorgan/tim/blob/main/ui/Workshop.cs"
click node_workshop_guidance "https://github.com/aidanmorgan/tim/blob/main/ui/WorkshopGuidance.cs"
click node_workshop_visuals "https://github.com/aidanmorgan/tim/blob/main/ui/WorkshopIcons.cs"
click node_saved_machine "https://github.com/aidanmorgan/tim/blob/main/engine/MachineData.cs"
click node_campaign "https://github.com/aidanmorgan/tim/blob/main/tools/Campaign/Program.cs"
click node_machine_world "https://github.com/aidanmorgan/tim/blob/main/engine/MachineWorld.cs"
click node_part_catalog "https://github.com/aidanmorgan/tim/tree/main/parts"
click node_machine_part "https://github.com/aidanmorgan/tim/blob/main/engine/MachinePart.cs"
click node_connection_ports "https://github.com/aidanmorgan/tim/blob/main/engine/ConnectionPort.cs"
click node_mechanical "https://github.com/aidanmorgan/tim/blob/main/engine/MechanicalNetwork.cs"
click node_electrical "https://github.com/aidanmorgan/tim/blob/main/engine/ElectricalNetwork.cs"
click node_optical "https://github.com/aidanmorgan/tim/blob/main/engine/OpticalNetwork.cs"
click node_rope "https://github.com/aidanmorgan/tim/blob/main/engine/RopeNetwork.cs"
click node_airflow "https://github.com/aidanmorgan/tim/blob/main/engine/AirflowNetwork.cs"
click node_world_geometry "https://github.com/aidanmorgan/tim/blob/main/engine/WorldGeometry.cs"
click node_physics_world "https://github.com/aidanmorgan/tim/blob/main/engine/physics/PhysicsWorld.cs"
click node_physics_body "https://github.com/aidanmorgan/tim/blob/main/engine/physics/PhysicsBody.cs"
click node_optical_visuals "https://github.com/aidanmorgan/tim/blob/main/ui/OpticalPathVisual.cs"

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_workshop_ui,node_workshop_guidance,node_saved_machine toneBlue
class node_campaign toneAmber
class node_machine_world,node_part_catalog,node_machine_part,node_connection_ports,node_mechanical,node_electrical,node_optical,node_rope,node_airflow,node_world_geometry,node_physics_world,node_physics_body toneMint
class node_workshop_visuals,node_optical_visuals toneRose
class node_player toneIndigo
```

## Components

### Workshop

- [Workshop UI](https://github.com/aidanmorgan/tim/blob/main/ui/Workshop.cs): `ui/Workshop.cs`
- [Editing guidance](https://github.com/aidanmorgan/tim/blob/main/ui/WorkshopGuidance.cs): `ui/WorkshopGuidance.cs`
- [Saved machine](https://github.com/aidanmorgan/tim/blob/main/engine/MachineData.cs): `engine/MachineData.cs`

### Puzzles

- [Campaign content](https://github.com/aidanmorgan/tim/blob/main/tools/Campaign/Program.cs): `tools/Campaign/Program.cs`

### Simulation

- [Machine world](https://github.com/aidanmorgan/tim/blob/main/engine/MachineWorld.cs): `engine/MachineWorld.cs`
- [Contraption parts](https://github.com/aidanmorgan/tim/tree/main/parts): `parts`
- [Part runtime](https://github.com/aidanmorgan/tim/blob/main/engine/MachinePart.cs): `engine/MachinePart.cs`
- [Typed connections](https://github.com/aidanmorgan/tim/blob/main/engine/ConnectionPort.cs): `engine/ConnectionPort.cs`
- [Mechanical network](https://github.com/aidanmorgan/tim/blob/main/engine/MechanicalNetwork.cs): `engine/MechanicalNetwork.cs`
- [Electrical network](https://github.com/aidanmorgan/tim/blob/main/engine/ElectricalNetwork.cs): `engine/ElectricalNetwork.cs`
- [Optical network](https://github.com/aidanmorgan/tim/blob/main/engine/OpticalNetwork.cs): `engine/OpticalNetwork.cs`
- [Rope network](https://github.com/aidanmorgan/tim/blob/main/engine/RopeNetwork.cs): `engine/RopeNetwork.cs`
- [Airflow network](https://github.com/aidanmorgan/tim/blob/main/engine/AirflowNetwork.cs): `engine/AirflowNetwork.cs`
- [World geometry](https://github.com/aidanmorgan/tim/blob/main/engine/WorldGeometry.cs): `engine/WorldGeometry.cs`
- [Physics solver](https://github.com/aidanmorgan/tim/blob/main/engine/physics/PhysicsWorld.cs): `engine/physics/PhysicsWorld.cs`
- [Physics bodies](https://github.com/aidanmorgan/tim/blob/main/engine/physics/PhysicsBody.cs): `engine/physics/PhysicsBody.cs`

### Visuals

- [Workshop visuals](https://github.com/aidanmorgan/tim/blob/main/ui/WorkshopIcons.cs): `ui/WorkshopIcons.cs`
- [Optical path visuals](https://github.com/aidanmorgan/tim/blob/main/ui/OpticalPathVisual.cs): `ui/OpticalPathVisual.cs`

### Other components

- **Player**

## Connections

- Player → Workshop UI: edits machine (evidence: `README.md`)
- Workshop UI → Machine world: edits and runs (evidence: `ui/Workshop.cs`)
- Workshop UI → Saved machine: saves snapshot (evidence: `ui/Workshop.cs`)
- Workshop UI → Campaign content: selects level (evidence: `README.md`)
- Workshop UI → Editing guidance: uses guidance (evidence: `ui/WorkshopGuidance.cs`)
- Workshop UI → Workshop visuals: uses icons (evidence: `ui/Workshop.cs`)
- Machine world → Part runtime: manages parts (evidence: `engine/MachineWorld.cs`)
- Machine world → Contraption parts: creates parts (evidence: `engine/MachineWorld.cs`)
- Part runtime → Typed connections: declares ports (evidence: `engine/MachinePart.cs`)
- Machine world → Mechanical network: updates network (evidence: `engine/MachineWorld.cs`)
- Machine world → Electrical network: updates network (evidence: `engine/MachineWorld.cs`)
- Machine world → Optical network: updates network (evidence: `engine/MachineWorld.cs`)
- Machine world → Rope network: updates network (evidence: `engine/MachineWorld.cs`)
- Machine world → Airflow network: updates network (evidence: `engine/MachineWorld.cs`)
- Machine world → Optical path visuals: refreshes paths (evidence: `engine/MachineWorld.cs`)
- Machine world → World geometry: uses collision geometry (evidence: `engine/WorldGeometry.cs`)
- World geometry → Physics bodies: queries bodies (evidence: `engine/WorldGeometry.cs`)
- World geometry → Physics solver: uses physics geometry
- Physics solver → Physics bodies: steps bodies (evidence: `engine/physics/PhysicsWorld.cs`)
