# thomasschemmer/bestagon architecture

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

- Interactive diagram: https://gitdiagram.com/thomasschemmer/bestagon
- Repository: https://github.com/thomasschemmer/bestagon

## Overview

**┌─ Game Core ─────────────────────┐**
- ┌─ Gameplay Systems ─────────┐  │
- GameplayAbilitySystem   │  │
- Card System            │  │
- Building System       │  │
- Unit System          │  │
- ┘  │

- ┌─ World Generation ─────────┐  │
- MapGenerator            │  │
- TileMeshGenerator      │  │
- WorldGenerator         │  │
- ┘  │

- ┌─ Visualization ───────────┐  │
- Entity Visualization   │  │
- Preview System        │  │
- Indicator System      │  │
- ┘  │
- ┘

##### Key Subsystems

a) Gameplay Ability System (GAS):
- Abilities, Attributes, and Effects
- Flow of gameplay effects
- Link to tag system

b) Building & Resource Management:
- Building definitions
- Production systems
- Resource flow

c) Card System:
- Deck management
- Card effects
- Card UI elements

##### Integration Points

Clear connections between:
- UI Layer ↔ Game Systems
- World Generation ↔ Visualization
- Card System ↔ Building System

##### Technical Details

Important technical implementations:
- Unity's Universal Render Pipeline integration
- Shader systems for visualization
- Compute shaders for world generation
- GameplayAbilitySystem implementation

##### The tutorial and quest systems

Use a hierarchical layout to show how these systems interact while maintaining clear separation of concerns. The GameplayAbilitySystem should be shown as a central framework that other systems build upon.

- System boundaries
- Component relationships

This will create a comprehensive visualization of the game's architecture while maintaining clarity about how the different systems interact.

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles and Classes
    classDef core fill:#3498db,stroke:#2980b9,color:white
    classDef gameplay fill:#2ecc71,stroke:#27ae60,color:white
    classDef ui fill:#e67e22,stroke:#d35400,color:white
    classDef visual fill:#9b59b6,stroke:#8e44ad,color:white
    classDef data fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef critical fill:#e74c3c,stroke:#c0392b,color:white

    %% UI Layer
    subgraph UI
        ScreenMgr["Screen Management"]
        CardUI["Card UI"]
        BuildUI["Building UI"]
        UnitUI["Unit UI"]
        Minimap["Minimap"]
        Indicators["Indicators"]
    end

    %% Core Systems
    subgraph CoreSystems
        GameService["Game Service"]
        TurnSystem["Turn System"]
        SaveMgr["Save Game Manager"]
        WorldGen["World Generator"]
    end

    %% Gameplay Systems
    subgraph GameplaySystems
        subgraph BuildingSystem
            BuildService["Building Service"]
            BuildDefs["Building Definitions"]
            ProdSystem["Production System"]
        end

        subgraph UnitSystem
            UnitService["Unit Service"]
            WorkerMgmt["Worker Management"]
            ScoutMgmt["Scout Management"]
        end

        subgraph CardSystem
            CardFactory["Card Factory"]
            DeckMgmt["Deck Management"]
            HandMgmt["Hand Management"]
        end

        subgraph QuestSystem
            QuestService["Quest Service"]
            QuestTemplates["Quest Templates"]
        end
    end

    %% Visualization Layer
    subgraph Visualization
        HexGrid["Hexagon Grid Visualization"]
        BuildVis["Building Visualization"]
        UnitVis["Unit Visualization"]
        Preview["Preview System"]
        ParticleSystem["Particle System"]
        CloudRender["Cloud Renderer"]
    end

    %% Data Management
    subgraph DataManagement
        SaveSystem["Save System"]
        EntityProv["Entity Providers"]
        LocMgmt["Location Management"]
        AttrSystem["Attribute System"]
    end

    %% Relationships
    GameService --> TurnSystem
    GameService --> SaveMgr
    GameService --> WorldGen
    GameService --> BuildService
    GameService --> UnitService
    GameService --> QuestService

    BuildService --> BuildDefs
    BuildService --> ProdSystem
    UnitService --> WorkerMgmt
    UnitService --> ScoutMgmt
    CardFactory --> DeckMgmt
    DeckMgmt --> HandMgmt
    QuestService --> QuestTemplates

    ScreenMgr --> CardUI
    ScreenMgr --> BuildUI
    ScreenMgr --> UnitUI
    ScreenMgr --> Minimap
    ScreenMgr --> Indicators

    BuildService -.-> BuildVis
    UnitService -.-> UnitVis
    WorldGen -.-> HexGrid
    Preview --> BuildVis
    Preview --> UnitVis

    SaveMgr --> SaveSystem
    WorldGen --> EntityProv
    GameService --> LocMgmt
    GameService --> AttrSystem

    %% Click Events
    click GameService "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/Util/GameService/GameService.cs"
    click TurnSystem "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/Player/Turn.cs"
    click SaveMgr "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/Util/Saving/SaveGameManager.cs"
    click WorldGen "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/Generation/WorldGenerator.cs"
    click BuildService "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/Buildings/BuildingService.cs"
    click BuildDefs "https://github.com/ThomasSchemmer/Bestagon/tree/master/Assets/Resources/Buildings/Definitions/"
    click UnitService "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/Unit/Units.cs"
    click WorkerMgmt "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/Unit/Workers.cs"
    click CardFactory "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/Cards/CardFactory.cs"
    click DeckMgmt "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/Cards/CardCollection.cs"
    click QuestService "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/Quests/QuestService.cs"
    click HexGrid "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/Visualization/HexagonVisualization.cs"
    click BuildVis "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/Visualization/BuildingVisualization.cs"
    click UnitVis "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/Visualization/UnitVisualization.cs"
    click Preview "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/Visualization/Preview/PreviewSystem.cs"
    click CloudRender "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/Visualization/CloudRenderer.cs"
    click ScreenMgr "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/UI/Screens/ScreenUI.cs"
    click CardUI "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/UI/Screens/CardGroupScreen.cs"
    click BuildUI "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/UI/Screens/ScreenFeatures/BuildingPreviewScreen.cs"
    click UnitUI "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/UI/Screens/ScreenFeatures/SelectedUnitsScreen.cs"
    click SaveSystem "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/Util/Saving/SaveableService.cs"
    click EntityProv "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/Generation/EntityProvider.cs"
    click LocMgmt "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Scripts/Util/Location/Location.cs"
    click AttrSystem "https://github.com/ThomasSchemmer/Bestagon/blob/master/Assets/Imports/GAS/Attributes/AttributeSet.cs"

    %% Style Applications
    class GameService,TurnSystem,SaveMgr,WorldGen core
    class BuildService,BuildDefs,ProdSystem,UnitService,WorkerMgmt,ScoutMgmt,CardFactory,DeckMgmt,HandMgmt,QuestService,QuestTemplates gameplay
    class ScreenMgr,CardUI,BuildUI,UnitUI,Minimap,Indicators ui
    class HexGrid,BuildVis,UnitVis,Preview,ParticleSystem,CloudRender visual
    class SaveSystem,EntityProv,LocMgmt,AttrSystem data
```
