# ptlc8/actionrpg architecture

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

- Interactive diagram: https://gitdiagram.com/ptlc8/actionrpg
- Repository: https://github.com/ptlc8/actionrpg

## Overview

##### Main Components

a. Core Game Architecture:
- Game Engine Layer
- Rendering System
- Physics/Collision System
- Input Management System
- Multiplayer Network Layer

b. Key Subsystems:
- Entity Component System
- Game State Management
- Resource Management (Models)
- Dungeon Generation System

**Client Interface (Main.java, Client.java) <-> Server Interface (Server.java)**

**Game Management Layer (GameManager, SoloGameManager, ClientGameManager, ServerGameManager)**
- Game Logic Layer (Game.java, Wave.java, DungeonGenerator.java)
- Entity Management
- Resource Management

**Core Systems**
- Rendering (Renderer, Camera system)
- Physics (Collision detection)
- Input Management
- Network Communication

##### Component Relationships to Highlight

a. Game Architecture:
- Relationship between GameManager variants (Solo vs Multiplayer)
- How the Entity Component System works with different entity types
- Demonstrate the dungeon generation flow

b. Rendering Pipeline:
- Model loading to the Renderer
- Camera hierarchy (First/Third Person, Free Camera)
- Resource loading paths

c. Networking Architecture:
- Client-Server communication flow
- Package serialization path
- Multiplayer state synchronization

##### Implementation Details

- Native library integration (LWJGL, JInput)
- Model resource loading system
- Collision detection system
- Input handling pipeline
- Camera management system

- Use rectangles for major components
- Use diamonds for interfaces

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Client-Server["Client-Server Layer"]
        Client["Client Interface"]:::client
        Server["Server Interface"]:::server
    end

    subgraph GameManagement["Game Management Layer"]
        GM["Game Manager"]:::core
        SGM["Solo Game Manager"]:::core
        CGM["Client Game Manager"]:::client
        SrvGM["Server Game Manager"]:::server
    end

    subgraph GameLogic["Game Logic Layer"]
        Game["Game Core"]:::logic
        Wave["Wave System"]:::logic
        DungeonGen["Dungeon Generator"]:::logic
        Room["Room System"]:::logic
    end

    subgraph EntitySystem["Entity Component System"]
        Entity["Base Entity"]:::entity
        Player["Player Entity"]:::entity
        AI["AI Entity"]:::entity
    end

    subgraph CoreSystems["Core Systems"]
        direction TB
        subgraph Rendering["Rendering System"]
            Renderer["Main Renderer"]:::render
            Camera["Camera System"]:::render
            Model["Model Loading"]:::render
        end

        subgraph Physics["Physics System"]
            Collision["Collision Detection"]:::physics
            Shape["Physics Shapes"]:::physics
        end

        subgraph Input["Input System"]
            InputCore["Core Input"]:::input
            PhysInput["Physical Input"]:::input
        end

        subgraph Network["Network System"]
            SocketClient["Socket Client"]:::network
            SocketServer["Socket Server"]:::network
            NetPackages["Network Packages"]:::network
        end
    end

    %% Relationships
    Client --> CGM
    Server --> SrvGM
    GM --> Game
    SGM --> Game
    CGM --> Game
    SrvGM --> Game

    Game --> Wave
    Game --> DungeonGen
    DungeonGen --> Room

    Game --> Entity
    Entity --> Player
    Entity --> AI

    Entity --> Renderer
    Entity --> Collision
    Player --> InputCore
    InputCore --> PhysInput

    CGM --> SocketClient
    SrvGM --> SocketServer
    SocketClient <--> NetPackages
    SocketServer <--> NetPackages

    %% Click Events
    click GM "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/GameManager.java"
    click Renderer "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/render/Renderer.java"
    click Camera "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/render/Camera.java"
    click Collision "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/game/collision/Collision.java"
    click Shape "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/game/collision/Shape.java"
    click InputCore "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/inputs/Input.java"
    click PhysInput "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/inputs/PhysicInput.java"
    click SocketClient "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/multiplayer/SocketClient.java"
    click SocketServer "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/multiplayer/SocketServer.java"
    click Entity "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/game/entities/Entity.java"
    click Player "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/game/entities/Player.java"
    click AI "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/game/entities/AI.java"
    click Game "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/game/Game.java"
    click Wave "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/game/Wave.java"
    click DungeonGen "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/game/DungeonGenerator.java"
    click Room "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/game/Room.java"
    click Model "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/render/Model.java"
    click Client "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/Client.java"
    click Server "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/Server.java"
    click CGM "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/multiplayer/ClientGameManager.java"
    click SrvGM "https://github.com/ptlc8/actionRPG/blob/multiplayer/src/fr/actionrpg3d/multiplayer/ServerGameManager.java"

    %% Styles
    classDef core fill:#1e90ff,stroke:#333,stroke-width:2px
    classDef client fill:#32cd32,stroke:#333,stroke-width:2px
    classDef server fill:#ff6347,stroke:#333,stroke-width:2px
    classDef logic fill:#ffa500,stroke:#333,stroke-width:2px
    classDef entity fill:#9370db,stroke:#333,stroke-width:2px
    classDef render fill:#4169e1,stroke:#333,stroke-width:2px
    classDef physics fill:#20b2aa,stroke:#333,stroke-width:2px
    classDef input fill:#daa520,stroke:#333,stroke-width:2px
    classDef network fill:#ff69b4,stroke:#333,stroke-width:2px
```
