Using C++ to Build a Traditional Roguelike, Second Edition — book cover
✓ Free online edition

Using C++ to Build a Traditional Roguelike

From an empty window to a finished dungeon crawler, with SDL 3. The complete second edition — free to read online.

27 Chapters SDL 3 C++ Roguelike

Reading online is completely free — browse the contents below and start anywhere. Prefer it on your shelf or your Kindle? It's on Amazon too.

27chapters, free online
1winnable roguelike you build
230+diagrams & screenshots
£0no sign-up, no paywall

A few screens from the book — a glimpse of the game you'll build.

ASCII combat — the player @ faces a jackal in a fire-lit room, with a message log reading ‘The fireball bursts! The fireball kills the jackal!’
Bump-to-attack combat, with a running message log.
The full game screen — a dungeon lit by field of view with dim remembered rooms, an ‘Amulets of SDL’ sidebar and a message log.
Fog of war — lit in view, dim in memory — and the HUD.
A graphical tile-mode cave full of sprite monsters, potions and scrolls.
The same game in optional graphical tile mode.
A victory screen reading ‘YOU HAVE WON — All three Amulets of SDL are yours’.
A real win: recover the three Amulets of SDL.

Build a complete, winnable roguelike in modern C++ — one game, across twenty-seven chapters, every one ending in a program you can compile, run and play. It's a traditional roguelike: turn-based, grid-based, drawn in ASCII, with dungeons that are different every run and death that is permanent. No engine, no framework doing the thinking for you — just C++, SDL 3 for the window and the pixels, and you. You type every line, and you understand every line. The whole second edition is free to read online.

What you'll build

Procedural dungeons Cellular-automata caves Field of view & fog of war Monster pathfinding Monster AI Turn-based combat Ranged magic Items & identification Equipment & stats Status effects Character classes Save & load Synthesized sound A way to win

Contents

Twenty-seven chapters and three appendices, every one free to read online. Start at the beginning, or jump to whatever you want to see first.

Start here

Before the code: what you're building, why a roguelike, and how to get the most from the book.

All the source is on GitHub. Every chapter's complete, ready-to-build project lives at EliteIntegrity/Using-C-to-Build-a-Traditional-Roguelike-2nd-Edition — one folder per chapter, matching the book line for line. View repo →

Part of the series

Learning C++ by Building Games →

New to C++? Start here — the language from a blank file, one game at a time. Free to read online, and its finale is a taste of this book's genre.

Fundamentals →

The math every engine hides — vectors, physics, pathfinding and a software 3D renderer, built from scratch.

Building C++ Games with AI →

You bring the vision, the AI writes the C++, and you direct it all the way to finished.