https://github.com/yousefalshaikh17/2d-game-engine
This project is a work in progress 2D game engine developed with C++, SFML, and EnTT. It features a modular entity-component-system architecture and core gameplay systems such as rendering, scripting, and collision detection. The engine currently supports simple game creation and serves as a foundation for building more complex games and tools.
Inspired by commercial engines, the project focuses on flexibility and extensibility, with ongoing development aimed at editor integration, scene management, and improved rendering features. Future plans include adding hierarchy support, expanding component types, and moving beyond SFML to increase performance and customization.
Currently, only simple shapes are being used to test the capabilities of the engine. A demo game will be developed soon.
This project was developed using C++, Visual Studio, CMake, and SFML. It is a custom 2D game engine built on top of the EnTT entity-component-system (ECS) library. The engine focuses on modular design and extendability, allowing for the creation of lightweight, performant 2D games. Key features include:
ScriptComponent for response logic.MonoBehaviour, this allows custom behavior through lifecycle functions such as start, update, fixedUpdate, and collision callbacks (e.g. onCollide).The engine implements a fixed timestep game loop combined with interpolation to ensure consistent simulation updates along with smooth rendering. The fixed timestep runs core game logic, including physics and scripted behavior, at a steady rate, usually 60 times per second. This prevents issues caused by fluctuating frame rates.

Pseudocode: Game Loop with fixed timestep and interpolation for smooth and stable updates.
During each frame, the loop accumulates elapsed time and performs fixed updates in consistent increments. After these updates, it calculates an interpolation factor to smoothly blend between previous and current states during rendering. This keeps the simulation accurate and the visuals fluid.
Variable timestep updates handle input processing, animations, and other frame-dependent tasks that can safely run with the actual elapsed time. This separation improves both the stability and responsiveness of the game.
Additionally, the engine uses double buffering for rendering. This technique draws the next frame to a back buffer while the current frame is displayed, preventing visual artifacts like screen tearing and providing smooth frame transitions.