# sorincu/space-chess architecture

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

- Interactive diagram: https://gitdiagram.com/sorincu/space-chess
- Repository: https://github.com/sorincu/space-chess

## Overview

##### Main Components Identification
The system should be represented with these primary components:

a) Unity Runtime Environment
- Represents the main game engine layer
- Includes MonoBleedingEdge runtime for C# execution
- Handles rendering and physics

b) Game Core Components
- Game Manager (coordinates game state)
- Board Manager (handles 3D chess board logic)
- Piece Manager (manages chess pieces and their movements)
- Input System (processes player interactions)
- UI System (manages game interface)

c) Data Management
- Asset Management (resources.assets)
- Scene Management (level0, level1, level2)
- State Management (globalgamemanagers)

##### Player Interaction Layer
- Input handling
- UI elements
- Camera controls

##### Game Logic Layer
- Chess rules engine
- Move validation
- Game state management
- 3D space navigation logic

##### Unity Engine Layer
- Rendering pipeline
- Physics engine
- Asset management
- Scene management

##### Runtime Layer
- MonoBleedingEdge
- .NET runtime environment

##### Component Relationships

- Player input → Game Logic
- Game Logic → Unity Engine (rendering requests)
- Unity Engine → Runtime Environment
- Asset Loading flows
- State management flows

##### Technical Details

Notes about:
- C# scripting architecture
- Unity version compatibility
- Resource management approach
- Scene hierarchy

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "Player Interaction Layer"
        Input["Input System"]:::input
        UI["UI System"]:::input
        Camera["Camera Controls"]:::input
    end

    subgraph "Game Logic Layer"
        GameManager["Game Manager"]:::logic
        BoardManager["Board Manager"]:::logic
        PieceManager["Piece Manager"]:::logic
        ChessRules["Chess Rules Engine"]:::logic
        MoveValidator["Move Validation"]:::logic
        SpaceLogic["3D Space Navigation"]:::logic
    end

    subgraph "Unity Engine Layer"
        RenderPipeline["Rendering Pipeline"]:::unity
        PhysicsEngine["Physics Engine"]:::unity
        AssetMgmt["Asset Management"]:::unity
        click AssetMgmt "https://github.com/sorincu/space-chess/blob/main//space_chess_Data/resources.assets"
        SceneMgmt["Scene Management"]:::unity
        StateManager["State Manager"]:::unity
        click StateManager "https://github.com/sorincu/space-chess/tree/main//space_chess_Data/globalgamemanagers"
    end

    subgraph "Runtime Layer"
        MonoRuntime["MonoBleedingEdge Runtime"]:::runtime
        click MonoRuntime "https://github.com/sorincu/space-chess/tree/main//MonoBleedingEdge"
        DotNetRuntime[".NET Runtime"]:::runtime
        click DotNetRuntime "https://github.com/sorincu/space-chess/tree/main//space_chess_Data/Managed"
        CrashHandler["Crash Handler"]:::runtime
        click CrashHandler "https://github.com/sorincu/space-chess/blob/main//UnityCrashHandler64.exe"
    end

    subgraph "Data Management"
        Resources["Resources"]:::data
        click Resources "https://github.com/sorincu/space-chess/tree/main//space_chess_Data/Resources"
        Scenes["Game Scenes"]:::data
        click Scenes "https://github.com/sorincu/space-chess/tree/main//space_chess_Data/level0"
        Config["Configuration Files"]:::data
        click Config "https://github.com/sorincu/space-chess/blob/main//space_chess_Data/boot.config"
        SharedAssets["Shared Assets"]:::data
        click SharedAssets "https://github.com/sorincu/space-chess/blob/main//space_chess_Data/sharedassets0.assets"
    end

    %% Relationships
    Input --> GameManager
    UI --> GameManager
    Camera --> GameManager

    GameManager --> BoardManager
    GameManager --> PieceManager
    BoardManager --> ChessRules
    PieceManager --> MoveValidator
    ChessRules --> MoveValidator
    BoardManager --> SpaceLogic

    GameManager --> RenderPipeline
    BoardManager --> PhysicsEngine
    PieceManager --> AssetMgmt
    GameManager --> StateManager
    GameManager --> SceneMgmt

    RenderPipeline --> MonoRuntime
    PhysicsEngine --> MonoRuntime
    MonoRuntime --> DotNetRuntime
    DotNetRuntime -.-> CrashHandler

    AssetMgmt --> Resources
    SceneMgmt --> Scenes
    StateManager --> Config
    AssetMgmt --> SharedAssets

    %% Styles
    classDef input fill:#FFA500,stroke:#333,stroke-width:2px
    classDef logic fill:#90EE90,stroke:#333,stroke-width:2px
    classDef unity fill:#87CEEB,stroke:#333,stroke-width:2px
    classDef runtime fill:#FFD700,stroke:#333,stroke-width:2px
    classDef data fill:#DDA0DD,stroke:#333,stroke-width:2px

    %% Legend
    subgraph Legend
        L1["Input/UI Components"]:::input
        L2["Game Logic"]:::logic
        L3["Unity Engine"]:::unity
        L4["Runtime Components"]:::runtime
        L5["Data Storage"]:::data
    end
```
