Game Development Patterns and Best Practices

Utilize proven solutions to solve common problems in game development

Game Development Patterns and Best Practices

John P. Doran, Matt Casanova

1 customer reviews
Utilize proven solutions to solve common problems in game development
Mapt Subscription
FREE
$29.99/m after trial
eBook
$25.20
RRP $35.99
Print + eBook
$44.99
RRP $44.99
What do I get with a Mapt Pro subscription?
  • Unlimited access to all Packt’s 5,000+ eBooks and Videos
  • Early Access content, Progress Tracking, and Assessments
  • 1 Free eBook or Video to download and keep every month after trial
What do I get with an eBook?
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with Print & eBook?
  • Get a paperback copy of the book delivered to you
  • Download this book in EPUB, PDF, MOBI formats
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
What do I get with a Video?
  • Download this Video course in MP4 format
  • DRM FREE - read and interact with your content when you want, where you want, and how you want
  • Access this title in the Mapt reader
$0.00
$25.20
$44.99
$29.99p/m after trial
RRP $35.99
RRP $44.99
Subscription
eBook
Print + eBook
Start 30 Day Trial
Subscribe and access every Packt eBook & Video.
 
  • 5,000+ eBooks & Videos
  • 50+ New titles a month
  • 1 Free eBook/Video to keep every month
Start Free Trial
 
Preview in Mapt

Book Details

ISBN 139781787127838
Paperback394 pages

Book Description

You’ve learned how to program, and you’ve probably created some simple games at some point, but now you want to build larger projects and find out how to resolve your problems. So instead of a coder, you might now want to think like a game developer or software engineer. To organize your code well, you need certain tools to do so, and that’s what this book is all about.

You will learn techniques to code quickly and correctly, while ensuring your code is modular and easily understandable.

To begin, we will start with the core game programming patterns, but not the usual way. We will take the use case strategy with this book. We will take an AAA standard game and show you the hurdles at multiple stages of development. Similarly, various use cases are used to showcase other patterns such as the adapter pattern, prototype pattern, flyweight pattern, and observer pattern. Lastly, we’ll go over some tips and tricks on how to refactor your code to remove common code smells and make it easier for others to work with you. By the end of the book you will be proficient in using the most popular and frequently used patterns with the best practices.

 

Table of Contents

Chapter 1: Introduction to Design Patterns
Chapter overview
Your objective
Why you should plan for change
Separating the why and the how
An Introduction to interfaces
The advantages of compartmentalizing code
The problems with using design patterns in games
Setting up the project
Summary
Chapter 2: One Instance to Rule Them All - Singletons
Chapter overview
Your objective
An overview on class access specifiers
The static keyword
Pros and cons of global variables
What is a Singleton?
Learning about templates
Templatizing Singletons
Advantages/disadvantages of using only one instance
The Singleton in action - the Application class
Summary
Chapter 3: Creating Flexibility with the Component Object Model
Chapter overview
Why a monolithic game object is a bad design
Why inheritance hierarchies are inflexible
The Strategy pattern and the Decorator pattern
The Component Object Model explained
Performance concerns
Summary
Chapter 4: Artificial Intelligence Using the State Pattern
Chapter overview
Summary
Chapter 5: Decoupling Code via the Factory Method Pattern
Chapter overview
Your objective
The Dependency Inversion Principle
The Factory method pattern
Creating a component and Object Factory
Architecting versus over-architecting
Summary
Chapter 6: Creating Objects with the Prototype Pattern
Your objectives
The Prototype pattern explained
Examples of the clone method in Mach5
Loading archetypes from a file
Summary
Chapter 7: Improving Performance with Object Pools
Chapter overview
Why you should care about memory
The Object Pool pattern explained
Implementing a basic object pool
Operator overloading in C++
Building the object pool for Mach5
Issues with object pools
Summary
Chapter 8: Controlling the UI via the Command Pattern
Chapter overview
How can we control actions through buttons?
The Command pattern explained
The benefits of the command pattern
Easy UI with commands in Mach5
Summary
Chapter 9: Decoupling Gameplay via the Observer Pattern
Chapter overview
How gameplay creeps into every system
The Observer pattern explained
Benefits of using the Observer pattern
Summary
Chapter 10: Sharing Objects with the Flyweight Pattern
Chapter overview
Introductions to particles
Implementing particles in Mach5
Why memory is still an issue
Introduction to the Flyweight pattern
Transitioning to ParticleSystems
Summary
Chapter 11: Understanding Graphics and Animation
Chapter overview
Introduction to monitor refresh rates
Double buffering
Triple buffering
LCD monitors
Time-based movement and animation
Summary
Chapter 12: Best Practices
Chapter overview
Learning fundamental code quality techniques
Learning and understand the uses of the const keyword
Learning how iteration can improve your game and code design
Learning when to use scripting in a game
Summary

What You Will Learn

  • Implement key data interaction techniques to enable seamless online gaming
  • Reduce the maintenance burden with well-tested, cleaner code
  • Employ the singleton pattern effectively to reduce your compiler workload
  • Use the factory pattern to help you create different objects with the same creation logic and reduce coding time
  • Improve game performance with Object Pools
  • Allow game play to interact with physics or graphics in an abstract way
  • Refractor your code to remove common code smells

Authors

Table of Contents

Chapter 1: Introduction to Design Patterns
Chapter overview
Your objective
Why you should plan for change
Separating the why and the how
An Introduction to interfaces
The advantages of compartmentalizing code
The problems with using design patterns in games
Setting up the project
Summary
Chapter 2: One Instance to Rule Them All - Singletons
Chapter overview
Your objective
An overview on class access specifiers
The static keyword
Pros and cons of global variables
What is a Singleton?
Learning about templates
Templatizing Singletons
Advantages/disadvantages of using only one instance
The Singleton in action - the Application class
Summary
Chapter 3: Creating Flexibility with the Component Object Model
Chapter overview
Why a monolithic game object is a bad design
Why inheritance hierarchies are inflexible
The Strategy pattern and the Decorator pattern
The Component Object Model explained
Performance concerns
Summary
Chapter 4: Artificial Intelligence Using the State Pattern
Chapter overview
Summary
Chapter 5: Decoupling Code via the Factory Method Pattern
Chapter overview
Your objective
The Dependency Inversion Principle
The Factory method pattern
Creating a component and Object Factory
Architecting versus over-architecting
Summary
Chapter 6: Creating Objects with the Prototype Pattern
Your objectives
The Prototype pattern explained
Examples of the clone method in Mach5
Loading archetypes from a file
Summary
Chapter 7: Improving Performance with Object Pools
Chapter overview
Why you should care about memory
The Object Pool pattern explained
Implementing a basic object pool
Operator overloading in C++
Building the object pool for Mach5
Issues with object pools
Summary
Chapter 8: Controlling the UI via the Command Pattern
Chapter overview
How can we control actions through buttons?
The Command pattern explained
The benefits of the command pattern
Easy UI with commands in Mach5
Summary
Chapter 9: Decoupling Gameplay via the Observer Pattern
Chapter overview
How gameplay creeps into every system
The Observer pattern explained
Benefits of using the Observer pattern
Summary
Chapter 10: Sharing Objects with the Flyweight Pattern
Chapter overview
Introductions to particles
Implementing particles in Mach5
Why memory is still an issue
Introduction to the Flyweight pattern
Transitioning to ParticleSystems
Summary
Chapter 11: Understanding Graphics and Animation
Chapter overview
Introduction to monitor refresh rates
Double buffering
Triple buffering
LCD monitors
Time-based movement and animation
Summary
Chapter 12: Best Practices
Chapter overview
Learning fundamental code quality techniques
Learning and understand the uses of the const keyword
Learning how iteration can improve your game and code design
Learning when to use scripting in a game
Summary

Book Details

ISBN 139781787127838
Paperback394 pages
Read More
From 1 reviews

Read More Reviews