BEngine
A component-based C++23 engine built to practise design patterns, with an NES Bomberman clone as the test bed.
Media
Project Overview
BEngine is a small 2D engine in C++23 on SDL3, focused on design patterns. The engine code lives in
Core/ under the bengine namespace, and every game target links it as a static library. The NES
Bomberman clone sits on top of it as a test bed. A CMake toolchain produces the web build in the
media panel above through Emscripten.
Key Features
Scene graph and components: A Scene owns its GameObjects through unique_ptr, so parent and child links stay raw and Transform is a plain member. World transforms recompute lazily behind a dirty flag, and component access is constrained by a ComponentType concept.
Command bindings: InputManager binds a scancode or gamepad button and its key state to an ICommand, so rebinding a control needs no code change.
Multicast delegate: Subscribe returns a ScopedDelegate that unsubscribes on destruction, and unsubscribing during Broadcast is deferred until it finishes. Callbacks are typed, so observers need no abstract interface.
Event bus: Unrelated systems share events through a type-erased map from std::type_index to a MulticastDelegate slot, so a listener holds no pointer to the subject.
Service locator: Audio and the event bus come from the service locator. Audio falls back to a NullAudioService, so calls are no-ops when nothing is registered, which is how the web build runs.
Audio thread: The SDL audio service runs its own jthread. Load, play and stop calls push an event variant onto a queue and return, so the worker does the mixer work off the main thread. A stop token ends it and joins before the mixer is destroyed.
SYS_SPECS
- Language:
- C++
- Technology:
- SDL3, CMake
- Platforms:
- Windows, Linux, Wasm