# misterflask/libgdxturnbasedstrategy architecture

> Architecture diagram of the GitHub repository misterflask/libgdxturnbasedstrategy, 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/misterflask/libgdxturnbasedstrategy
- Repository: https://github.com/misterflask/libgdxturnbasedstrategy

## Overview

##### Main Components (Top Level)
- Core Game Engine (LibGDX)
- Game Logic Layer
- View/Rendering Layer
- Asset Management System
- Input Processing System

##### Key Architectural Layers (from bottom to top)

a. Foundation Layer:
- LibGDX Framework
- Kotlin Runtime
- Desktop Launcher

b. Core Systems Layer:
- Asset Management (core/assets/)
- Tile System (tiledutils/)
- Animation System (view/animation/)
- Input Processing (controller/)

c. Game Logic Layer:
- Tactical Map System (common/)
- AI System (ai/)
- Character System (tacmapunits/)
- Ability System (abilities/)
- Equipment System (equipment/)

d. Presentation Layer:
- UI System (view/ui/)
- Animation Rendering
- Shader Management
- Camera System

##### Important Connections to Highlight

- Input Processing → Game Logic → View System → Rendering
- Asset Management ↔ All Layers
- AI System → Tactical Map System

- Tilesets
- Shaders
- UI Skins
- Animations
- Particles

- TacticalMapState
- GlobalTacMapState
- Mission State

- Blue: Core Engine Components
- Green: Game Logic Systems
- Orange: View/Rendering Systems
- Purple: Asset Management
- Red: Input/Control Systems

##### Implementation Details

- Dependency Injection System (using Guice)
- Event System (EventNotifier)
- Animation Queue System
- Pathfinding System
- Battle Goals System

##### Key Design Patterns to Highlight

- Factory Pattern (various *Factory classes)
- Observer Pattern (EventNotifier)
- Strategy Pattern (AI implementation)
- Command Pattern (Action system)

##### The animation and rendering pipeline

Remember to include version control and build system information (Gradle) in a separate section, as they're crucial for project management but not part of the runtime architecture.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Style Definitions
    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef logic fill:#4CAF50,stroke:#388E3C,color:white
    classDef view fill:#FF9800,stroke:#F57C00,color:white
    classDef asset fill:#9C27B0,stroke:#7B1FA2,color:white
    classDef input fill:#F44336,stroke:#D32F2F,color:white

    %% Foundation Layer
    subgraph Foundation
        LibGDX[LibGDX Framework]:::core
        Kotlin[Kotlin Runtime]:::core
        Desktop[Desktop Launcher]:::core
        GameMain[Game Engine]:::core
    end

    %% Asset Management Layer
    subgraph AssetManagement
        Assets["Asset Management"]:::asset
        Tilesets["Tilesets"]:::asset
        Shaders["Shaders"]:::asset
        UIAssets["UI Assets"]:::asset
        Animations["Animations"]:::asset
    end

    %% Core Systems Layer
    subgraph CoreSystems
        TileSystem["Tile System"]:::core
        AnimSystem["Animation System"]:::core
        InputProc["Input Processing"]:::core
        ShaderMgr["Shader Management"]:::core
        CameraSystem["Camera System"]:::core
    end

    %% Game Logic Layer
    subgraph GameLogic
        TacMap["Tactical Map System"]:::logic
        AISystem["AI System"]:::logic
        CharSystem["Character System"]:::logic
        AbilitySystem["Ability System"]:::logic
        EquipSystem["Equipment System"]:::logic
        EventSystem["Event System"]:::logic
    end

    %% State Management
    subgraph StateManagement
        TacMapState["Tactical Map State"]:::logic
        GlobalState["Global TacMap State"]:::logic
        MissionState["Mission State"]:::logic
    end

    %% Presentation Layer
    subgraph Presentation
        UISystem["UI System"]:::view
        AnimRender["Animation Rendering"]:::view
        BattleGoals["Battle Goals"]:::view
    end

    %% Connections
    LibGDX --> GameMain
    Kotlin --> GameMain
    Desktop --> GameMain
    
    Assets --> TileSystem
    Assets --> ShaderMgr
    Assets --> UISystem
    Assets --> AnimSystem

    InputProc --> TacMap
    TacMap --> AnimRender
    AISystem --> TacMap
    CharSystem --> TacMap
    AbilitySystem --> CharSystem
    EquipSystem --> CharSystem
    
    TacMap --> TacMapState
    TacMapState --> GlobalState
    GlobalState --> MissionState

    EventSystem --> TacMap
    EventSystem --> UISystem
    
    AnimSystem --> AnimRender
    ShaderMgr --> AnimRender
    CameraSystem --> AnimRender

    %% Click Events
    click GameMain "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/blob/master/core/src/com/ironlordbyron/turnbasedstrategy/entrypoints/GdxGameMain.kt"
    click Assets "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/tree/master/core/assets/"
    click Tilesets "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/tree/master/core/assets/tilesets/"
    click Shaders "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/tree/master/core/assets/shaders/"
    click UIAssets "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/tree/master/core/assets/tactical-ui-skins/"
    click Animations "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/tree/master/core/assets/animations/"
    click TileSystem "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/tree/master/core/src/com/ironlordbyron/turnbasedstrategy/tiledutils/"
    click AnimSystem "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/tree/master/core/src/com/ironlordbyron/turnbasedstrategy/view/animation/"
    click InputProc "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/tree/master/core/src/com/ironlordbyron/turnbasedstrategy/controller/"
    click TacMap "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/tree/master/core/src/com/ironlordbyron/turnbasedstrategy/common/"
    click AISystem "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/tree/master/core/src/com/ironlordbyron/turnbasedstrategy/ai/"
    click CharSystem "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/tree/master/core/src/com/ironlordbyron/turnbasedstrategy/tacmapunits/"
    click AbilitySystem "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/tree/master/core/src/com/ironlordbyron/turnbasedstrategy/common/abilities/"
    click EquipSystem "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/tree/master/core/src/com/ironlordbyron/turnbasedstrategy/common/equipment/"
    click UISystem "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/tree/master/core/src/com/ironlordbyron/turnbasedstrategy/view/ui/"
    click ShaderMgr "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/blob/master/core/src/com/ironlordbyron/turnbasedstrategy/view/ShaderManager.kt"
    click CameraSystem "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/tree/master/core/src/com/ironlordbyron/turnbasedstrategy/view/animation/camera/"
    click TacMapState "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/blob/master/core/src/com/ironlordbyron/turnbasedstrategy/common/TacticalMapState.kt"
    click GlobalState "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/blob/master/core/src/com/ironlordbyron/turnbasedstrategy/common/GlobalTacMapState.kt"
    click EventSystem "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/blob/master/core/src/com/ironlordbyron/turnbasedstrategy/controller/EventNotifier.kt"
    click BattleGoals "https://github.com/MisterFlask/LibgdxTurnBasedStrategy/tree/master/core/src/com/ironlordbyron/turnbasedstrategy/common/campaign/battlegoals/"
```
