# psychodrive-dictator/psychodrive architecture

> Architecture diagram of the GitHub repository psychodrive-dictator/psychodrive, 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/psychodrive-dictator/psychodrive
- Repository: https://github.com/psychodrive-dictator/psychodrive

## Overview

##### Main Components

a. Core Engine Components:
- Game State Manager (main.cpp/hpp)
- Rendering System (render.cpp/hpp)
- Input Handler (input.cpp/hpp)
- User Interface System (ui.cpp/hpp)
- Character System (guy.cpp/hpp)

b. Data Management:
- JSON Data Parser (json.hpp)
- Character Data Storage (/data/chars/)
- Battle Constants (/data/battle_consts.json)
- Game State Dumps Storage (/game_state_dumps/)

c. Graphics Pipeline:
- OpenGL Implementation (gl3w.c/h)
- Shader System (/data/shaders/)
- ImGui Integration (imgui/)
- ImPlot Integration (implot.*)

d. External Interfaces:
- SF6 Mod Integration (/sf6_mod/)
- Controller/Keyboard Input Systems

##### Relationships and Data Flow

- Data flow from SF6 mod scripts to the engine
- Character data loading pipeline
- Input processing flow
- Rendering pipeline
- State management flow

##### Specific Architecture Elements

Core Architecture:
**[Input Handler] → [Game State Manager] → [Rendering System]**
- ↑               ↑                        ↑
**[Controller/KB] [Character System]        [Graphics Pipeline]**
- ↑
- [Data Management]
- ↑
- [SF6 Mod Integration]

##### Important Subsystems to Detail

Character System:
- Relationship between character data files
- Movement and animation systems
- Hit detection system
- State management

Data Management:
- JSON parsing and storage
- Character data organization
- Game state dump handling
- Battle constants integration

##### Implementation Details

- Real-time processing pipeline
- Frame-perfect timing systems
- Character state management
- Input timeline editing capabilities
- Hitbox visualization system

## Diagram (Mermaid)

```mermaid
graph TB
    %% Core Engine Components
    subgraph Core
        GSM["Game State Manager"]:::core
        RS["Rendering System"]:::core
        IH["Input Handler"]:::core
        UI["User Interface System"]:::core
        CS["Character System"]:::core
    end

    %% Data Management
    subgraph DataMgmt
        JSON["JSON Parser"]:::data
        CD["Character Data"]:::data
        BC["Battle Constants"]:::data
        GSD["Game State Dumps"]:::data
    end

    %% Graphics Pipeline
    subgraph Graphics
        OGL["OpenGL System"]:::graphics
        SS["Shader System"]:::graphics
        IMGUI["ImGui System"]:::graphics
        IMPLOT["ImPlot System"]:::graphics
    end

    %% External Interfaces
    subgraph External
        SF6["SF6 Mod Integration"]:::external
        SF6S["SF6 Script System"]:::external
        HD["Hitbox Display"]:::external
        ID["Information Display"]:::external
    end

    %% Input Systems
    subgraph Input
        KB["Keyboard Input"]:::input
        CTRL["Controller Input"]:::input
    end

    %% Relationships
    KB & CTRL --> IH
    IH --> GSM
    GSM --> RS
    CS --> GSM
    JSON --> CS
    CD --> CS
    BC --> CS
    GSD --> GSM
    RS --> OGL
    OGL --> SS
    RS --> IMGUI
    IMGUI --> IMPLOT
    SF6 --> SF6S
    SF6S --> HD & ID
    SF6 --> CS
    UI --> IMGUI

    %% Click Events
    click GSM "https://github.com/PsychoDrive-Dictator/psychodrive/blob/master/main.cpp"
    click RS "https://github.com/PsychoDrive-Dictator/psychodrive/blob/master/render.cpp"
    click IH "https://github.com/PsychoDrive-Dictator/psychodrive/blob/master/input.cpp"
    click UI "https://github.com/PsychoDrive-Dictator/psychodrive/blob/master/ui.cpp"
    click CS "https://github.com/PsychoDrive-Dictator/psychodrive/blob/master/guy.cpp"
    click JSON "https://github.com/PsychoDrive-Dictator/psychodrive/blob/master/json.hpp"
    click CD "https://github.com/PsychoDrive-Dictator/psychodrive/tree/master//data/chars/"
    click BC "https://github.com/PsychoDrive-Dictator/psychodrive/blob/master//data/battle_consts.json"
    click GSD "https://github.com/PsychoDrive-Dictator/psychodrive/tree/master//game_state_dumps/"
    click OGL "https://github.com/PsychoDrive-Dictator/psychodrive/blob/master/gl3w.c"
    click SS "https://github.com/PsychoDrive-Dictator/psychodrive/tree/master//data/shaders/"
    click IMGUI "https://github.com/PsychoDrive-Dictator/psychodrive/tree/master//imgui/"
    click IMPLOT "https://github.com/PsychoDrive-Dictator/psychodrive/blob/master/implot.cpp"
    click SF6 "https://github.com/PsychoDrive-Dictator/psychodrive/tree/master//sf6_mod/"
    click SF6S "https://github.com/PsychoDrive-Dictator/psychodrive/blob/master//sf6_mod/sf6_script.lua"
    click HD "https://github.com/PsychoDrive-Dictator/psychodrive/blob/master//sf6_mod/disp_hitboxes.lua"
    click ID "https://github.com/PsychoDrive-Dictator/psychodrive/blob/master//sf6_mod/info_display.lua"

    %% Styles
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef data fill:#2ecc71,stroke:#27ae60,color:white
    classDef graphics fill:#e67e22,stroke:#d35400,color:white
    classDef external fill:#9b59b6,stroke:#8e44ad,color:white
    classDef input fill:#e74c3c,stroke:#c0392b,color:white

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Data Management"]:::data
        L3["Graphics Pipeline"]:::graphics
        L4["External Interfaces"]:::external
        L5["Input Systems"]:::input
    end
```
