Learning C++ by Building Games
From your first line of code to a roguelike you built yourself. The complete second edition — free to read online.
Reading online is completely free — browse the contents below and start anywhere. The Kindle edition has every chapter; the paperback has the core course.
A few screens from the book — a glimpse of the games you'll build.




Never written a line of code? Start here. C++ has a reputation for being hard, usually because it's taught in the abstract — this book does the opposite. Every idea arrives because a game needs it, and you build every game step by step, with the code explained as you go. By the end you'll have written modern C++20 and built a roguelike of your own. This whole second edition is free to read online; it's also the complete companion to the print and Kindle editions.
What you'll build
Contents
Thirty-six chapters and two appendices, every one free to read online. Twenty-five of them are hands-on projects — a game you build. Start at the beginning, or jump to whatever you want to see first.
From a blank window to a working arcade shooter, learning the language one small game at a time.
if and switch so your code can react.
5Square Invader ProjectA player you steer and an invader to dodge, built from what you know so far.
6LoopsRepeat work without repeating yourself, with for and while.
7Cascade ProjectA falling-blocks toy that puts loops to work on screen.
8FunctionsBreak a program into named, reusable pieces you can call anywhere.
9Act 1 Capstone Shooter ProjectPull the whole act together into a small arcade shooter.
Memory, collections and the structure you need to build something larger.
Classes, inheritance and polymorphism — the way real C++ is organised.
Beyond the basics: real-world C++, building with AI, and patterns for performance.
Seven parts that build a roguelike of your own, from an empty grid to swords and fireballs.
A place to look things up, and setup for other platforms.
Carry on in the series
Fundamentals →
The math every engine hides — vectors, physics, pathfinding and a software 3D renderer, built from scratch.
Using C++ to Build a Traditional Roguelike →
Rogue SDL was a taste. This is the whole meal — a complete dungeon crawler, built properly.
Building C++ Games with AI →
You bring the vision, the AI writes the C++, and you direct it all the way to finished.
Want the story behind the book? About this book →
