The Offender Engine Book

Preface

There is a book missing from the shelf. If you go looking today for a serious, current guide to building a game engine on modern graphics hardware, you will find two kinds of things and nothing in between. On one side are the beginner tutorials: draw a triangle, texture a quad, rotate a cube, and stop — right at the moment it starts to matter. On the other are the reference tomes, most of them a decade old, teaching a single API in isolation as if the other four don't exist. The book that builds a real engine, all the way, across every modern graphics API, does not exist.

This is that book — or rather, the first of them. Across this series we build enginebook: a real, cross-platform game engine, from an empty folder to something you could ship a game on. Not a toy. And we do it on a single clean abstraction — one render hardware interface, the RHI — implemented across all five modern graphics backends: OpenGL 4.1+, OpenGL ES, DirectX 12, Vulkan, and Metal. The same engine, the same scene, the same shaders, everywhere.

Why this series exists

Four gaps, and this series sits in all of them.

Modern, cross-API graphics material doesn't exist. The DirectX 12 book everyone still recommends came out in 2016. It predates almost everything that makes DirectX 12 modern — the Agility SDK, enhanced barriers, GPU upload heaps, bindless resources, the current debugging tools. And that is just one API. For Vulkan, Metal, and modern OpenGL, the material is scattered across blog posts and sample repositories, each in its own universe, none of them behind a single engine.

Engine material is either a toy or a lecture. The popular "build an engine" content builds something small and stops before the hard parts — the parts where you would actually ship. The academic material is architecture diagrams with no running product behind them. Almost nobody builds a real engine, all the way, and shows you why it is built the way it is.

Shader cross-compilation is a black box. The moment you support more than one graphics API, you hit a wall: you cannot hand-author every shader in HLSL and SPIR-V and Metal Shading Language and GLSL. Real engines solve this with a shading language and a converter, and almost no one walks you through building one. We build ours in the open — it is one of the most satisfying parts of the whole project.

Cross-platform building is folklore. Getting one codebase to compile on Windows, Linux, macOS, iOS, and Android — each with a different graphics SDK — is something everyone struggles with and nobody writes down properly. We treat it as a first-class topic, not an afterthought.

Everything we build serves at least one of these gaps. If something serves none of them, it does not make the cut.

Who this book is for

You should be comfortable in C++ — classes, pointers and references, headers and translation units; a template should not frighten you. You should have at least brushed against graphics before: you have drawn something, or you at least know roughly what a vertex buffer and a shader are. You do not need to be an expert. You need to be dangerous.

You do not need to already know DirectX 12, Vulkan, Metal, or modern OpenGL. We learn each one as we implement it, behind the RHI. That is much of the point.

This book is not the right starting place if you have never written C++, or have never seen a graphics API at all. That is not gatekeeping; it is pacing. We move at the speed of people building a real thing, and I do not want you fighting two battles at once. If that is you, work through one solid C++ resource and one "draw your first triangle" tutorial, then come back. You will be ready.

There are three things I will not reteach: C++ syntax, the GPU at the hardware level, and linear algebra from first principles. When we need a matrix, I will tell you what it does and we will use it; I will not derive it. Excellent resources exist for all three, and I point to them where it matters. This book is about building the engine.

How to use this book

The engine is built in one repository, and every chapter's code has a git tag. When a chapter says its milestone is ch05, you can check out ch05 and have the engine exactly as the chapter leaves it. Fell behind, jumped ahead, or want to compare your version against mine? Check out the tag and diff. You are never stranded.

Code listings in these pages are the repository's real, tagged commits — never a parallel version that quietly drifts. I show the lines that matter inline and point you to the tag for the full file.

This same material exists as a video course as well, built from the same commits and the same milestones. Some people learn better watching code get written; some prefer the page they can annotate and search. Use whichever fits you, or both — they are the same engine.

A book that builds software is only as honest as the software it builds. So when something is subtle, I will show you where it bit us; when a decision has a real cost, I will name the cost. Occasional sidebars carry three kinds of aside: a Design lesson (the principle a piece of code illustrates), a War story (the same situation from a real, shipped engine), and a Gotcha (a trap and how it shows up). They are the parts you will remember at 2 a.m. six months from now.

Let's begin where every good engine begins: not with code, but with a clear picture of the thing we're about to build, and the one idea that makes all of it possible.

In summary

This preface stakes out the book that isn't on the shelf: a serious, current guide to building a real cross-platform game engine — enginebook — on one clean abstraction, the RHI, implemented across all five modern graphics backends: OpenGL 4.1+, OpenGL ES, DirectX 12, Vulkan, and Metal.

What it commits to:

  • four gaps to sit in — no modern cross-API graphics material, engine material that is either a toy or a lecture, shader cross-compilation as a black box, and cross-platform building as folklore. Anything serving none of them doesn't make the cut;
  • who it's for — you're comfortable in C++ and have drawn something; you needn't know D3D12, Vulkan, Metal, or modern GL, because we learn each as we implement it behind the RHI;
  • three things it won't reteach — C++ syntax, the GPU at the hardware level, and linear algebra from first principles;
  • how the code reaches you — every chapter's state is a git tag, and the listings are the repository's real tagged commits, never a parallel version that drifts;
  • the sidebars — a Design lesson, a War story, and a Gotcha, so subtleties and costs get named rather than glossed.

Chapter 1 turns that into a map: the one idea the series rests on, what this first book delivers, and every tool installed to build it.

Comments

Sign in to join the conversation.