Introduction
cbengine is an open‑source, cross‑platform game engine designed for the development of 2D and 3D interactive applications. It is written in C++ and provides a modular architecture that separates rendering, physics, audio, and scripting into distinct subsystems. The engine is available for Windows, macOS, Linux, Android, and iOS, allowing developers to target desktop, mobile, and console platforms from a single codebase. cbengine includes a lightweight visual editor that enables designers to assemble scenes, configure assets, and preview changes without the need to write code. The engine’s emphasis on modularity, performance, and a clear API makes it suitable for both rapid prototyping and production‑grade projects.
The core of cbengine is built around the Entity‑Component‑System (ECS) paradigm, which promotes flexibility by allowing components to be attached to entities at runtime. This design encourages the composition of behavior from small, reusable pieces rather than inheritance hierarchies. In addition to the ECS, the engine implements a scene graph that handles spatial relationships, rendering order, and hierarchical transformations. The rendering pipeline is modular, supporting both forward and deferred rendering paths and allowing the integration of third‑party shaders and post‑processing effects. Audio is handled through an audio mixer that supports 3D spatialization and dynamic mixing. Scripting is supported via embedded Lua, enabling rapid iteration and dynamic content creation.
History and Development
Origins
The origins of cbengine trace back to a small team of hobbyist developers who sought a lightweight alternative to existing commercial engines. The initial prototype was created in 2012 with a focus on rendering performance and a minimalistic API. Early iterations were heavily influenced by the design principles of OpenGL and the Vulkan graphics APIs. The team prioritized platform independence, resulting in a renderer that could switch between OpenGL, DirectX 11, and Vulkan at compile time based on the target operating system. The first public release of the engine was in late 2013, distributed under the MIT license to encourage community adoption and contributions.
Throughout its early history, the engine's development was guided by a philosophy of “build once, run anywhere.” The core libraries were written to be platform agnostic, and the build system leveraged CMake to generate native build files for multiple compilers. This approach facilitated contributions from developers across the world, as the engine could be compiled with GCC, Clang, or MSVC without significant changes. The community grew steadily, with contributors adding features such as a basic physics wrapper, an asset import pipeline, and a rudimentary visual editor.
Release History
cbengine’s release history can be summarized in several key milestones. Version 1.0, released in March 2014, introduced the first stable renderer, the ECS framework, and basic scene management. Subsequent releases added a 2D sprite system, a simple physics integration using Box2D, and a Lua scripting interface. Version 2.0, released in 2016, marked a significant overhaul of the rendering pipeline, incorporating support for deferred shading, HDR, and a customizable post‑processing stack. This version also added a more comprehensive asset importer that could handle FBX, OBJ, and COLLADA files.
The engine reached version 3.0 in 2018, bringing Vulkan support, improved audio mixing capabilities, and a more feature‑rich visual editor. The editor now supported drag‑and‑drop asset placement, real‑time lighting previews, and a built‑in profiler. Version 4.0, released in 2020, focused on mobile optimization, adding support for Metal on iOS, and introducing a new physics engine based on the Bullet library to replace the earlier Box2D integration. The latest release, version 5.0 in 2022, added extensive support for virtual reality devices such as the Oculus Quest and Valve Index, introduced a scripting system for the Unity scripting language via IL2CPP, and further refined the ECS to support multi‑threaded job systems.
Architecture
Rendering System
The rendering system of cbengine is designed to be highly modular, enabling developers to swap between different rendering back‑ends or to customize shading pipelines. At its core, the engine exposes a high‑level graphics API that abstracts the underlying graphics library, whether it be OpenGL, DirectX, Vulkan, or Metal. The renderer manages frame buffers, depth buffers, and swap chains, and is responsible for setting up the viewport and handling window resizing events. Developers can register custom shader programs that are compiled at runtime, and the engine provides a uniform buffer management system that simplifies the passing of data such as transformation matrices and material properties to GPU shaders.
The engine supports both forward and deferred rendering paths. In the forward path, geometry is rendered directly to the screen with lighting calculations performed per‑fragment. Deferred rendering splits the geometry pass from the lighting pass, allowing the scene to be rendered with a fixed geometry overhead while varying the number of lights without a proportional performance penalty. The deferred path is optional and can be enabled via a compile‑time flag or through runtime configuration. The renderer also includes a built‑in post‑processing stack that supports common effects such as bloom, tone mapping, and color grading, which can be applied via a series of render passes. This stack is designed to be extensible, enabling developers to add new post‑processing effects through a plug‑in architecture.
Physics Engine
cbengine’s physics subsystem provides two distinct physics engines: a 2D physics module based on the open‑source Box2D library and a 3D physics module based on the Bullet Physics library. The choice of physics engine is determined by the type of entities in a scene; 2D entities are automatically assigned to the Box2D world, whereas 3D entities are managed by Bullet. The physics world is updated each frame during the simulation step, and the results are applied to the ECS components responsible for position and rotation. Collision callbacks can be defined through Lua scripts, allowing developers to customize responses such as damage, sound, or particle effects.
The physics subsystem supports a wide range of rigid body types, including dynamic, kinematic, and static bodies, as well as soft bodies and cloth simulation. Collision shapes are automatically generated based on the mesh data of an entity, and developers can also define custom collision primitives such as capsules, convex hulls, and custom convex shapes. The engine exposes a physics API that allows querying contact points, raycasting, and applying forces or torques to objects. This API is accessible from C++ code and Lua scripts, providing flexibility for both high‑performance core logic and rapid prototyping.
Audio Subsystem
The audio subsystem of cbengine is built around the OpenAL Soft library for audio playback and spatialization. It provides a high‑level audio API that manages audio sources, listeners, and sound buffers. Developers can load audio files in common formats such as WAV, MP3, and OGG, and the engine automatically streams large files to reduce memory usage. Spatial audio is implemented using 3D positional audio models, allowing sound sources to emit audio that changes in volume, pitch, and stereo panning based on their position relative to the listener.
Additionally, cbengine includes a simple mixer that supports multiple audio channels, real‑time volume control, and fade effects. The mixer can be accessed via Lua scripts, enabling dynamic audio behavior such as triggering background music transitions or adjusting sound parameters based on gameplay events. The audio subsystem also supports audio effect chains, allowing developers to apply reverb, echo, and equalization to individual sources or to the master output. This flexibility makes the audio engine suitable for both simple 2D games and complex 3D simulations that require realistic sound propagation.
Animation System
The animation subsystem supports skeletal animation for both 2D and 3D characters. In 3D, the engine uses a skeletal rig that consists of a hierarchy of joints, each with a local transformation matrix. Animations are stored as keyframes that specify joint positions, rotations, and scales at specific timestamps. The engine interpolates between keyframes in real time to produce smooth animation playback. Animation blending is supported, allowing multiple animations to be blended together with configurable blend weights. This feature is particularly useful for mixing idle, walking, and attack animations.
For 2D animation, cbengine implements a sprite sheet system where each frame of an animation is a sub‑image within a larger texture atlas. Animation sequences are defined through a series of frame indices and a frame duration. The 2D animation system also supports flip‑book animations, procedural transformations, and basic physics integration for cloth or soft body simulations. All animation data can be edited within the visual editor, which provides a timeline view for editing keyframes and a preview pane for real‑time playback.
Input Handling
Input handling in cbengine is abstracted through an input manager that normalizes events from keyboards, mice, touchscreens, and game controllers. The engine supports the standard set of input actions, such as key presses, mouse clicks, axis movements, and joystick triggers. Developers can bind input actions to callbacks defined in C++ or Lua, allowing for flexible control schemes. The input manager also handles input polling as well as event callbacks, ensuring that input is processed consistently across frames.
The system provides a device discovery feature, automatically detecting connected input devices and presenting them to the application through a query interface. For mobile platforms, the engine interprets touch gestures such as swipes, pinches, and taps and maps them to high‑level actions. The input manager also supports virtual controllers that can be rendered on-screen, enabling developers to create custom UI elements for touch‑based input.
Scripting Integration
cbengine embeds the Lua scripting language, providing a lightweight yet powerful runtime for game logic. The engine exposes a set of C++ bindings that allow Lua scripts to manipulate entities, query components, and invoke engine services such as rendering, audio, and physics. Lua scripts can be loaded from files or compiled at runtime, and they are executed within a sandboxed environment to prevent unintended modifications to the engine core.
The scripting interface is designed to be modular; developers can add or remove bindings for specific modules (e.g., physics, audio, UI) without affecting the core engine. The engine also offers a script hot‑reloading feature, allowing developers to modify Lua scripts while the game is running and see the changes immediately. This feature greatly speeds up iteration and debugging. Additionally, cbengine includes a debugging console that can evaluate Lua expressions on the fly, making it easier to inspect state and diagnose issues.
Key Concepts
Scene Graph
The scene graph is a hierarchical data structure that represents the spatial organization of entities within a level. Each node in the graph holds a transformation matrix that combines translation, rotation, and scaling relative to its parent. The graph allows for efficient culling, as nodes outside the camera frustum can be skipped during rendering. The engine implements both a 2D and a 3D scene graph; the 3D graph supports nested bone hierarchies for skeletal animation, while the 2D graph is optimized for sprite layering and viewport scrolling.
Hierarchy changes such as parent reassignment or node insertion are propagated through the graph with minimal computational overhead. The graph also supports custom traversal orders, enabling developers to implement specialized rendering passes such as forward rendering, deferred shading, or shadow mapping. By decoupling the scene graph from the ECS, cbengine ensures that spatial relationships can be maintained independently of component data.
Component System
cbengine’s component system attaches data and behavior to entities. Each component type is defined by a struct that contains data fields relevant to that behavior, such as a Transform component with position and rotation or a MeshRenderer component with a reference to a mesh asset. Components are stored in contiguous memory buffers, which improves cache locality during updates.
Components can be serialized to disk using the engine’s built‑in serialization framework, which uses binary format for fast loading. The framework also supports custom serialization callbacks, allowing developers to extend component behavior during load and save operations. The component system is closely integrated with the editor, providing property editors that can be customized through metadata annotations. This integration allows designers to edit component values directly within the visual editor.
Entity‑Component‑System (ECS)
The ECS architecture separates data (components) from logic (systems). Systems iterate over entities that possess the required component set, performing updates such as physics integration or rendering. This design reduces coupling between systems and promotes parallelism, as systems that operate on disjoint sets of components can be scheduled concurrently.
In cbengine, the ECS is implemented with a data‑parallel approach. Each system can query the engine for entities with a specific component signature, and the engine ensures that component data is aligned for SIMD usage. Systems also support job scheduling, allowing developers to dispatch work across multiple threads. The ECS is fully typed, meaning that component queries are performed at compile time, which reduces runtime overhead and increases safety.
Resource Management
cbengine features a robust resource manager that handles the loading, caching, and unloading of assets such as textures, meshes, audio clips, and scripts. The manager uses reference counting to determine when an asset is no longer in use, and it can unload assets asynchronously to avoid frame stalls.
The engine provides a resource path abstraction that supports both file system paths and virtual file system (VFS) paths. This allows developers to bundle assets into compressed archives (e.g., ZIP or custom archive formats) and load them on demand. The resource manager also implements a hot‑reload feature; when an asset file is modified on disk, the manager automatically reloads it and updates all references within the engine. This feature is particularly valuable during development, as it reduces the need to restart the editor or game when making changes to assets.
Features
Visual Editor
The visual editor is an integrated development environment that allows level design, component editing, and asset management. It features a node‑based scene hierarchy view, a property inspector, and a real‑time preview window. The editor supports drag‑and‑drop placement of entities, alignment guides for precision placement, and multi‑selection editing.
Developers can also create custom editor plugins that extend the editor’s functionality. The plugin system is designed to be lightweight, using dynamic libraries that can be loaded at runtime. Common plugins include UI widget editors, particle system editors, and shader editors. The editor is cross‑platform and runs on Windows, macOS, and Linux, providing a consistent development experience across operating systems.
Cross‑Platform Deployment
cbengine targets multiple platforms, including Windows, macOS, Linux, Android, iOS, and WebAssembly. The engine uses platform‑specific back‑ends for windowing and input handling: GLFW for desktop, SDL2 for mobile, and Emscripten’s HTML5 canvas for WebAssembly. The codebase is fully portable; developers can build a single code base and deploy it to all supported platforms with minimal changes.
Deployment features include platform‑specific packaging tools that bundle executables, libraries, and assets into platform‑appropriate installers or application bundles. The engine also supports runtime platform detection, allowing code to query the current platform and adapt behavior accordingly. For WebAssembly builds, the engine leverages the Web Audio API for audio output and the WebGL API for rendering, ensuring smooth performance in browsers.
Modular Architecture
cbengine’s core is intentionally minimal, exposing only essential systems and allowing developers to enable or disable modules as needed. This modularity is achieved through a plug‑in system that loads modules at runtime based on configuration files. Each module registers its own services, bindings, and systems with the engine, and the engine can query which modules are available during runtime.
Developers can also write custom modules in C++ and compile them into shared libraries (.dll, .so, .dylib). The engine loads these modules at runtime, and they can expose new component types, systems, or editor tools. The module system is designed to be lightweight; the overhead of loading a module is minimal, and modules can be unloaded at runtime if they are no longer needed.
Lighting and Shadowing
cbengine includes a dynamic lighting system that supports point lights, spotlights, directional lights, and ambient lighting. Lights can be added to a scene through components, and their properties such as color, intensity, and range can be edited in real time. In the deferred rendering path, lights are processed in a separate pass, and the engine automatically culls lights that do not affect the current frame.
For 3D scenes, the engine implements shadow mapping for directional and point lights. The shadow maps are generated using cube maps for point lights and 2D textures for directional lights. The engine automatically updates shadow map resolution based on the number of lights and the quality setting specified by the developer. Shadows are rendered using depth pre‑passes and can be blended with ambient occlusion for added realism.
Animation System (Detailed)
Animation system details are included in the above animation section, covering skeletal and sprite sheet animations. The engine’s animation timeline editor allows for fine‑grained editing of keyframes, blending curves, and procedural animation constraints.
Particle System
cbengine incorporates a simple yet powerful particle system that supports both CPU‑based and GPU‑based particle emission. Each particle emitter is a component that defines emission rate, lifespan, size, color, and texture. Particles can be affected by physics, enabling behaviors such as wind drift or collision response. The particle system can be controlled through Lua scripts, allowing for dynamic emission rates, burst events, and particle pooling.
Particles can be emitted in bursts or continuous streams and are rendered using billboarding techniques for 3D scenes or simple sprite rendering for 2D scenes. The engine also supports GPU instancing for particle rendering, which allows thousands of particles to be drawn with a single draw call. This feature is particularly useful for effects such as smoke, fire, or magical spells.
Network Support
cbengine offers a lightweight networking module built on top of the ENet networking library. The module provides reliable UDP-based communication, which is sufficient for many multiplayer games. It supports client‑server and peer‑to‑peer topologies, and developers can define custom network messages using the engine’s message serialization framework.
The networking module integrates with the ECS, enabling networked entities to synchronize state across clients. The engine provides a state replication system that can be configured to send only relevant data (e.g., position, velocity) to minimize bandwidth usage. The module also includes a built‑in lobby system that manages player connections, matchmaking, and game start synchronization. This networking stack is designed to be flexible enough for small, local multiplayer games and large, persistent multiplayer servers.
Lighting and Shadowing (Revisited)
In addition to the previously mentioned forward and deferred rendering paths, cbengine supports various shadowing techniques. It provides a cascaded shadow map (CSM) system for directional lights, which subdivides the view frustum into multiple cascades and generates separate shadow maps for each cascade. The engine also supports point light shadows using omnidirectional shadow maps, which render depth from the light’s position in all directions. All shadow maps are generated using a dedicated depth pre‑pass, which is reused for multiple lighting calculations.
These shadowing techniques can be enabled or disabled through a configuration file, and the engine provides an optimization toggle that reduces shadow map resolution during low‑end hardware or for specific game scenes where shadows are not critical. The combination of CSM and omnidirectional shadows allows developers to create realistic lighting for scenes with dynamic lights, moving characters, and complex geometries.
Networking Support
cbengine provides a networking module that facilitates client‑server and peer‑to‑peer communication. The module uses the ENet library for low‑level networking primitives, delivering reliable UDP communication with built‑in packet ordering, fragmentation, and retransmission. Developers can define custom message types, each of which can be serialized and deserialized using the engine’s serialization framework. The networking module also offers a high‑level API that manages connections, latency, and packet loss, abstracting the complexity of networking for typical use cases.
To support real‑time multiplayer games, cbengine includes a state replication system that automatically syncs entity state across clients. Systems can mark components as networked, and the engine will serialize and transmit the component data to connected peers. On the receiving side, the engine deserializes the data and updates the local entity accordingly. This replication system is highly configurable; developers can choose to replicate only the most critical data (e.g., position and health) to minimize bandwidth usage. The networking module also includes a lobby system for matchmaking and session creation, which can be accessed from Lua scripts or C++ code.
Networking Support (Detailed)
In addition to basic connection establishment and message passing, cbengine’s networking module provides several advanced features. One such feature is the support for server‑authoritative architecture, where the server validates all client actions before applying them to the game state. This reduces cheating and ensures consistency across all clients. The server can host dedicated sessions that can be queried by clients for available games, and clients can filter sessions based on criteria such as region, maximum players, or game mode.
The networking stack also offers reliable message batching, where multiple small messages are combined into a single packet to reduce overhead. This batching is done automatically by the engine and can be tuned via a configuration file. Developers can also define custom network protocols if they require a different message ordering or priority system. In addition, the networking module exposes a debugging tool that visualizes network traffic, packet loss, and latency, allowing developers to identify performance bottlenecks or connectivity issues.
Conclusion
cbengine is a feature‑rich game development platform that combines a modular architecture with a powerful ECS, advanced rendering, physics, audio, and animation systems, and robust resource and scripting management. Its design focuses on performance, extensibility, and developer productivity, making it suitable for both hobbyist developers and professional studios working on complex projects. By providing a flexible, cross‑platform foundation, cbengine empowers developers to bring their creative visions to life with minimal overhead and maximum control.
No comments yet. Be the first to comment!