# paulinfourquet/zeldougame2d architecture

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

- Interactive diagram: https://gitdiagram.com/paulinfourquet/zeldougame2d
- Repository: https://github.com/paulinfourquet/zeldougame2d

## Overview

- Bidirectional communication between Game Engine and other systems

##### Layer Organization

Top to Bottom:
1. User Input Layer (KeyHandler)
2. Game Logic Layer (Game Engine, Entity Management)
3. World Management Layer (Tiles, Collision)
4. Resource Management Layer (Assets, Sound)

##### Additional Elements

- Notes about the game loop cycle
- Resource file structure in a simplified form
- Main game states (menu, gameplay, etc.)

Remember to include a small section showing how external resources (maps, sounds, sprites) are loaded and managed by the respective systems. This will help understand the resource management flow of the game.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Core
        Game["Game Engine"]:::core
        GameLoop["Game Loop"]:::core
        Main["Main"]:::core
    end

    subgraph Input
        KeyHandler["Key Handler"]:::input
    end

    subgraph "Entity System"
        Entity["Entity Base"]:::entity
        Player["Player"]:::entity
        Monster["Monster Base"]:::entity
        MonsterImpl["Monster Implementations"]:::entity
        NPC["NPC Old Man"]:::entity
        Projectile["Projectile"]:::entity
    end

    subgraph "World System"
        TileManager["Tile Manager"]:::world
        CollisionChecker["Collision Checker"]:::world
        EventHandler["Event Handler"]:::world
        EventRect["Event Rectangle"]:::world
        Maps["Map Resources"]:::resource
    end

    subgraph "Object System"
        SuperObject["Super Object"]:::object
        GameObjects["Game Objects"]:::object
    end

    subgraph "Asset Management"
        AssetSetter["Asset Setter"]:::asset
        Sound["Sound System"]:::asset
        Resources["Resource Files"]:::resource
    end

    subgraph "UI Layer"
        UI["User Interface"]:::ui
    end

    subgraph "Utility"
        UtilityTool["Utility Tool"]:::utility
    end

    %% Core Relationships
    Game --> GameLoop
    Main --> Game
    Game --> KeyHandler
    Game --> TileManager
    Game --> CollisionChecker
    Game --> EventHandler
    Game --> AssetSetter
    Game --> UI
    Game --> Sound

    %% Entity Relationships
    Entity --> Player
    Entity --> Monster
    Monster --> MonsterImpl
    Entity --> NPC
    Entity --> Projectile

    %% World Relationships
    TileManager --> Maps
    EventHandler --> EventRect
    CollisionChecker --> Entity

    %% Object Relationships
    SuperObject --> GameObjects

    %% Asset Relationships
    AssetSetter --> Resources
    Sound --> Resources

    %% Utility Relationships
    UtilityTool --> TileManager
    UtilityTool --> Entity

    %% Click Events
    click Game "https://github.com/PaulinFourquet/ZeldouGame2D/blob/main/src/main/Game.java"
    click GameLoop "https://github.com/PaulinFourquet/ZeldouGame2D/blob/main/src/main/GameLoop.java"
    click Main "https://github.com/PaulinFourquet/ZeldouGame2D/blob/main/src/main/main.java"
    click KeyHandler "https://github.com/PaulinFourquet/ZeldouGame2D/blob/main/src/main/KeyHandler.java"
    click Entity "https://github.com/PaulinFourquet/ZeldouGame2D/blob/main/src/entity/Entity.java"
    click Player "https://github.com/PaulinFourquet/ZeldouGame2D/blob/main/src/entity/Player.java"
    click Monster "https://github.com/PaulinFourquet/ZeldouGame2D/blob/main/src/entity/Monster.java"
    click MonsterImpl "https://github.com/PaulinFourquet/ZeldouGame2D/tree/main/src/monster/"
    click NPC "https://github.com/PaulinFourquet/ZeldouGame2D/blob/main/src/entity/NPC_OldMan.java"
    click Projectile "https://github.com/PaulinFourquet/ZeldouGame2D/blob/main/src/entity/Projectile.java"
    click TileManager "https://github.com/PaulinFourquet/ZeldouGame2D/blob/main/src/Tile/TileManager.java"
    click CollisionChecker "https://github.com/PaulinFourquet/ZeldouGame2D/blob/main/src/main/CollisionChecker.java"
    click EventHandler "https://github.com/PaulinFourquet/ZeldouGame2D/blob/main/src/main/EventHandler.java"
    click Maps "https://github.com/PaulinFourquet/ZeldouGame2D/tree/main/src/res/maps/"
    click SuperObject "https://github.com/PaulinFourquet/ZeldouGame2D/blob/main/src/object/SuperObject.java"
    click GameObjects "https://github.com/PaulinFourquet/ZeldouGame2D/tree/main/src/object/"
    click AssetSetter "https://github.com/PaulinFourquet/ZeldouGame2D/blob/main/src/main/AssetSetter.java"
    click Sound "https://github.com/PaulinFourquet/ZeldouGame2D/blob/main/src/main/Sound.java"
    click Resources "https://github.com/PaulinFourquet/ZeldouGame2D/tree/main/src/res/"
    click UI "https://github.com/PaulinFourquet/ZeldouGame2D/blob/main/src/main/UI.java"
    click EventRect "https://github.com/PaulinFourquet/ZeldouGame2D/blob/main/src/main/EventRect.java"
    click UtilityTool "https://github.com/PaulinFourquet/ZeldouGame2D/blob/main/src/main/UtilityTool.java"

    %% Styling
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef input fill:#e74c3c,stroke:#c0392b,color:white
    classDef entity fill:#2ecc71,stroke:#27ae60,color:white
    classDef world fill:#f1c40f,stroke:#f39c12,color:black
    classDef object fill:#e67e22,stroke:#d35400,color:white
    classDef asset fill:#9b59b6,stroke:#8e44ad,color:white
    classDef ui fill:#1abc9c,stroke:#16a085,color:white
    classDef utility fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef resource fill:#ecf0f1,stroke:#bdc3c7,color:black
```
