Game Development Patterns with Unreal Engine 5: Build maintainable and scalable systems with C++ and Blueprint
9781803243252
Learn how design patterns offer the tools and practices to write code faster and more easily with Game Development Patte
162
105
13MB
English
Pages 288
Year 2023
Report DMCA / Copyright
DOWNLOAD EPUB FILE
Table of contents :
Game Development Patterns with Unreal Engine 5
Foreword
Contributors
About the authors
About the reviewer
Preface
Who this book is for
What this book covers
To get the most out of this book
Download the example code files
Conventions used
Get in touch
Share Your Thoughts
Once you’ve read Game Development Patterns with Unreal Engine 5, we’d love to hear your thoughts! Please click here to go straight to the Amazon review page for this book and share your feedback.
Download a free PDF copy of this book
Part 1:Learning from Unreal Engine 5
1
Understanding Unreal Engine 5 and its Layers
Technical requirements
Introducing Unreal Engine 5
Installing Unreal Engine 5 and preparing your development environment
The “Fuzzy” layer – bridging the gap from C++ to Blueprint
Property Specifiers
Function Specifiers
Useful inheritance
Translating back from Blueprint to C++
Worked example
Summary
Questions
Answers
2
“Hello Patterns”
Technical requirements
S.O.L.I.D. principles
Single responsibility
Open-closed
Liskov substitution
Interface segregation
Dependency inversion
Exploring solutions to common problems
The moving box problem
The rotating box problem
The cascading cast chain problem
The trade-off
Summary
3
UE5 Patterns in Action – Double Buffer, Flyweight, and Spatial Partitioning
Technical requirements
Double buffer
Flyweight
Spatial partitioning
Introducing World Partition
Understanding when objects are loaded
Ensuring actors are loaded when required
Enabling World Partition on an existing level
Summary
4
Premade Patterns in UE5 – Component, Update Method, and Behavior Tree
Technical requirements
Understanding and creating components
Applying the update method for prototyping gameplay
Working with behavior trees
Creating the AI controller
Creating the Blackboard asset
Building the behavior tree
Summary
Part 2: Anonymous Modular Design
5
Forgetting Tick
Technical requirements
Before we begin
A world that ticks
A clock that stops
Event driven systems
Summary
6
Clean Communication – Interface and Event Observer Patterns
Technical requirements
Interfacing communication across classes in UE5
Blueprint interfaces
Interface events versus functions
Interfaces in C++
Building an example interface communication
Implementing event delegate communication across UE5
Event delegates in Blueprint
Event delegates in C++
Building a useful delegate tool
Summary
7
A Perfectly Decoupled System
Technical requirements
Using UML to plan a sample hierarchy
What are the types of class relations?
What is a sequence diagram?
Decoupling the reference train
Modularity and decoupling
Establishing infrastructure
Implementing decoupled design in an example
Benefits of decoupling
Summary
Part 3: Building on Top of Unreal
8
Building Design Patterns – Singleton, Command, and State
Technical requirements
Implementing a Singleton pattern – understanding why it’s a Pandora’s box
Implementing the Command pattern for different use cases
Command pattern for undo functionality in Blueprint Utilities
Command pattern for gameplay in C++
Creating the many levels of a state machine
Exploring animation state machines
Enum/switch implementation
Static versus instanced states
Concurrent state machines
Hierarchical state machines
Pushdown automata
Summary
9
Structuring Code with Behavioral Patterns – Template, Subclass Sandbox, and Type Object
Technical requirements
Exploring the template pattern
Building the template (parent class)
Creating child classes
Template pistol
Template shotgun
Understanding subclass sandbox
Building the sandbox (parent class)
Creating child classes
Sandbox pistol
Sandbox shotgun
Type object pattern
Variants
Data Tables
Data Assets
Summary
10
Optimization through Patterns
Technical requirements
Using dirty flags to reduce unnecessary processing
Application of dirty flags
How data locality affects code efficiency
Hot/cold splitting
Contiguous arrays
Object pooling our resources to save time later
Implementing object pooling
Making an object pool
Summary
Index
Why subscribe?
Other Books You May Enjoy
Packt is searching for authors like you
Download a free PDF copy of this book