# megorov4/lampyengine architecture

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

- Interactive diagram: https://gitdiagram.com/megorov4/lampyengine
- Repository: https://github.com/megorov4/lampyengine

## Overview

##### Main Components
- Engine Core & Engine Context:
- These are fundamental modules that set up the overall engine behavior and context. Look at the “Engine/Core” and “Engine/EngineContext” directories. They handle the engine initialization, configuration (e.g., EngineConfig.h), and the entry point (main.cpp) for the engine.
- Modular Subsystems:
- Under “Engine/Modules” you have many subsystems:
▪ AudioModule – handles audio processing.
▪ EditorGuiModule – manages GUI components for the in-engine editor (including ContentBrowser, EditorConsole, MainMenuBar, WorldInspector, etc.).
▪ EventModule – handles event dispatching.
▪ FilesystemModule – abstracts file operations.
▪ ImGuiModule – integrates the Dear ImGui library, alongside backend-specific integrations for GLFW, OpenGL, and Vulkan.
▪ InputModule – processes user input.
▪ LoggerModule – manages logging.
▪ LuaScriptModule – allows scripting with Lua.
▪ ObjectCoreModule – likely handles the object model and ECS (Entity Component System); organizes 2D and 3D scene objects.
▪ ProjectModule – handles project-specific logic.
▪ RenderModule – abstract rendering interfaces and implementations, with different renderers (abstract interfaces, OpenGL, Vulkan, and offscreen rendering support). Observe the abstract interfaces in “Engine/Modules/RenderModule/Abstract” and concrete implementations in the “OpenGL” and “Vulkan” subdirectories.
▪ ResourceModule – manages resources like meshes, shaders, textures, and caching.
▪ ShaderCompilerModule – handles shader compilation.
▪ WindowModule – manages window creation and operation.
- Editor & Project Browser:
- Within “Engine/Editor” and “Engine/ProjectBrowser” you have editor-specific code that likely allows developers to interact with the engine in a graphical environment.
- Supporting and Build Infrastructure:
- Automation scripts, CMake files, and third-party integrations (under “Engine/ThirdParty”) provide build and dependency management.
- Resources:
- The “Resources” directory holds assets like meshes, shaders (GLSL and SPIR-V), textures, and fonts.

##### Relationships and Interactions
- The Engine Core initializes and holds the EngineContext, which is then used by the various modules.
- Modules interact with the core engine via well-defined interfaces. For instance, the RenderModule uses abstractions that can be implemented using either OpenGL or Vulkan backends.
- The EditorGuiModule utilizes the ImGuiModule to render its UI, and both are tightly coupled with the WindowModule that creates the graphical display.
- The ResourceModule feeds data to low-level renderers and possibly to the LuaScriptModule for dynamic scene manipulation.
- The ObjectCoreModule (with its ECS and scene graph) forms the backbone of 2D/3D scene management, interfacing with both Render and Editor systems.
- Other modules like Input, Audio, and Logger provide low-level services that the engine core or other systems can call upon.

##### Architectural Patterns and Technologies
- Modularity: The project is structured so that each subsystem is isolated in its own module directory, allowing for independent development and potentially dynamic configuration.
- Abstraction Layers: The RenderModule provides abstract interfaces (e.g., IRenderer, IShader, etc.) and then specific implementations (OpenGL, Vulkan, offscreen). This supports multiple rendering backends.
- ECS (Entity Component System): Look at the “Engine/Modules/ObjectCoreModule/ECS” which hints at the use of an ECS pattern for scene management.
- Integration of external tools: The presence of CMake, Conan profiles, and Doxygen (docs/ folder and Doxyfile) indicate automated builds, dependency management, and documentation generation.

##### Instructing the Principal Software Engineer
- Within that framework, add sub-blocks for each module with clear labels (Audio, EditorGui, Event, Filesystem, ImGui, Input, Logger, LuaScript, ObjectCore/ECS, Project, Render, Resource, ShaderCompiler, Window).
- That the RenderModule splits into an abstraction and two concrete implementations (OpenGL and Vulkan) with further branches for specific objects (e.g., framebuffers, vertex buffers).
- Annotations where applicable (e.g., “Uses Dear ImGui” next to ImGuiModule, “ECS design” near ObjectCoreModule).

## Diagram (Mermaid)

```mermaid
flowchart TD
    LAMPY["LampyEngine"]:::main

    subgraph "Core System"
        CORE["Engine Core"]:::core
        CONTEXT["Engine Context"]:::core
    end

    LAMPY -->|"init_core"| CORE
    CORE -->|"creates"| CONTEXT

    subgraph "Modular Subsystems"
        AUDIO["AudioModule"]:::module
        EDITORGUI["EditorGuiModule"]:::module
        EVENT["EventModule"]:::module
        FILESYS["FilesystemModule"]:::module
        IMGUI["ImGuiModule"]:::module
        INPUT["InputModule"]:::module
        LOGGER["LoggerModule"]:::module
        LUA["LuaScriptModule"]:::module
        OBJECTCORE["ObjectCoreModule"]:::module
        PROJECTMOD["ProjectModule"]:::module
        SHADERCOMP["ShaderCompilerModule"]:::module
        WINDOW["WindowModule"]:::module
        RESOURCE["ResourceModule"]:::module

        subgraph "RenderModule"
            RENDER_ABS["Abstract Interfaces"]:::module
            RENDER_GL["OpenGL Implementation"]:::module
            RENDER_VK["Vulkan Implementation"]:::module
            RENDER_OFF["Offscreen Support"]:::module
        end
        RENDER_ABS -->|"impl_GL"| RENDER_GL
        RENDER_ABS -->|"impl_VK"| RENDER_VK
        RENDER_ABS -->|"impl_offscreen"| RENDER_OFF
    end

    CONTEXT -->|"init_audio"| AUDIO
    CONTEXT -->|"init_editorGUI"| EDITORGUI
    CONTEXT -->|"init_event"| EVENT
    CONTEXT -->|"init_files"| FILESYS
    CONTEXT -->|"init_imgui"| IMGUI
    CONTEXT -->|"init_input"| INPUT
    CONTEXT -->|"init_logger"| LOGGER
    CONTEXT -->|"init_lua"| LUA
    CONTEXT -->|"init_objCore"| OBJECTCORE
    CONTEXT -->|"init_project"| PROJECTMOD
    CONTEXT -->|"init_shader"| SHADERCOMP
    CONTEXT -->|"init_window"| WINDOW
    CONTEXT -->|"init_resource"| RESOURCE
    CONTEXT -->|"init_render"| RENDER_ABS

    EDITORGUI -->|"uses_imgui"| IMGUI
    EDITORGUI -->|"requires_window"| WINDOW
    IMGUI -->|"binds_window"| WINDOW
    OBJECTCORE -->|"renders_with"| RENDER_ABS
    RESOURCE -->|"supplies_render"| RENDER_ABS
    SHADERCOMP -->|"compiles_to"| RESOURCE

    subgraph "Editor & Project Browser"
        EDITOR["Editor"]:::editor
        PROJECTBROWSER["ProjectBrowser"]:::editor
    end

    OBJECTCORE -->|"updates_editor"| EDITOR
    EDITOR -->|"manages_projBrowser"| PROJECTBROWSER

    INFRA["Build & Integration"]:::infra
    LAMPY -->|"build_scripts"| INFRA

    RES["Resources Assets"]:::resource
    LAMPY -->|"loads_resources"| RES

    classDef main fill:#cfc,stroke:#333,stroke-width:2px;
    classDef core fill:#f9d,stroke:#333,stroke-width:2px;
    classDef module fill:#bbf,stroke:#333,stroke-width:2px;
    classDef editor fill:#bfb,stroke:#333,stroke-width:2px;
    classDef infra fill:#ffb,stroke:#333,stroke-width:2px;
    classDef resource fill:#fbf,stroke:#333,stroke-width:2px;

    click CORE "https://github.com/megorov4/lampyengine/tree/main/Engine/Core"
    click CONTEXT "https://github.com/megorov4/lampyengine/tree/main/Engine/EngineContext"
    click AUDIO "https://github.com/megorov4/lampyengine/tree/main/Engine/Modules/AudioModule"
    click EDITORGUI "https://github.com/megorov4/lampyengine/tree/main/Engine/Modules/EditorGuiModule"
    click EVENT "https://github.com/megorov4/lampyengine/tree/main/Engine/Modules/EventModule"
    click FILESYS "https://github.com/megorov4/lampyengine/tree/main/Engine/Modules/FilesystemModule"
    click IMGUI "https://github.com/megorov4/lampyengine/tree/main/Engine/Modules/ImGuiModule"
    click INPUT "https://github.com/megorov4/lampyengine/tree/main/Engine/Modules/InputModule"
    click LOGGER "https://github.com/megorov4/lampyengine/tree/main/Engine/Modules/LoggerModule"
    click LUA "https://github.com/megorov4/lampyengine/tree/main/Engine/Modules/LuaScriptModule"
    click OBJECTCORE "https://github.com/megorov4/lampyengine/tree/main/Engine/Modules/ObjectCoreModule"
    click PROJECTMOD "https://github.com/megorov4/lampyengine/tree/main/Engine/Modules/ProjectModule"
    click SHADERCOMP "https://github.com/megorov4/lampyengine/tree/main/Engine/Modules/ShaderCompilerModule"
    click WINDOW "https://github.com/megorov4/lampyengine/tree/main/Engine/Modules/WindowModule"
    click RESOURCE "https://github.com/megorov4/lampyengine/tree/main/Engine/Modules/ResourceModule"
    click RENDER_ABS "https://github.com/megorov4/lampyengine/tree/main/Engine/Modules/RenderModule/Abstract"
    click RENDER_GL "https://github.com/megorov4/lampyengine/tree/main/Engine/Modules/RenderModule/OpenGL"
    click RENDER_VK "https://github.com/megorov4/lampyengine/tree/main/Engine/Modules/RenderModule/Vulkan"
    click RENDER_OFF "https://github.com/megorov4/lampyengine/tree/main/Engine/Modules/RenderModule/VulkanOffscreenObjects"
    click EDITOR "https://github.com/megorov4/lampyengine/tree/main/Engine/Editor"
    click PROJECTBROWSER "https://github.com/megorov4/lampyengine/tree/main/Engine/ProjectBrowser"
    click INFRA "https://github.com/megorov4/lampyengine/tree/main/Engine/ThirdParty"
    click RES "https://github.com/megorov4/lampyengine/tree/main/Resources"
```
