# pixeltris/ygomaster architecture

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

- Interactive diagram: https://gitdiagram.com/pixeltris/ygomaster
- Repository: https://github.com/pixeltris/ygomaster

## Overview

##### Project type and purpose
- YgoMaster is a “full-stack” modding suite for offline play of the Unity-based Yu-Gi-Oh! Master Duel on PC.
- It comprises four primary sub-projects:
- A native injector/loader (YgoMasterLoader) that hooks into the official game binary.
- A managed client (YgoMasterClient) that intercepts & extends the in-game UI and network calls.
- A proxy tool (YgoMasterFiddler) that rewrites or redirects the game’s HTTP/WebSocket traffic.
- A .NET server (YgoMasterServer) that implements the Master Duel server protocol, backed by JSON “database” files under YgoMaster/Data.

##### File structure
- Top-level executables & build scripts: Build.bat, YgoMaster.sln
- Subdirectories:
- YgoMasterLoader (native C++ DLL + injector code)
- YgoMasterClient (C# code hooking into Unity via IL2CPP reflection)
- YgoMasterFiddler (C# proxy that deserializes/serializes LZ4+MessagePack payloads)
- YgoMasterServer (C# .NET server, Acts/Net/Infos simulate Yugioh server API)
- YgoMaster/Data (static JSON underpins card lists, solo duels, shop, packs, etc.)
- Configs and docs: Docs/, README.md, app.config, .gitignore

##### README for additional insights
- Purpose: offline mod (progress not shared with official servers)
- Requirements: .NET Framework 4.x, full Steam download of the game
- Usage: drop-in “YgoMaster” folder → run YgoMasterClient.exe (auto-launches loader & game)
- Documentation links point out PvP, Solo, Settings, FileLoadError, Linux, Modding guides

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% External dependencies
    subgraph "External Dependencies"
        Steam["Steam"]:::external
        DotNet[".NET Runtime"]:::external
    end

    %% Frontend Layer
    subgraph "Frontend Layer"
        Client["YgoMasterClient.exe"]:::client
        Game["Official Game Process\n(UnityPlayer.dll)"]:::client
    end

    %% Middleware Layer
    subgraph "Middleware"
        Loader["YgoMasterLoader\n(Injector)"]:::middleware
        Fiddler["YgoMasterFiddler\n(Proxy)"]:::middleware
    end

    %% Backend Layer
    subgraph "Backend Layer"
        Server["YgoMasterServer"]:::backend
        Data["Data Store\n(JSON files)"]:::backend
    end

    %% Connections
    Steam --> Client
    DotNet --> Client
    Client -->|"spawns injector"| Loader
    Loader -->|"injects into"| Game
    Game -->|"HTTP/WebSocket traffic"| Fiddler
    Fiddler -->|"forwards over TCP"| Server
    Server -->|"reads/writes JSON"| Data
    Data -->|"provides data"| Server
    Server -->|"responses over TCP"| Fiddler
    Fiddler -->|"returns to game"| Game

    %% Click Events
    click Loader "https://github.com/pixeltris/ygomaster/blob/master/YgoMasterLoader/YgoMasterLoader.cpp"
    click Client "https://github.com/pixeltris/ygomaster/blob/master/YgoMasterClient/Program.cs"
    click Fiddler "https://github.com/pixeltris/ygomaster/blob/master/YgoMasterFiddler/Program.cs"
    click Server "https://github.com/pixeltris/ygomaster/blob/master/YgoMasterServer/Program.cs"
    click Data "https://github.com/pixeltris/ygomaster/blob/master/YgoMaster/Data/CardList.json"

    %% Styles
    classDef client fill:#a8f0a1,stroke:#333,stroke-width:1px
    classDef middleware fill:#f9e79f,stroke:#333,stroke-width:1px
    classDef backend fill:#aed6f1,stroke:#333,stroke-width:1px
    classDef external fill:#d5d8dc,stroke:#333,stroke-width:1px
```
