# fearmyshotz/platformergame architecture

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

- Interactive diagram: https://gitdiagram.com/fearmyshotz/platformergame
- Repository: https://github.com/fearmyshotz/platformergame

## Overview

##### Connection and Data Flow

- Game Loop → All updateable components
- Input System → Game State
- Game State → Entity Manager
- Rendering System → Game Objects
- Resource Management → Game Objects

##### Specific Implementation Details

Key architectural patterns:
- Manager pattern (shown by various *Manager classes)
- State pattern (GameState, MenuState, PauseState, PlayState)
- Observer pattern (for input handling)
- Factory pattern (for entity and animation creation)

##### Additional Elements

- File structure for resources
- Animation system workflow
- Entity hierarchy

Key Considerations:

##### Game loop architecture
- Input processing
- State updates
- Rendering
- Resource management

##### Clear separation between
- Game logic
- Rendering
- Resource management
- Input handling

##### Extensibility points
- Entity system
- Animation system
- Input handling

## Diagram (Mermaid)

```mermaid
graph TB
    %% Styles
    classDef core fill:#ff7777,stroke:#333,stroke-width:2px
    classDef input fill:#7777ff,stroke:#333,stroke-width:2px
    classDef render fill:#77ff77,stroke:#333,stroke-width:2px
    classDef gameObj fill:#ffff77,stroke:#333,stroke-width:2px
    classDef resource fill:#ff77ff,stroke:#333,stroke-width:2px
    classDef state fill:#77ffff,stroke:#333,stroke-width:2px

    %% Core Game Engine
    PGame["PlatformerGame"]:::core
    GameLoop["GameLoop"]:::core
    click PGame "https://github.com/FearMyShotz/PlatformerGame/blob/main/src/main/java/platformer/PlatformerGame.java"
    click GameLoop "https://github.com/FearMyShotz/PlatformerGame/blob/main/src/main/java/platformer/tick/GameLoop.java"

    %% Input System
    subgraph InputSystem
        InputMgr["InputManager"]:::input
        KeySystem["Keyboard System"]:::input
        MouseSystem["Mouse System"]:::input
    end
    click InputMgr "https://github.com/FearMyShotz/PlatformerGame/blob/main/src/main/java/platformer/input/InputManager.java"
    click KeySystem "https://github.com/FearMyShotz/PlatformerGame/tree/main/src/main/java/platformer/input/keyboard/"
    click MouseSystem "https://github.com/FearMyShotz/PlatformerGame/tree/main/src/main/java/platformer/input/mouse/"

    %% Rendering System
    subgraph RenderSystem
        WinMgr["WindowManager"]:::render
        GPanel["GamePanel"]:::render
        GWindow["GameWindow"]:::render
    end
    click WinMgr "https://github.com/FearMyShotz/PlatformerGame/blob/main/src/main/java/platformer/window/WindowManager.java"
    click GPanel "https://github.com/FearMyShotz/PlatformerGame/blob/main/src/main/java/platformer/window/GamePanel.java"
    click GWindow "https://github.com/FearMyShotz/PlatformerGame/blob/main/src/main/java/platformer/window/GameWindow.java"

    %% Game Objects
    subgraph GameObjects
        EntitySys["Entity System"]:::gameObj
        TileSys["Tile System"]:::gameObj
        AnimSys["Animation System"]:::gameObj
        MapSys["Map System"]:::gameObj
    end
    click EntitySys "https://github.com/FearMyShotz/PlatformerGame/tree/main/src/main/java/platformer/model/entity/"
    click TileSys "https://github.com/FearMyShotz/PlatformerGame/tree/main/src/main/java/platformer/model/tile/"
    click AnimSys "https://github.com/FearMyShotz/PlatformerGame/tree/main/src/main/java/platformer/model/animation/"
    click MapSys "https://github.com/FearMyShotz/PlatformerGame/tree/main/src/main/java/platformer/model/map/"

    %% Resource Management
    subgraph ResourceMgmt
        AssetMgr["AssetManager"]:::resource
        EntityLoad["EntityLoader"]:::resource
        MapLoad["MapLoader"]:::resource
        SpriteLoad["SpritesheetLoader"]:::resource
    end
    click AssetMgr "https://github.com/FearMyShotz/PlatformerGame/blob/main/src/main/java/platformer/manager/AssetManager.java"
    click EntityLoad "https://github.com/FearMyShotz/PlatformerGame/blob/main/src/main/java/platformer/model/entity/loader/EntityLoader.java"
    click MapLoad "https://github.com/FearMyShotz/PlatformerGame/blob/main/src/main/java/platformer/model/map/loader/MapLoader.java"
    click SpriteLoad "https://github.com/FearMyShotz/PlatformerGame/blob/main/src/main/java/platformer/model/spritesheet/loader/SpritesheetLoader.java"

    %% State Management
    subgraph StateSystem
        GState["GameState"]:::state
        MenuState["MenuState"]:::state
        PauseState["PauseState"]:::state
        PlayState["PlayState"]:::state
    end
    click GState "https://github.com/FearMyShotz/PlatformerGame/blob/main/src/main/java/platformer/model/state/GameState.java"
    click MenuState "https://github.com/FearMyShotz/PlatformerGame/blob/main/src/main/java/platformer/model/state/MenuState.java"
    click PauseState "https://github.com/FearMyShotz/PlatformerGame/blob/main/src/main/java/platformer/model/state/PauseState.java"
    click PlayState "https://github.com/FearMyShotz/PlatformerGame/blob/main/src/main/java/platformer/model/state/PlayState.java"

    %% Relationships
    PGame --> GameLoop
    GameLoop --> StateSystem
    InputSystem --> StateSystem
    StateSystem --> GameObjects
    RenderSystem --> GameObjects
    ResourceMgmt --> GameObjects
    GameLoop --> RenderSystem
    GameLoop --> InputSystem

    %% Legend
    subgraph Legend
        Core["Core Components"]:::core
        Input["Input Components"]:::input
        Render["Render Components"]:::render
        Objects["Game Objects"]:::gameObj
        Resource["Resource Components"]:::resource
        States["State Components"]:::state
    end
```
