The math your game engine hides
Open any game engine and you'll find a Vector3, a Physics.Raycast, a rotation matrix — tools you can lean on for years without ever knowing what they do. This book is where you find out. Starting from an empty window, you write the vectors, the dot and cross products, the collision tests, the physics, the pathfinding, and — by the final chapters — every pixel of a small software 3D renderer, all from scratch, in modern C++. SDL 3 opens a window and draws a triangle; everything of substance is your own code, shown and explained line by line.
Free to read, start to finish
The complete second edition is free to read online, right here — all thirty-five chapters, no sign-up, no paywall. Start reading →
It is, on purpose, not a "build one big game" book — and that's the point. Instead of a sprawling project you can lose the thread in, every idea gets its own tiny interactive demo you run and poke at with the mouse, so the concept you're learning stays front and centre. You watch a dot correctly chase your cursor, a fast bullet finally stop punching through a thin wall, a textured cube spin without warping. The demos stay small; the understanding doesn't. When you'd like it offline and on your shelf, it's on Amazon as a Kindle ebook and paperback.
What you'll build
- 36 runnable, interactive demos — one per idea, every one from scratch
- Vectors, trigonometry, matrices, and quaternions — derived, not assumed
- Collision detection, raycasting, a small physics engine, and pathfinding (BFS, Dijkstra, A*)
- A complete software 3D pipeline: projection, cameras, the z-buffer, and perspective-correct texturing
- Exercises — and an optional "study it with an AI" prompt — at the end of every chapter
Every demo's complete, ready-to-run project is on GitHub, one folder per demo, with SDL bundled so each opens and runs as it comes.
Who it's for
Intermediate C++ programmers who are comfortable with classes, references, and std::vector. You need no prior game-math background — the one feature beginners often haven't met, operator overloading, is taught the moment it's first needed. Newer than that? The companion Learning C++ by Building Games starts you from zero and builds the games this book goes underneath.
