How lapamanstudio/kengine works
Project Type and Purpose
• KEngine is an open-source 2D game engine that offers both a game development runtime (engine) and an editor interface for developers.
• A supporting C# SDK component (located in KEngine.NET.SDK) provides integration, custom behavior scripting via MonoBehaviour, and other C# conveniences to tie into the underlying engine.
File Structure to Define Major Components
• The project is split into several areas:
• KEngine.NET.SDK: A C# component with classes like Transform.cs and Vector2.cs used for scripting behaviors and providing accessible game object components.
• core: This is the central C/C++ codebase for the engine and editor.
• The “core/include/…” and “core/src/…” directories provide headers and implementations for both the “engine” and “editor” subsystems.
• Editor components: These include directories for editor GUI (panels, window management, docking, work scene controls, etc.), graphics utilities, and scene management.
• Engine components: These include the game object management, core objects, renderer implementations and platform-specific rendering (OpenGL and DirectX).
a. Editor Module:
• Editor GUI and Window: Contains panels such as ConsolePanel, ObjectInspectorPanel, ProjectFilesPanel, and workscene specific panels.
• Editor Core: Manages project configurations, plugin integration, scene and object management.
• Graphics and Utilities in the editor: Implements drivers, font management (FontAwesome, IconsFontAwesome5), and GUI utilities.
b. Engine (Runtime) Module:
• Core Engine: Handles game objects (GameObject, components like Transform, Camera, Renderer, Script).
• Rendering and Platform Abstraction: Supports both OpenGL and DirectX rendering through specialized helper classes (e.g., GLGraphicHelper, DXGraphicHelper) and window management (GLWindow, DXWindow).
• Script Management: Links functionality to scripted behavior (using classes like MonoBehaviour and Script from the engine).
c. SDK / Integration Module:
• KEngine.NET.SDK: Provides .NET (C#) components that likely wrap or simplify interactions with the engine for simpler game development.
d. Installer and Packaging Module:
• Installer Scripts and Configuration: Contains scripts (Makefile, installer directory contents) used for building and packaging the engine into an installer.
Relationships and Interactions
• The Engine module’s platform abstraction (OpenGL/DirectX) abstracts graphics and window creation, enabling both the editor and runtime portions to access rendering functionalities in a unified manner.
• The SDK serves as a bridge between high-level C# game logic and the underlying engine, enabling scripting and custom extensions.
• External libraries such as GLFW, GLM, FreeType, ImGui, and JSON are used by both the engine and editor components for windowing, math utilities, font rendering, GUI, and configuration/data parsing respectively.
Architectural Patterns and Design Principles
• Modular design: The clear separation between the editor and engine components helps isolate concerns (rendering, scene management, editor UI).
• Platform abstraction: The engine supports multiple rendering APIs (OpenGL vs. DirectX) through a unified design using helper/factory classes.
• Extensibility: The use of a C# SDK along with plugin integration in the engine ensures that the architecture can be extended as new features like a sprite editor or 3D components are added.