# edo9300/edopro architecture

> Architecture diagram of the GitHub repository edo9300/edopro, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-05-18). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/edo9300/edopro
- Repository: https://github.com/edo9300/edopro

## Overview

##### Project type and purpose
- Project Ignis: EDOPro is a cross-platform, C++-based automatic duel simulator client for the Yu-Gi-Oh! Official Card Game. It ties together a game-logic core (ocgcore), a custom GUI framework (gframe + Irrlicht), networking, scripting, resource managers, audio backends, and auxiliary tools (updater, bot, repo manager, Discord integration).

##### File structure
- Top-level modules:
- discord-launcher (macOS Discord RPC stub)
- gframe (monolithic GUI + platform abstraction + game client logic)
- irrlicht (embedded 3D engine)
- ocgcore (external core engine submodule for rule scripting)
- sfAudio & SoundBackends (audio abstraction + multiple backend implementations)
- overwrites (custom patches for mingw and other toolchains)
- ios-assets, android, iOS subfolders under gframe (mobile platform ports)
- tools (scripts for embedding binary assets)
- travis, .github (CI/deployment pipelines)
- config, notices, LICENSE/COPYING (docs and licensing)

##### README for additional insights
- The README confirms:
- It is the game client only (no server core)
- It uses an automated scripting engine (ocgcore fork)
- Integrates open-source card/script repos via Git

##### Main components
a. User Interface Layer
- gframe GUI modules + Irrlicht renderer
- EventHandler → translates user input to game commands
b. Game Logic Core
- ocgcore (card rule engine, duel simulator)
- GenericDuel, DuelClient classes orchestrating matches
c. Resource & Data Management
- DataManager, ImageManager, RepoManager (card scripts, databases)
- Updater, ClientUpdater (downloads assets via Curl, Git2)
d. Audio Subsystem
- SoundManager → selects SoundBackend (irrklang, miniaudio, sdlmixer, sfml)
e. Networking & Multiplayer
- NetServer (host lobbies), DuelClient (client-side networking), Network abstraction
f. Auxiliary Services
- Discord integration (discord_wrapper, discord_register)
- WindBot AI plugin (windbot_panel, windbot)
g. Build & Deployment
- Premake5 scripts, Travis/GitHub Actions pipelines, platform port modules (Android/iOS)

##### Relationships & Interactions
- UI Layer ←→ Game Logic (commands, state updates)
- Game Logic ←→ Resource Manager (load card data, images, scripts)
- Game Logic ←→ Audio Subsystem (play sound effects, music)
- Game Logic ←→ Networking (send turn data, receive opponent moves)
- Updater & RepoManager → Resource Manager (update local script/db repositories)
- DiscordWrapper ←→ Game Logic & UI (rich presence updates)
- WindBot plugin ←→ Game Logic (automated commands)

##### Architectural patterns & design principles
- Layered architecture: separates UI, core logic, I/O, network, audio
- Strategy pattern for audio backends (SoundBackend interface + multiple implementations)
- Plugin/extension points: dllinterface, repo-based script loading
- Platform abstraction for OS-specific operations (COSAndroidOperator, COSiOSOperator)
- CI/CD orchestration with premake and Travis/GitHub workflows

##### Essential elements
- Clear component names (e.g., DataManager, SoundManager)
- Annotations for extensibility points (plugin API, script loader)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% User Interface Layer
    subgraph "User Interface Layer"
        direction TB
        GFRAME["gframe GUI"]:::ui
        IRRLICHT["Irrlicht Renderer"]:::ui
    end

    %% Game Logic Core
    subgraph "Game Logic Core"
        direction TB
        OCGCORE["ocgcore Engine"]:::core
        GENERIC_DUEL["GenericDuel / DuelClient"]:::core
    end

    %% Resource & Data Management
    subgraph "Resource & Data Management"
        direction TB
        DATA_MGR["DataManager"]:::service
        IMAGE_MGR["ImageManager"]:::service
        REPO_MGR["RepoManager"]:::service
        REPO_CLONER["RepoCloner"]:::service
        CLIENT_UPDATER["ClientUpdater"]:::service
    end

    %% Audio Subsystem
    subgraph "Audio Subsystem"
        direction TB
        SOUND_MGR["SoundManager"]:::audio
        SOUNDBACKENDS["SoundBackends"]:::audio
        SFAUDIO["sfAudio"]:::audio
    end

    %% Networking & Multiplayer
    subgraph "Networking & Multiplayer"
        direction TB
        NETSERVER["NetServer"]:::network
        NETWORK_ABS["Network Abstraction"]:::network
        DUELCLIENT_NET["DuelClient"]:::network
    end

    %% Auxiliary Services
    subgraph "Auxiliary Services"
        direction TB
        subgraph "Discord Integration"
            DISCORD_WRAPPER["discord_wrapper"]:::service
            DISCORD_REGISTER["discord_register"]:::service
        end
        subgraph "WindBot AI Plugin"
            WINDBOT_PANEL["windbot_panel"]:::service
            WINDBOT["windbot"]:::service
        end
    end

    %% Platform Adapters
    subgraph "Platform Adapters"
        direction TB
        ANDROID["gframe/Android"]:::service
        IOS["gframe/iOS"]:::service
        IOS_ASSETS["ios-assets"]:::service
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        direction TB
        PREMAKE_ROOT["premake5.lua (root)"]:::service
        PREMAKE_GFRAME["gframe/premake5.lua"]:::service
        PREMAKE_IRRLICHT["irrlicht/premake5.lua"]:::service
        PREMAKE_DISCORD["discord-launcher/premake5.lua"]:::service
        GHACTIONS[".github/workflows/edopro.yml"]:::service
        TRAVIS["travis"]:::service
    end

    %% Overwrites / Toolchain Patches
    subgraph "Toolchain Patches"
        direction TB
        OVERWRITES["overwrites"]:::service
        OVERWRITES_MINGW["overwrites-mingw"]:::service
    end

    %% Auxiliary Tools & Scripts
    subgraph "Auxiliary Tools & Scripts"
        direction TB
        TOOLS["tools"]:::service
        SOUND_FILES["sound/files.txt"]:::service
        TEXTURES["textures"]:::service
        CONFIG_DIR["config"]:::service
        NOTICES["notices"]:::service
    end

    %% External Dependencies
    subgraph "External Dependencies"
        direction TB
        LIBGIT2["libgit2"]:::external
        CURL["Curl"]:::external
        PREMAKE_EXT["Premake"]:::external
        OCGCORE_SUB["ocgcore submodule"]:::external
    end

    %% Connections
    GFRAME -->|"UserCommand"| GENERIC_DUEL
    IRRLICHT -->|"RenderRequest"| GENERIC_DUEL
    GENERIC_DUEL -->|"StateUpdate"| GFRAME
    GENERIC_DUEL -->|"RenderFrame"| IRRLICHT

    GENERIC_DUEL -->|"CardDataRequest"| DATA_MGR
    GENERIC_DUEL -->|"CardDataRequest"| IMAGE_MGR
    GENERIC_DUEL -->|"ScriptLoad"| REPO_MGR

    CLIENT_UPDATER -->|"UpdateRepo"| REPO_MGR
    REPO_MGR -->|"Clone via libgit2"| LIBGIT2

    GENERIC_DUEL -->|"SoundEvent"| SOUND_MGR
    SOUND_MGR -->|"Strategy"| SOUNDBACKENDS
    SOUND_MGR -->|"Strategy"| SFAUDIO

    GENERIC_DUEL -->|"TurnPacket"| NETSERVER
    NETSERVER -->|"TurnPacket"| GENERIC_DUEL
    GENERIC_DUEL -->|"NetworkCall"| NETWORK_ABS
    NETWORK_ABS -->|"NetworkCall"| DUELCLIENT_NET

    DISCORD_WRAPPER -->|"RPC"| GENERIC_DUEL
    GENERIC_DUEL -->|"PresenceUpdate"| DISCORD_WRAPPER
    DISCORD_WRAPPER -->|"Register"| DISCORD_REGISTER

    WINDBOT_PANEL -->|"UserConfig"| WINDBOT
    WINDBOT -->|"AutoCommands"| GENERIC_DUEL

    PREMAKE_ROOT -->|"Includes"| PREMAKE_EXT
    PREMAKE_GFRAME -->|"Includes"| PREMAKE_EXT
    PREMAKE_IRRLICHT -->|"Includes"| PREMAKE_EXT
    PREMAKE_DISCORD -->|"Includes"| PREMAKE_EXT

    CLIENT_UPDATER -->|"HTTP Download"| CURL

    ANDROID -->|"PlatformOps"| GFRAME
    IOS -->|"PlatformOps"| GFRAME
    IOS_ASSETS -->|"Resources"| GFRAME

    OCGCORE -->|"Integration"| GENERIC_DUEL
    OCGCORE_SUB -->|"Source"| OCGCORE

    %% Click Events
    click GFRAME "https://github.com/edo9300/edopro/tree/master/gframe"
    click IRRLICHT "https://github.com/edo9300/edopro/tree/master/irrlicht"
    click OCGCORE "https://github.com/edo9300/edopro/tree/master/ocgcore"
    click GENERIC_DUEL "https://github.com/edo9300/edopro/blob/master/gframe/generic_duel.cpp"
    click DATA_MGR "https://github.com/edo9300/edopro/blob/master/gframe/data_manager.cpp"
    click IMAGE_MGR "https://github.com/edo9300/edopro/blob/master/gframe/image_manager.cpp"
    click REPO_MGR "https://github.com/edo9300/edopro/blob/master/gframe/repo_manager.cpp"
    click REPO_CLONER "https://github.com/edo9300/edopro/blob/master/gframe/repo_cloner.cpp"
    click CLIENT_UPDATER "https://github.com/edo9300/edopro/blob/master/gframe/client_updater.cpp"
    click SOUND_MGR "https://github.com/edo9300/edopro/blob/master/gframe/sound_manager.cpp"
    click SOUNDBACKENDS "https://github.com/edo9300/edopro/tree/master/gframe/SoundBackends"
    click SFAUDIO "https://github.com/edo9300/edopro/tree/master/sfAudio"
    click NETSERVER "https://github.com/edo9300/edopro/blob/master/gframe/netserver.cpp"
    click NETWORK_ABS "https://github.com/edo9300/edopro/blob/master/gframe/network.h"
    click DUELCLIENT_NET "https://github.com/edo9300/edopro/blob/master/gframe/duelclient.cpp"
    click DISCORD_WRAPPER "https://github.com/edo9300/edopro/blob/master/gframe/discord_wrapper.cpp"
    click DISCORD_REGISTER "https://github.com/edo9300/edopro/blob/master/gframe/discord_register.h"
    click WINDBOT "https://github.com/edo9300/edopro/blob/master/gframe/windbot.cpp"
    click WINDBOT_PANEL "https://github.com/edo9300/edopro/blob/master/gframe/windbot_panel.cpp"
    click ANDROID "https://github.com/edo9300/edopro/tree/master/gframe/Android"
    click IOS "https://github.com/edo9300/edopro/tree/master/gframe/iOS"
    click IOS_ASSETS "https://github.com/edo9300/edopro/tree/master/ios-assets"
    click PREMAKE_ROOT "https://github.com/edo9300/edopro/blob/master/premake5.lua"
    click PREMAKE_GFRAME "https://github.com/edo9300/edopro/blob/master/gframe/premake5.lua"
    click PREMAKE_IRRLICHT "https://github.com/edo9300/edopro/blob/master/irrlicht/premake5.lua"
    click PREMAKE_DISCORD "https://github.com/edo9300/edopro/blob/master/discord-launcher/premake5.lua"
    click GHACTIONS "https://github.com/edo9300/edopro/blob/master/.github/workflows/edopro.yml"
    click TRAVIS "https://github.com/edo9300/edopro/tree/master/travis"
    click OVERWRITES "https://github.com/edo9300/edopro/tree/master/overwrites"
    click OVERWRITES_MINGW "https://github.com/edo9300/edopro/tree/master/overwrites-mingw"
    click TOOLS "https://github.com/edo9300/edopro/tree/master/tools"
    click SOUND_FILES "https://github.com/edo9300/edopro/blob/master/sound/files.txt"
    click TEXTURES "https://github.com/edo9300/edopro/tree/master/textures"
    click CONFIG_DIR "https://github.com/edo9300/edopro/tree/master/config"
    click NOTICES "https://github.com/edo9300/edopro/tree/master/notices"

    %% Styles
    classDef ui fill:#8FBC8F,stroke:#333,stroke-width:1px
    classDef core fill:#87CEFA,stroke:#333,stroke-width:1px
    classDef service fill:#FFA500,stroke:#333,stroke-width:1px
    classDef network fill:#9370DB,stroke:#333,stroke-width:1px
    classDef audio fill:#FFD700,stroke:#333,stroke-width:1px
    classDef external fill:#C0C0C0,stroke:#333,stroke-width:1px
```
