Shape Wars

Introduction

Ever since I started developing games, I’ve mostly worked with game engines to bring them to life. However, I’ve always wanted to understand the fundamentals of how engines work behind the scene.How objects are rendered, how collisions are detected, and what drives the core game loop. I started this small project to explore the backend of game engines and aim to eventually build a simple engine of my own using C++, the SFML library, and ImGui for UI handling. I also had prior exposure to ECS (Entity-Component-System) architecture, and this project provided the perfect opportunity to implement a basic ECS system from scratch.

SFML & ImGui

While planning my approach to the game and the tools I would need, I quickly realized I needed a way to interact with various components of the computer. Using SFML provided a simple and effective interface to handle tasks such as rendering objects, playing sounds, registering input, and more. This allowed me to provide my small engine with core modules that could be reused across multiple systems. Similarly, I wanted a configurable UI system to display information to the player and assist with debugging. That’s why I chose ImGui, to handle both UI functionality and in-game debugging efficiently.

ECS

Entity Component System (ECS) is an architectural pattern that allows for flexible and efficient management of game objects. It breaks down into three parts:

In traditional OOP-style GameObject models such as Unity’s, a GameObject acts as a container that can hold both data and logic. This is quite different from ECS, which separates data and behavior strictly. In this project, I wanted to implement an ECS to better understand when, where, and how it is more effective than the traditional model I’m used to. After building my first ECS, I came to the following conclusion: