# sesem4/nelda architecture

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

- Interactive diagram: https://gitdiagram.com/sesem4/nelda
- Repository: https://github.com/sesem4/nelda

## Overview

##### Main Architecture Components
The system should be represented as a modular component-based architecture with the following main components:

- Core Game Engine (Core module)
- Common Services & Interfaces (Common module)
- Event System (shown in Common/event)

b. Game Modules (Arranged in logical groups):
- Player Systems
- Enemy Systems
- Systems
- Combat Systems
- AI Systems
- Control Systems

##### Component Relationships

a. Core Layer (Center):
- GameData and GameEntities as central components
- EventManager as a central hub for communication

b. Gameplay Layer:
- Player Component
- Combat System (Sword module)
- System
- Collision System

c. Enemy Layer:
- EnemyMoblin
- EnemyOctorok
- EnemySpawner
- AI Components (Random, Simple, Smart)

d. Service Layer (Surrounding):
- Processing Services
- Post-Processing Services
- Plugin Services
- Event Services

##### Additional Elements

Include:
- Version information
- Module dependencies
- SPI interfaces (shown as interfaces between components)
- Event flow paths

Remember to include notes about the event-driven architecture and how it facilitates communication between components without direct dependencies.

This will create a comprehensive visualization of the system that accurately represents the component-based, event-driven architecture of the Nelda game.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Core Layer
    subgraph Core
        GameEngine["Game Engine"]:::core
        GameData["Game Data"]:::core
        GameEntities["Game Entities"]:::core
        EventManager["Event Manager"]:::core
    end

    %% Service Layer
    subgraph Services
        SPI["Service Interfaces"]:::spi
        ProcessingService["Processing Services"]:::service
        PostProcessingService["Post-Processing Services"]:::service
        PluginService["Plugin Services"]:::service
    end

    %% Gameplay Layer
    subgraph Gameplay
        Player["Player System"]:::gameplay
        Combat["Combat System"]:::gameplay
        MapSystem["Map System"]:::gameplay
        Collision["Collision System"]:::gameplay
        Controls["Control System"]:::gameplay
    end

    %% Enemy Layer
    subgraph Enemies
        EnemyMoblin["Enemy Moblin"]:::enemy
        EnemyOctorok["Enemy Octorok"]:::enemy
        EnemySpawner["Enemy Spawner"]:::enemy
    end

    %% AI Layer
    subgraph AI
        AIRandom["Random AI"]:::ai
        AISimple["Simple AI"]:::ai
        AISmart["Smart AI"]:::ai
    end

    %% Relationships
    GameEngine --> GameData
    GameEngine --> EventManager
    GameData --> GameEntities
    EventManager -.-> Player
    EventManager -.-> Combat
    EventManager -.-> MapSystem
    
    SPI --> ProcessingService
    SPI --> PostProcessingService
    SPI --> PluginService
    
    Player --> Combat
    Player --> Collision
    Controls --> Player
    
    EnemyMoblin --> Combat
    EnemyOctorok --> Combat
    EnemySpawner --> EnemyMoblin
    EnemySpawner --> EnemyOctorok
    
    AIRandom --> EnemyMoblin
    AISimple --> EnemyOctorok
    AISmart --> EnemyMoblin
    
    MapSystem --> Collision
    Combat --> Collision

    %% Click Events
    click GameEngine "https://github.com/sesem4/Nelda/blob/develop/Core/src/main/java/dk/sdu/sesem4/core/Game.java"
    click EventManager "https://github.com/sesem4/Nelda/tree/develop/Common/src/main/java/dk/sdu/sesem4/common/event/"
    click Player "https://github.com/sesem4/Nelda/tree/develop/Player/src/main/java/dk/sdu/sesem4/player/"
    click EnemyMoblin "https://github.com/sesem4/Nelda/tree/develop/EnemyMoblin/src/main/java/dk/sdu/sesem4/moblin/"
    click EnemyOctorok "https://github.com/sesem4/Nelda/tree/develop/EnemyOctorok/src/main/java/dk/sdu/sesem4/octorok/"
    click EnemySpawner "https://github.com/sesem4/Nelda/tree/develop/EnemySpawner/src/main/java/dk/sdu/sesem4/spawner/"
    click MapSystem "https://github.com/sesem4/Nelda/tree/develop/Map/src/main/java/dk/sdu/sesem4/map/"
    click Combat "https://github.com/sesem4/Nelda/tree/develop/Sword/src/main/java/dk/sdu/sesem4/sword/"
    click AIRandom "https://github.com/sesem4/Nelda/tree/develop/AI-Random/src/main/java/dk/sdu/sesem4/RandomMovement/"
    click AISimple "https://github.com/sesem4/Nelda/tree/develop/AI-Simple/src/main/java/dk/sdu/sesem4/ai/simple/"
    click AISmart "https://github.com/sesem4/Nelda/tree/develop/AI-Smart/src/main/java/dk/sdu/sesem4/ai/smart/"
    click Controls "https://github.com/sesem4/Nelda/tree/develop/KeyboardControl/src/main/java/dk/sdu/sesem4/keyboardcontrol/"
    click Collision "https://github.com/sesem4/Nelda/tree/develop/Collision/src/main/java/dk/sdu/sesem4/collision/"
    click SPI "https://github.com/sesem4/Nelda/tree/develop/Common/src/main/java/dk/sdu/sesem4/common/SPI/"
    click GameData "https://github.com/sesem4/Nelda/tree/develop/Common/src/main/java/dk/sdu/sesem4/common/data/"
    click GameEntities "https://github.com/sesem4/Nelda/tree/develop/Common/src/main/java/dk/sdu/sesem4/common/data/"

    %% Styles
    classDef core fill:#2b4b6b,stroke:#fff,stroke-width:2px,color:#fff
    classDef spi fill:#87ceeb,stroke:#333,stroke-width:1px
    classDef service fill:#add8e6,stroke:#333
    classDef gameplay fill:#90ee90,stroke:#333
    classDef enemy fill:#ff6b6b,stroke:#333
    classDef ai fill:#ffa500,stroke:#333

    %% Legend
    subgraph Legend
        L1["Core Components"]:::core
        L2["Service Interfaces"]:::spi
        L3["Gameplay Components"]:::gameplay
        L4["Enemy Components"]:::enemy
        L5["AI Components"]:::ai
    end
```
