Chapter 1, Introduction to Design Patterns, introduces the concept of design patterns and how they can benefit our projects. We also dive into learning about the advantages of compartmentalizing our code and set up a sample project that we can use to build upon in the book.
Chapter 2, One Instance to Rule Them All – Singletons, discusses the well-known singleton pattern, explaining common arguments for and against having a single instance that’s accessible globally within our game.
Chapter 3, Creating Flexibility with the Component Object Model, explores how to create a large amount of different game object types while minimizing code duplication.
Chapter 4, Artificial Intelligence Using the State Pattern, shows the usage of states to allow a game object to change its behavior and functionality due to different stimuli in your game. We discuss and apply how we can use this concept in both player behavior and artificial intelligence.
Chapter 5, Decoupling Code via the Factory Method Pattern, explains how we separate our specific game objects from our game engine. This will allow us to reuse all or at least part of our game engine for future games.
Chapter 6, Creating Objects with the Prototype Pattern, covers another way to reduce dependencies within our game engine. We learn how to create objects through their base classes. In addition, we cover how to read object data from a file.
Chapter 7, Improving Performance with Object Pools, covers a way to improve memory costs in our games by reusing objects that we’ve created dynamically by making use of a manager to control what is and isn’t being used at the moment.
Chapter 8, Controlling the UI via the Command Pattern, discusses how to create reusable actions that can be utilized for UI button clicks or input devices such as keyboard or controller.
Chapter 9, Decoupling Gameplay via the Observer Pattern, explains multiple ways that classes can communicate and share data without using global variables.
Chapter 10, Sharing Objects with the Flyweight Pattern, discusses how we can design our objects to be as lightweight as possible by separating data that can and can't be shared. We use this knowledge to create a particle system which produces smaller objects developed to simulate things like fire, explosions, and smoke.
Chapter 11, Understanding Graphics and Animation, provides a low-level explanation of how graphics and rendering work so that you are better able to implement it in your game.
Chapter 12, Best Practices, covers a number of topics that will improve your code and game projects in the future, touching on things like how to improve your code quality, use the const keyword correctly, how iteration is a great way to improve game and code design, and when you should consider adding scripting to your game.