Robert Nystrom’s game-code patterns, with a practical starting point in state machines.
guide
Original conceptual example inspired by the State chapter, not a reproduction of its diagram. Additional game rules may require different states or transitions. Original explanatory artwork prepared for GameSlash with AI assistance. Documentation is the factual source only; no source imagery reused. Not an official screenshot or gameplay capture. Concept source
Use it for: Character flags that contradict each other, or gameplay code that is hard to change safely.
Start: 1) Read State. 2) Draw standing, jumping, ducking and diving transitions. 3) Try an enum before introducing separate state classes.
Original data-model illustration. Separate independent dimensions can still use separate state machines when appropriate. Original explanatory artwork prepared for GameSlash with AI assistance. Documentation is the factual source only; no source imagery reused. Not an official screenshot or gameplay capture. Concept source
Try checking: Repeated jump presses in mid-air and releasing duck during a jump should not create contradictory states or graphics.
Limits: Examples omit details and teach concepts, not production-ready code or modern C++ style. Reading does not require building the book.