SFML + Flecs Breakout Clone

24 September 2025 | Eric

Introduction

In 2025, I set myself the goal of learning C++ and Game Development. Facing the infinite number of frameworks and libraries, I decided to start with SFML. Why SFML? Because it’s providing easy access to the system, window, graphics, events, audio, and networks. It’s written in C++ and has a very active community and nice documentation.

Also, I wanted to stay in 2D and avoid the complexity of 3D, at least for now.

Breakout

Nothing was planned. I started by playing around with some SFML experimentation, slowly building a game engine along the way. At some point, I decided to implement basic input and game logic and ended up with a simple breakout clone.

Scene Graph

One of the challenges I faced was to implement a scene graph. I wanted to be able to switch between scenes and have the game engine handle the transition. For that, I created a Game State class that would handle the transition between states using a stack of states. Each state can handle multiple scenes that can be loaded additively on top of each other.

This was great, but adding entities in each scene was a bit cumbersome. I already explored ECS before when creating a simple Javascript engine with Pixi.js and my own ECS library. So I decided to explore ECS engines again and ended up choosing Flecs.

Flecs

Flecs is amazing. It provides a great query system, top performance, and a friendly community on Discord.

It took me a little while to get used to it, especially to the staging system. Also, it was a bit of a challenge to integrate it in my existing engine as I was already managing scene state in each scene class. And along the way, I made a few mistakes that cost me a lot of time.

Keep system global and data-driven

The main learning for me was to keep the system global and data-driven. At first, I was trying to have scene-local systems, but it ended up being cumbersome to manage as I had to constantly disable systems with scene transition.

Finally, I moved all the systems globally and made them data-driven, so each system was running only if the query matched entities currently loaded in any scene. My scene state was also extracted and moved to singleton components and tags.

State of the Engine

The engine is still in a very early stage, but it is already working for simple games. A few of the features already implemented are:

Conclusion

Overall, it took me about 2 months to build a simple game engine with SFML and Flecs. I’m very happy with the result, and I’m looking forward to continue working on it.

The game is obviously not complete and polished, the goal is to learn and not to release anything. I am focusing on high ROI, high-return learning. So the goal is to continue learning before polishing anything as polishing takes the most time and grind.

What’s next?

I will certainly come back to this project in the future. But the main focus for now is to learn more about game programming. Some system I want to explore:

The game I will probably clone is Monaco, a top-down stealth/heist, multiplayer game. Certainly, I will add my own twist to it.