# shellyshells/wizzard architecture

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

- Interactive diagram: https://gitdiagram.com/shellyshells/wizzard
- Repository: https://github.com/shellyshells/wizzard

## Overview

##### Main Components
a. Entry Point
- Main Application (Main.java) – bootstraps the app, initializes controller and view.
b. Controller Layer (src/controller)
- GameController – orchestrates flow, reacts to user actions.
- ProgressTracker – tracks player state (e.g., current node, inventory).
- StoryLoader – loads/parses story content from resources.
c. Model Layer (src/model)
- Core Entities: Story, StoryNode, Encounter, Choice, Character, Entity, Inventory, CombatSystem, etc.
- They encapsulate game data, business logic (e.g., combat resolution).
d. View Layer (src/view)
- UI Screens & Components: MainMenuScreen/UI, MapScreen, CombatScreen, InventoryScreen, HelpWindow, EndingDialog, ProphecyUI, VisionDialog, CharacterPortrait, etc.
- They render model state and forward user events to controllers.
e. Assets & Resources
- Fonts and Images (src/Assets/Fonts, Images) – loaded at runtime by StoryLoader or view components.
f. Build & Deployment
- pom.xml (Maven) – defines dependencies, build lifecycle.
- target/ – compiled classes & build artifacts.

##### Relationships & Data Flows
- User Input → View Component → forwards event → GameController
- GameController ↔ Model (e.g., ProgressTracker, Inventory, CombatSystem)
– executes game logic, updates model state
- GameController → View
– instructs view to transition screens or re-render based on updated model
- StoryLoader → Model
– at startup or new game, reads story definitions into Story, StoryNode, etc.
- Model → View
– view queries model for display data (e.g., current node text, character stats)

##### Architectural Patterns & Principles
- MVC (Model–View–Controller) separation
- Single-process desktop app – no external microservices
- Resource-driven content (assets + story files under docs or embedded)
- Dependency direction: Controllers depend on Model & View; View only depends on Model for reads; Model is independent.

##### Technologies & Frameworks
- Java (JDK)
- GUI toolkit (Swing/JavaFX – implied by view package structure)
- Maven (pom.xml)
- Plain files for story content (e.g., docs/game_content_map.md, potentially JSON/YAML/XML loaded by StoryLoader)

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Entry Point
    subgraph "Entry Point"
        MainApp["Main Application\n(Main.java)"]:::entry
    end

    %% Controller Layer
    subgraph "Controller Layer"
        GC["GameController"]:::controller
        PT["ProgressTracker"]:::controller
        SL["StoryLoader"]:::controller
    end

    %% Model Layer
    subgraph "Model Layer"
        Story["Story"]:::model
        StoryNode["StoryNode"]:::model
        Encounter["Encounter"]:::model
        Choice["Choice"]:::model
        Character["Character"]:::model
        Entity["Entity"]:::model
        Inventory["Inventory"]:::model
        CombatSystem["CombatSystem"]:::model
    end

    %% View Layer
    subgraph "View Layer"
        MMS["MainMenuScreen"]:::view
        MMU["MainMenuUI"]:::view
        MS["MapScreen"]:::view
        CS["CombatScreen"]:::view
        IS["InventoryScreen"]:::view
        HW["HelpWindow"]:::view
        ED["EndingDialog"]:::view
        PU["ProphecyUI"]:::view
        VD["VisionDialog"]:::view
        CP["CharacterPortrait"]:::view
    end

    %% Assets & Resources
    subgraph "Assets / Resources"
        Fonts["Fonts"]:::resource
        Images["Images"]:::resource
        StoryMap["game_content_map.md"]:::resource
    end

    %% Build & Deployment
    subgraph "Build & Deployment"
        POM["pom.xml"]:::build
        Target["target/"]:::build
    end

    %% Connections
    MainApp -->|bootstraps| GC
    MainApp -->|bootstraps| SL
    SL -->|load content| Story
    SL -->|load content| StoryNode
    SL -->|load content| Encounter
    SL -->|load content| Choice
    SL -->|load content| Character
    SL -->|load content| Entity
    SL -->|load content| Inventory
    SL -->|load content| CombatSystem
    SL -->|loads assets| Fonts
    SL -->|loads assets| Images
    SL -->|loads map| StoryMap

    %% User events from View to Controller
    MMS -->|"user event"| GC
    MMU -->|"user event"| GC
    MS -->|"user event"| GC
    CS -->|"user event"| GC
    IS -->|"user event"| GC
    HW -->|"user event"| GC
    ED -->|"user event"| GC
    PU -->|"user event"| GC
    VD -->|"user event"| GC
    CP -->|"user event"| GC

    %% Controller updates Model
    GC -->|"update state"| PT
    GC -->|"update state"| Inventory
    GC -->|"execute logic"| CombatSystem

    %% Controller renders View
    GC -->|"render request"| MMS
    GC -->|"render request"| MS
    GC -->|"render request"| CS
    GC -->|"render request"| IS

    %% Model to View data retrieval
    Story -->|"data for display"| MMS
    Inventory -->|"data for display"| IS
    Character -->|"data for display"| CP

    %% Build
    POM -->|"build produces"| Target

    %% Click Events
    click MainApp "https://github.com/shellyshells/wizzard/blob/main/src/Main.java"
    click GC "https://github.com/shellyshells/wizzard/blob/main/src/controller/GameController.java"
    click PT "https://github.com/shellyshells/wizzard/blob/main/src/controller/ProgressTracker.java"
    click SL "https://github.com/shellyshells/wizzard/blob/main/src/controller/StoryLoader.java"
    click Story "https://github.com/shellyshells/wizzard/blob/main/src/model/Story.java"
    click StoryNode "https://github.com/shellyshells/wizzard/blob/main/src/model/StoryNode.java"
    click Encounter "https://github.com/shellyshells/wizzard/blob/main/src/model/Encounter.java"
    click Choice "https://github.com/shellyshells/wizzard/blob/main/src/model/Choice.java"
    click Character "https://github.com/shellyshells/wizzard/blob/main/src/model/Character.java"
    click Entity "https://github.com/shellyshells/wizzard/blob/main/src/model/Entity.java"
    click Inventory "https://github.com/shellyshells/wizzard/blob/main/src/model/Inventory.java"
    click CombatSystem "https://github.com/shellyshells/wizzard/blob/main/src/model/CombatSystem.java"
    click MMS "https://github.com/shellyshells/wizzard/blob/main/src/view/MainMenuScreen.java"
    click MMU "https://github.com/shellyshells/wizzard/blob/main/src/view/MainMenuUI.java"
    click MS "https://github.com/shellyshells/wizzard/blob/main/src/view/MapScreen.java"
    click CS "https://github.com/shellyshells/wizzard/blob/main/src/view/CombatScreen.java"
    click IS "https://github.com/shellyshells/wizzard/blob/main/src/view/InventoryScreen.java"
    click HW "https://github.com/shellyshells/wizzard/blob/main/src/view/HelpWindow.java"
    click ED "https://github.com/shellyshells/wizzard/blob/main/src/view/EndingDialog.java"
    click PU "https://github.com/shellyshells/wizzard/blob/main/src/view/ProphecyUI.java"
    click VD "https://github.com/shellyshells/wizzard/blob/main/src/view/VisionDialog.java"
    click CP "https://github.com/shellyshells/wizzard/blob/main/src/view/CharacterPortrait.java"
    click Fonts "https://github.com/shellyshells/wizzard/tree/main/src/Assets/Fonts"
    click Images "https://github.com/shellyshells/wizzard/tree/main/src/Assets/Images"
    click StoryMap "https://github.com/shellyshells/wizzard/blob/main/docs/game_content_map.md"
    click POM "https://github.com/shellyshells/wizzard/blob/main/pom.xml"
    click Target "https://github.com/shellyshells/wizzard/tree/main/target/"

    %% Styles
    classDef entry fill:#D2B48C,stroke:#000,stroke-width:1px
    classDef controller fill:#ADD8E6,stroke:#000,stroke-width:1px
    classDef model fill:#90EE90,stroke:#000,stroke-width:1px
    classDef view fill:#FFA500,stroke:#000,stroke-width:1px
    classDef resource fill:#D3D3D3,stroke:#000,stroke-width:1px
    classDef build fill:#FFB6C1,stroke:#000,stroke-width:1px
```
