Start free trial
Trending New Genres Authors
EnglishEnglish
EspañolSpanish
简体中文Chinese
繁體中文Chinese (Traditional)
FrançaisFrench
DeutschGerman
日本語Japanese
PortuguêsPortuguese
ItalianoItalian
한국어Korean
РусскийRussian
NederlandsDutch
العربيةArabic
PolskiPolish
हिन्दीHindi
Tiếng ViệtVietnamese
SvenskaSwedish
ΕλληνικάGreek
TürkçeTurkish
ไทยThai
ČeštinaCzech
RomânăRomanian
MagyarHungarian
УкраїнськаUkrainian
IndonesiaIndonesian
DanskDanish
SuomiFinnish
БългарскиBulgarian
עבריתHebrew
NorskNorwegian
HrvatskiCroatian
CatalàCatalan
SlovenčinaSlovak
LietuviųLithuanian
SlovenščinaSlovenian
СрпскиSerbian
EestiEstonian
LatviešuLatvian
فارسیPersian
മലയാളംMalayalam
தமிழ்Tamil
اردوUrdu
Searching...
SoBrief
Game Development Patterns and Best Practices

Game Development Patterns and Best Practices

Better games, less hassle
Build game systems that adapt to change, without paying for flexibility you do not need.
by John P. Doran 2017 361 pages
3.90
20 ratings
Listen
Immersive
V2.3
Amazon Kindle Audible
Try Full Access for 3 Days
Unlock listening & more!
Continue

Key Takeaways

Treat patterns as change-management tools, not architectural decoration.

Design for the likely change. Game plans shift: a level, enemy, or core mechanic can change after testing, and tightly connected code makes each adjustment risky. Design patterns are reusable approaches to recurring problems, not ready-made code to install. Start by identifying what is likely to vary, then isolate it behind a clear interface. Keep the solution as simple as the problem allows, since extra layers cost time and can slow execution.

Make code legible. Named constants are easier to revise than scattered numbers; consistent spacing, descriptive names, and comments about intent help teammates maintain the work. The goal is not maximum abstraction. It is code that can absorb a plausible design change without forcing unrelated systems to change too.

Analysis

What's valuable here is the emphasis on the cost of revision, not the prestige of a pattern. This resembles a useful principle in system design: isolate the parts with high uncertainty, while keeping stable parts straightforward. The risk is that teams can mistake imagined future flexibility for a real requirement and build elaborate frameworks too early. A disciplined test is practical: name the change the design must support, then ask whether the abstraction makes that change cheaper without making ordinary work harder.

Make only genuinely unique engine services globally accessible.

Use global access sparingly. A Singleton provides a single instance that code can reach without passing it through every function. The Mach5 engine uses this approach for services such as application, graphics, input, and object management, where a second instance would generally make little sense. The convenience comes with a cost: hidden dependencies are harder to trace, test, and reuse, and a future feature such as cooperative play may overturn the assumption that something is unique.

Control its lifetime. The book presents several C++ implementations, including a function-local static instance that is destroyed automatically, and a static-only engine interface whose initialization order is explicit. Its practical rule is to limit variables and services to the narrowest scope that works, rather than turning every manager into a global.

Analysis

A Singleton is best understood as a policy about ownership and access, not merely a coding trick. That framing helps explain why one global graphics service may be reasonable in a small engine but a global gameplay state can become a source of invisible coupling. Dependency injection, where a needed service is passed explicitly, makes relationships easier to inspect and test. The tradeoff is real: explicit wiring adds setup work. The right choice depends on whether the service is truly unique and whether global access hides important variation.

Assemble game objects from behaviors instead of inheritance branches.

Avoid the everything-object. A single game-object struct can grow to hold unrelated fields for players, missiles, bombs, and interface buttons. A small shooter example quickly accumulates more than 25 fields, many unused by most objects. A long inheritance tree improves this by separating types, but similar behaviors then get duplicated or pushed into a bloated base class. Multiple inheritance can add further ambiguity, as in the C++ diamond problem.

Compose what varies. The book's Component Object Model keeps an object relatively simple and gives it a collection of components for graphics, collision, input, or behavior. Components can be added, removed, and combined, including at runtime. Archetype files can let designers choose combinations without changing engine code. This flexibility has costs, including pointer-heavy access, allocation, and virtual calls, so performance should be measured.

Analysis

Composition is powerful because game categories are often unstable: a new design may combine abilities that do not fit a tidy family tree. The component approach treats behavior as a set of capabilities rather than a permanent identity, which is a better match for experimentation. It is not automatically faster or simpler, however. Numerous tiny components can make data scattered and iteration costly. The book's strength is acknowledging that flexibility is most useful while design is moving, not claiming that every finished game should preserve every abstraction forever.

Give each discrete behavior explicit entry, update, and exit rules.

Make state changes visible. A Finite State Machine (FSM) represents behavior through a defined set of states and transitions. A simple enemy might be idle until the player comes close, pursue the player while nearby, and die when hit. Separating what happens on entry, during each update, and on exit prevents repeated setup work and makes transitions easier to inspect. The Mach5 example uses separate Find, Rotate, and Go states for an enemy that chooses a destination and travels toward it.

Use states where they clarify. A machine can organize menus, stages, player actions, and enemy AI. Multiple machines can give one object separate behaviors. But adding states can make an FSM unwieldy, and similar logic may be duplicated. The book identifies behavior trees as one alternative used for more complex AI.

Analysis

The entry-update-exit structure resembles a small protocol: each state has defined responsibilities and a controlled way to hand off to the next. That makes temporal behavior easier to reason about than a tangle of conditionals. The limitation is combinatorial growth. If an enemy has movement, alertness, damage, and weapon modes, one giant machine can multiply states to represent every combination. Separating relatively independent machines can help, but only if their interactions remain understandable.

Decouple construction, then let data files define object archetypes.

Depend on abstractions. The Dependency Inversion Principle says high-level systems should rely on abstractions, not specific low-level classes. A stage manager should work with a common stage interface rather than a growing switch statement naming every menu and level. A factory moves the decision about which concrete object to create out of the system that uses it. The book progresses from a simple switch-based factory to a registry of builders that can be added or removed.

Clone configured examples. A Prototype supplies a Clone operation so code can copy an object without knowing its exact type. Mach5 loads an archetype and its component settings from an INI file, then clones it when the game needs another instance. The file is read once rather than repeatedly during play; the book estimates disk access can be 10,000 to 50,000 times slower than using data already in memory.

Analysis

Factories and prototypes solve different parts of the same boundary problem. A factory answers which kind of object to create; a prototype answers how to make another configured instance without hardwiring its type into the caller. Moving balance values into files also changes who can safely make changes, giving designers room to tune without recompiling. The caution is that configuration formats become interfaces of their own. Validation and useful error messages matter, or flexibility simply relocates bugs from code into data.

Reuse short-lived objects and share stable data across instances.

Pool frequent creations. Bullets and particles may be created and discarded in large numbers. Repeated allocation can cost time and fragment memory, so an Object Pool keeps reusable instances available. A request takes an unused object, and releasing it makes it available again. This is most useful when many objects are used briefly. A pool can also waste memory if it retains a rare peak number of objects for the whole game.

Share what does not vary. The Flyweight pattern separates shared, stable data from per-instance data. In the book's particle example, lifetime and scale rules can belong to a shared particle-system object, while each particle retains its own position and remaining life. Pooling reduces repeated creation; Flyweight reduces duplicated data. These are different optimizations, and neither should be added without checking whether memory or allocation is an actual constraint.

Analysis

These patterns address two distinct forms of waste: the cost of repeatedly constructing objects and the cost of storing identical values many times. That distinction prevents a common design error, applying a pool when the real problem is duplicated state, or sharing mutable data that should be independent. Both techniques also complicate ownership and reset rules. A pooled bullet must not retain stale velocity or state, while shared particle configuration must remain separate from changing particle properties.

Package actions as commands so buttons do not own game logic.

Separate the request from its effect. The Command pattern wraps an action and the information it needs in an object with a shared Execute interface. A button can trigger a command without knowing whether it changes stages, alters an object, or performs another action. This is safer than embedding screen coordinates and stage-switching logic in a menu, where resizing or changing the action would require edits in several places.

Keep actions reusable. The same command can be triggered by a button, keyboard, or controller, and can be prepared for execution later. Commands can also support undo and redo by storing the previous values an action changes. The C++ function-pointer and member-function-pointer mechanics can be awkward, but the larger design benefit is that the caller no longer needs to understand the called function's details.

Analysis

A command turns an instruction into data that can be stored, passed, or replayed. That is why it fits both interface controls and editor undo histories: the system records an operation rather than taking a full snapshot of everything. The pattern also makes responsibility clearer, since a button detects input while a command performs an action. The cost is another layer of indirection, which can make debugging less direct if commands are created or dispatched through opaque systems.

Notify observers when values change instead of making systems poll.

Publish meaningful changes. The Observer pattern links one Subject to multiple Observers. When a player's health changes, the player can notify a health display, a health bar, and stage logic that checks for defeat. Without notification, each system might repeatedly search for the player and ask for the same value, even when nothing has changed. The push version sends the changed data to observers; the pull version sends the subject, allowing each observer to request what it needs.

Manage references carefully. Push communication reduces dependencies, while pull communication is more flexible but can couple observers to particular subject types. Either version must handle object lifetimes: a subject must not call an observer through a pointer to an object that has already been destroyed. The pattern can also become difficult to trace if too many systems notify one another.

Analysis

Notification is a form of event-driven coordination: work happens in response to a change rather than on a constant checking schedule. That can improve clarity as well as avoid needless repeated queries. The central design question is not simply which objects need data, but who owns the relationship and how it ends. Weakly coupled communication still depends on reliable lifecycle rules. Without those rules, an observer list can turn a clean interface into a network of stale references.

Synchronize drawing, but make movement depend on elapsed time.

Protect the displayed frame. With double buffering, the game draws into a back buffer while the monitor displays a front buffer. Swapping them at the wrong time can still produce tearing; VSync waits for the monitor's refresh interval before swapping. Triple buffering adds another drawing buffer and can avoid some stalls, but it uses more memory and can increase input delay. Each choice trades smooth presentation, responsiveness, and resources.

Advance simulation by time. Moving an object by a fixed amount every frame makes speed depend on frame rate. Instead, update position and velocity using elapsed time, often called delta time. The book demonstrates Euler integration, whose error grows with the size of the time step: smaller steps at higher update rates produce closer results. Rendering rate and simulation behavior are connected, but they are not the same problem.

Analysis

The useful distinction is between the game's simulation clock and the display's presentation rhythm. Buffering governs when a completed image becomes visible; time-based movement governs how the world evolves between updates. Treating these as one issue encourages poor fixes, such as tying character speed to refresh rate. Delta-time integration is not exact, though, especially when frame times vary sharply. The book's central advice remains practical: use elapsed time, and choose an integration method suited to the required accuracy.

Prototype early, observe players, and choose scripts for fast tuning.

Test the experience before polishing. The book recommends a repeated cycle: make a small prototype, put it in front of players, observe what they do, and revise or remove features. A paper version of Tetris can test basic shape and pacing ideas in minutes, before code and art consume much more time. During a playtest, avoid explaining the controls immediately; confusion and unexpected actions reveal what the game communicates poorly. Feedback is evidence to weigh, not an order to obey.

Match the language to the work. Scripts let designers adjust gameplay, levels, and triggers without rebuilding the whole project. They are also useful for prototypes and modding. C++ offers more control and performance for demanding systems, while scripts can be slower and may introduce runtime costs. The book's practical approach is to prototype in a flexible form, then optimize measured bottlenecks when needed.

Analysis

The strongest development loop combines observation with reversible decisions. A prototype is valuable not because it predicts success perfectly, but because it makes a weak assumption cheap to discover. Watching behavior can also reveal a gap between what players say and what they actually understand. Scripting extends that learning loop by shortening the distance between an idea and a playable test. It still requires boundaries: designers need tools that expose safe changes, and performance claims should be verified in the target game.

Analysis

The book's central argument is that game code should be organized around anticipated change, but not every possible change. Its examples trace a progression from fragile code to explicit boundaries: a monolithic object gives way to components; sprawling conditionals give way to states; direct construction gives way to factories and prototypes; constant querying gives way to notification. These are not isolated recipes. Together, they shift responsibility toward the part of the program best equipped to handle it.

The most useful tension is between flexibility and cost. Components enable rapid combinations but scatter data and add indirection. Pools avoid repeated allocation but retain memory. Observers reduce polling while creating lifetime hazards. VSync avoids tearing but can increase latency or constrain frame rates. The book is most credible when it names these tradeoffs rather than presenting patterns as universal upgrades. Its guidance to prioritize algorithms and measured bottlenecks over tiny optimizations follows the same logic: optimize the actual constraint, not the imagined one.

A second theme is organizational. Data files and scripts do more than reduce recompilation. They redistribute work, allowing designers to tune values and test variations without asking programmers to alter source code for every adjustment. That makes architecture a production tool as much as a technical one. The book's development advice completes the picture: prototypes and observed playtests supply evidence about which changes are worth supporting.

The text is rooted in C++ and a small 2D engine, so its exact implementation choices are not universal. Modern engines may provide components, event systems, scripting, and memory tools already. The transferable lesson is therefore not to reproduce Mach5's architecture, but to understand the problem each pattern isolates, its costs, and the evidence that justifies adopting it. Patterns are most valuable when they shorten the next change without obscuring the current program.

Summary in 30 Seconds
Organize code around likely changes, and keep abstractions only when they reduce the cost of those changes. Combine objects from independent behaviors, use explicit states for transitions, and move construction choices into factories and data files. Reuse frequently created objects only when allocation is a real bottleneck. Notify systems when values change, and base movement on elapsed time rather than frame count. Prototype early, watch players, and tune through scripts.
Contains spoilers

Last updated:

Report Issue

Review Summary

3.90 out of 5
Average of 20 ratings from Goodreads and Amazon.

The book Game Development Patterns and Best Practices receives generally positive reviews, with an average rating of 3.89 out of 5. Readers appreciate the coverage of important design patterns and techniques, particularly the Component Object Model. The book also explores graphics basics and code quality. However, some criticize the focus on C++ and the inclusion of the Singleton pattern. While informative, readers find it good but not exceptional, noting both pros and cons in its approach to game development concepts.

Your rating:
4.41
121 ratings
Want to read the full book?

Glossary

Design patterns

Reusable problem-solving approaches

Design patterns are established approaches to recurring software design problems. They describe a structure and division of responsibilities, not a code library that can be copied unchanged into every project. Their implementation depends on the language and system. In this book, patterns are tools for making game code easier to understand, reuse, and modify.

Separation of concerns

Isolate distinct responsibilities

Separation of concerns means dividing a program into parts that each address a distinct reason the code might change. A graphics system, input system, and gameplay behavior should avoid unnecessary overlap. This makes it easier to modify one area without disturbing unrelated areas, and provides the foundation for many of the patterns discussed in the book.

Singleton pattern

One globally accessible instance

The Singleton pattern restricts a class to a single instance and provides a shared way to access it. The book uses Singleton-like access for core Mach5 services, including application and graphics functions. It can simplify access to services that are truly unique, but global access hides dependencies and can make code harder to test, reuse, or adapt when the assumption of one instance changes.

Component Object Model

Compose objects from components

In this book, the Component Object Model is a game-object design in which an object holds a flexible collection of components. Components supply capabilities such as graphics, collision, input, or AI, and can be combined or removed without creating a specialized inheritance class for every combination. This supports design changes and data-driven object definitions, at the cost of additional indirection and allocation.

Finite State Machine

Behavior organized into states

A Finite State Machine represents a system using a limited set of defined states and rules for moving between them. An enemy might switch from idle to pursuit when a player approaches, then stop pursuing when the player leaves range. State logic can separate entry, ongoing update, and exit behavior. Large machines can become difficult to maintain as states and interactions multiply.

Dependency Inversion Principle

Depend on abstractions

The Dependency Inversion Principle says high-level modules should not depend directly on low-level implementation details. Both should rely on abstractions, and the abstractions should not depend on those details. For example, a stage manager can operate through a shared stage interface instead of naming every specific menu and level, making the manager easier to reuse when game content changes.

Factory Method pattern

Create objects behind an interface

The Factory Method pattern provides an interface for creating objects while keeping the specific construction choice away from the code that uses them. In the book's engine, builders create stages, components, or objects, and a factory selects a builder using a type key. This reduces direct dependencies on concrete classes and allows creation choices to be registered or changed.

Prototype pattern

Copy without knowing type

The Prototype pattern creates a new object by asking an existing configured object to clone itself. A caller can work through a base type or common interface without knowing the exact derived type or invoking its specific constructor. Mach5 uses prototypes to copy objects and their components after loading archetype definitions, avoiding repeated file reads during gameplay.

Object Pool pattern

Reuse allocated objects

The Object Pool pattern retains a collection of objects for reuse rather than repeatedly allocating and destroying them. A client acquires an unused object and releases it when finished, making it available again. This can help with many short-lived objects such as bullets. Pools require careful reset and ownership rules, and can waste memory if they retain an unusually large peak allocation.

Command pattern

Represent an action as an object

The Command pattern wraps an action and any information it needs in an object with a common execution interface. A button or input system can trigger the command without knowing the details of the action. Commands can be stored or passed for later execution, and can support undo by retaining the previous values changed by an operation.

Observer pattern

Notify interested objects

The Observer pattern connects a Subject holding changing data to one or more Observers that need to react. When the Subject changes, it notifies its Observers instead of requiring each one to repeatedly request the data. The approach can reduce coupling and unnecessary polling, but requires careful management of references so a Subject does not notify an Observer that has been destroyed.

Flyweight pattern

Share common object data

The Flyweight pattern reduces duplicated memory by separating data that can be shared from data that varies by individual instance. Shared, intrinsic state can include common particle lifetime or scaling rules; extrinsic state, such as position or remaining lifetime, belongs to a particular particle. A factory can manage and return shared Flyweight objects.

VSync

Synchronize frame swaps

VSync coordinates the swapping of displayed and rendered buffers with a monitor's refresh interval. Waiting for the appropriate interval can prevent tearing, where parts of different frames appear together. Synchronization can also introduce delays or reduce frame rates when a game misses a refresh. It addresses presentation timing, not the underlying rate of game simulation.

Euler Integration

Approximate motion over time

Euler Integration updates position and velocity in small time steps using current velocity and acceleration. It is a simple way to simulate motion in a game, but its accuracy depends on the size of the step and the changing forces or acceleration. Smaller steps generally reduce the approximation error, while more demanding simulations may require another integration method.

About the Author

John P. Doran is a game developer and author specializing in game development patterns and best practices. John P. Doran has written extensively on topics such as the Component Object Model, State, Prototype, Factory Method, Command, Observer, and Flyweight patterns. His work focuses on helping developers create efficient and well-structured game code. Doran's expertise extends to graphics programming and code quality improvement. While his book has been well-received overall, some readers have critiqued certain aspects, such as the inclusion of the Singleton pattern. Despite this, Doran's contributions to game development literature are considered valuable by many in the field.

Download PDF

To save this Game Development Patterns and Best Practices summary for later, download the free PDF. You can print it out, or read offline at your convenience.
Download PDF
File size: 0.34 MB     Pages: 18

Download EPUB

To read this Game Development Patterns and Best Practices summary on your e-reader device or app, download the free EPUB. The .epub digital book format is ideal for reading ebooks on phones, tablets, and e-readers.
Download EPUB
File size: 1.40 MB     Pages: 22
Want to read the full book?
Follow
Listen
Home
Swipe
Library
Get App
Try Full Access for 3 Days
Listen, bookmark, and more
Compare Features Free Pro
📖 Read Summaries
Read unlimited summaries. Free users get 3 per month
🎧 Listen to Summaries
Listen to unlimited summaries in 40 languages
—
❤️ Unlimited Bookmarks
Free users are limited to 4
—
📜 Unlimited History
Free users are limited to 4
—
📥 Unlimited Downloads
Free users are limited to 1
—
Risk-Free Timeline
Today: Get Instant Access
Listen to full summaries of 26,000+ books. That's 12,000+ hours of audio!
Day 2: Trial Reminder
We'll send you a notification that your trial is ending soon.
Day 3: Your subscription begins
You'll be charged on Nov 24,
cancel anytime before.
Consume 2.8× More Books
2.8× more books Listening Reading
Our users love us
1M+ readers
Trustpilot Rating
TrustPilot
4.6 Excellent
This site is a total game-changer. I've been flying through book summaries like never before. Highly, highly recommend.
— Dave G
Worth my money and time, and really well made. I've never seen this quality of summaries on other websites. Very helpful!
— Em
Highly recommended!! Fantastic service. Perfect for those that want a little more than a teaser but not all the intricate details of a full audio book.
— Greg M
Save 62%
Yearly
$119.88 $44.99/year/yr
$3.75/mo
Monthly
$9.99/mo
Start a 3-Day Free Trial
3 days free, then $44.99/year. Cancel anytime.
Unlock a world of fiction & nonfiction books
26,000+ books for the price of 2 books
Read any book in 10 minutes
Discover new books like Tinder
Request any book if it's not summarized
Read more books than anyone you know
#1 app for book lovers
Lifelike & immersive summaries
30-day money-back guarantee
Download summaries in EPUBs or PDFs
Cancel anytime in a few clicks

Why one summary?

Scanner
Find a barcode to scan

⭐
⭐
⭐
We have a special gift for you
Open
38% off
DISCOUNT FOR YOU
⭐
⭐
⭐
$79.99
$49.99/year
Only $4.16 per month
Continue
2 taps to start, super easy to cancel
Settings
General
Widget
Loading...