# zku11y/liars-bar-x-balatro architecture

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

- Interactive diagram: https://gitdiagram.com/zku11y/liars-bar-x-balatro
- Repository: https://github.com/zku11y/liars-bar-x-balatro

## Overview

##### Main Components
- Game Engine Configuration: Represented by the Godot project file (project.godot) and supporting configuration files.
- Game Logic & State Management: Highlight scripts like Card.gd, Card_hand.gd, container.gd, control.gd, and the “State machine.md” documentation which indicate the use of a state machine to handle card states and game flow.
- Game Scenes & Visual Representation: Include various scene files (.tscn) such as Cards.tscn, hand.tscn, hand2.tscn, hand3.tscn, and no_animation_card.tscn, plus shader files (idle_wobble.gdshader) that manage visual effects.
- Asset Management: Include the Assets directory (and subdirectories like Cards_PNG) that contains the art resources (pixel art for cards, characters, and backgrounds) used by the game.
- Documentation & Development Aids: Don’t overlook the “Liars bar x balatro Vault” which contains current tasks, notes, and additional ideas that inform development priorities.

##### Relationships and Interactions
- The core game loop managed by Godot ties together the various scenes and scripts. For example, scene files trigger the game logic in their respective GDScript files.
- The state machine (as indicated in the “State machine.md” and possibly within one of the main scripts) orchestrates transitions between different game states (e.g., card drawn, card played, joker bonus activated).
- Layout how assets (cards, backgrounds, shader effects) are loaded and associated with the game scenes, ensuring the proper connection between visual components and the underlying logic.

##### Architectural Patterns and Design Principles
- Modular Design: The separation of resources into assets, logic, and scene files points to a modular design, making it easier to update, test, and extend various components.
- Separation of Concerns: Game logic (card mechanics and bluffing methods) is decoupled from visual skill implementations and scene management.
- State Management: The use of a state machine for controlling game flow and card states is key to understanding system interactions.
- Event-Driven Flow: Consider representing the impact of player interactions (e.g., playing a card, triggering a joker bonus) as events that trigger state transitions in the logic layer.

##### Final Touches
- Detail interactions such as how player inputs translate into game events, and how the state machine in the core logic updates the visuals accordingly.
- If applicable, you might include external service connections (like multiplayer features that are planned for Phase 3), even if they’re not fully implemented yet, to give context for future extensions.

## Diagram (Mermaid)

```mermaid
graph TD
    %% Engine & Configuration
    subgraph "Engine & Configuration"
        EConfig["project.godot"]:::config
    end

    %% Game Logic & State Management
    subgraph "Game Logic & State Management"
        Card["Card.gd"]:::logic
        CardHand["Card_hand.gd"]:::logic
        Container["container.gd"]:::logic
        Control["control.gd"]:::logic
        Globals["Globals.gd"]:::logic
        StateMachine["State machine.md"]:::logic
    end

    %% User Interface & Scenes
    subgraph "User Interface & Scenes"
        CardsScene["Cards.tscn"]:::scenes
        HandScene["hand.tscn"]:::scenes
        Hand2Scene["hand2.tscn"]:::scenes
        Hand3Scene["hand3.tscn"]:::scenes
        NoAnimScene["no_animation_card.tscn"]:::scenes
        ShaderEffect["idle_wobble.gdshader"]:::scenes
    end

    %% Asset Management
    subgraph "Asset Management"
        Assets["Assets"]:::asset
    end

    %% Documentation & Development Process
    subgraph "Documentation & Development Process"
        Vault["Vault"]:::doc
    end

    %% Relationships
    EConfig -->|"configures"| Card
    EConfig -->|"configures"| CardsScene

    Assets -->|"loads assets into"| CardsScene
    Assets -->|"loads assets into"| HandScene
    Assets -->|"loads assets into"| Hand2Scene
    Assets -->|"loads assets into"| Hand3Scene
    Assets -->|"loads assets into"| NoAnimScene
    Assets -->|"loads assets into"| ShaderEffect

    CardsScene -->|"triggersEvent"| Card
    HandScene -->|"triggersEvent"| CardHand
    NoAnimScene -->|"triggersEvent"| Container
    Hand2Scene -->|"triggersEvent"| Control
    Hand3Scene -->|"triggersEvent"| Globals
    ShaderEffect -->|"appliesTo"| CardsScene
    StateMachine -->|"drivesState"| CardsScene

    Vault -->|"informsDesign"| EConfig
    Vault -->|"guidesDev"| Card

    %% Styles
    classDef config fill:#f9d6a5,stroke:#d48c3,stroke-width:2px;
    classDef logic fill:#a5d8f9,stroke:#0a74da,stroke-width:2px;
    classDef scenes fill:#d5f9a5,stroke:#7fc74d,stroke-width:2px;
    classDef asset fill:#f9a5e9,stroke:#d06c9f,stroke-width:2px;
    classDef doc fill:#f9f3a5,stroke:#d7d03b,stroke-width:2px;

    %% Click Events
    click EConfig "https://github.com/zku11y/liars-bar-x-balatro/blob/main/liars-bar-x-balatro/project.godot"
    click Card "https://github.com/zku11y/liars-bar-x-balatro/blob/main/liars-bar-x-balatro/Card.gd"
    click CardHand "https://github.com/zku11y/liars-bar-x-balatro/blob/main/liars-bar-x-balatro/Card_hand.gd"
    click Container "https://github.com/zku11y/liars-bar-x-balatro/blob/main/liars-bar-x-balatro/container.gd"
    click Control "https://github.com/zku11y/liars-bar-x-balatro/blob/main/liars-bar-x-balatro/control.gd"
    click Globals "https://github.com/zku11y/liars-bar-x-balatro/blob/main/liars-bar-x-balatro/Globals.gd"
    click StateMachine "https://github.com/zku11y/liars-bar-x-balatro/blob/main/Liars bar x balatro Vault/State machine.md"
    click CardsScene "https://github.com/zku11y/liars-bar-x-balatro/blob/main/liars-bar-x-balatro/Cards.tscn"
    click HandScene "https://github.com/zku11y/liars-bar-x-balatro/blob/main/liars-bar-x-balatro/hand.tscn"
    click Hand2Scene "https://github.com/zku11y/liars-bar-x-balatro/blob/main/liars-bar-x-balatro/hand2.tscn"
    click Hand3Scene "https://github.com/zku11y/liars-bar-x-balatro/blob/main/liars-bar-x-balatro/hand3.tscn"
    click NoAnimScene "https://github.com/zku11y/liars-bar-x-balatro/blob/main/liars-bar-x-balatro/no_animation_card.tscn"
    click ShaderEffect "https://github.com/zku11y/liars-bar-x-balatro/blob/main/liars-bar-x-balatro/idle_wobble.gdshader"
    click Assets "https://github.com/zku11y/liars-bar-x-balatro/tree/main/liars-bar-x-balatro/Assets"
    click Vault "https://github.com/zku11y/liars-bar-x-balatro/tree/main/Liars bar x balatro Vault"
```
