2D Game Engine

A C++ 2D game engine (SFML + Box2D) with a platformer demo.

C++17 SFML Box2D Custom ECS-lite

This project is a custom 2D engine built in C++ using SFML for rendering/input and Box2D for physics. A platformer demo validates the engine systems through a concrete gameplay scenario (movement, collisions, enemies, levels, UI).

The engine's original platformer demo is still included too, kept as a bonus: the concrete scenario (movement, collisions, enemies, levels, UI) the core systems were first built and tested against.

Architecture

Systems are layered: a fixed-timestep game loop drives scene updates; each scene owns entity lists and delegates rendering, physics, and gameplay in a strict order.

Engine core

2D systems

Rendering

SFML handles windowing, input polling, and draw calls. The render pass runs after simulation so visuals always reflect the latest physics state.

Physics

Box2D bodies are owned by gameplay entities. Collisions trigger gameplay events (damage, pickups) without tight coupling to the physics library internals.

// Fixed update order (simplified)
while (accumulator >= FIXED_DT) {
  scene->processInput();
  scene->updatePhysics(FIXED_DT);
  scene->updateGameplay(FIXED_DT);
  accumulator -= FIXED_DT;
}
scene->render();

Modular growth (3D-ready separation)

Rendering and simulation are isolated behind scene interfaces so future 3D backends could replace SFML draw paths without rewriting gameplay rules.

Key engineering decisions

Development workflow

Iteration cycle: implement engine feature → validate in platformer demo → refactor boundaries → document update order. Git branches per system (physics, UI, levels).

Progression

Challenges

Building a modular engine means defining clear system boundaries while keeping the demo game fun and stable.

What I built

Links

Last Wing - the engine's flagship demo