# bosh/trogdor-pinball architecture

> Architecture diagram of the GitHub repository bosh/trogdor-pinball, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-27). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/bosh/trogdor-pinball
- Repository: https://github.com/bosh/trogdor-pinball

## Overview

##### Main Components

a) Core Game Components:
- MPF Framework Layer
- FAST Neuron Hardware Interface
- Godot-based GMC (Game Media Controller)
- Ruby-based Build System (Trogbuild)

b) Configuration Layer:
- Base Configurations (/config)
- Mode Configurations (/modes)
- Hardware Definitions
- Generated Configurations

c) Game Elements:
- Mode System
- Controller
- Sound System
- Light Controller
- Switch Management
- Ball Device Management

**┌─────────────────────────────────────────────────────┐**
- Physical Layer                      │
- (FAST Neuron Hardware, Switches, Lights, etc)    │
- ┘
- ↕
**┌─────────────────────────────────────────────────────┐**
- Hardware Interface Layer               │
- (MPF Hardware Abstractions, Drivers)        │
- ┘
- ↕
**┌─────────────────────────────────────────────────────┐**
- Game Logic Layer                   │
- ┬─────────────────────┬────────────────┤
- Mode       │     Base Game       │    Show        │
- System     │     Controller      │    Controller  │
- ┴─────────────────────┴────────────────┘
- ↕
**┌─────────────────────────────────────────────────────┐**
- Presentation Layer                    │
- (Godot-based GMC, Display, Audio)         │
- ┘

##### Key Relationships to Highlight

- Build pipeline from Ruby-based Trogbuild to generated configurations
- Mode hierarchy and relationships
- Demonstrate the audio system's integration with game events
- Interaction between physical inputs and game logic
- Configuration flow from YAML files to runtime systems

##### Build System Integration

How trogbuild.rb generates:
- Mode configurations
- Sound hooks
- Achievement systems
- Definitions

##### Monitoring and Debug

Monitoring system's architecture showing:
- Monitor interface
- Debug connections
- Live state observation

Remember to:
- Keep hardware abstraction layers clear
- Notes for key architectural decisions
- Configuration file relationships

This architecture should emphasize the real-time nature of the pinball system while showing how the various components interact to create the game experience.

## Diagram (Mermaid)

```mermaid
flowchart TB
    subgraph Physical["Physical Layer"]
        HW[FAST Neuron Hardware]
        SW[Switches]
        LT[Lights]
        SND[Sound Hardware]
    end

    subgraph Interface["Hardware Interface Layer"]
        FAST["FAST Hardware Interface"]:::config
        HWDEF["Hardware Definitions"]:::config
        SWMGR["Switch Management"]:::config
        LTCTL["Light Controller"]:::config
        BDEV["Ball Device Management"]:::config
    end

    subgraph Logic["Game Logic Layer"]
        CORE["Core Game Logic"]:::code
        BASE["Base Game Controller"]:::code
        MODES["Mode System"]:::code
        SHOWS["Show Controller"]:::code
        ACH["Achievement System"]:::code
    end

    subgraph Presentation["Presentation Layer"]
        GMC["Godot Media Controller"]:::presentation
        SOUND["Sound System"]:::presentation
        DISP["Display System"]
    end

    subgraph Build["Build & Configuration"]
        TROG["Ruby Build System"]:::build
        BCONF["Base Configuration"]:::config
        GCONF["Generated Configurations"]:::config
        MON["Monitor/Debug Interface"]:::config
    end

    %% Physical to Interface connections
    HW --> FAST
    SW --> SWMGR
    LT --> LTCTL
    SND --> SOUND

    %% Interface to Logic connections
    FAST --> CORE
    HWDEF --> CORE
    SWMGR --> CORE
    LTCTL --> SHOWS
    BDEV --> BASE

    %% Logic to Presentation connections
    CORE --> GMC
    SHOWS --> GMC
    MODES --> GMC
    BASE --> GMC
    ACH --> GMC

    %% Build system connections
    TROG --> GCONF
    TROG --> ACH
    BCONF --> CORE
    GCONF --> CORE
    MON --> CORE

    %% Style definitions
    classDef config fill:#f96,stroke:#333
    classDef code fill:#9cf,stroke:#333
    classDef presentation fill:#c9f,stroke:#333
    classDef build fill:#fc9,stroke:#333

    %% Click events
    click GMC "https://github.com/bosh/trogdor-pinball/tree/master/gmc"
    click TROG "https://github.com/bosh/trogdor-pinball/blob/master/ruby/trogbuild.rb"
    click FAST "https://github.com/bosh/trogdor-pinball/blob/master/config/fast.yaml"
    click BCONF "https://github.com/bosh/trogdor-pinball/blob/master/config/config_base.yaml"
    click MODES "https://github.com/bosh/trogdor-pinball/tree/master/modes"
    click SOUND "https://github.com/bosh/trogdor-pinball/tree/master/gmc/sounds"
    click LTCTL "https://github.com/bosh/trogdor-pinball/tree/master/config/lights"
    click SWMGR "https://github.com/bosh/trogdor-pinball/tree/master/config/switches"
    click BDEV "https://github.com/bosh/trogdor-pinball/blob/master/config/ball_devices.yaml"
    click SHOWS "https://github.com/bosh/trogdor-pinball/tree/master/modes/priority_shows"
    click GCONF "https://github.com/bosh/trogdor-pinball/blob/master/config/generated_configs.yaml"
    click CORE "https://github.com/bosh/trogdor-pinball/tree/master/modes/code_base"
    click HWDEF "https://github.com/bosh/trogdor-pinball/blob/master/config/hardware.yaml"
    click MON "https://github.com/bosh/trogdor-pinball/blob/master/monitor/monitor.yaml"
    click ACH "https://github.com/bosh/trogdor-pinball/tree/master/modes/generated_achievements"
    click BASE "https://github.com/bosh/trogdor-pinball/tree/master/modes/base"
```
