# jakesteam/pixelblacksmith architecture

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

- Interactive diagram: https://gitdiagram.com/jakesteam/pixelblacksmith
- Repository: https://github.com/jakesteam/pixelblacksmith

## Overview

##### Main Components

a. Core Game Systems:
- Activity Layer (Main UI screens)
- Helper Layer (Business Logic)
- Model Layer (Data Objects)
- Database Layer (SugarORM)
- Resource Management (Assets, Sounds, Layouts)

b. External Integrations:
- Google Play Services
- In-App Billing
- Advertisement System
- Storage System

**[UI Layer]**
- Activities (27+ game screens)
- Custom Controls
- Layouts & Resources

**[Business Logic Layer]**
- Helper Classes
- Game Logic Helpers
- UI Helpers
- Integration Helpers
- Service Layer

**[Data Layer]**
- Model Classes
- SugarORM
- Local Storage

**[External Services]**
- Google Play Services
- In-App Billing
- Advertisement System

##### Key Relationships to Highlight

a. Activity Flow:
- How MainActivity connects to other activities
- Navigation patterns between screens

b. Helper Class Integration:
- How DisplayHelper, VisitorHelper, and WorkerHelper interact
- Connection to models and UI

c. Data Flow:
- How models interact with SugarORM
- Data persistence patterns

##### Implementation Details

- Use rectangles for activities
- Use circles for helpers
- Use clouds for external services
- Annotations for critical paths

##### Additional Notes

- Helper-based architecture
- Relationship between activities and their corresponding helpers
- Game's offline-first architecture
- Data flow for save game system

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef ui fill:#3498db,stroke:#2980b9,color:white
    classDef logic fill:#2ecc71,stroke:#27ae60,color:white
    classDef data fill:#f1c40f,stroke:#f39c12,color:black
    classDef external fill:#95a5a6,stroke:#7f8c8d,color:white
    classDef resource fill:#e74c3c,stroke:#c0392b,color:white

    %% UI Layer
    subgraph UI
        Activities["Activities (27+ Screens)"]:::ui
        CustomControls["Custom Controls"]:::ui
        LayoutRes["Layouts & Resources"]:::ui
    end

    %% Business Logic Layer
    subgraph Logic
        GameLogic["Game Logic Helpers"]:::logic
        UIHelpers["UI Helpers"]:::logic
        IntegrationHelpers["Integration Helpers"]:::logic
    end

    %% Data Layer
    subgraph Data
        Models["Model Classes"]:::data
        SugarORM["SugarORM"]:::data
        LocalStorage["Local Storage"]:::data
    end

    %% External Services
    subgraph External
        GooglePlay["Google Play Services"]:::external
        InAppBilling["In-App Billing"]:::external
        Ads["Advertisement System"]:::external
    end

    %% Resource Management
    subgraph Resources
        SoundMgmt["Sound Management"]:::resource
        AssetMgmt["Asset Management"]:::resource
        Translations["Multi-language Support"]:::resource
    end

    %% Relationships
    Activities --> GameLogic
    Activities --> UIHelpers
    Activities --> CustomControls
    Activities --> LayoutRes
    GameLogic --> Models
    UIHelpers --> Models
    Models --> SugarORM
    Models --> LocalStorage
    IntegrationHelpers --> GooglePlay
    IntegrationHelpers --> InAppBilling
    IntegrationHelpers --> Ads
    Activities --> SoundMgmt
    Activities --> AssetMgmt
    Activities --> Translations

    %% Click Events
    click Activities "https://github.com/JakeSteam/PixelBlacksmith/tree/master/Blacksmith/src/main/java/uk/co/jakelee/blacksmith/main/"
    click CustomControls "https://github.com/JakeSteam/PixelBlacksmith/tree/master/Blacksmith/src/main/java/uk/co/jakelee/blacksmith/controls/"
    click LayoutRes "https://github.com/JakeSteam/PixelBlacksmith/tree/master/Blacksmith/src/main/res/layout/"
    click GameLogic "https://github.com/JakeSteam/PixelBlacksmith/tree/master/Blacksmith/src/main/java/uk/co/jakelee/blacksmith/helper/"
    click Models "https://github.com/JakeSteam/PixelBlacksmith/tree/master/Blacksmith/src/main/java/uk/co/jakelee/blacksmith/model/"
    click Ads "https://github.com/JakeSteam/PixelBlacksmith/blob/master/Blacksmith/src/main/java/uk/co/jakelee/blacksmith/helper/AdvertHelper.java"
    click LocalStorage "https://github.com/JakeSteam/PixelBlacksmith/blob/master/Blacksmith/src/main/java/uk/co/jakelee/blacksmith/helper/StorageHelper.java"
    click SoundMgmt "https://github.com/JakeSteam/PixelBlacksmith/blob/master/Blacksmith/src/main/java/uk/co/jakelee/blacksmith/helper/SoundHelper.java"
    click Translations "https://github.com/JakeSteam/PixelBlacksmith/tree/master/Blacksmith/src/main/res/values-*/"
    click GooglePlay "https://github.com/JakeSteam/PixelBlacksmith/tree/master/BaseGameUtils/src/main/java/com/google/example/games/basegameutils/"
    click InAppBilling "https://github.com/JakeSteam/PixelBlacksmith/tree/master/Blacksmith/src/com/android/vending/billing/"
```
