3 options
Game development patterns and best practices : better games, less hassle / John P. Doran, Matt Casanova.
- Format:
- Book
- Author/Creator:
- Doran, John P., author.
- Casanova, Matt, author.
- Language:
- English
- Subjects (All):
- Video games--Programming.
- Video games.
- Physical Description:
- 1 online resource (367 pages) : illustrations (some color)
- Edition:
- 1st edition
- Place of Publication:
- Birmingham, England ; Mumbai, [India] : Packt, 2017.
- System Details:
- text file
- Summary:
- Utilize proven solutions to solve common problems in game development About This Book Untangle your game development workflow, make cleaner code, and create structurally solid games Implement key programming patterns that will enable you to make efficient AI and remove duplication Optimize your game using memory management techniques Who This Book Is For If you are a game developer who wants to solve commonly-encountered issues or have some way to communicate to other developers in a standardized format, then this book is for you. Knowledge of basic game programming principles and C++ programming is assumed. What You Will Learn Learn what design patterns are and why you would want to use them 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 In Detail 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. Style and approach This book takes a step-by-step real-life case studies approach. Every pattern is first explained using a bottleneck. We will show you a problem in your everyday workflow, and then introduce...
- Contents:
- Cover
- Copyright
- Credits
- About the Authors
- About the Reviewers
- www.PacktPub.com
- Customer Feedback
- Table of Contents
- Preface
- Chapter 1: Introduction to Design Patterns
- Chapter overview
- Your objective
- What are design patterns
- Why you should plan for change
- Understanding UML class diagrams
- Relationships between classes
- Inheritance
- Aggregation
- Composition
- Implements
- Separating the why and the how
- Understanding the separation of concerns
- An Introduction to interfaces
- Polymorphism refresher
- Understanding interfaces
- The advantages of compartmentalizing code
- The structure of the Mach5 engine
- Mach5 core engines and systems
- The app
- The StageManager
- The ObjectManager
- The graphics engine
- Tools and utilities
- The problems with using design patterns in games
- Setting up the project
- Summary
- Chapter 2: One Instance to Rule Them All - Singletons
- An overview on class access specifiers
- The static keyword
- Static keyword inside a function
- Static keyword in class definitions
- Static as a file global variable
- Pros and cons of global variables
- What is a Singleton?
- Keeping the single in Singleton
- Deleting our object correctly
- Learning about templates
- Templatizing Singletons
- Advantages/disadvantages of using only one instance
- The Singleton in action - the Application class
- Chapter 3: Creating Flexibility with the Component Object Model
- Your objectives
- Why a monolithic game object is a bad design
- The monolithic game object
- The problem with object behavior
- The benefits of the monolithic game object
- Why inheritance hierarchies are inflexible
- Organizing the code by what it does, not what it is
- Avoiding the Diamond of Death.
- The Strategy pattern and the Decorator pattern
- The Strategy pattern explained
- The Decorator pattern explained
- The Component Object Model explained
- Implementing the Component Object Model
- Implementing components
- Creating and removing objects and components
- Performance concerns
- Chapter 4: Artificial Intelligence Using the State Pattern
- The State pattern explained
- Introduction to State Machines
- An overview of enumerations
- Acting on states
- Issues with conditionals
- Expanding on the State Machine
- The State pattern in action - the M5StateMachine class
- The State pattern in action - StageManager
- Issues with FSMs
- Chapter 5: Decoupling Code via the Factory Method Pattern
- The trouble with switch statements
- The Dependency Inversion Principle
- The Factory method pattern
- The Static Factory
- The Dynamic Factory
- Creating our Stage Builders
- The template builder
- Creating the Dynamic Factory class
- Using the Dynamic Factory
- Creating a component and Object Factory
- The Templated Factory
- Architecting versus over-architecting
- Chapter 6: Creating Objects with the Prototype Pattern
- The trouble with using a factory for game objects
- Using builders with objects
- Solution - reading from files
- The Prototype pattern explained
- The virtual constructor
- The problem with constructors
- The benefits of a virtual constructor
- We don't need to know the type
- No need to subclass
- It's easy to make exact copies
- Examples of the clone method in Mach5
- The Gfx and collider components
- Cloning an object
- Choosing a copy constructor
- Covariant return types
- Loading archetypes from a file
- Archetype files
- The object manager
- Summary.
- Chapter 7: Improving Performance with Object Pools
- 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
- Chapter 8: Controlling the UI via the Command Pattern
- How can we control actions through buttons?
- Callback functions
- Repeated code in the component
- The Command pattern explained
- Two parameters and beyond
- Pointers to member functions
- Pointer to member command
- The benefits of the command pattern
- Treating a function call like an object
- Physically decoupling the client and the function call
- Temporal decoupling
- Undo and redo
- Easy UI with commands in Mach5
- Using commands
- Chapter 9: Decoupling Gameplay via the Observer Pattern
- How gameplay creeps into every system
- Hardcoding requirements
- Polling
- The Observer pattern explained
- The Subject and Observer
- The Player
- The Observers
- Push versus Pull
- Benefits of using the Observer pattern
- Problems using the Observer pattern
- Dangling references
- Overuse
- Implementing interfaces
- When to notify
- Chapter 10: Sharing Objects with the Flyweight Pattern
- Introductions to particles
- Implementing particles in Mach5
- Why memory is still an issue
- Introduction to the Flyweight pattern
- Transitioning to ParticleSystems
- Creating different system types
- Developing the ParticleFactory
- Using the ParticleFactory
- Chapter 11: Understanding Graphics and Animation
- Introduction to monitor refresh rates
- What is a pixel?.
- The horizontal and vertical blank
- Refresh rate
- Double buffering
- The back buffer
- VSync
- Triple buffering
- LCD monitors
- Time-based movement and animation
- Frame-based movement
- Time-based movement
- Chapter 12: Best Practices
- Learning fundamental code quality techniques
- Avoid magic numbers
- White space
- Indentation
- Blank lines and spaces
- Comments and self-documenting code
- Commenting
- Learning and understand the uses of the const keyword
- Const function parameters
- Const classes as parameters
- Const member functions
- Problems with const
- Learning how iteration can improve your game and code design
- The game development cycle
- Production phase
- Prototyping
- Playtesting
- Conducting a playtest
- Iteration
- Meeting milestones
- Learning when to use scripting in a game
- Introduction to assembly
- Moving to higher-level programming languages
- Introducing the compiler
- Introduction to scripting languages
- Using interpreters
- Just in time compilation
- Why use a scripting language?
- When to use C++
- Compiled versus scripting
- Index.
- Notes:
- Description based on online resource; title from PDF title page (ebrary, viewed July 14, 2017).
- OCLC:
- 987331259
The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.