How willtobyte/carimbo works
Project type and purpose
• Carimbo is a modern, cross-platform 2D game engine written in modern C++ using SDL and scriptable in Lua.
• It targets platforms: Linux, Windows, macOS, WebAssembly, Android, iOS.
• Key features: rendering, audio, input, resource loading, scene & state management, scripting, event handling.
File structure
• Top-level build/config files:
• CMakeLists.txt, Makefile, conanfile.py – build and dependency management
• .github/workflows/* – CI configurations for all platforms
• src/ directory – the entire engine code:
• application.* – entry point for user applications built on the engine
• engine.* and enginefactory.* – the core engine interfaces and factories
• window.*, audiodevice.*, soundmanager.*, soundfx.* – platform & audio subsystems
• scene.*, scenemanager.*, object*, objectmanager*, particlesystem* – scene and object management
• eventmanager.*, timermanager.*, lifecycleobserver* – core loop, timing, and event system
• scriptengine.* – Lua binding and script integration
• filesystem.*, io.* – resource I/O and virtual filesystem
• resourcemanager.*, fontfactory.*, querybuilder* – resource loading, fonts, and data queries
• design patterns: factory (enginefactory, fontfactory), singleton, observer/delegate (lifecycleobserver), pooling (objectpool, pixmappool), reflection (reflection.hpp), defer (defer.hpp).
README for additional insights
• Confirms it is a full-stack game engine core, not an application/game itself.
• Mentions scripting, cross-platform via SDL & WebAssembly.
Diagramming the system architecture
a. Main components
1. Application Layer
– application.cpp/hpp: user-implemented game entry
– scripts (Lua) loaded via scriptengine
2. Engine Core
– Engine API (engine.hpp)
– EngineFactory: creates platform-specific engine instance
– Subsystems:
• Rendering (renderer, canvas, pixmap, tilemap)
• Audio (audiodevice, soundmanager, soundfx)
• Input & Window Management (window, cursor)
• Scene & Object Management (scene, scenemanager, object, objectmanager)
• Event & Timing (eventmanager, timermanager, lifecycleobserver)
• Resource Management (filesystem, resourcemanager, fontfactory)
• Scripting (scriptengine, Lua)
• Networking (socket) & Steam integration
3. Platform Layer
– SDL backend for windowing, input, audio
– WebAssembly port
– Native mobile/desktop implementations
4. External Services
– Lua interpreter
– SDL
– (Optional) Steam SDK
b. Relationships and interactions
• Application calls EngineFactory → Engine
• Engine initializes subsystems (rendering, audio, input, scripting)
• Main loop: Timemanager ticks → Eventmanager dispatches → SceneManager updates objects → ScriptEngine executes game logic → Renderer draws → AudioDevice plays sounds
• ResourceManager/Filesystem load assets on demand
• ScriptEngine uses ResourceManager for scripts and game assets
• Networking/socket & Steam modules plug into event loop
• Factories (font, engine) produce subsystem instances
• Observers subscribe to lifecycle events (init, update, shutdown)
c. Architectural patterns & principles
• Layered architecture: Application → Engine Core → Platform
• Modular subsystems with clear interfaces
• Factory pattern for engine and resource instantiation
• Observer/Event Dispatcher for decoupling event handling
• Singleton for global managers (optional usage)
• Object Pool for performance (pixmappool, objectpool)
• Reflection and script-binding for dynamic behaviors
d. Key technologies & libraries
• C++17 (modern C++)
• SDL (cross-platform multimedia)
• Lua (scripting language)
• CMake & Conan (build & package management)
• WebAssembly toolchain (emscripten)
• Steamworks SDK (optional)