# phoboslab/high_impact architecture

> Architecture diagram of the GitHub repository phoboslab/high_impact, 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/phoboslab/high_impact
- Repository: https://github.com/phoboslab/high_impact

## Overview

##### Main Components

Engine Core (Center):
- Entity System (entity.h, entity_def.h)
- Animation System (animation.h)
- Camera System (camera.h)
- Input Handler (input.h)
- Sound System (sound.h)
- Memory Management (alloc.h)
- System (map.h)

Platform Layer (Bottom):
- Platform Abstraction (platform.h)
- Two Platform Implementations:
- SDL2 Backend (platform_sdl.c)
- Sokol Backend (platform_sokol.c)

Rendering System (Right Side):
- Render Interface (render.h)
- Three Renderer Implementations:
- OpenGL (render_gl.c)
- Metal (render_metal.m)
- Software (render_software.c)

Asset Systems (Left Side):
- Image Loading (image.h)
- Font System (font.h)
- Sound Loading (sound.h)
- Asset Format Support:
- QOI for images
- QOA for audio
- JSON for maps

##### Implementation Details

- Component name
- Key files involved
- Primary responsibilities
- Supported formats/backends

##### External Dependencies Section

- SDL2
- Sokol (App, Audio, Time)
- Other libraries (glad, stb, QOI, QOA, pl_json)

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Styles
    classDef core fill:#a8d1f0,stroke:#333
    classDef platform fill:#90EE90,stroke:#333
    classDef render fill:#FFB347,stroke:#333
    classDef asset fill:#DDA0DD,stroke:#333
    classDef external fill:#D3D3D3,stroke:#333
    classDef tools fill:#FFD700,stroke:#333

    %% Core Engine Components
    subgraph CoreEngine["Engine Core"]
        Engine["Engine System"]:::core
        EntitySystem["Entity System"]:::core
        AnimSystem["Animation System"]:::core
        CamSystem["Camera System"]:::core
        InputHandler["Input Handler"]:::core
        SoundSystem["Sound System"]:::core
        MemManager["Memory Management"]:::core
        MapSystem["Map System"]:::core
    end

    %% Platform Layer
    subgraph PlatformLayer["Platform Layer"]
        PlatformAbs["Platform Abstraction"]:::platform
        SDL["SDL2 Backend"]:::platform
        Sokol["Sokol Backend"]:::platform
    end

    %% Rendering System
    subgraph RenderSystem["Rendering System"]
        RenderInterface["Render Interface"]:::render
        OpenGL["OpenGL Renderer"]:::render
        Metal["Metal Renderer"]:::render
        Software["Software Renderer"]:::render
    end

    %% Asset Systems
    subgraph AssetSystem["Asset Systems"]
        ImageLoader["Image Loading"]:::asset
        FontSystem["Font System"]:::asset
        SoundLoader["Sound Loading"]:::asset
    end

    %% External Libraries
    subgraph ExternalLibs["External Libraries"]
        SokolLib["Sokol Libraries"]:::external
        QOI["QOI Image Format"]:::external
        QOA["QOA Audio Format"]:::external
        JSON["PL JSON Parser"]:::external
    end

    %% Tools
    subgraph Tools["Development Tools"]
        FontTool["Font Tool"]:::tools
        MapEditor["Map Editor"]:::tools
    end

    %% Connections
    Engine --> EntitySystem
    Engine --> AnimSystem
    Engine --> CamSystem
    Engine --> InputHandler
    Engine --> SoundSystem
    Engine --> MemManager
    Engine --> MapSystem

    PlatformAbs --> SDL
    PlatformAbs --> Sokol
    
    RenderInterface --> OpenGL
    RenderInterface --> Metal
    RenderInterface --> Software

    Engine --> PlatformAbs
    Engine --> RenderInterface

    AssetSystem --> Engine
    Tools --> AssetSystem
    ExternalLibs --> AssetSystem

    %% Click Events
    click Engine "https://github.com/phoboslab/high_impact/blob/master/src/engine.h"
    click EntitySystem "https://github.com/phoboslab/high_impact/blob/master/src/entity.h"
    click AnimSystem "https://github.com/phoboslab/high_impact/blob/master/src/animation.h"
    click CamSystem "https://github.com/phoboslab/high_impact/blob/master/src/camera.h"
    click InputHandler "https://github.com/phoboslab/high_impact/blob/master/src/input.h"
    click SoundSystem "https://github.com/phoboslab/high_impact/blob/master/src/sound.h"
    click MemManager "https://github.com/phoboslab/high_impact/blob/master/src/alloc.h"
    click MapSystem "https://github.com/phoboslab/high_impact/blob/master/src/map.h"
    click PlatformAbs "https://github.com/phoboslab/high_impact/blob/master/src/platform.h"
    click SDL "https://github.com/phoboslab/high_impact/blob/master/src/platform_sdl.c"
    click Sokol "https://github.com/phoboslab/high_impact/blob/master/src/platform_sokol.c"
    click RenderInterface "https://github.com/phoboslab/high_impact/blob/master/src/render.h"
    click OpenGL "https://github.com/phoboslab/high_impact/blob/master/src/render_gl.c"
    click Metal "https://github.com/phoboslab/high_impact/blob/master/src/render_metal.m"
    click Software "https://github.com/phoboslab/high_impact/blob/master/src/render_software.c"
    click ImageLoader "https://github.com/phoboslab/high_impact/blob/master/src/image.h"
    click FontSystem "https://github.com/phoboslab/high_impact/blob/master/src/font.h"
    click SoundLoader "https://github.com/phoboslab/high_impact/blob/master/src/sound.h"
    click SokolLib "https://github.com/phoboslab/high_impact/blob/master/libs/sokol_app.h"
    click QOI "https://github.com/phoboslab/high_impact/blob/master/libs/qoi.h"
    click QOA "https://github.com/phoboslab/high_impact/blob/master/libs/qoa.h"
    click JSON "https://github.com/phoboslab/high_impact/blob/master/libs/pl_json.h"
    click FontTool "https://github.com/phoboslab/high_impact/blob/master/font_tool.html"
    click MapEditor "https://github.com/phoboslab/high_impact/blob/master/weltmeister.html"
```
