This is a list of self-learning resources for game engine programming. It is not exhaustive, there are many more things to learn, but it will get you started. The content is organized sequentially, but the order is not strict, feel free to jump around.
1. Programming Basics
Engines are mostly written in C++ because it maps somewhat directly to how the CPU works, which allows to achieve high performance.
Handmade Hero by Casey Muratori shows how to make an engine in C, which is a subset of C++. It has no prerequisites, but the intro to C might feel insufficient if you do not already have some programming experience.
The Definitive C++ Book Guide and List on Stack Overflow recommends several books, such as C++ Primer by Stanley Lippman, Josée Lajoie, and Barbara E. Moo.
Online reference: cppreference.com.
2. Programming Best Practices
- The Rules of Programming: How to Write Better Code by Chris Zimmerman explains the programming practices used at Sucker Punch where they make their own engine. It is one of the most beneficial books you can read as a beginner. Although the examples are in C++, the focus is not on the language itself but on general programming practices.
C++ is a huge language with many parts and features that can be used (and misused) in many different ways. Handmade Hero teaches low-level C-style code, whereas general C++ books teach more abstract paradigms such as object-oriented programming. Some programmers have very strong opinions about the right way to do things. Engine programmers tend toward low-level code. However, you will likely encounter all kinds of code through your career.
- Effective C++ and Effective Modern C++ by Scott Meyers cover standard C++ idioms and practices that are widespread in objet-oriented codebases. It is useful to think critically about the strengths and weaknesses of such practices.
- John Carmack on Inlined Code.
- John Carmack on Functional Programming in C++.
- “Clean” Code, Horrible Performance by Casey Muratori on object-oriented features such as virtual functions.
- Many engines use their own replacement of the STL, such as the Electronics Arts Standard Template Library whose documentation contains justifications.
- Walter Bright on exceptions.
3. Algorithms and Data Structures
Algorithms and data structures are fundamental to solving problems with code. They are used everywhere in engines. You need to know their characteristics.
- The Algorithm Design Manual by Steven Skiena uses C to teach them.
- Hacker’s Delight by Henry S. Warren, Jr. is about bit manipulation tricks.
- Advent of Code is a website with fun exercises to practice.
- I’ve been writing ring buffers wrong all these years by Juho Snellman.
- More numerical experiments in hashing by Paul Khuong, on Robin Hood hashing.
4. Computer Architecture and Performance
Engine programming requires a good understanding of how computers work in order to achieve the high performance required for real-time interactive games.
These resources cover the basics broadly:
- The Performance-Aware Programming Series by Casey Muratori teaches the essentials. It is currently in production, with a weekly release schedule.
- Computer Systems: A Programmer’s Perspective by Randal E. Bryant and David R. O’Hallaron. It has a slightly broader scope. Although most engine programming is done on Windows, the book requires Linux for doing the labs.
The other resources listed below dive deeper into specific topics.
Assembly, which you do not necessarily need to know how to write, but at least to read in order to verify that the compiler did what you expect with your code:
- Applied Reverse Engineering by Daax Rynd, although it is still unfinished.
- Reverse Engineering for Beginners by Dennis Yurichev goes further.
Data-oriented design, a programming approach that takes advantage of the way that modern CPUs work, in particular with respect to caching:
- Efficiency with Algorithms, Performance with Data Structures by Chandler Carruth.
- Optimizable Code by Andreas Fredriksson.
- Data-Oriented Design and C++ by Mike Acton.
Parallel programming, which becomes increasingly important as CPUs get more cores:
- Is Parallel Programming Hard, And, If So, What Can You Do About It? by Paul E. McKenney.
Advanced resources if you want to further specialize in optimization:
- Computer Architecture: A Quantitative Approach by John L. Hennessy and David A. Patterson gives a lot more details about the way hardware works.
- Agner Fog wrote several advanced optimization manuals.
Misc useful links:
- x86 instructions: www.felixcloutier.com/x86/.
- Performance characteristics of x86 instructions: uops.info.
- Compiler Explorer is a tool that lets you see the assembly that various compilers produce from your code snippets.
- Online reference for intrinsics: Intel Intrinsics Guide.
- Onboarding floating-point by Mike Acton explains the basics of the floating-point formats.
- Tool to see the floating point representation of a number: Float Exposed.
Some parts of an engine use math, such as rendering and physics. The most important fields are trigonometry, calculus, and linear algebra. Only resources at a level above high-school are listed here.
While it is useful to learn these topics eventually, some find it better to learn them when the necessity becomes manifest in practice. If that is your case, come back here later as needed.
- Calculus GREEN by Robert Ghrist. The course is not complete yet.
Introductory linear algebra:
- Calculus BLUE Vol 1 : Vectors & Matrices by Robert Ghrist.
- Essence of Linear Algebra by 3Blue1Brown.
- Linear Algebra by Gilbert Strang.
Rigorous linear algebra:
- Numerical Recipes: The Art of Scientific Computing by William H. Press, Saul A. Teukolsky, William T. Vetterling and Brian P. Flannery.
6. Engine Programming
With the fundamental knowledge learned so far, you know enough to finally consider engines.
Game Engine Architecture by Jason Gregory gives a broad overview of how engines are organized. It will make you familiar with the different parts of a typical engine.
The Foundations of Game Engine Development series by Eric Lengyel introduces fundamental topics rather than architecture, and it does so in enough detail to enable you to make proper implementations. The series is not finished yet, two books are currently available.
Rendering is one of the most important parts of an engine. There are often specialized roles for rendering, as opposed to generalist engine programmers. However, even as a generalist, you need to know the basics.
- Alex Tardif gives advice about learning graphics programming.
Reference that covers a lot of topics:
- Real-Time Rendering by Tomas Akenine-Möller, Eric Haines, Naty Hoffman, Angelo Pesce, Michał Iwanicki, and Sébastien Hillaire. This itself contains many references to resources for the various presented techniques.
Resources for path tracing, useful to understand how rendering works by doing it all in software, without using the GPU:
- Ray Tracing in One Weekend by Peter Shirley is a short introduction.
- Physically Based Rendering: From Theory to Implementation by Matt Pharr, Wenzel Jakob, and Greg Humphreys. It is much more complete.
- Shadertoy, where people share shaders.
To use the GPU, you need to go through a graphics API. OpenGL and Direct3D 11 are the easiest to start with. Their successors, Vulkan and Direct3D 12, are more complex, but these are what modern engines use because they allow building multiple command buffers in parallel with multriple threads. Below are resources for these APIs.
- Learn OpenGL by Joey de Vries.
- The official documentation.
- Practical Rendering & Computation with Direct3D 11 by Jason Zink, Matt Pettineo and Jack Hoxley.
- d7samurai’s samples: part 1, 2 and 3.
- Mārtiņš Možeiko’s sample in C.
- The specification.
- How to Learn Vulkan by Jeremy Ong.
- Vulkan in 30 minutes by baldurk.
- API without Secrets: Introduction to Vulkan by Pawel Lapinski.
- Vulkan Tutorial by Alexander Overvoorde.
- Vulkan C++ examples and demos by Sascha Willems.
- Vulkan Synchronization Primer, part 1 and 2 by Jeremy Ong.
- The official API documentation.
- The specification.
- Microsoft’s samples.
- DX12 Do’s And Don’ts by Nvidia.
- A Gentle Introduction to D3D12 by Alex Tardif.
- GPU Memory Pools in D3D12 by Matt Pettineo.
To understand the abstractions provided by the graphics APIs and use them most effectively, it helps to also learn about how GPUs work:
The most relevant field of physics for games is classical Newtonian mechanics, in particular rigid-body dynamics.
Chris Hecker has a list of resources: Physics References: An Annotated Bibliography for Rigid Body Dynamics.
Introduction to dynamics:
- An Introduction to Physically Based Modeling by Andrew Witkin, David Baraff, and Michael Kass.
- Dynamic Simulations of Multibody Systems by Murilo G. Coutinho.
- Real-Time Collision Detection by Christer Ericson.
General introductory physics resources, not meant specifically for games or simulations, but with high quality explanations:
- The Feynman Lectures on Physics, Volume I by Feynman, Leighton, and Sands.
- Fundamentals of Physics I by Ramamurti Shankar. Also on YouTube.
What is Rollback Netcode? by Muno illustrates rollback netcode using gifs. It gives an intuition for some of the problems that networking can face in games.
Glenn Fiedler wrote many articles about networking in different series.
There are notable libraries known to be used by some engines. They satisfy requirements such as ease of integration, ease of debugging, good performance, …
7. Starting on Your First Job
You do not need to know everything about engines to start working as an engine programmer. And when you start, you will then be learning even more on the job.
Mike Acton gives his advice to new engine programmers in his talk Solving the Right Problems for Engine Programmers.
An engine can be a very large program, and learning your way around your company’s engine can be intimiading. Jeremy Ong gives advice in Grokking Big Unfamiliar Codebases.
Jeremy Ong also gives an overview of the important lenses through which he evaluates engines: How I Evaluate Game Engines.
- Teach Yourself Programming in Ten Years by Peter Norvig, general advice about learning programming.
- Teach Yourself Computer Science by Oz Nova and Myles Byrne, a more general list of resources for self-learning computer science.
- Handmade Network, a community of programmers, many of whom have an interest in engine programming. Their Discord server is a good place to ask questions when you need help.
Q: How were the resources listed here chosen?
A: I used many of the resources myself when learning. Some have been recommended by other people, in which case I check that they are relevant, that they meet quality standards, and that they fill an obvious gap. I avoid adding many redundant resources, if I find a better one I replace the previous one.
Q: Is engine programming right for me?
A: If you just want to make games, you can use an existing engine such as Unreal. On the other hand, people drawn to making engines are in it for the pleasure of low-level programming, of knowing how everything works, of doing things themselves, and of achieving high quality results. You may find the resources listed here useful even if you do not plan on becoming an engine programmer.
Q: Who wrote this page?
A: I’m Radek Jurga, I work as an engine programmer. I studied physics and then learned programming on my own, using many of the resources listed above. I initially wrote this page for a friend who I was mentoring. At the time, he was a physician, and using this guide he succesfully changed career to AAA game development. I joined the same studio and we now work together. This page is online in the hope that other people will find it useful too.