# toxocious/ephemeral architecture

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

- Interactive diagram: https://gitdiagram.com/toxocious/ephemeral
- Repository: https://github.com/toxocious/ephemeral

## Overview

##### Project type and purpose
- This is a C++-based game engine (“Core”) plus a desktop game editor (“Editor”), intended ultimately to form the foundation of a Pokémon MMO.
- It is not a web app or microservice, but a native desktop application with a modular, layered engine architecture.

##### File structure
- Top-level directories:
- Build scripts (`Build.lua`, `Compile.sh`, `premake5.lua`) and configuration (.clang-format, .gitignore).
- `Libraries/` – various third-party dependencies (GLAD, GLFW, GLM, ImGui, spdlog, stb_image).
- `Projects/Core/` – the engine code, split into `Include/` (headers) and `Source/` (implementation).
· Sub-folders in Core/Include: `Core`, `Modules` (Window, Renderer, Scene, ImGuiLayer, SceneCamera), `Renderer` (VAO/VBO/EBO, Shader, Texture, Viewport, GameScene, Camera, Grid), `Util` (FileSystem, Log, Math, OpenGL wrappers).
- `Projects/Editor/` – the editor application, also split into `Include/Gui/` and `Source/Gui/`, relying on Core modules.
- `Docs/` and `Changelogs/` hold governance and change-history documents.

##### README for additional insights
- Confirms the structure, lists Premake as the build generator, points to `Docs/DEPENDENCIES.md` for tech stack, and defines the project scope (hand-crafted engine + editor + future server).
- No existing network/server code in the tree yet—focus is on engine/editor.

##### Key points to capture
- Don’t merge subsystems: show each module separately.
- Layering: Build tools at top, application (Editor), engine layers, external systems (OS, GPU).
- Detail the dependencies between modules and libraries.

## Diagram (Mermaid)

```mermaid
flowchart TB
    %% Build Tools Layer
    subgraph "Build & Toolchain"
        direction TB
        BuildLua["Build.lua"] 
        BuildCoreLua["Build-Core.lua"]
        BuildEditorLua["Build-Editor.lua"]
        BuildUtils["BuildUtils.lua"]
        CompileSh["Compile.sh"]
    end

    %% Application Layer
    EditorApp["Editor App"]:::inhouse
    subgraph "Editor Source"
        direction TB
        EditorInclude["Include/Gui"]:::inhouse
        EditorSource["Source"]:::inhouse
    end

    %% Core Engine Layer
    subgraph "Core Engine" 
        direction TB
        CoreInclude["Include"]:::inhouse
        CoreSource["Source"]:::inhouse

        subgraph "Modules"
            direction TB
            Window["Window Module"]:::inhouse
            RendererMod["Renderer Module"]:::inhouse
            Scene["Scene Module"]:::inhouse
            ImGuiLayer["ImGuiLayer Module"]:::inhouse
            SceneCamera["SceneCamera Module"]:::inhouse
        end

        subgraph "Utilities"
            direction TB
            FileSystem["FileSystem Utility"]:::inhouse
            LogUtil["Logging Utility"]:::inhouse
            MathUtil["Math Utility"]:::inhouse
            OpenGLWrap["OpenGL Wrapper"]:::inhouse
        end

        subgraph "Assets"
            direction TB
            Shaders["Shaders"]:::inhouse
            Textures["Textures"]:::inhouse
            Fonts["Fonts"]:::inhouse
        end
    end

    %% Third-party Libraries
    subgraph "Third-Party Libraries"
        direction TB
        GLAD["GLAD"]:::thirdparty
        GLFW["GLFW"]:::thirdparty
        GLM["GLM"]:::thirdparty
        ImGuiLib["ImGui"]:::thirdparty
        SPDLOG["spdlog"]:::thirdparty
        STB["stb_image"]:::thirdparty
    end

    %% External Systems
    subgraph "External Systems"
        direction TB
        Disk["Disk"]:::external
        GPU["GPU (OpenGL)"]:::external
        OS["Operating System"]:::external
    end

    %% Connections
    BuildLua -->|generates projects| EditorApp
    BuildEditorLua -->|builds| EditorApp
    BuildCoreLua -->|builds| CoreInclude
    BuildCoreLua -->|builds| CoreSource

    EditorApp -->|uses API| CoreInclude
    EditorApp -->|uses API| CoreSource

    CoreInclude --> Window
    CoreSource --> Window

    CoreInclude --> RendererMod
    CoreSource --> RendererMod

    CoreInclude --> Scene
    CoreSource --> Scene

    CoreInclude --> ImGuiLayer
    CoreSource --> ImGuiLayer

    CoreInclude --> SceneCamera
    CoreSource --> SceneCamera

    Window -->|calls GLFW| GLFW
    Window -->|calls OpenGL via| GLAD
    RendererMod -->|uses math| GLM
    RendererMod -->|renders UI via| ImGuiLib
    Scene -->|logs via| SPDLOG
    Scene -->|loads images via| STB
    ImGuiLayer -->|renders with| ImGuiLib
    SceneCamera -->|matrices via| GLM

    FileSystem -->|loads assets from| Disk
    FileSystem -->|reads shaders/textures/fonts| Shaders
    FileSystem -->|reads shaders/textures/fonts| Textures
    FileSystem -->|reads shaders/textures/fonts| Fonts

    RendererMod -->|submits commands to| GPU
    OpenGLWrap -->|wraps calls to| GLAD
    OpenGLWrap -->|executes on| GPU
    LogUtil -->|writes logs to| Disk

    CoreInclude --> FileSystem
    CoreInclude --> LogUtil
    CoreInclude --> MathUtil
    CoreInclude --> OpenGLWrap

    OS -->|provides context| GLFW
    OS -->|file I/O| Disk
    OS -->|drivers| GPU

    %% Click Events
    click EditorInclude "https://github.com/toxocious/ephemeral/tree/development/Projects/Editor/Include/Gui"
    click EditorSource "https://github.com/toxocious/ephemeral/tree/development/Projects/Editor/Source"
    click CoreInclude "https://github.com/toxocious/ephemeral/tree/development/Projects/Core/Include"
    click CoreSource "https://github.com/toxocious/ephemeral/tree/development/Projects/Core/Source"
    click Window "https://github.com/toxocious/ephemeral/blob/development/Projects/Core/Include/Modules/Window.h"
    click Window "https://github.com/toxocious/ephemeral/blob/development/Projects/Core/Source/Modules/Window.cpp"
    click RendererMod "https://github.com/toxocious/ephemeral/blob/development/Projects/Core/Include/Modules/Renderer.h"
    click RendererMod "https://github.com/toxocious/ephemeral/blob/development/Projects/Core/Source/Modules/Renderer.cpp"
    click RendererMod "https://github.com/toxocious/ephemeral/tree/development/Projects/Core/Include/Renderer"
    click RendererMod "https://github.com/toxocious/ephemeral/tree/development/Projects/Core/Source/Renderer"
    click Scene "https://github.com/toxocious/ephemeral/blob/development/Projects/Core/Include/Modules/Scene.h"
    click Scene "https://github.com/toxocious/ephemeral/blob/development/Projects/Core/Source/Modules/Scene.cpp"
    click ImGuiLayer "https://github.com/toxocious/ephemeral/blob/development/Projects/Core/Include/Modules/ImGuiLayer.h"
    click ImGuiLayer "https://github.com/toxocious/ephemeral/blob/development/Projects/Core/Source/Modules/ImGuiLayer.cpp"
    click SceneCamera "https://github.com/toxocious/ephemeral/blob/development/Projects/Core/Include/Modules/SceneCamera.h"
    click SceneCamera "https://github.com/toxocious/ephemeral/blob/development/Projects/Core/Source/Modules/SceneCamera.cpp"
    click FileSystem "https://github.com/toxocious/ephemeral/blob/development/Projects/Core/Include/Util/FileSystem.h"
    click FileSystem "https://github.com/toxocious/ephemeral/blob/development/Projects/Core/Source/Util/FileSystem.cpp"
    click LogUtil "https://github.com/toxocious/ephemeral/blob/development/Projects/Core/Include/Util/Log.h"
    click LogUtil "https://github.com/toxocious/ephemeral/blob/development/Projects/Core/Source/Util/Log.cpp"
    click MathUtil "https://github.com/toxocious/ephemeral/tree/development/Projects/Core/Include/Util/Math"
    click MathUtil "https://github.com/toxocious/ephemeral/tree/development/Projects/Core/Source/Util/Math"
    click OpenGLWrap "https://github.com/toxocious/ephemeral/blob/development/Projects/Core/Include/Util/OpenGL.h"
    click OpenGLWrap "https://github.com/toxocious/ephemeral/blob/development/Projects/Core/Source/Util/OpenGL.cpp"
    click Shaders "https://github.com/toxocious/ephemeral/tree/development/Projects/Core/Assets/Shaders"
    click Textures "https://github.com/toxocious/ephemeral/tree/development/Projects/Core/Assets/Textures"
    click Fonts "https://github.com/toxocious/ephemeral/tree/development/Projects/Core/Assets/Fonts"
    click GLAD "https://github.com/toxocious/ephemeral/tree/development/Libraries/glad"
    click GLFW "https://github.com/toxocious/ephemeral/tree/development/Libraries/glfw"
    click GLM "https://github.com/toxocious/ephemeral/tree/development/Libraries/glm"
    click ImGuiLib "https://github.com/toxocious/ephemeral/tree/development/Libraries/imgui"
    click SPDLOG "https://github.com/toxocious/ephemeral/tree/development/Libraries/spdlog"
    click STB "https://github.com/toxocious/ephemeral/tree/development/Libraries/stb_image"

    %% Styles
    classDef inhouse fill:#E0F7FA,stroke:#0288D1,color:#000
    classDef thirdparty fill:#E8F5E9,stroke:#43A047,color:#000
    classDef external fill:#ECEFF1,stroke:#90A4AE,color:#000
```
