# uzi-belfayez/acl_project architecture

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

- Interactive diagram: https://gitdiagram.com/uzi-belfayez/acl_project
- Repository: https://github.com/uzi-belfayez/acl_project

## Overview

##### Project type and purpose
- This is a standalone Java 2D desktop game (“Balade dans un labyrinthe”) built with Maven.
- The player navigates a maze, collects keys, battles monsters and ghosts, and advances through levels.

##### File structure
- Top-level Maven project (pom.xml) with standard `src/main/java`, `src/main/resources`, and `src/test/java`.
- `main` package holds core game systems:
- GamePanel, Main (entry point)
- AssetSetter (loads entities & objects onto the map)
- CollisionChecker (detects and resolves collisions)
- EventHandler & KeyHandler (input processing)
- UI (draws HUD)
- UtilityTool (generic helpers)
- `entity` package defines in-game actors: Player, Monstre, Ghost, Fireball, plus base Entity.
- `object` package holds collectible or interactive items (keys, doors, boots, chests, etc.).
- `tile` package defines Tile and TileManager (loads map, tiles).
- `resources` contains images and map definitions.
- JUnit tests in `src/test/java` verify core entities’ behavior.

##### README
- Confirms game objectives and controls.
- Shows build & run via Maven.

a. Main components
- Launcher: Main.java
- Game Engine/Core Loop: GamePanel
- Input Layer: KeyHandler → EventHandler
- Asset Management: AssetSetter + UtilityTool
- Game World Representation: TileManager + map files
- Actors & Items: entity classes + SuperObject & its subclasses
- Collision System: CollisionChecker
- Rendering/UI: UI + GamePanel.paintComponent()
- Persistence/Resources: images, map text files
- Build & Test: Maven (pom.xml), JUnit tests
b. Relationships & interactions
- Main initializes GamePanel & window.
- GamePanel runs the loop:
- Poll input → KeyHandler → EventHandler → updates entity states
- AssetSetter loads entities/objects once at level start
- TileManager holds static map collision & rendering grid
- CollisionChecker invoked each tick to resolve overlaps
- GamePanel invokes UI to overlay HUD on rendered scene
- All modules read from `src/main/resources`.
- Tests target entity behaviors in isolation.
c. Architectural patterns & design principles
- Game Loop pattern
- Separation of concerns: input, update, collision, rendering
- Factory/Setter pattern for assets (AssetSetter)
- Manager classes (TileManager, CollisionChecker) encapsulate related logic
d. Key technologies & libraries
- Java SE (AWT/Swing or Java2D) for rendering & input
- Maven for build, dependency management, packaging
- JUnit for unit tests

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Core Engine
    subgraph "Launch"
        Main["Main.java"]:::core
        click Main "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/main/Main.java"
    end

    Main -->|"initializes"| GamePanel

    subgraph "Game Engine / Main Loop"
        GamePanel["GamePanel.java"]:::core
        click GamePanel "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/main/GamePanel.java"
    end

    %% Input Layer
    subgraph "Input Layer" 
        KeyHandler["KeyHandler.java"]:::io
        click KeyHandler "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/main/KeyHandler.java"
        EventHandler["EventHandler.java"]:::io
        click EventHandler "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/main/EventHandler.java"
        KeyHandler -->|"processes key events"| EventHandler
    end

    %% Asset Management
    subgraph "Asset Management"
        AssetSetter["AssetSetter.java"]:::core
        click AssetSetter "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/main/AssetSetter.java"
        UtilityTool["UtilityTool.java"]:::core
        click UtilityTool "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/main/UtilityTool.java"
    end

    %% World Representation
    subgraph "World Representation"
        TileManager["TileManager.java"]:::model
        click TileManager "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/tile/TileManager.java"
        Tile["Tile.java"]:::model
        click Tile "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/tile/Tile.java"
    end

    %% Actors & Objects
    subgraph "Actors & Objects"
        Entity["Entity.java"]:::model
        click Entity "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/entity/Entity.java"
        Player["Player.java"]:::model
        click Player "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/entity/Player.java"
        Monstre["Monstre.java"]:::model
        click Monstre "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/entity/Monstre.java"
        Ghost["Ghost.java"]:::model
        click Ghost "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/entity/Ghost.java"
        Fireball["Fireball.java"]:::model
        click Fireball "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/entity/Fireball.java"
        SuperObject["SuperObject.java"]:::model
        click SuperObject "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/object/SuperObject.java"
        OBJ_Key["OBJ_Key.java"]:::model
        click OBJ_Key "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/object/OBJ_Key.java"
        OBJ_Door["OBJ_Door.java"]:::model
        click OBJ_Door "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/object/OBJ_Door.java"
        OBJ_Boots["OBJ_Boots.java"]:::model
        click OBJ_Boots "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/object/OBJ_Boots.java"
        OBJ_CLOAK["OBJ_CLOAK.java"]:::model
        click OBJ_CLOAK "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/object/OBJ_CLOAK.java"
        OBJ_Heart["OBJ_Heart.java"]:::model
        click OBJ_Heart "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/object/OBJ_Heart.java"
        OBJ_Chest["OBJ_Chest.java"]:::model
        click OBJ_Chest "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/object/OBJ_Chest.java"
    end

    %% Collision System
    subgraph "Collision System"
        CollisionChecker["CollisionChecker.java"]:::core
        click CollisionChecker "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/main/CollisionChecker.java"
    end

    %% Rendering & UI
    subgraph "Rendering & UI"
        UI["UI.java"]:::core
        click UI "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/java/main/UI.java"
    end

    %% Resources
    ResourcesImages[("Images & Tiles\n(resources folders)")]:::io
    click ResourcesImages "https://github.com/uzi-belfayez/acl_project/tree/main/ACL_Game/src/main/resources/tiles"

    ResourcesMaps[("Map Files\nmap.txt, map2.txt, map3.txt")]:::io
    click ResourcesMaps "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/main/resources/maps/map.txt"

    %% Build & Test
    Maven["pom.xml"]:::infra
    click Maven "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/pom.xml"

    subgraph "Unit Tests"
        PlayerTest["PlayerTest.java"]:::infra
        click PlayerTest "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/test/java/test/PlayerTest.java"
        MonstreTest["MonstreTest.java"]:::infra
        click MonstreTest "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/test/java/test/MonstreTest.java"
        GhostTest["GhostTest.java"]:::infra
        click GhostTest "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/test/java/test/GhostTest.java"
        Test1["Test1.java"]:::infra
        click Test1 "https://github.com/uzi-belfayez/acl_project/blob/main/ACL_Game/src/test/java/test/Test1.java"
    end

    %% Flow Connections
    GamePanel -->|"polls input"| KeyHandler
    GamePanel -->|"loads assets"| AssetSetter
    GamePanel -->|"loads world"| TileManager
    GamePanel -->|"updates actors"| Entity
    GamePanel -->|"resolves collisions"| CollisionChecker
    GamePanel -->|"renders scene"| UI
    GamePanel -->|"uses helpers"| UtilityTool

    EventHandler -->|"updates entity states"| Entity
    AssetSetter -->|"places entities/objects"| Entity
    TileManager -->|"reads maps"| ResourcesMaps
    UI -->|"draws images"| ResourcesImages

    %% Test coverage
    PlayerTest --> Player
    MonstreTest --> Monstre
    GhostTest --> Ghost
    Test1 --> Entity

    %% Styles
    classDef core fill:#AED6F1,stroke:#1B4F72,stroke-width:1px;
    classDef model fill:#ABEBC6,stroke:#1D8348,stroke-width:1px;
    classDef io fill:#F9E79F,stroke:#B9770E,stroke-width:1px;
    classDef infra fill:#D5D8DC,stroke:#566573,stroke-width:1px;
```
