Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Game Development Patterns with Unreal Engine 5
Game Development Patterns with Unreal Engine 5

Game Development Patterns with Unreal Engine 5: Build maintainable and scalable systems with C++ and Blueprint

Arrow left icon
Profile Icon Stuart Butler Profile Icon Tom Oliver
Arrow right icon
€15.99 €23.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5 (17 Ratings)
eBook Jan 2024 254 pages 1st Edition
eBook
€15.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m
Arrow left icon
Profile Icon Stuart Butler Profile Icon Tom Oliver
Arrow right icon
€15.99 €23.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5 (17 Ratings)
eBook Jan 2024 254 pages 1st Edition
eBook
€15.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m
eBook
€15.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Table of content icon View table of contents Preview book icon Preview Book

Game Development Patterns with Unreal Engine 5

Understanding Unreal Engine 5 and its Layers

Design patterns are a series of tools and practices by which we can learn to write faster and easier-to-work-with code.

Applying design patterns to projects developed in Unreal Engine 5 (UE5) will allow you to make your projects more performant, easier to read, and build upon, as well as develop an improved understanding of how the engine works.

We’re going to begin by developing an understanding of the history of Unreal Engine and ensuring that we are all set up to work with the engine, covering some basic ideas of how C++ and Unreal Engine’s visual scripting language, Blueprint, are linked.

In this chapter, we’re going to cover the following main topics:

  • Introducing Unreal Engine 5
  • Installing Unreal Engine 5 and preparing your development environment
  • The “Fuzzy” layer – bridging the gap from C++ to Blueprint
  • Translating back from Blueprint to C++

Technical requirements

Before embarking on this journey of discovery, know that this book will assume some working knowledge of C++ syntax and the Unreal Engine Editor. Familiarity with pointers and how to follow code in your chosen integrated development environment (IDE) will be key to understanding the Unreal core API.

You will require the following software:

  • Unreal Engine 5 (this book has been written with version 5.0.3).
  • Visual Studio is a decent free IDE (basic support for the engine is present, meaning projects may show errors and IntelliSense may not auto-complete some keywords, but the project will compile and run).
  • If you have access, JetBrains Rider version 2022 or later has built-in support for Unreal Engine, which will make the development process a lot easier. Rider is an alternative IDE to Visual Studio that is often preferred among programmers working with Unreal. It offers improved support for working with C++ in Unreal Engine, including auto-complete. You can learn more about it by visiting https://www.jetbrains.com/lp/rider-unreal/.

Introducing Unreal Engine 5

Unreal Engine 5, or Unreal for short, is a game engine developed by Epic Games. Unreal, as with any other game engine at its core, simply processes data from files and instructions into data that you can see on the screen. The suite of tools provided are designed to assist you in creative and predictable tasks. Having been created for you by elite programmers and designers, it is like outsourcing your development to the big leagues.

However, like a high-performance racing car driven by a learner, even the best tools can perform badly. The experts at Epic didn’t know how you would use their tools. So, when we design our code architecture, we need to keep this break in communications in mind. This is where this book comes in, teaching the expected best practices when writing games in Unreal Engine 5.

Unreal Engine has powered an impressive list of gaming titles covering a vast array of genres, shipping on a multitude of platforms.

Unreal Engine 3 powered some of the biggest hits from the seventh generation of game consoles, ranging from third-person shooter games such as the Gears of War series developed by Epic Games themselves to fighting games such as Injustice: Gods Among Us and Mortal Kombat from NetherRealm, as well as strategy games including the XCOM series developed by Firaxis Games.

The eighth generation of consoles saw Unreal Engine 4 expand its portfolio to include racing titles such as the MotoGP games from Milestone and Assetto Corsa Competizione from Kunos Simulazioni, as well as facilitating the hugely popular introduction of the Battle Royale genre with PlayerUnknowns’ Battlegrounds (PUBG Studios), which is listed as the fifth highest-selling video game on Wikipedia, and Epic GamesFortnite, which transitioned to Unreal Engine 5 in December 2021 as detailed in Chapter 3.

Unreal Engine 5 features a series of new, key technologies, including Nanite, a sub-mesh level of detail system allowing massive polycount models to render with even screen-space hull size at any distance, and Lumen, a real-time lighting solution that mixes mesh distance fields and atlassed local surface data progressively over time to create a realistic lighting effect at low cost. These new technologies drove the transition from 4.26/4.27 to 5.0 as part of a complete rework of Unreal’s rendering technology. The engine had an impactful debut with the release of The Matrix Awakens: An Unreal Engine Experience, a demo featuring photorealistic likenesses of Carrie-Anne Moss and Keanu Reeves, and an open-world city featuring impressive examples of crowd and traffic simulations.

Increasingly, games studios are opting to replace proprietary in-house developed game engines with Unreal Engine 5; studios such as CD Projekt Red (The Witcher) and Crystal Dynamics (Tomb Raider) have announced the decision to use Unreal Engine 5 in the latest installments of their game series.

Now that we’ve covered a little about Unreal Engine’s past, pedigree, and influence on gaming history, we will get things set up next so that you are ready to use Unreal Engine 5 with C++.

Installing Unreal Engine 5 and preparing your development environment

Unreal Engine can be downloaded either via the Epic Games Launcher (available from https://unrealengine.com, which will install the engine for you) or as source code from GitHub (www.github.com/EpicGames), allowing users to compile the engine and modify it to fit their projects.

To engage with the activities in this book, you won’t need to compile the engine from source unless you really want to. The benefits of compiling from source will likely come much later into your journey of working with Unreal Engine and C++. You will, however, need to install version 5.0.3 (or above) of the engine and have an IDE installed. This section covers the download, installation, and setup of the engine from scratch using the Unreal Launcher and installation of Visual Studio 2022 Community. If you already have the engine and Visual Studio installed, you can skip over this section.

Firstly, you will need to download the Launcher from https://unrealengine.com by clicking the Download button in the top-right corner of the page and clicking the Download Launcher button on the following page.

Once downloaded, you will need to install the Launcher from the .msi installer.

The Launcher is home to the Epic Games Store, your library of purchased and downloaded games as well as versions of Unreal Engine (4 and above). You will need to navigate to Unreal Engine and then Library, then click the yellow plus icon and select your engine version from the resulting engine slot:

Figure 1.1 – The default Epic Games Launcher with no versions of the engine installed

Figure 1.1 – The default Epic Games Launcher with no versions of the engine installed

Alternatively, if you don’t have any versions of the engine installed, you can click the yellow drop-down button in the top right of the Launcher application.

Both approaches will present you with the option of where you would like to install the engine. It is advisable to install the engine on an SSD if possible as the engine will load significantly quicker than from an HDD:

Figure 1.2 – Install location options

Figure 1.2 – Install location options

Clicking the Options button will present you with a series of optional elements for installing the engine:

Figure 1.3 – Installation options for Unreal Engine 5.0.3

Figure 1.3 – Installation options for Unreal Engine 5.0.3

We advise installing Starter Content, Templates and Feature Packs, and Engine Source.

Engine Source will make browsing and debugging code easier but does not allow you to rebuild the engine; for that functionality, you will need to download the source from GitHub, as mentioned earlier.

Editor symbols for debugging allows the debugging of C++ in the Editor. This is not required but will prove useful to facilitate jumping from the Editor to engine code and allow you to explore the code behind Blueprint nodes.

If you decide you want to add/remove elements later, you can modify these choices by clicking the down arrow next to Launch on the engine slot and selecting Options:

Figure 1.4 – Location of the Options menu on an engine slot

Figure 1.4 – Location of the Options menu on an engine slot

Enable the checkbox next to Editor symbols for debugging and click Apply.

Once you have the engine installed, you can move on to installing Visual Studio.

You will need to download the Visual Studio installer from https://visualstudio.microsoft.com/downloads/.

When you run the installer, select the Game Development with C++ preset in the Workloads tab and select optional components, as shown in Figure 1.5:

Figure 1.5 – Suggested installation options for Visual Studio Community 2022

Figure 1.5 – Suggested installation options for Visual Studio Community 2022

Once you have Visual Studio installed, you should be ready to go. If you want to further improve your experience of working in Visual Studio with Unreal Engine 5.0.X, you can find some additional guidance from Epic at https://docs.unrealengine.com/5.0/en-US/setting-up-visual-studio-development-environment-for-cplusplus-projects-in-unreal-engine/.

Now that we’ve installed the engine and set up our IDE, we can start exploring the link between C++ code and Blueprint.

The “Fuzzy” layer – bridging the gap from C++ to Blueprint

Most engines work on the concept of layers. Each layer has a specific job to do, and when stacked in the correct order, they simplify the development and maintenance of an engine. For example, if a new graphics language emerges that it would be wise to support, only the layer with the graphics pipeline needs to be changed.

There is no hard and fast rule for the number or breakdown of layers in an engine, but what you will generally find is a separation that resembles Table 1.1:

Tool

Full of Editor functions that speed up standard tasks. This suite is generally what an engine is marketed on.

Gameplay

All of the custom systems created to facilitate interaction mechanics that will be bespoke in the built game.

Function

Where all automatic internal systems are handled like input capture and physics processing, etc.

Resource

Memory management and asset streaming are handled here.

Platform

Essentially, the graphics pipeline definition and build platform native integrations if the engine supports it.

Base

Full of core dependency libraries such as UI frameworks for the Editor and math libraries.

Table 1.1 – Common engine layers and their uses

Although Unreal may not explicitly label its layers in this way, we can see them in action in the relationship between how Unreal processes C++ and Blueprint gameplay. Functions created with certain specifiers in C++ can be accessed in Blueprint, but the reverse is not true. This shows there is an order to our actions where signals can only be passed one way. We’ll refer to this internal separation between gameplay layers as the Fuzzy layer.

The fact that the Fuzzy layer exists places a limitation on how we design our systems, but in turn, we gain a separation that enables gameplay programmers to work alongside designers with little friction. Systems can be developed for simple creative use within accessible Blueprints with the more efficient C++ code hidden out of sight. To facilitate this construction, Unreal gives us Property Specifiers and Function Specifiers to define how signals will punch through.

Property Specifiers

Property Specifiers define characteristics of C++-defined variables when viewed and accessed in the Blueprint layer. The Unreal docs provide a handy table explaining the different levels of security afforded by each, along with some more specific ones designed for events, collections, and replication over networks (https://docs.unrealengine.com/5.0/en-US/unreal-engine-uproperties/). The six Display Property Specifiers most commonly used are as follows:

  • EditAnywhere – The value will be changeable in all class defaults and instance detail panels. This specifier is generally used while prototyping as it displays the variable in most places, with the most options for changing its value. However, security is the price paid for this flexibility, allowing any designer to change the default and instance values, and so access should be restricted down to what you actually need once a system is tested as working.
  • EditDefaultsOnly – The value will only be changeable in class defaults. Useful when a variable needs to be changed for balancing and all instances are spawned at runtime, where you wouldn’t have access to instance detail panels anyway. Can also be used to ensure no spawned instance has a rogue different value if necessary for execution.
  • EditInstanceOnly – The value will only be changeable in instance detail panels. Useful for allowing designers different values on bespoke placed actors in a scene but restricting the default value to something that is tested as working.
  • VisibleAnywhere – The value will be visible in all class defaults and instance detail panels, with no option for changing it from the Editor. This is useful for debugging how the initialization process affects a value when it is unknown if the code is generally wrong or wrong at an edge case. The latter will show incorrect values at the instance level, whereas the former will be wrong at both levels.
  • VisibleInstanceOnly – The value will only be visible in instance detail panels. Useful for surface-level debugging of values in each instance without cluttering the screen with debug messages when you have a large number of instances spawned.
  • VisibleDefaultsOnly – The value will only be visible in class defaults. Useful for designers to reference what a functional value is and create a parity in the visual elements of an actor. This is the highest security level as each actor will display the starting value in one place.

There are two access specifiers we need to pay attention to for now: BlueprintReadOnly and BlueprintReadWrite. They give child Blueprint-based classes access to either just the getter or both getter and setter in their graphs.

Function Specifiers

Function Specifiers work similarly to Property Specifiers, defining how functions should be seen and accessed by the Blueprint layer, with some subtleties to their usage. You can find a full list of Function Specifiers in the Unreal docs (https://docs.unrealengine.com/5.0/en-US/ufunctions-in-unreal-engine/), but the three we are interested in are detailed next:

  • BlueprintCallable – As the name suggests, Blueprint classes can call this function if it is in a parent class and it has the correct encapsulation type (public or protected).
  • BlueprintImplementableEvent – The stub for this function signature is defined in C++ without any implementation. This allows C++ systems to call it and Blueprint systems to fill out its actual body. You might use this for triggering visual effects like a laser beam on a gun when it is fired.
  • BlueprintNativeEvent – This allows C++ to define a function that is filled out in Blueprint, but in this case, there can also be a default implementation, which will also be run. Unreal achieves this by generating two more function definitions for you: *_Implementation() and Execute_*(). The former is used for the C++ side that must be run, and the latter is the function that must be called in C++ to fire both implementations.

Important note

As with layering, the C++ side of BlueprintNativeEvents will execute before the Blueprint side.

Using Property and Function Specifiers, we can make systems that cross the Fuzzy layer, but almost as important as routing function signals is designing inheritance hierarchies that smooth this process.

Useful inheritance

As standard practice, it is best to make sure that anything instanced in your world is a Blueprint class. This helps with debugging and linking classes with references as you have all the visual tools built into the Editor for tracing executions, and if classes are renamed or if they move directories, then links are live instead of text-based, preventing crashes.

To make this inheritance strategy work, it is recommended you think about your system from an abstract gameplay point of view. Which classes affect the mechanics? These classes need to have a C++ representation for efficiency, and so a hierarchy can be designed. From there, we inherit Blueprint classes from the end of each branch. This gives us the Blueprint classes to link, create instances of, and add visual components to:

Figure 1.6 – Example hierarchy for a weapon mechanic that includes both Projectile and HitScan mechanic types

Figure 1.6 – Example hierarchy for a weapon mechanic that includes both Projectile and HitScan mechanic types

In Figure 1.6, the C++ classes would contain all the logic for ammo, damaging actors, interaction handling, and so on. Then, in the Blueprint classes, components to display the mesh, run the kickback animations, and display the muzzle flash would be added. There would most likely be a function in the Weapon parent class called from somewhere in the firing logic that looks like this:

UFUNCTION(BlueprintImplementableEvent)
void Fire_Visuals();

This could then be implemented in the Blueprint classes to trigger visual effects. Using some of the patterns we will cover later, namely the type object pattern, you can create a vast array of weapons from these few classes with some simple asset and variable changes. This shows how the artist, designer, and programmer can all work together on one system without getting in each other’s way while still benefitting from the efficiency gain in C++.

In theory, this process is perfect, but theory rarely translates to the real world. A lot of dev time is usually spent working out how to do something based on forum posts, documentation, and videos. It’s great that these resources exist; almost every problem you come across has likely been solved by someone else, but there is no guarantee they have been developed with the same practice. You will come across a situation where the fix you need is in a Blueprint tutorial/example and your system needs it to be in C++, so let’s have a look at the translation process.

Translating back from Blueprint to C++

Equipping yourself with tools to translate back from Blueprint to C++ is the smart thing to do, not only for the everyday fixes as mentioned previously, but also for the triple-A setting in a large company. A typical Unreal mechanics development pipeline at a large studio might follow the following process:

  1. A designer has an idea for a mechanic and is given time to prototype it in Blueprint as a proof of concept.
  2. This mechanic is tested to see if it should be developed further.
  3. If it receives a green light, it will be a programmer’s job to convert the prototype into a more robust C++ system.

We’ve covered the tools for designing C++ systems to work with Blueprint effectively, but when faced with the aforementioned situation, how do you take another person’s vision and translate it into something that works efficiently yet doesn’t lose what made it good? Well, the obvious answer is to directly translate it. Node for node. That process is easy, as nodes in Blueprint are quite literally just C++ functions that you have to find in the engine source. Let’s take a closer look:

  1. The first step is to hover the mouse over the node. Every node has a Target class, and mousing over will tell you what that is.
  2. Next, we go to the Unreal Engine docs (https://www.unrealengine.com/en-US/bing-search?) and search for U< Target class name>::<Node name with no spaces>.
  3. The Unreal docs page for the function is likely to be bare, but it will give you the #include directory for the file header containing that function. Once a class has been included, it can be used and explored via autocompleting a dot accessor.

Important note

If the target is Actor, then it will have an A instead of a U at the beginning, as shown in the example in Figure 1.7. This is one of the oddities of UE5; each time there is one, it will be mentioned in a box like this.

Figure 1.7 – Showing the process from node to Unreal C++ documentation

Figure 1.7 – Showing the process from node to Unreal C++ documentation

This process may seem tedious but after a while of searching different things, you will start to see patterns and be able to work out where functions are likely to be. Each node with an execution pin (the white arrow) then becomes one line of code with input pins forming the function arguments, and output pins are generally the return type (multiple of which would form a struct).

Tip

Reading through the following headers will be useful for mastering the translation process as they are the most frequently used: AActor.h, UGameplayStatics.h, and UkismetSystemLibrary.h.

The next question is, how do you know where to leave the line between C++ and Blueprints? Theoretically, you could make everything in C++, but as we’ve already shown, that is not a good idea for teamworking reasons. The answer has already been hinted at, but generally, you want everything visual or not to do with the gameplay mechanics to be Blueprint-based. Where that line exactly sits is up to interpretation and not worth agonizing over.

Worked example

To cement this theory, let’s work through an example. In Figure 1.8, you can see an example Blueprint system designed to increment an integer when it is overlapped by a projectile; then, once it reaches 10 overlaps, it will play a sound and unhide a particle effect:

Figure 1.8 – A series of Blueprint nodes in a basic function; this piece of Blueprint has been arranged using a reroute node for readability but would normally be laid out more linearly

Figure 1.8 – A series of Blueprint nodes in a basic function; this piece of Blueprint has been arranged using a reroute node for readability but would normally be laid out more linearly

First, we need a C++ class for this to inherit from, and seeing as it is called BP_Target, we can name it Target. The Target class will need some variables; we can tell from the event that there is some kind of collision component named TargetCollision, which has its overlap event bound to this function. As a component, it needs to be stored in a pointer; otherwise, we would be referencing the class, not an instance. We also need an integer named TimesHit. As discussed prior, mechanics are made by a team of programmers, designers, and artists. Linking the right particle system for user feedback is a designer’s job, so we’ll leave that as Blueprint for now, but we do need a way to fire the Blueprint side, so a BlueprintImplementableEvent will be needed. With that in mind, the header for our new class will look something like this:

Target.h

#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Target.generated.h"
class USphereComponent;
UCLASS(Abstract)
class EXAMPLE_API ATarget : public AActor
{
    GENERATED_BODY()
    UPROPERTY(EditDefaultsOnly)
    USphereComponent* _TargetCollision;
    int _TimesHit;
public:
    ATarget();
    UFUNCTION()
    void OnTargetCollisionBeginOverlap(AActor* OtherActor,
        int32 OtherBodyIndex, bool bFromSweep, const
        FHitResult& SweepResult);
    UFUNCTION(BlueprintImplementableEvent)
    Void TenHitVisuals();
};

Important note

Notice how the UCLASS() call includes the Abstract tag. This will stop designers from accidentally creating instances of your C++ classes that have not had any visuals set up.

The next step is to populate the function bodies:

Target.cpp

#include "Target.h"
#include "Components/SphereComponent.h"
#include "ExampleProjectile.h"
ATarget::ATarget()
{
    _TargetCollision =CreateDefaultSubobject <USphereComponent>
        (TEXT("TargetCollision"));
    _TargetCollision->SetupAttachment(RootComponent);
    _TargetCollision->
        OnComponentBeginOverlap.AddDynamic( this,
        &ATarget::OnTargetCollisionBeginOverlap);
    _TimesHit = 0;
}
void ATarget::OnTargetCollisionBeginOverlap
    (UPrimitiveComponent* OverlappedComponent, AActor*
        OtherActor, UPrimitiveComponent* OtherComp, int32
        OtherBodyIndex, bool bFromSweep, const FHitResult&
        SweepResult)
{
    ExampleProjectile* otherProj =
        Cast<AExampleProjectile>(OtherActor);
    if (otherProj != nullptr)
    {
        _TimesHit++;
        if (_TimesHit == 10)
        {
            TenHitVisuals();
        }
    }
}

The constructor is going to be standard, creating the default sub-object for the collision component and binding the overlap function to that component’s overlap event (OnTargetCollisionBeginOverlap). In the overlap function, the cast node becomes a cast to a temporary “cache” variable with an if statement to check its value against nullptr. _TimesHit can then post increment, and the branch converts to an if statement which, if passed, will call the BlueprintImplementableEvent to pass the signal to the Blueprint child class.

Note

You are not required to build this example; it is here for reference only.

There will be plenty more examples of Blueprint to C++ conversion throughout the rest of this book, but if you would like to see some first-party examples, the template projects created by Epic can be loaded in both C++ and Blueprint versions.

Summary

In this chapter, we have discussed what Unreal Engine 5 is and how to get it set up with a useful development environment. We also defined some of the key terms and tools we will be using in later chapters and shared a best practice strategy for building mechanics.

Lastly, we showed the process of translating from other practices to our new best practice.

This forms the foundation for designing well-structured systems. At this point, you should be able to at least plan mechanics for your game and implement something that utilizes both C++ and Blueprint.

In the next chapter, we will cover the process of optimizing a bad project by implementing some of the patterns we will see later in the book. This should give you an understanding of why design patterns are useful before we jump into a deep dive of each one.

Let’s end the chapter by answering a few questions to test our knowledge and cement some of these practices covered in the chapter.

Questions

  1. Which one of these describes the implementation of BlueprintNativeEvent?
    1. A function that can be described in Blueprint.
    2. A function defined in C++ with both C++ and Blueprint implementations.
    3. An event declared in C++ but used in Blueprint with an Execute function.
  2. How does Nanite work?
    1. Magic
    2. Mesh distance formulas
    3. Sub-mesh LOD groups
  3. Which one of these is not a Property Specifier?
    1. BlueprintWriteOnly
    2. EditInstanceOnly
    3. VisibleAnywhere
  4. Which base class adds an A to the start of each of its children in C++?
    1. GameplayStatics
    2. Actor
    3. ActorComponents
  5. All C++ functions should be marked as which of the following?
    1. BuildOnly
    2. Pure
    3. Abstract

Answers

  1. B
  2. C
  3. A
  4. B
  5. C
Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Explore programming patterns, structures, and principles and their applications in Unreal Engine 5 game development
  • Translate code from Blueprint to C++ to implement performant solutions in game development
  • Build a decoupled communications hierarchy and become a better game developer
  • Purchase of the print or Kindle book includes a free PDF eBook

Description

Design patterns serve as a toolkit of techniques and practices that enable you to write code that’s not only faster, but also more manageable. With this book, you’ll explore a range of design patterns and learn how to apply them to projects developed in Unreal Engine 5. You’ll begin by delving into the foundational principles of coding and develop a solid understanding of the concepts, challenges, and benefits of using patterns in your code. As you progress, you’ll identify patterns that are woven into the core of Unreal Engine 5 such as Double Buffer, Flyweight, and Spatial Partitioning, followed by some of the existing tool sets that embody patterns in their design and usage including Component, Behavior Tree, and Update. In the next section of the book, you’ll start developing a series of gameplay use cases in C++ to implement a variety of design patterns such as Interface and Event-based Observers to build a decoupled communications hierarchy. You’ll also work with Singleton, Command, and State, along with Behavioral Patterns, Template, Subclass Sandbox, and Type Object. The final section focuses on using design patterns for optimization, covering Dirty Flag, Data Locality, and Object Pooling. By the end, you’ll be proficient in designing systems with the perfect C++/Blueprint blend for maintainable and scalable systems.

Who is this book for?

If you are a beginner or intermediate game developer working with Unreal Engine and looking to improve your C++ coding practices, this book is tailor-made to help you produce clean, reusable code through the application of design patterns. While this book will cover introductory tasks to show the fundamentals of Unreal Engine 5, its primary purpose is not to teach Unreal Engine from scratch. Prior experience with Unreal Engine will be beneficial, but don’t fret if your knowledge isn’t in-depth; the book will introduce tools and features as needed.

What you will learn

  • Grasp the essence of design patterns and their inherent utility
  • Understand the layers within UE 5 and how they work together
  • Identify the relationship between C++ code and Blueprint in Unreal Engine 5
  • Recognize the design patterns found within existing Unreal Engine 5 functions
  • Explore design patterns to understand their purpose and application within Unreal Engine 5
  • Creatively apply design patterns to existing code to overcome common challenges

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Jan 05, 2024
Length: 254 pages
Edition : 1st
Language : English
ISBN-13 : 9781803246185
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Billing Address

Product Details

Publication date : Jan 05, 2024
Length: 254 pages
Edition : 1st
Language : English
ISBN-13 : 9781803246185
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 103.97
Unreal Engine 5 Game Development with C++ Scripting
€37.99
Game Development Patterns with Unreal Engine 5
€29.99
Multiplayer Game Development with Unreal Engine 5
€35.99
Total 103.97 Stars icon

Table of Contents

15 Chapters
Part 1:Learning from Unreal Engine 5 Chevron down icon Chevron up icon
Chapter 1: Understanding Unreal Engine 5 and its Layers Chevron down icon Chevron up icon
Chapter 2: “Hello Patterns” Chevron down icon Chevron up icon
Chapter 3: UE5 Patterns in Action – Double Buffer, Flyweight, and Spatial Partitioning Chevron down icon Chevron up icon
Chapter 4: Premade Patterns in UE5 – Component, Update Method, and Behavior Tree Chevron down icon Chevron up icon
Part 2: Anonymous Modular Design Chevron down icon Chevron up icon
Chapter 5: Forgetting Tick Chevron down icon Chevron up icon
Chapter 6: Clean Communication – Interface and Event Observer Patterns Chevron down icon Chevron up icon
Chapter 7: A Perfectly Decoupled System Chevron down icon Chevron up icon
Part 3: Building on Top of Unreal Chevron down icon Chevron up icon
Chapter 8: Building Design Patterns – Singleton, Command, and State Chevron down icon Chevron up icon
Chapter 9: Structuring Code with Behavioral Patterns – Template, Subclass Sandbox, and Type Object Chevron down icon Chevron up icon
Chapter 10: Optimization through Patterns Chevron down icon Chevron up icon
Index Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.5
(17 Ratings)
5 star 82.4%
4 star 0%
3 star 5.9%
2 star 11.8%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




N/A Feb 08, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Feefo Verified review Feefo
Kyle Yang Jan 30, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I got the chance to go through a few chapters. I will say being a mainly Unity developer with plans to further learn Unreal in the future, it was very beginner friendly. I felt eased into the book, rather than getting slammed with super diificult topics, especially with the example codes, diagrams, photos of the work being done, and even the little pop quiz and installing instructions in the beginning. I definitely have a better understand of Blueprint as well as programming patterns for Unreal, though some patterns and topics were a bit difficult for me as a semi-beginner to grasp while only reading and not actually doing. But when I do eventually get to learning how to better using the Unreal engine, I will definiely cite back to this book for help!
Amazon Verified review Amazon
Byron Jan 13, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book was surprisingly easy to follow. I’ve found myself referring to it often and re-reading sections in order to move forward with my own work. It’s does a great job of tackling the once showing just how visual studio works with unreal engine and it provides me with a work flow that works for me and the next person viewing my code. I started this book with limited basic knowledge of C++ and a good understanding of Blueprints in Unreal Engine. Before this book I didn’t bother attempting to look further under the hood of a blueprint to see what was really happening but now I have an understanding of how and why to convert a blueprint into C++. Node for node allowing me to customize and create efficient unique tools.
Amazon Verified review Amazon
Tajyo Luminique Feb 28, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I'm two hours in and the book is super organized and set into pretty clear steps.There have been a couple typos but overall it is well-edited.It gets a bit verbose on tangents in some spots, which would be good for those that want more context and history.Great work on formatting and pictures illustrating the steps and guiding the reader through the processes described.(Product received for free.)
Amazon Verified review Amazon
Mr. Jones Jan 10, 2024
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book has a great amount of knowledge packed in not too long of a read! It covers all major topics needed to elevate your game programming from novice to professional level. With the combination of easy to understand theory and practical examples both in the book and the provided GitHub repository, you will come away being a better game developer. I would highly recommend it to any game engineer looking to break into the industry or improve their existing coding skills!
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.