How martijnhagenaars/lagged works
Project Type and Purpose
• LAGGED is a custom game engine and sample game project. Its purpose is to explore graphics and engine development. It is not a typical client-server or web stack, but a full C++ game engine with a modular architecture: engine core, ECS, editor tools, platform abstraction layer, platform-specific renderers, and a small sample game.
File Structure Analysis
• Top-level directories:
• External — third-party libraries (GLFW, GLEW, GLM, ImGui/ImGuizmo, FastNoise2, TinyGLTF, stb).
• LAGGED — the engine code itself, subdivided into Core, ECS, Editor, Platform (abstraction), Utility.
• Platforms — concrete backends (OpenGL in this repo; potentially DirectX, Vulkan later).
• Game — a minimal “hello world” that links against the engine to instantiate and drive a world.
• Solution and project files (.sln, .vcxproj) orchestrate builds for engine, backend, and game.
Key Components
a. External Libraries
b. Engine Core (LAGGED/src/Core)
• Subcomponents: ApplicationInterface, Engine, EntryPoint, IO (File I/O, watcher), Input, Resources (ResourceManager).
c. Entity–Component System (LAGGED/src/ECS)
• Components, Systems, Scene, Reflection, Views.
d. Editor Framework (LAGGED/src/Editor)
• UI helpers, Tools, ToolManager, Reflection widgets.
e. Platform Abstraction
• RenderBackend interface, Window interface, common utility types.
f. Platform Implementation (Platforms/OpenGL)
• GL_RenderBackend, GL_Window, GL_Resources (buffers, textures, shaders…), GL_Utility.
g. Sample Game (Game)
• Uses public engine API (Engine, World, Chunk), demonstrating engine usage.
h. Utility Modules
• Logging, Profiler, Timer, Noise, stb_image, tiny_gltf, StringUtility.
Relationships and Data Flow
• Game → Engine Core API → ECS / World / ApplicationInterface.
• Engine Core → Platform Abstraction → Platform Implementation (OpenGL).
• Engine Core / ECS / Editor → External libs (GLFW/GLEW for context/input, GLM for math, ImGui/ImGuizmo for UI, FastNoise2, TinyGLTF, stb_image for asset loading).
• ResourceManager → IO module → filesystem / watchers.
• Editor tools ↔ ECS (using Reflection) to inspect/modify scene.
Architectural Patterns & Principles
• Entity-Component System to decouple data (components) from logic (systems).
• Abstraction layer (RenderBackend, Window) to support multiple graphics APIs.
• Modular external library integration via includes and libs under External/.
• Separation of concerns: Core <→ ECS <→ Editor <→ Platform <→ Game.
• Resource Manager centralizes asset loading and caching.
• Reflection subsystem supports Editor integration at runtime.