How burned-games/coffee-engine works
Based on our analysis, Coffee Engine is a cross-platform 3D game engine written in C++ that uses OpenGL and SDL3. This project isn’t just a runtime library—there is an editor (CoffeeEditor), the engine core (CoffeeEngine), a runtime application (Runtime), and even a sandbox example (Sandbox) to showcase or test functionality. In addition, the engine supports a modular design (with subsystems for rendering, physics, audio, scripting, input, etc.) and contains clear separation between platform-specific code (in the Platform folder) and platform-independent core logic.
Main Components
a. CoffeeEngine (Core Engine)
• Contains the most critical subsystems:
– Core (Application, Logging, Window, Input, Data Structures, etc.)
– Renderer (OpenGL-based rendering, shader management, textures, materials, 2D/3D rendering)
– Audio subsystem (Audio, AudioFootsteps, AudioZone, etc.)
– Physics (CollisionSystem, RigidBody, PhysicsWorld, etc.)
– Scene Management (Scene, SceneTree, ECS, Entity-Component system)
– Scripting (Lua and C# backends)
– IO and Resource Handling (ResourceLoader, ResourceRegistry, ImportData, Serialization)
– Animation and Particle systems
– Platform abstraction (Linux and Windows specific implementations)
b. CoffeeEditor (Editor Application)
• Built on top of CoffeeEngine for interactive scene and project management.
c. Runtime and Sandbox
• CoffeeRuntimeApp and SandboxApp provide examples or testbeds for executing built projects.
• Sandbox is a simple demonstration app that shows how to use the engine’s features and assets.
Relationships and Interactions
• The Engine Core (CoffeeEngine) acts as a set of libraries and subsystems that encapsulate most of the engine functionality. It interacts with:
• The Editor (CoffeeEditor) for building and modifying scenes, resources, and game logic.
• The Runtime and Sandbox, which use the Engine Core to run end-user applications.
• Subsystems within CoffeeEngine are interconnected. For example:
• The Audio subsystem and Engine Input capture user interactions and events.
• The Scripting system hooks into the Engine to allow game logic injection.
• IO modules manage asset loading for both runtime and editor scenarios.
• External libraries (SDL3, GLM, Assimp, spdlog, etc.) support lower-level functionality (logging, math, asset importing, UI with ImGui).
Architectural Patterns and Principles
• Modular design: Separate modules (rendering, audio, physics, etc.) reside in their own folders within CoffeeEngine, making it easier to update or extend individual systems.
• MVC-like separation in the Editor: The editor’s panel structure represents the view layer while connecting to engine “models” (the scene, assets, etc.).
• Abstraction layers for platform independence: The Engine has a dedicated Platform folder, encapsulating Windows and Linux specifics.
• Data-driven systems for resource management (import/saver/registry in IO) and scene management (ECS, scene tree).
• Clear labels for each main component (like “Renderer”, “Physics”, “Audio”, etc.).
• A note on build configuration and deployment (the presence of CMakeLists.txt at various levels and vcpkg integration for dependencies).
Happy diagramming!