# deety-anh/bombit architecture

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

- Interactive diagram: https://gitdiagram.com/deety-anh/bombit
- Repository: https://github.com/deety-anh/bombit

## Overview

##### Project type and purpose
- From the file list and the “BomgIt” title in the README, this is a small C++-based 2D arcade/game application (a Bomberman-style game).
- Key files: main.cpp (entry point), Core.* (engine/game loop), GameController.* (state management and input), Object.* (game-object base class), Player.* (player entity), Programs.* (possibly menu or launcher logic), plus an assets folder with sprites and tiles.

##### File structure
- Top-level C++ source files implement the engine and game logic.
- assets/ holds art assets sorted by type (tiles, bombs, boosts, buttons, player frames).
- No separate “frontend” or “backend”—this is a standalone desktop game.
- No apparent external service integration; the core is the game loop, rendering, input, and asset management.

##### README for additional insights
- The README is minimal (“# BomgIt”), so rely on file names to infer architecture.

- Entry Point (main.cpp / Programs)
- Game Engine Core (Core.h/.cpp)
- Game Controller (GameController.h/.cpp)
- Entity System (Object.h/.cpp, Player.h/.cpp)
- Asset Manager (loads assets/*.png etc.)
- Rendering Subsystem (graphics API layer)
- Input Subsystem (keyboard/mouse handling)
- Game Loop / Scheduler (timing, update tick)
- Resource Files (assets folder)

b. Relationships and interactions:
- main.cpp invokes Programs → initializes Core.
- Core contains the main game loop: calls Input → GameController → Entity updates → Rendering.
- GameController uses the Entity System to create/destroy Objects and Players.
- Asset Manager is called by Entity constructors or rendering to load textures.
- Input Subsystem feeds events into GameController.

c. Architectural patterns / design principles:
- Separation of concerns: Engine Core vs. Game Logic vs. Entities vs. Rendering vs. Input.
- Component-based or class-hierarchy for in-game objects (Object base class, specialized Player, Bomb, Boosts).
- Single responsibility: asset loading separated from logic; game loop separated from state management.

d. Key technologies and libraries (inferred):
- C++17 or later
- External graphics library (e.g., SDL, SFML, OpenGL)—highlight as “Rendering API”
- Standard filesystem I/O for assets
- Standard containers/memory management for entities

##### Don’t overthink—capture every distinct component
- Call out the assets folder as its own component.
- If Programs.cpp contains menu logic, represent it as a child of main/initialization.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Initialization Layer
    subgraph "Initialization"
        Main["main.cpp"]:::engine
        Programs["Programs.cpp"]:::engine
    end

    %% Core Engine
    CoreComp["Core (Core.h/.cpp)"]:::engine
    Loop["Game Loop"]:::engine

    %% Subsystems
    Input["Input Subsystem"]:::io
    GameCtrl["GameController"]:::logic
    EntitySys["Entity System"]:::logic
    RenderNode["Rendering Subsystem"]:::io
    AssetMgr["Asset Manager"]:::io

    %% Rendering API (External)
    RenderAPI["Rendering API (SDL/OpenGL)"]:::external

    %% Resource Files
    subgraph "Resource Files"
        Assets["assets/"]:::external
        assetsTile["assets/Tile/"]:::external
        assetsBomb["assets/bomb/"]:::external
        assetsBoosts["assets/boosts/"]:::external
        assetsButton["assets/button/"]:::external
        assetsPlayer["assets/player/"]:::external
        assetsP1["assets/player/1/"]:::external
        assetsP2["assets/player/2/"]:::external
    end

    %% Flow
    Main --> CoreComp
    Programs --> CoreComp
    CoreComp --> Loop
    Loop --> Input
    Loop --> GameCtrl
    Loop --> RenderNode
    Loop --> Loop
    Input --> GameCtrl
    GameCtrl --> EntitySys
    EntitySys --> Loop
    AssetMgr -->|loads textures| EntitySys
    AssetMgr -->|provides assets| RenderNode
    RenderNode --> RenderAPI
    Assets --> AssetMgr
    assetsTile --> AssetMgr
    assetsBomb --> AssetMgr
    assetsBoosts --> AssetMgr
    assetsButton --> AssetMgr
    assetsPlayer --> AssetMgr
    assetsP1 --> AssetMgr
    assetsP2 --> AssetMgr

    %% Click Events
    click Main "https://github.com/deety-anh/bombit/blob/main/main.cpp"
    click Programs "https://github.com/deety-anh/bombit/blob/main/Programs.cpp"
    click CoreComp "https://github.com/deety-anh/bombit/blob/main/Core.h"
    click CoreComp "https://github.com/deety-anh/bombit/blob/main/Core.cpp"
    click GameCtrl "https://github.com/deety-anh/bombit/blob/main/GameController.cpp"
    click EntitySys "https://github.com/deety-anh/bombit/blob/main/Object.h"
    click EntitySys "https://github.com/deety-anh/bombit/blob/main/Object.cpp"
    click EntitySys "https://github.com/deety-anh/bombit/blob/main/Player.h"
    click EntitySys "https://github.com/deety-anh/bombit/blob/main/Player.cpp"
    click Assets "https://github.com/deety-anh/bombit/tree/main/assets/"
    click assetsTile "https://github.com/deety-anh/bombit/tree/main/assets/Tile/"
    click assetsBomb "https://github.com/deety-anh/bombit/tree/main/assets/bomb/"
    click assetsBoosts "https://github.com/deety-anh/bombit/tree/main/assets/boosts/"
    click assetsButton "https://github.com/deety-anh/bombit/tree/main/assets/button/"
    click assetsPlayer "https://github.com/deety-anh/bombit/tree/main/assets/player/"
    click assetsP1 "https://github.com/deety-anh/bombit/tree/main/assets/player/1/"
    click assetsP2 "https://github.com/deety-anh/bombit/tree/main/assets/player/2/"

    %% Styles
    classDef engine fill:#cce5ff,stroke:#005cbf,stroke-width:1px;
    classDef logic fill:#d4edda,stroke:#155724,stroke-width:1px;
    classDef io fill:#fff3cd,stroke:#856404,stroke-width:1px;
    classDef external fill:#f8d7da,stroke:#721c24,stroke-width:1px,stroke-dasharray: 5 5;
```
