# citymania-org/robs-trains architecture

> Architecture diagram of the GitHub repository citymania-org/robs-trains, 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/citymania-org/robs-trains
- Repository: https://github.com/citymania-org/robs-trains

## Overview

##### Main Components

a) Input Processing Layer:
- PSD Files Directory (./pp/)
- Configuration Files (id_map.json)
- Sound Files Directory (./sounds/)

b) Core Processing Components:
- Train Type Modules
- Standard Gauge (/code/standard_gauge/)
- Narrow Gauge (/code/narrow_gauge/)
- Common Utilities (common.py, lib.py)
- PSDLivery Processing System

c) Generation System:
- Main Generator (generate.py)
- Output Handling

**[Input Assets] → [Processing Engine] → [Output Generation]**

##### Key Relationships to Highlight

- How the compositing arguments (shading, paint, overlay) interact
- Relationship between train type modules and the generation system
- Palette processing flow for paint handling

##### Technical Details

- Dependencies (grf-py, psd-tools)
- Sound file integration
- Configuration file usage

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Input
        PSD[PSD Files]:::input
        SND[Sound Files]:::input
        CFG[Configuration Files]:::config
    end

    subgraph Processing
        PL[PSDLivery Processing]:::process
        
        subgraph Utilities
            CU[Common Utilities]:::util
            LU[Library Functions]:::util
        end
        
        subgraph "Train Modules"
            SG[Standard Gauge]:::module
            NG[Narrow Gauge]:::module
        end
        
        subgraph "Processing Steps"
            LC[Layer Composition]:::step
            PP[Paint Processing]:::step
            CC[CC Color Handling]:::step
        end
    end

    subgraph Output
        GEN[Generator]:::output
        OUT[Output Files]:::output
        LOG[Changelog]:::output
    end

    %% Input Connections
    PSD --> PL
    SND --> PL
    CFG --> PL

    %% Processing Connections
    PL --> LC
    LC --> PP
    PP --> CC
    
    CU --> PL
    LU --> PL
    
    PL --> SG
    PL --> NG
    
    SG --> GEN
    NG --> GEN
    
    %% Output Connections
    GEN --> OUT
    GEN --> LOG

    %% Styling
    classDef input fill:#a8d1ff,stroke:#333
    classDef config fill:#ffe0a8,stroke:#333
    classDef process fill:#c9e6ff,stroke:#333
    classDef util fill:#d1ffed,stroke:#333
    classDef module fill:#ffd1e3,stroke:#333
    classDef step fill:#e6ffc9,stroke:#333
    classDef output fill:#ffc9c9,stroke:#333

    %% Click Events
    click PSD "https://github.com/citymania-org/robs-trains/tree/main//pp/"
    click SND "https://github.com/citymania-org/robs-trains/tree/main//sounds/"
    click CFG "https://github.com/citymania-org/robs-trains/blob/main//id_map.json"
    click SG "https://github.com/citymania-org/robs-trains/tree/main//code/standard_gauge/"
    click NG "https://github.com/citymania-org/robs-trains/tree/main//code/narrow_gauge/"
    click CU "https://github.com/citymania-org/robs-trains/blob/main//common.py"
    click LU "https://github.com/citymania-org/robs-trains/blob/main//lib.py"
    click GEN "https://github.com/citymania-org/robs-trains/blob/main//generate.py"
    click OUT "https://github.com/citymania-org/robs-trains/tree/main//robs_trains/"
    click LOG "https://github.com/citymania-org/robs-trains/blob/main//robs_trains/changelog.txt"

    %% Legend
    subgraph Legend
        I[Input Files]:::input
        C[Configuration]:::config
        PR[Processing]:::process
        U[Utilities]:::util
        M[Modules]:::module
        S[Processing Steps]:::step
        O[Output]:::output
    end
```
