# verillious/godot-clyde-dialogue architecture

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

- Interactive diagram: https://gitdiagram.com/verillious/godot-clyde-dialogue
- Repository: https://github.com/verillious/godot-clyde-dialogue

## Overview

##### Main Components

a) Core Components:
- Parser System
- Interpreter System
- Resource Management
- Editor Interface
- Helper System

b) External Integration:
- Godot Engine
- Game Project
- Translation System

##### Detailed Architecture Breakdown

**TOP LAYER: User Interface**

**MIDDLE LAYER: Core Processing**

**BOTTOM LAYER: Integration Layer**

##### Component Relationships

a) Editor Flow:
**.clyde files → Parser → Resource Generation → Interpreter**

b) Runtime Flow:
**Dialogue Resource → Interpreter → Game Integration**

##### File Processing Pipeline
- File Loader (/addons/clyde/file_loader.gd)
- Parser System (/addons/clyde/parser/)
- Resource Management (/addons/clyde/resource/)

##### Core Systems
- Interpreter (/addons/clyde/interpreter/)
- Memory Management
- Logic Processing

##### Editor Integration
- Main Panel
- Block List
- File List
- Syntax Highlighting
- Debug Tools

##### Helper System
- Dialogue Manager
- Bubble System
- Configuration System

##### File Processing
**.clyde files → Parser → ClydeDialogueResource → Interpreter**

##### Editor Integration
**Editor UI → Parser → Debug Tools → Interpreter**

##### Runtime Flow
**Game → Dialogue Manager → Interpreter → UI Elements**

##### Implementation Notes

- Clear separation between editor-time and runtime components
- Plugin's integration points with Godot
- Translation system integration
- Helper system as an optional layer

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph External["External Systems"]
        GE["Godot Engine"]:::external
        GP["Game Project"]:::external
    end

    subgraph UI["User Interface Layer"]
        direction TB
        EP["Editor Panel"]:::editor
        click EP "https://github.com/verillious/godot-clyde-dialogue/blob/godot_4/addons/clyde/editor/main_panel.gd"
        BL["Block List"]:::editor
        click BL "https://github.com/verillious/godot-clyde-dialogue/blob/godot_4/addons/clyde/editor/block_list.gd"
        FL["File List"]:::editor
        click FL "https://github.com/verillious/godot-clyde-dialogue/blob/godot_4/addons/clyde/editor/file_list.gd"
        SH["Syntax Highlighter"]:::editor
        click SH "https://github.com/verillious/godot-clyde-dialogue/blob/godot_4/addons/clyde/editor/editor/clyde_syntax_highlighter.gd"
        DT["Debug Tools"]:::editor
        click DT "https://github.com/verillious/godot-clyde-dialogue/blob/godot_4/addons/clyde/editor/player/debug_dock.gd"
    end

    subgraph Core["Core Processing Layer"]
        direction TB
        subgraph PS["Parser System"]
            direction TB
            MP["Main Parser"]:::core
            click MP "https://github.com/verillious/godot-clyde-dialogue/blob/godot_4/addons/clyde/parser/Parser.gd"
            LX["Lexer"]:::core
            click LX "https://github.com/verillious/godot-clyde-dialogue/blob/godot_4/addons/clyde/parser/Lexer.gd"
            TW["Token Walker"]:::core
            click TW "https://github.com/verillious/godot-clyde-dialogue/blob/godot_4/addons/clyde/parser/TokenWalker.gd"
        end

        subgraph IS["Interpreter System"]
            direction TB
            MI["Main Interpreter"]:::core
            click MI "https://github.com/verillious/godot-clyde-dialogue/blob/godot_4/addons/clyde/interpreter/Interpreter.gd"
            LI["Logic Interpreter"]:::core
            click LI "https://github.com/verillious/godot-clyde-dialogue/blob/godot_4/addons/clyde/interpreter/LogicInterpreter.gd"
            MM["Memory Management"]:::core
            click MM "https://github.com/verillious/godot-clyde-dialogue/blob/godot_4/addons/clyde/interpreter/Memory.gd"
        end

        subgraph RM["Resource Management"]
            direction TB
            RD["Resource Definition"]:::core
            click RD "https://github.com/verillious/godot-clyde-dialogue/blob/godot_4/addons/clyde/resource/ClydeDialogueResource.gd"
            RL["Resource Loader"]:::core
            click RL "https://github.com/verillious/godot-clyde-dialogue/blob/godot_4/addons/clyde/resource/ClydeDialogueResourceLoader.gd"
            RS["Resource Saver"]:::core
            click RS "https://github.com/verillious/godot-clyde-dialogue/blob/godot_4/addons/clyde/resource/ClydeDialogueResourceSaver.gd"
        end
    end

    subgraph Helper["Helper System Layer"]
        direction TB
        DM["Dialogue Manager"]:::helper
        click DM "https://github.com/verillious/godot-clyde-dialogue/blob/godot_4/addons/clyde/helpers/dialogue_manager.gd"
        DC["Dialogue Config"]:::helper
        click DC "https://github.com/verillious/godot-clyde-dialogue/blob/godot_4/addons/clyde/helpers/dialogue_config.gd"
        BS["Bubble System"]:::helper
        click BS "https://github.com/verillious/godot-clyde-dialogue/tree/godot_4/addons/clyde/helpers/bubbles/"
    end

    subgraph TS["Translation System"]
        direction TB
        ET["English Translation"]:::translation
        click ET "https://github.com/verillious/godot-clyde-dialogue/blob/godot_4/addons/clyde/editor/config/translations/en.csv"
        IT["Interface Text"]:::translation
        click IT "https://github.com/verillious/godot-clyde-dialogue/blob/godot_4/addons/clyde/editor/config/interface_text.gd"
    end

    FL --> MP
    MP --> LX
    LX --> TW
    MP --> RD
    RD --> MI
    MI --> LI
    MI --> MM
    RL --> RD
    RD --> RS
    DM --> MI
    DC --> DM
    BS --> DM
    EP --> DT
    DT --> MI
    TS --> EP

    classDef core fill:#2196F3,stroke:#1565C0,color:white
    classDef editor fill:#4CAF50,stroke:#2E7D32,color:white
    classDef helper fill:#FFC107,stroke:#FFA000,color:black
    classDef external fill:#9E9E9E,stroke:#616161,color:white
    classDef translation fill:#E91E63,stroke:#C2185B,color:white

    %% Legend
    subgraph Legend
        C[Core Component]:::core
        E[Editor Component]:::editor
        H[Helper Component]:::helper
        EX[External System]:::external
        T[Translation Component]:::translation
    end
```
