# timyr-tm/testgame architecture

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

- Interactive diagram: https://gitdiagram.com/timyr-tm/testgame
- Repository: https://github.com/timyr-tm/testgame

## Overview

TestGame is an experimental Godot game with a reusable C# API and a Roslyn event-subscription generator. The visible runtime workflow begins when Godot readies the main scene, which publishes a setup event through the game event bus; that bus dispatches matching generated handlers. The API also provides generic vector types, with game-side conversions to Godot vectors. Logging is configured through a Godot console sink and structured formatter. World-object types are present, but the excerpts do not show gameplay behavior or scene wiring, so those relationships are omitted.

Main entry points: [`src/TestGame.Game/src/Event/EventBus.cs`](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/Event/EventBus.cs) (Game Event Bus), [`src/TestGame.Game/src/Main.cs`](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/Main.cs) (Main Scene), [`src/TestGame.Game/src/Logging/GodotConsoleSink.cs`](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/Logging/GodotConsoleSink.cs) (Godot Console Sink), [`src/TestGame.Api/src/Math/Vectors/IFloatingVector.cs`](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Math/Vectors/IFloatingVector.cs) (Floating Vector Interface)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Godot Runtime"]
  node_main["Main Scene<br/>[Main.cs]"]
  node_worldnode["Game Object Node<br/>[GameObjectNode.cs]"]
  node_vectorbridge["Vector Extensions"]
end

subgraph group_events["Event System"]
  node_eventbus["Game Event Bus<br/>[EventBus.cs]"]
  node_setupevent["Setup Event<br/>[SetupEvent.cs]"]
  node_eventsubs["Generated Subscribers"]
  node_generator["Subscription Generator"]
end

subgraph group_api["Game API"]
  node_eventcontract["Event Contract<br/>[Event.cs]"]
  node_eventattribute["Handler Attribute"]
  node_eventinterface["Bus Interface<br/>[IEventBus.cs]"]
  node_gameobject["Game Object Contract<br/>[GameObject.cs]"]
  node_vectorbase["Vector Interface<br/>[IVector.cs]"]
  node_floatvectorbase["Floating Vector Interface<br/>[IFloatingVector.cs]"]
  node_vector2i["2D Integer Vector<br/>[Vector2I.cs]"]
  node_vector2f["2D Float Vector<br/>[Vector2F.cs]"]
  node_vector3i["3D Integer Vector<br/>[Vector3I.cs]"]
  node_vector3f["3D Float Vector<br/>[Vector3F.cs]"]
end

subgraph group_logging["Logging"]
  node_loggingsetup["Logging Setup<br/>[LoggingSetup.cs]"]
  node_sink["Godot Console Sink"]
  node_formatter["Structured Formatter"]
end

node_godot(("Godot Engine"))

node_godot -.->|"readies scene"| node_main
node_main -->|"creates"| node_setupevent
node_main -->|"publishes through"| node_eventbus
node_eventbus -->|"looks up handlers"| node_eventsubs
node_generator -->|"finds attributed handlers"| node_eventattribute
node_generator -->|"groups event types"| node_eventcontract
node_eventbus -->|"implements"| node_eventinterface
node_eventbus -->|"dispatches events"| node_eventcontract
node_setupevent -->|"inherits"| node_eventcontract
node_vector2i -->|"implements"| node_vectorbase
node_vector3i -->|"implements"| node_vectorbase
node_vector2f -->|"implements"| node_floatvectorbase
node_vector3f -->|"implements"| node_floatvectorbase
node_floatvectorbase -->|"extends"| node_vectorbase
node_vectorbridge -->|"converts"| node_vector2i
node_vectorbridge -->|"converts"| node_vector2f
node_loggingsetup -->|"configures"| node_sink
node_sink -->|"formats with"| node_formatter
node_sink -->|"prints rich output"| node_godot

click node_main "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/Main.cs"
click node_worldnode "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/World/GameObjectNode.cs"
click node_vectorbridge "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/Math/VectorExtensions.cs"
click node_eventbus "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/Event/EventBus.cs"
click node_setupevent "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/Event/SetupEvent.cs"
click node_eventsubs "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.SourceGenerators/src/EventSubsGenerator.cs"
click node_generator "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.SourceGenerators/src/EventSubsGenerator.cs"
click node_eventcontract "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Event/Event.cs"
click node_eventattribute "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Event/EventHandlerAttribute.cs"
click node_eventinterface "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Event/IEventBus.cs"
click node_gameobject "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/World/GameObject.cs"
click node_vectorbase "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Math/Vectors/IVector.cs"
click node_floatvectorbase "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Math/Vectors/IFloatingVector.cs"
click node_vector2i "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Math/Vectors/Vector2I.cs"
click node_vector2f "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Math/Vectors/Vector2F.cs"
click node_vector3i "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Math/Vectors/Vector3I.cs"
click node_vector3f "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Math/Vectors/Vector3F.cs"
click node_loggingsetup "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/Logging/LoggingSetup.cs"
click node_sink "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/Logging/GodotConsoleSink.cs"
click node_formatter "https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/Logging/StructuredFormatter.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_main,node_worldnode,node_vectorbridge toneBlue
class node_eventbus,node_setupevent,node_eventsubs,node_generator toneAmber
class node_eventcontract,node_eventattribute,node_eventinterface,node_gameobject,node_vectorbase,node_floatvectorbase,node_vector2i,node_vector2f,node_vector3i,node_vector3f toneMint
class node_loggingsetup,node_sink,node_formatter toneRose
class node_godot toneIndigo
```

## Components

### Godot Runtime

- [Main Scene](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/Main.cs): `src/TestGame.Game/src/Main.cs`
- [Game Object Node](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/World/GameObjectNode.cs): `src/TestGame.Game/src/World/GameObjectNode.cs`
- [Vector Extensions](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/Math/VectorExtensions.cs): `src/TestGame.Game/src/Math/VectorExtensions.cs`

### Event System

- [Game Event Bus](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/Event/EventBus.cs): `src/TestGame.Game/src/Event/EventBus.cs`
- [Setup Event](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/Event/SetupEvent.cs): `src/TestGame.Game/src/Event/SetupEvent.cs`
- [Generated Subscribers](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.SourceGenerators/src/EventSubsGenerator.cs): `src/TestGame.SourceGenerators/src/EventSubsGenerator.cs`
- [Subscription Generator](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.SourceGenerators/src/EventSubsGenerator.cs): `src/TestGame.SourceGenerators/src/EventSubsGenerator.cs`

### Game API

- [Event Contract](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Event/Event.cs): `src/TestGame.Api/src/Event/Event.cs`
- [Handler Attribute](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Event/EventHandlerAttribute.cs): `src/TestGame.Api/src/Event/EventHandlerAttribute.cs`
- [Bus Interface](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Event/IEventBus.cs): `src/TestGame.Api/src/Event/IEventBus.cs`
- [Game Object Contract](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/World/GameObject.cs): `src/TestGame.Api/src/World/GameObject.cs`
- [Vector Interface](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Math/Vectors/IVector.cs): `src/TestGame.Api/src/Math/Vectors/IVector.cs`
- [Floating Vector Interface](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Math/Vectors/IFloatingVector.cs): `src/TestGame.Api/src/Math/Vectors/IFloatingVector.cs`
- [2D Integer Vector](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Math/Vectors/Vector2I.cs): `src/TestGame.Api/src/Math/Vectors/Vector2I.cs`
- [2D Float Vector](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Math/Vectors/Vector2F.cs): `src/TestGame.Api/src/Math/Vectors/Vector2F.cs`
- [3D Integer Vector](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Math/Vectors/Vector3I.cs): `src/TestGame.Api/src/Math/Vectors/Vector3I.cs`
- [3D Float Vector](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Api/src/Math/Vectors/Vector3F.cs): `src/TestGame.Api/src/Math/Vectors/Vector3F.cs`

### Logging

- [Logging Setup](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/Logging/LoggingSetup.cs): `src/TestGame.Game/src/Logging/LoggingSetup.cs`
- [Godot Console Sink](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/Logging/GodotConsoleSink.cs): `src/TestGame.Game/src/Logging/GodotConsoleSink.cs`
- [Structured Formatter](https://github.com/timyr-tm/testgame/blob/main/src/TestGame.Game/src/Logging/StructuredFormatter.cs): `src/TestGame.Game/src/Logging/StructuredFormatter.cs`

### Other components

- **Godot Engine**

## Connections

- Godot Engine → Main Scene: readies scene
- Main Scene → Setup Event: creates (evidence: `src/TestGame.Game/src/Main.cs`)
- Main Scene → Game Event Bus: publishes through (evidence: `src/TestGame.Game/src/Main.cs`)
- Game Event Bus → Generated Subscribers: looks up handlers (evidence: `src/TestGame.Game/src/Event/EventBus.cs`)
- Subscription Generator → Handler Attribute: finds attributed handlers (evidence: `src/TestGame.SourceGenerators/src/EventSubsGenerator.cs`)
- Subscription Generator → Event Contract: groups event types (evidence: `src/TestGame.SourceGenerators/src/EventSubsGenerator.cs`)
- Game Event Bus → Bus Interface: implements (evidence: `src/TestGame.Game/src/Event/EventBus.cs`)
- Game Event Bus → Event Contract: dispatches events (evidence: `src/TestGame.Game/src/Event/EventBus.cs`)
- Setup Event → Event Contract: inherits (evidence: `src/TestGame.Game/src/Event/SetupEvent.cs`)
- 2D Integer Vector → Vector Interface: implements (evidence: `src/TestGame.Api/src/Math/Vectors/Vector2I.cs`)
- 3D Integer Vector → Vector Interface: implements (evidence: `src/TestGame.Api/src/Math/Vectors/Vector3I.cs`)
- 2D Float Vector → Floating Vector Interface: implements (evidence: `src/TestGame.Api/src/Math/Vectors/Vector2F.cs`)
- 3D Float Vector → Floating Vector Interface: implements (evidence: `src/TestGame.Api/src/Math/Vectors/Vector3F.cs`)
- Floating Vector Interface → Vector Interface: extends (evidence: `src/TestGame.Api/src/Math/Vectors/IFloatingVector.cs`)
- Vector Extensions → 2D Integer Vector: converts (evidence: `src/TestGame.Game/src/Math/VectorExtensions.cs`)
- Vector Extensions → 2D Float Vector: converts (evidence: `src/TestGame.Game/src/Math/VectorExtensions.cs`)
- Logging Setup → Godot Console Sink: configures (evidence: `src/TestGame.Game/src/Logging/LoggingSetup.cs`)
- Godot Console Sink → Structured Formatter: formats with (evidence: `src/TestGame.Game/src/Logging/GodotConsoleSink.cs`)
- Godot Console Sink → Godot Engine: prints rich output (evidence: `src/TestGame.Game/src/Logging/GodotConsoleSink.cs`)
