The Goal
Building a game engine from scratch was about understanding how everything works under the hood. I wanted to create a 2D engine that handled the full pipeline—from rendering with OpenGL to an efficient ECS and custom physics.
What I Built
Lunar Engine is a 2D engine written in C# using Silk.NET, focusing on a clean, data-oriented architecture.
- Custom ECS Framework: Wrote a high-performance Entity-Component-System from scratch to handle rendering, physics, and gameplay logic efficiently.
- Command-Buffer Rendering: Implemented a render command pattern. This decouples the game simulation from the drawing calls, allowing for better batching and sorting.
- Dockable Editor: Built a professional editor using ImGui. It features a scene hierarchy, inspector, scene view with gizmos, and a project browser.
- 2D Physics: Wrote a physics engine for rigid body dynamics and collision detection, fully integrated with the ECS.
- API Abstractions: Created clean wrappers for OpenGL primitives (Shaders, VBOs, VAOs) to make graphics programming safer and more intuitive.
- Asset Management: Built systems for asynchronous asset loading and scene serialization.
Takeaways
- Low-Level Mastery: Building an engine from the ground up gave me a deep appreciation for memory management and the rendering pipeline.
- Tooling Matters: Having a custom editor with an inspector and gizmos made developing scenes much faster than just using code.