✳ Choose your perspective
← Back to projects

07 / C++ · TURN-BASED GAME

The Final Room

Every decision takes a turn.

The final project in the ECS engine guide: a turn-based game about finding a key, opening doors and progressing through random levels.

MY CONTRIBUTION

All programming

DATE

June 2023

DURATION

1 month

TOOLS

C++ · Raylib · ECS

01 / CONTEXT

The challenge.

Bringing together the lessons from the guide in a more complete game while keeping the relationship between engine systems and game behaviour visible.

02 / PROCESS

My contribution.

I programmed the game and its logic on top of the engine developed in the guide. Each move or interaction uses a turn; progression adds obstacles and enemies while reducing the items available.

  • All game code.
  • Turn logic, interactions and progression.
  • Integration as the guide’s final example.
03 / OUTCOME

What we built.

A game with random levels and increasing difficulty, browsable source code and a Linux download. Its implementation is explained step by step in the guide’s final chapters.

A playable project reveals how architecture decisions fit together.
04 / DECISIONS

Development decisions.

A turn is not a frame

The loop keeps drawing while logic alternates between player input and AI updates. A turn variable and a time interval regulate the alternation. This makes it possible to distinguish continuous presentation from the moment when characters are allowed to act.

From a key press to a changed world

The input system reads the player’s components and sets movement. Collision, position and rendering systems then process the state. Following this chain shows each system’s responsibility and where the game rules connect.

Changing levels also means managing state

Resetting preserves inventory through the game manager, removes entities and clears component storage before another level is prepared. Randomised progression requires attention both to what gets generated and to what must survive between stages.

05 / WALKTHROUGH

The project in use.

  1. Inspect the board and plan a route towards the objects needed to advance, accounting for obstacles and enemies.
  2. Make a move and follow the response: turns organise when the player acts and when the AI takes over.
  3. Complete the level and compare the next stage, where the layout and difficulty conditions change.
06 / EXPLORE

What to explore.

A way into the project through its screens, supporting material and, where available, its source code.

  • The alternation between input and AI in the main loop.
  • The path from input components through position, collision and drawing.
  • Inventory preservation and entity cleanup when changing levels.
THIS PROJECT CONNECTS TOBuilding an ECS game engine in C++20

THE PEOPLE BEHIND IT

Credits.

Laureano Cantó

Programming

Alicia Aurecchia

2D art

NEXT PROJECT / 08

Making a washer and dryer easier to understand