# ligen131/equal_to_p architecture

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

- Interactive diagram: https://gitdiagram.com/ligen131/equal_to_p
- Repository: https://github.com/ligen131/equal_to_p

## Overview

##### Project Type and Purpose
- The project is a puzzle game created for Global Game Jam 2024, built using Godot 4.3.
- Its core idea revolves around solving Boolean/arithmetic expressions that remain true while incorporating a smiley face emoticon, making it both a visual and logic puzzle.
- The README hints at an evolving game (with future Steam release plans) and shows credits for different roles (code, art, music, design).

##### Analyzing the File Structure
- The root contains various Git and release files, but most of the meat of the project is in directories like “addons”, “components”, “objects”, “scenes”, “scripts”, “singletons”, “ui”, and “dialogs”.
- Game-specific elements are separated into logical groupings:
- “scenes”: Contains different game screens (main_menu, level_menu, base_level, credits).
- “objects”: Contains game objects like cards, blocks, table cloth, and word objects – these likely represent interactive or physics-driven elements in the game.
- “components”: Contains behavior modules (e.g., smooth movement, shake component) which are attached to objects for enhanced functionality.
- “scripts”: Houses various utility scripts, cursor management, image library handlers, and game logic bits.
- “singletons”: For global managers (e.g., sound_manager), indicating a pattern where certain managers handle cross-cutting concerns.
- “ui”: Details for user interface components such as buttons, dynamic backgrounds, and cursors.
- “data”, “lang”, “fonts”, “themes”: These suggest that the game has configuration and styling assets to ensure a consistent look and localization.
- Also, the presence of “bus”, “dialogs”, “shaders”, etc., indicates that the project divides responsibilities very clearly by functionality.

##### Components
a. Main Game Engine (Godot Core)
- At the center, show the Godot Engine as the runtime environment.
- Main entry points: “main.gd” and “main.tscn”.

b. Scenes and UI Layers
- The UI layer includes subcomponents from the “ui” directory (cursor, dynamic backgrounds, styled buttons) and “dialogs” for style settings.

c. Game Objects and Components
- Objects (cards, blocks, words, table_cloth) and illustrate how they interact with the game scenes.
- Attached “components” such as shake and smooth movement to indicate composability and behavioral augmentation.

d. Addons and Tools (AsepriteWizard)
- “addons/AsepriteWizard” as a subsystem that manages sprite creation, import, and editing integrations that assist with asset management.
- Internal structure (importers, creators, interface docks) to highlight how it plugs into the Godot editor.

e. Global Managers and Utilities
- Scripting utilities (cursor_manager, image_lib, save_lib) as helpers that mediate between objects and UI.

f. External Build/CI Integration
- Though not part of game runtime, include a note on continuous integration workflows (in the .github/workflows folder) that are used for builds, indicating automated exports for Windows, Linux, macOS, etc.

##### Architectural Patterns and Relationships
- The design mirrors a modular or component-based architecture where major aspects (scenes, objects, and UI elements) are separated but interconnected using scripts and singletons.
- Data flow:
- User actions in the UI lead to scene transitions and trigger events handled by singleton managers (sound, input).
- Objects within a scene collaborate with attached components and use utility scripts.
- For the addons, illustrate how they extend Godot’s editor capabilities, facilitating asset and animation management.

##### Instructing the Principal Software Engineer
- Game Objects and Components: Illustrate how the interactive objects (e.g., cards, blocks) are enhanced by attached components like smooth_movement or shake_component.
- Global Systems: Include singletons such as the sound_manager, and outline how utility scripts (cursor management, image library) assist core components.
- Finally, mention the CI/build process in a peripheral note to emphasize the development lifecycle integration without cluttering the game runtime design.

## Diagram (Mermaid)

```mermaid
graph TD
    subgraph "Godot Engine"
        A1["main.gd"]:::godot
        A2["main.tscn"]:::godot
    end

    subgraph "Game Scenes"
        B1["Main Menu"]:::scene
        B2["Level Menu"]:::scene
        B3["Base Level"]:::scene
        B4["Credits"]:::scene
    end

    subgraph "UI Layer"
        C1["Styled Button"]:::ui
        C2["Dynamic BG"]:::ui
        C3["Cursor (UI)"]:::ui
        C4["Dialogs"]:::ui
    end

    subgraph "Game Objects"
        D1["Card"]:::scene
        D2["Card Base"]:::scene
        D3["Block"]:::scene
        D4["Table Cloth"]:::scene
        D5["Word"]:::scene
    end

    subgraph "Components"
        E1["Shake Component"]:::scene
        E2["Smooth Movement Component"]:::scene
    end

    subgraph "Global Managers & Utilities"
        F1["Sound Manager"]:::global
        F2["Cursor Manager (Script)"]:::global
        F3["Image Lib"]:::global
        F4["Save Lib"]:::global
    end

    subgraph "Addons/Tools"
        G1["AsepriteWizard Addon"]:::addon
    end

    subgraph "CI Integration"
        H1["GitHub Workflows"]:::ci
    end

    A1 & A2 -->|"starts"| B1
    B1 -->|"transitions"| B2
    B2 -->|"transitions"| B3
    B3 -->|"transitions"| B4

    B1 -->|"displays"| C1
    B2 -->|"displays"| C2
    B3 -->|"displays"| C3
    B4 -->|"displays"| C4

    B1 -->|"contains"| D1
    B1 -->|"contains"| D2
    B2 -->|"contains"| D3
    B3 -->|"contains"| D4
    B4 -->|"contains"| D5

    D1 -->|"uses"| E1
    D2 -->|"uses"| E2
    D3 -->|"uses"| E1
    D4 -->|"uses"| E2
    D5 -->|"uses"| E1

    C1 -->|"accesses"| F1
    C2 -->|"accesses"| F2
    C3 -->|"accesses"| F3
    C4 -->|"accesses"| F4

    B1 -->|"managed_by"| F1
    B2 -->|"managed_by"| F2
    B3 -->|"managed_by"| F3
    B4 -->|"managed_by"| F4

    G1 -->|"integrates_with"| A1

    H1 -->|"builds"| A1

    F1 -->|"controls"| B1

    classDef godot fill:#fef08a,stroke:#facc15,stroke-width:2px;
    classDef scene fill:#c6f6d5,stroke:#38a169,stroke-width:2px;
    classDef ui fill:#bee3f8,stroke:#3182ce,stroke-width:2px;
    classDef addon fill:#fed7aa,stroke:#ed8936,stroke-width:2px;
    classDef global fill:#e9d8fd,stroke:#9f7aea,stroke-width:2px;
    classDef ci fill:#e2e8f0,stroke:#718096,stroke-width:2px;

    click A1 "https://github.com/ligen131/equal_to_p/blob/main/main.gd"
    click A2 "https://github.com/ligen131/equal_to_p/blob/main/main.tscn"
    click B1 "https://github.com/ligen131/equal_to_p/blob/main/scenes/main_menu/main_menu.tscn"
    click B2 "https://github.com/ligen131/equal_to_p/blob/main/scenes/level_menu/level_menu.tscn"
    click B3 "https://github.com/ligen131/equal_to_p/blob/main/scenes/base_level/base_level.tscn"
    click B4 "https://github.com/ligen131/equal_to_p/blob/main/scenes/credits/credits.tscn"
    click C1 "https://github.com/ligen131/equal_to_p/blob/main/ui/styled_button/styled_button.tscn"
    click C2 "https://github.com/ligen131/equal_to_p/blob/main/ui/dynamic_bg/dynamic_bg.tscn"
    click C3 "https://github.com/ligen131/equal_to_p/blob/main/ui/cursor/cursor_manager.tscn"
    click C4 "https://github.com/ligen131/equal_to_p/tree/main/dialogs/"
    click D1 "https://github.com/ligen131/equal_to_p/blob/main/objects/card/card.tscn"
    click D2 "https://github.com/ligen131/equal_to_p/blob/main/objects/card_base/card_base.tscn"
    click D3 "https://github.com/ligen131/equal_to_p/blob/main/objects/block/block.tscn"
    click D4 "https://github.com/ligen131/equal_to_p/blob/main/objects/table_cloth/table_cloth.tscn"
    click D5 "https://github.com/ligen131/equal_to_p/blob/main/objects/word/word.tscn"
    click E1 "https://github.com/ligen131/equal_to_p/blob/main/components/shake_component/shake_component.tscn"
    click E2 "https://github.com/ligen131/equal_to_p/blob/main/components/smooth_movement_component/smooth_movement_component.tscn"
    click F1 "https://github.com/ligen131/equal_to_p/blob/main/singletons/sound_manager/sound_manager.gd"
    click F2 "https://github.com/ligen131/equal_to_p/tree/main/scripts/cursor_manager/"
    click F3 "https://github.com/ligen131/equal_to_p/tree/main/scripts/image_lib/"
    click F4 "https://github.com/ligen131/equal_to_p/blob/main/scripts/save_lib.gd"
    click G1 "https://github.com/ligen131/equal_to_p/tree/main/addons/AsepriteWizard/"
    click H1 "https://github.com/ligen131/equal_to_p/tree/main/.github/workflows/"
```
