Elevating Game Experiences with Unreal Engine 5 - Second Edition | Game Development | eBook (2024)

Elevating Game Experiences with Unreal Engine 5 - Second Edition | Game Development | eBook (1)

Elevating Game Experiences with Unreal Engine 5 - Second Edition | Game Development | eBook (2)

Elevating Game Experiences with Unreal Engine 5 - Second Edition | Game Development | eBook (3)

By Gonçalo Marques,Devin Sherry,David Pereira,Hammad Fozi

$63.99$43.99

BookSep 2022760 pages2nd Edition

eBook$63.99$43.99Print$79.99Subscription$15.99Monthly
eBook$63.99$43.99Print$79.99Subscription$15.99Monthly

What do you get with eBook?

Instant access to your Digital eBook purchase

Download this book in EPUB and PDF formats

AI Assistant (beta) to help accelerate your learning

Access this title in our online reader with advanced features

DRM FREE - Read whenever, wherever and however you want

Buy Now

Table of content iconView table of contents

Preview Book

Elevating Game Experiences with Unreal Engine 5 - Second Edition | Game Development | eBook (4)

Elevating Game Experiences with Unreal Engine 5 - Second Edition

Welcome to Game Development Projects with Unreal Engine Second Edition. If this is the first time you’re using Unreal Engine 5 (UE5), this book will support you in getting started with one of the most in-demand game engines on the market. You will discover how to build up your game development skills and how to express yourself by creating video games. If you’ve already tried using UE5, this book will help you develop your knowledge and skills further so that you can build games more easily and effectively.

A game engine is a software application that allows you to produce video games from the ground up. Their feature sets vary significantly but usually allow you to import multimedia files, such as 3D models, images, audio, and video, and manipulate those files through the use of programming, where you can use programming languages such as C++, Python, and Lua, among others.

UE5 uses two main programming languages, C++ and Blueprint...

In this first exercise, we will learn how to create a new UE5 project. UE5 has predefined project templates that allow you to implement a basic setup for your project. We’ll be using the Third Person template project in this exercise.

Follow these steps to complete this exercise:

  1. After installing Unreal Engine version 5.0, launch the editor by clicking the Launch button next to the version icon.
  2. After you’ve done that, you’ll be greeted with the engine’s Projects window, which will show you the existing projects that you can open and work on. It will also give you the option to create a new project. Because we have no projects yet, the Recent Projects section will be empty. To create a new project, choose a Project Category option, which in our case will be Games. Then, click Next.
  3. After that, you’ll see the Project Templates window. This window will show all the available...

In this section, you will be introduced to the Unreal Engine editor, which is a fundamental topic for becoming familiar with UE5.

Once your project has been generated, you should see the Unreal Engine editor open automatically. This screen is likely the one that you will see the most when working with Unreal Engine, so you must get accustomed to it.

Let’s break down what we can see in the editor window:

Figure 1.1 – The Unreal Engine editor divided into its main windows

Let’s look at these windows in more detail:

  1. Viewport: At the very center of the screen, you can see the Viewport window. This will show you the content of the current level and will allow you to navigate through your level as well as add, move, remove, and edit objects inside it. It also contains several different parameters regarding visual filters, object filters (which objects you can see), and the lighting on your level.
  2. ...

As we’ve seen, the Unreal Engine editor is comprised of many windows, all of which are resizable, movable, and have a corresponding tab on top of them. You can click and hold a window’s tab and drag it to move it somewhere else. You can hide tab labels by right-clicking them and selecting the Hide Tabs option:

Elevating Game Experiences with Unreal Engine 5 - Second Edition | Game Development | eBook (5)

Figure 1.5 – How to hide a tab

If the tab labels have been hidden, you can get them to reappear by clicking the blue triangle in the top-left corner of that window, as shown in the following screenshot:

Elevating Game Experiences with Unreal Engine 5 - Second Edition | Game Development | eBook (6)

Figure 1.6 – The blue triangle that allows you to show a window’s tab

You can also dock the windows to the sidebar to hide them while also having them easily available:

Figure 1.7 – Docking a window to the sidebar

After that, to show or hide them, you simply have to click them:

Figure 1.8 – Showing...

In the previous section, we mentioned that the Viewport window allows you to visualize your level, as well as manipulate the objects inside it. Because this is a very important window for you to use and has a lot of functionality, we’re going to learn more about it in this section.

Before we start learning about the Viewport window, let’s quickly get to know levels. In UE5, levels represent a collection of objects, as well as their locations and properties. The Viewport window will always show you the contents of the currently selected level, which in this case was already made and generated alongside the Third Person template project. In this level, you can see four wall objects, one ground object, a set of stairs, and some other elevated objects, as well as the player character, which is represented by the UE5 mannequin. You can create multiple levels and switch between them by opening them via the Content Browser window.

To manipulate and...

In Unreal Engine, all the objects that can be placed in a level are referred to as Actors. In a movie, an actor would be a human playing a character, but in UE5, every single object you see in your level, including walls, floors, weapons, and characters, is an Actor.

Every Actor must have what’s called a Transform property, which is a collection of three things:

  • Location: A Vector property signifying the position of that Actor in the level in the X, Y, and Z-axis. A vector is simply a tuple with three floating-point numbers – one for the location of the point on each axis.
  • Rotation: A Rotator property signifying the rotation of that Actor along the X, Y, and Z-axis. A rotator is also a tuple with three floating-point numbers – one for the angle of rotation on each axis.
  • Scale: A Vector property signifying the scale (that is, the size) of that Actor in the level in the X, Y, and Z-axis. This is also a collection of three floating...

In UE5, the word Blueprint can be used to refer to two different things: UE5’s visual scripting language or a specific type of asset, also referred to as a Blueprint class or Blueprint asset.

As we’ve mentioned previously, an Actor is an object that can be placed in a level. This object can either be an instance of a C++ class or an instance of a Blueprint class, both of which must inherit from the Actor class (either directly or indirectly). So, what is the difference between a C++ class and a Blueprint class, you may ask? There are a few:

  • If you add programming logic to your C++ class, you’ll have access to more advanced engine functionality than you would if you were to create a Blueprint class.
  • In a Blueprint class, you can easily view and edit visual components of that class, such as a 3D mesh or a Trigger Box Collision, as well as modify properties defined in the C++ class that are exposed to the editor, which...

The Blueprint editor is a sub-editor within the Unreal Engine editor specifically for Blueprint classes. Here, you can edit the properties and logic for your Blueprint classes, or those of their parent classes, as well as their visual appearance.

When you open an Actor Blueprint class, you should see the Blueprint editor. This window will allow you to edit your Blueprint classes in UE5. Let’s learn about the windows that you’re currently seeing:

Figure 1.24 – The Blueprint editor window is broken down into five parts

Let’s look at these windows in more detail:

  1. Viewport: Front and center in the editor, you have the Viewport window. This window, similar to the Level Viewport window that we already learned about, will allow you to visualize your Actor and edit its components. Every Actor can have several Actor Components, some of which have a visual representation, such as Mesh Components and...

The Event Graph window is where you’ll be writing all of your Blueprint visual scripting code, creating your variables and functions, and accessing other variables and functions declared in this class’s parent class.

If you select the Event Graph tab, which you should be able to see to the right of the Viewport tab, you will be shown the Event Graph window instead of the Viewport window. On clicking the Event Graph tab, you will see the following window:

Figure 1.25 – The Event Graph window, showing three disabled events

You can navigate the Event Graph window by holding the right mouse button and dragging inside the graph, you can zoom in and out by scrolling the mouse wheel, and you can select nodes from the graph by either clicking the left mouse button or by clicking and holding to select an area of nodes.

You can also right-click inside the Event Graph window to access the Blueprint’s Actions...

Blueprints contain many more nodes that are not related to variables or functions. One such example is arithmetic nodes (that is, adding, subtracting, multiplying, and so on). If you search for Multiply in the Blueprint Actions menu, you’ll find the Multiply node:

Figure 1.40 – The multiply node

This node allows you to input two or more parameters, which can be of many types (for example, integer, float, vector, and so on; you can add more by clicking the + icon to the right of the Add pin text) and output the result of multiplying all of them. We will be using this node later, in this chapter’s activity.

Now, let’s look at two of the most important events in UE5: BeginPlay and Tick.

As mentioned previously, events will usually be called from outside the Blueprint class. In the case of the BeginPlay event, this event gets called either when an instance of this Blueprint class is placed in the level and the level starts being played, or when an instance of this Blueprint class is spawned dynamically while the game is being played. You can think of the BeginPlay event as the first event that will be called on an instance of this Blueprint, which you can use for initialization.

The other important event to know about in UE5 is the Tick event. As you may know, games run at a certain frame rate, with the most frequent being either 30 frames per second (FPS) or 60 FPS. This means that the game will render an updated image of the game 30 or 60 times every second. The Tick event will get called every time the game does this, which means that...

Let’s take a look at the ThirdPersonCharacter Blueprint class, which is the Blueprint that represents the character that the player controls, and look at the Actor Components that it contains.

Go to the ThirdPersonCPP | Blueprints directory inside the Content Browser window and open the ThirdPersonCharacter asset:

Elevating Game Experiences with Unreal Engine 5 - Second Edition | Game Development | eBook (7)

Figure 1.48 – The ThirdPersonCharacter Blueprint class

Previously, when we introduced the Components window inside the Blueprint editor, we mentioned Actor Components.

Actor Components are entities that must live inside an Actor and allow you to spread the logic of your Actor into several different Actor Components. In this Blueprint, we can see that there are four visually represented Actor Components:

  • A Skeletal Mesh Component, which shows the UE5 mannequin
  • A Camera Component, which shows where the player will be able to see the game from
  • An Arrow Component, which...

For a computer to visually represent a 3D object, it needs two things: a 3D mesh and a material. 3D meshes allow us to specify the shape of an object and its size, while a material allows us to specify its color and visual tones, among other things. We’ll dive deeper into both of these in the following sections and see how UE5 allows us to work with them.

Meshes

3D meshes allow you to specify the size and shape of an object, like this mesh representing a monkey’s head:

Figure 1.49 – A 3D mesh of a monkey’s head

Meshes are comprised of several vertices, edges, and faces. Vertices are simply 3D coordinates with X, Y, and Z positions; an edge is a connection (that is, a line) between two vertices; and a face is a connection of three or more edges. The preceding screenshot shows the individual vertices, edges, and faces of the mesh, where each face is colored between white and black,...

In this section, we’ll learn how materials work in UE5. As mentioned previously, materials are what specify the visual aspects of a certain object, including its color and how it reacts to light. To learn more about them, follow these steps:

  1. Go back to your Level Viewport window and select the Cube object shown in the following screenshot:

Figure 1.50 – The Cube object, next to the text that says Third Person on the floor

  1. Take a look at the Details window, where you’ll be able to see both the mesh and material associated with this object’s Static Mesh Component:

Figure 1.51 – The Static Mesh and Materials (Element 0) properties of the Cube object’s Static Mesh Component

Note

Keep in mind that meshes can have more than one material, but must have at least one.

  1. Click the looking glass icon next to the Materials property to be taken...

In this activity, you will use the Tick event of TestActor to move it on the Z-axis indefinitely, instead of doing this only once when the game starts.

Follow these steps to complete this activity:

  1. Open the TestActor Blueprint class.
  2. Add the Event Tick node to the Blueprint’s Event Graph window.
  3. Add the AddActorWorldOffset function, split its DeltaLocation pin, and connect the Tick event’s output execution pin to this function’s input execution pin, similar to what we did in Exercise 1.01 – creating an Unreal Engine 5 project.
  4. Add a Float Multiplication node to the Event Graph window.
  5. Connect the Tick event’s Delta Seconds output pin to the first input pin of the Float Multiplication node.
  6. Create a new variable of the float type, call it VerticalSpeed, and set its default value to 25.
  7. Add a getter to the VerticalSpeed variable in the Event Graph...

By completing this chapter, you have taken the first step in your game development journey by learning about UE5. You now know how to navigate the Unreal Engine editor, manipulate the Actors inside a level, create Actors, use the Blueprint scripting language, and how 3D objects are represented in UE5.

Hopefully, you realize that there’s a whole world of possibilities ahead of you and that the sky is the limit in terms of the things you can create using this game development tool.

In the next chapter, you will recreate the project template that was automatically generated in this chapter from scratch. You will learn how to create C++ classes and then create Blueprint classes that can manipulate properties declared in their parent class. You will also learn how to import character meshes and animations into Unreal Engine 5, as well as become familiar with other animation-related assets such as Animation Blueprints.

Page1of 17

Download Code

Key benefits

  • Kickstart your career or develop a new hobby by learning game development with Unreal Engine 5 and C++
  • Learn techniques to prototype and develop your own ideas with key images printed in color
  • Reinforce your skills with project-based learning by building a series of games from scratch

Description

Immerse yourself in the Unreal game projects with this book, written by four highly experienced industry professionals with many years of combined experience with Unreal Engine. Elevating Game Experiences with Unreal Engine 5 will walk you through the latest version of Unreal Engine by helping you get hands-on with the game creation projects.The book starts with an introduction to the Unreal Editor and key concepts such as actors, blueprints, animations, inheritance, and player input. You'll then move on to the first of three projects, building a dodgeball game, where you'll learn the concepts of line traces, collisions, projectiles, user interface, and sound effects. You’ll also discover how to combine these concepts to showcase your new skills. The second project, a side-scroller game, will help you implement concepts such as animation blending, enemy AI, spawning objects, and collectibles. And finally, you'll cover the key concepts in creating a multiplayer environment as you work on the third project, an FPS game.By the end of this Unreal Engine book, you'll have a broad understanding of how to use the tools that the game engine provides to start building your own games.

What you will learn

Create a fully functional third-person character and enemiesImplement navigation with keyboard, mouse, and gamepadProgram logic and game mechanics with collision and particle effectsExplore AI for games with Blackboards and behavior treesBuild character animations with animation blueprints and montagesPolish your game with stunning visual and sound effectsExplore the fundamentals of game UI using a heads-up displayDiscover how to implement multiplayer in your games

Product Details

Publication date :Sep 23, 2022

Length760 pages

Edition :2nd Edition

Language :English

ISBN-13 :9781803239866

Vendor :

Epic Games

Category :

Game Development

Languages :

C++ (Intermediate)

Concepts :

Game Design

Tools :

Unreal (Beginner)

What do you get with eBook?

Instant access to your Digital eBook purchase

Download this book in EPUB and PDF formats

AI Assistant (beta) to help accelerate your learning

Access this title in our online reader with advanced features

DRM FREE - Read whenever, wherever and however you want

Buy Now

Product Details

Publication date :Sep 23, 2022

Length760 pages

Edition :2nd Edition

Language :English

ISBN-13 :9781803239866

Vendor :

Epic Games

Category :

Game Development

Languages :

C++ (Intermediate)

Concepts :

Game Design

Tools :

Unreal (Beginner)

Elevating Game Experiences with Unreal Engine 5 - Second Edition | Game Development | eBook (2024)
Top Articles
Latest Posts
Article information

Author: Velia Krajcik

Last Updated:

Views: 5853

Rating: 4.3 / 5 (74 voted)

Reviews: 89% of readers found this page helpful

Author information

Name: Velia Krajcik

Birthday: 1996-07-27

Address: 520 Balistreri Mount, South Armand, OR 60528

Phone: +466880739437

Job: Future Retail Associate

Hobby: Polo, Scouting, Worldbuilding, Cosplaying, Photography, Rowing, Nordic skating

Introduction: My name is Velia Krajcik, I am a handsome, clean, lucky, gleaming, magnificent, proud, glorious person who loves writing and wants to share my knowledge and understanding with you.