# andythenorth/iron-horse architecture

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

- Interactive diagram: https://gitdiagram.com/andythenorth/iron-horse
- Repository: https://github.com/andythenorth/iron-horse

## Overview

##### Main Components

a) Core Engine Components:
- Vehicle Management System (src/train.py, src/roster.py)
- Graphics Processing Pipeline (src/gestalt_graphics/)
- Language/Localization System (src/lang/)
- Configuration System (src/global_constants.py)

b) Vehicle Roster Systems:
- Pony Roster (largest collection)
- Ibex Roster
- Moose Roster
- Zebra Roster

c) Support Systems:
- Documentation Generator (src/render_docs.py)
- Graphics Renderer (src/render_graphics.py)
- Language Renderer (src/render_lang.py)
- NML Renderer (src/render_nml.py)

##### Relationships

- Data Flow:
- Configuration → Vehicle Definitions
- Vehicle Definitions → Graphics Pipeline
- Vehicle Definitions → Language System
- All Components → Documentation Generator

- Dependencies:
- Vehicle Rosters → Core Engine
- Graphics Pipeline → Polar Fox Library
- Templates → Vehicle Definitions

##### Architectural Patterns to Highlight

- Template-based Generation System (src/templates/)
- Pipeline Architecture for Graphics Processing
- Multi-language Support Architecture
- Vehicle Type Inheritance System

Use the following structure:

- [Configuration Layer]
- ↓
- [Core Engine Layer]
- ↓
- [Vehicle Rosters Layer] ← [Templates Layer]
- ↓
- [Processing Layer]
- ↓
- [Output Layer]

##### Specific Elements

- Polar Fox Library integration points
- Template processing flow
- Vehicle definition hierarchy
- Graphics pipeline stages
- Documentation generation process
- Language processing system

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef core fill:#b3d9ff,stroke:#333
    classDef vehicle fill:#90EE90,stroke:#333
    classDef process fill:#FFE5B4,stroke:#333
    classDef template fill:#FFA07A,stroke:#333
    classDef output fill:#DDA0DD,stroke:#333
    classDef external fill:#D3D3D3,stroke:#333

    %% Configuration Layer
    subgraph Config
        GC["Global Constants"]
        GC_["Graphics Constants"]
    end
    click GC "https://github.com/andythenorth/iron-horse/blob/main/src/global_constants.py"
    click GC_ "https://github.com/andythenorth/iron-horse/blob/main/src/gestalt_graphics/graphics_constants.py"

    %% Core Engine Layer
    subgraph Core
        VM["Vehicle Management"]
        GP["Graphics Pipeline"]
        LS["Language System"]
    end
    click VM "https://github.com/andythenorth/iron-horse/blob/main/src/train.py"
    click GP "https://github.com/andythenorth/iron-horse/blob/main/src/gestalt_graphics/gestalt_graphics.py"
    click LS "https://github.com/andythenorth/iron-horse/tree/main/src/lang/"

    %% Vehicle Rosters Layer
    subgraph Rosters
        PR["Pony Roster"]
        IR["Ibex Roster"]
        MR["Moose Roster"]
        ZR["Zebra Roster"]
    end
    click PR "https://github.com/andythenorth/iron-horse/blob/main/src/rosters/pony.py"
    click IR "https://github.com/andythenorth/iron-horse/blob/main/src/rosters/ibex.py"
    click MR "https://github.com/andythenorth/iron-horse/blob/main/src/rosters/moose.py"
    click ZR "https://github.com/andythenorth/iron-horse/blob/main/src/rosters/zebra.py"

    %% Vehicle Definitions
    subgraph Vehicles
        PV["Pony Vehicles"]
        IV["Ibex Vehicles"]
        MV["Moose Vehicles"]
        ZV["Zebra Vehicles"]
    end
    click PV "https://github.com/andythenorth/iron-horse/tree/main/src/vehicles/pony/"
    click IV "https://github.com/andythenorth/iron-horse/tree/main/src/vehicles/ibex/"
    click MV "https://github.com/andythenorth/iron-horse/tree/main/src/vehicles/moose/"
    click ZV "https://github.com/andythenorth/iron-horse/tree/main/src/vehicles/zebra/"

    %% Template System
    subgraph Templates
        VT["Vehicle Templates"]
        DT["Doc Templates"]
    end
    click VT "https://github.com/andythenorth/iron-horse/tree/main/src/templates/"
    click DT "https://github.com/andythenorth/iron-horse/tree/main/src/docs_templates/"

    %% Processing Layer
    subgraph Processing
        GR["Graphics Renderer"]
        LR["Language Renderer"]
        NR["NML Renderer"]
        DG["Documentation Generator"]
    end
    click GR "https://github.com/andythenorth/iron-horse/blob/main/src/render_graphics.py"
    click LR "https://github.com/andythenorth/iron-horse/blob/main/src/render_lang.py"
    click NR "https://github.com/andythenorth/iron-horse/blob/main/src/render_nml.py"
    click DG "https://github.com/andythenorth/iron-horse/blob/main/src/render_docs.py"

    %% External Dependencies
    PF["Polar Fox Library"]:::external
    click PF "https://github.com/andythenorth/iron-horse/tree/main/src/polar_fox"

    %% Relationships
    GC --> VM
    GC_ --> GP
    VM --> Rosters
    GP --> GR
    LS --> LR

    PR --> PV
    IR --> IV
    MR --> MV
    ZR --> ZV

    VT --> Vehicles
    DT --> DG

    Vehicles --> GR
    Vehicles --> LR
    Vehicles --> NR
    Vehicles --> DG

    PF --> GP
    PF --> GR

    %% Style Applications
    class VM,GP,LS core
    class PR,IR,MR,ZR,PV,IV,MV,ZV vehicle
    class GR,LR,NR,DG process
    class VT,DT template
    class GC,GC_ core

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Vehicle Systems"]:::vehicle
        L3["Processing Systems"]:::process
        L4["Template Systems"]:::template
        L5["External Dependencies"]:::external
    end
```
