# shantheone/shooter architecture

> Architecture diagram of the GitHub repository shantheone/shooter, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2024-12-28). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/shantheone/shooter
- Repository: https://github.com/shantheone/shooter

## Overview

##### Main Components

a) Hardware Layer:
- Arduino Board
- Interface
- Input Controls
- Sound Output (indicated by sound on/off assets)

b) Software Components:
- Game Engine Core
- Asset Management System
- Game State Manager
- Input Handler
- Rendering System
- Sound System

**Game States**
**[Menu] ←→ [Gameplay] ←→ [Pause] ←→ [Game Over]**

**Core Systems**
**[Asset Manager] ↔ [Game Engine] ↔ [Input Handler]**
- ↕              ↕               ↕
**[Sprite System] ← [Renderer] → [Sound Manager]**

**Hardware Interface**
**[Display Driver] [Input Controls] [Sound Output]**
- ↓             ↓              ↓
- [Arduino Hardware Interface]

##### Key Elements to Highlight

a) Asset Management:
- How the bitmap assets (from bitmaps.h) are stored and accessed
- Sprite system for handling animations (tank and UFO frames)

b) Game States:
- Transitions between menu, gameplay, pause, and game over states
- How each state interfaces with the core game engine

c) Input Processing:
- Flow from hardware inputs to game logic
- Input handling for menu navigation and gameplay controls

##### Implementation Details

- Use rectangles for major components
- Use diamonds for decision points (state transitions)
- Memory allocation indicators where relevant

##### Additional Notes

- Notes about memory constraints and optimization strategies
- Relationship between the sketch.yaml configuration and the runtime system

This architecture should clearly communicate how a simple but complete game system operates on an embedded platform, from asset management to user interaction and display output.

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph Game_States
        Menu["Menu State"]
        Gameplay["Gameplay State"]
        Pause["Pause State"]
        GameOver["Game Over State"]
        Credits["Credits State"]
        
        Menu <--> Gameplay
        Gameplay <--> Pause
        Gameplay <--> GameOver
        Menu <--> Credits
    end

    subgraph Core_Systems
        GameEngine["Game Engine"]:::core
        AssetManager["Asset Manager"]:::core
        InputHandler["Input Handler"]:::core
        SpriteSystem["Sprite System"]:::core
        Renderer["Renderer"]:::core
        SoundManager["Sound Manager"]:::core

        GameEngine <--> AssetManager
        GameEngine <--> InputHandler
        GameEngine <--> SpriteSystem
        GameEngine <--> Renderer
        GameEngine <--> SoundManager
    end

    subgraph Hardware_Interface
        Display["Display Driver"]:::hardware
        Controls["Input Controls"]:::hardware
        Sound["Sound Output"]:::hardware
        Arduino["Arduino Hardware"]:::hardware

        Display --> Arduino
        Controls --> Arduino
        Sound --> Arduino
    end

    Game_States <--> Core_Systems
    Core_Systems <--> Hardware_Interface

    classDef core fill:#90EE90
    classDef hardware fill:#FFA500
    classDef state fill:#87CEEB

    click GameEngine "https://github.com/shantheone/shooter/blob/master/shooter.ino"
    click AssetManager "https://github.com/shantheone/shooter/blob/master/bitmaps.h"
    click Menu "https://github.com/shantheone/shooter/blob/master/assets/menu_sound_on.piko"
    click Pause "https://github.com/shantheone/shooter/blob/master/assets/pause_screen.piko"
    click GameOver "https://github.com/shantheone/shooter/blob/master/assets/game_over_screen.piko"
    click Credits "https://github.com/shantheone/shooter/blob/master/assets/credits_screen.piko"
    click SpriteSystem "https://github.com/shantheone/shooter/tree/master/assets"

    subgraph Legend
        L1["Game States"]:::state
        L2["Core Systems"]:::core
        L3["Hardware Components"]:::hardware
    end

    %% Configuration and Build System Nodes
    Config["Configuration Manager"]:::core
    BuildSystem["Build System"]:::core

    Config --> GameEngine
    BuildSystem --> GameEngine

    click Config "https://github.com/shantheone/shooter/blob/master/sketch.yaml"
    click BuildSystem "https://github.com/shantheone/shooter/blob/master/build.sh"
```
