Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Game Development Projects with Unreal Engine
Game Development Projects with Unreal Engine

Game Development Projects with Unreal Engine: Learn to build your first games and bring your ideas to life using UE4 and C++

Arrow left icon
Profile Icon Reis Profile Icon Hammad Fozi Profile Icon Devin Sherry Profile Icon Gonçalo Marques Profile Icon David Pereira +1 more Show less
Arrow right icon
$43.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.6 (35 Ratings)
Paperback Nov 2020 822 pages 1st Edition
eBook
$24.99 $35.99
Paperback
$43.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Reis Profile Icon Hammad Fozi Profile Icon Devin Sherry Profile Icon Gonçalo Marques Profile Icon David Pereira +1 more Show less
Arrow right icon
$43.99
Full star icon Full star icon Full star icon Full star icon Half star icon 4.6 (35 Ratings)
Paperback Nov 2020 822 pages 1st Edition
eBook
$24.99 $35.99
Paperback
$43.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$24.99 $35.99
Paperback
$43.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
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

Shipping Address

Billing Address

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

Game Development Projects with Unreal Engine

2. Working with Unreal Engine

Overview

This chapter will focus on many of the basic concepts and features within Unreal Engine. You will be shown how to create a C++ project, how to perform some basic debugging, and how to work with character-specific animations.

By the end of this chapter, you'll be able to create C++ template projects, be able to debug code within Visual Studio, understand the folder structure and the best practices involved, and finally, be able to set up character animations based on their states.

Introduction

In the previous chapter, we went through the basics of the Epic Games Launcher, along with Unreal Editor fundamentals. We saw how to work with Objects and what Blueprints are on a basic level, in addition to exploring the First Person Template. In this chapter, we'll be building upon those fundamentals by exploring the Third Person Template and working with Input and Animations.

Game development can be done in a wide variety of languages, such as C, C++, Java, C#, and even Python. While each language has pros and cons, we will be using C++ throughout this book as it is the primary programming language used within the Unreal Engine.

In this chapter, we will get you up to speed on how to create a C++ project and basic level debugging in UE4. It is very important to be able to debug code as it helps the developer while dealing with bugs. The tools provided come in very handy and are essential for any Unreal Engine developer.

Following this, we will get up close and personal with the core classes involved in creating games and experiences in Unreal Engine. You will explore Game Mode and the relevant class concepts, followed by an exercise to gain a hands-on understanding of this.

The final section in this chapter is all about animations. Almost every single game features animations, some to a very basic extent, but some to a very high level that includes captivating details which are key to the gameplaying experience. Unreal Engine offers several tools you can use to create and deal with animations, including the Animation Blueprint, which has complex graphs and a State Machine.

Creating and Setting Up a Blank C++ Project

At the start of every project, you might want to start with any of the templates provided by Epic (which contain ready-to-execute basic code) and build on top of that. Most/some of the time, you might need to set up a blank or an empty project that you can mold and sculpt to your requirements. We'll learn how to do that in the following exercise.

Exercise 2.01: Creating an Empty C++ Project

In this exercise, you will learn how to create an empty C++ project from the template provided by Epic. This will serve as the foundation for many of your future C++ projects.

The following steps will help you complete this exercise:

  1. Launch Unreal Engine 4.24 from the Epic Games Launcher.
  2. Click on the Games section and click Next.
  3. Make sure the Blank project template is selected and click Next.
  4. Click the Blueprint section dropdown and select C++.

    Note

    Make sure the project folder and project name are specified with an appropriate directory and name, respectively.

    When everything is set up, click on the Create Project button. In this case, our project directory is inside a folder called UnrealProjects, which is inside the E drive. The project name is set to MyBlankProj (it is recommended that you follow these names and project directories, but you can use your own if you wish to do so).

    Note

    The project name cannot have any spaces in it. It is preferable to have an Unreal directory as close to the root of a drive as possible (to avoid running into issues such as the 256-character path limit when creating or importing assets into your project's working directory; for small projects, it may be fine, but for more large-scale projects, where the folder hierarchy may become too complex, this step is important).

    You will notice that after it's done generating code and creating the project files, the project will be opened, along with its Visual Studio solution (.sln) file.

    Note

    Make sure the Visual Studio solution configuration is set to Development Editor and that the solution platform is set to Win64 for Desktop development:

    Figure 2.1: Visual Studio deployment settings

Figure 2.1: Visual Studio deployment settings

By completing this exercise, we now know how to create an empty C++ project on UE4, along with its considerations.

In the next section, we'll be talking a bit about the folder structure, along with the most basic and most used folder structure format that's used by Unreal developers.

Content Folder Structure in Unreal Engine

In your project directory (E:/UnrealProjects/MyBlankProj in our case), you will observe a Content folder. This is the primary folder that your project uses for different types of assets and project-relevant data (including Blueprints). The C++ code goes into the Source folder in your project. Please note that the best practice is to create new C++ code files directly through the Unreal Editor as this simplifies the process and results in fewer errors.

There are many different strategies you can use to organize the data inside your Content folder. The most basic and easy-to-understand is using folder names to depict the type of content inside. Therefore, a Content folder directory structure may resemble the example at https://packt.live/3lCVFkR. In this example, you can see that each file is categorically placed under the name of the folder representing its type on the first level, with the following levels further grouping it into meaningful folders.

Note

All blueprints should prefix BP in their name (to differentiate them from the default blueprints used by Unreal Engine). The rest of the prefixes are optional (however, it is best practice to format them with the prefixes shown earlier).

In the next section, we will be looking at the Visual Studio solution.

Working with the Visual Studio Solution

Every C++ project in Unreal Engine has a Visual Studio solution. This, in turn, drives all the code and provides developers with the ability to set up execution logic and debug code in its running state.

Solution Analysis

The Visual Studio solution (.sln) file that's produced inside the project directory contains the entire project and any associated code that's been added to it.

Let's have a look at the files present in Visual Studio. Double-click the .sln file to open it within Visual Studio.

In Solution Explorer, you will see two projects called Engine and Games.

The Engine Project

At the base level, Unreal Engine itself is a Visual Studio project and has its own solution file. This contains all the code and third-party integrations that work together in Unreal Engine. All the code within this project is called the "source" code.

The Engine project consists of the external dependencies, configurations, plugins, shaders, and source code of Unreal Engine that are currently being used for this project. You can, at any time, browse the UE4 -> Source folder to view any of the engine code.

Note

As Unreal Engine is open source, Epic allows developers to both view and edit source code to suit their needs and requirements. However, you cannot edit the source code in the version of Unreal Engine that's installed via the Epic Games Launcher. To be able to make and build changes in source code, you need to download the source version of Unreal Engine, which can be found via GitHub. You can use the following guide to download the Source Version of the Unreal Engine: https://docs.unrealengine.com/en-US/GettingStarted/DownloadingUnrealEngine/index.html

After downloading, you can also refer to the following guide for compiling/building the newly downloaded engine: https://docs.unrealengine.com/en-US/Programming/Development/BuildingUnrealEngine/index.html

Game Project

Under the Games directory is the solution folder with the name of your project. Upon expansion, you'll find a set of folders. You will be concerned with the following:

  • Config Folder: Carries all the configurations that have been set up for the project and the build (these can optionally have platform-specific (such as Windows, Android, iOS, Xbox, or PS) settings as well).
  • Plugins Folder: This is an optional folder that's created when you add any third-party plugin (downloaded from the Epic Marketplace or obtained through the internet). This folder will contain all of the source code of the plugins associated with this project.
  • Source Folder: This is the primary folder we're going to be working with. It will contain the Build Target files, as well as all the source code for the project. The following is a description of the default files in the source folder:
  • Target and Build Files: These (as shown in the following screenshot) contain code that specifies the Unreal Build Tool (the program that builds your game) that you will use to build your game. It contains any extra modules that need to be added to the game, as well as other build-related settings. By default, there are two target files (one for Unreal Editor and another for the build as depicted by their names), which end with the .Target.cs extension, and one build file that ends with Build.cs.
  • ProjectName code files (.cpp & .h): By default, these files are created for each project and contain the code that's used to run the default game module code.
  • ProjectNameGameModeBase code files (.cpp & .h): By default, an empty Project Game Mode Base is created. It's not usually used in most cases.
  • ProjectName.uproject file: Contains the descriptors used to provide basic information about the project and the list of plugins associated with it.

Debugging Code in Visual Studio

Visual Studio provides powerful debugging features with the help of breakpoints in code. It enables users to pause the game at a particular line of code so that the developer can see the current values of variables and step through the code and game in a controlled fashion (can proceed line by line, function by function, or so on).

This is useful when you have a lot of variables and code files in your game project, and you want to see the values of the variables being updated and used in a step-by-step fashion to debug the code, find out what issues there are, and solve them. Debugging is a fundamental process of any developer's work, and only after many continuous debugging, profiling, and optimization cycles does a project get polished enough for deployment.

Now that you've got the basic idea of the Visual Studio solution, we'll move on and cover a practical exercise on it.

Exercise 2.02: Debugging the Third Person Template Code

In this exercise, you'll be creating a project using the Third Person Template of Unreal Engine and will debug the code from within Visual Studio. We'll be investigating the value of a variable called BaseTurnRate in the Character class of this template project. We'll see how the value updates as we move through the code, line by line.

The following steps will help you complete this exercise:

  1. Launch Unreal Engine from the Epic Games Launcher.
  2. Click on the Games section and click Next.
  3. Select Third Person and click Next.
  4. Select C++, set the project name to ThirdPersonDebug, and click the Create Project button.
  5. Now, close Unreal Editor, go to the Visual Studio solution, and open the ThirdPersonDebugCharacter.cpp file:
    Figure 2.2: ThirdPersonDebugCharacter.cpp file location

    Figure 2.2: ThirdPersonDebugCharacter.cpp file location

  6. Left-click on the bar on the left-hand side of line 18. A red dot icon should appear on it (you can toggle it off by clicking on it again):
    Figure 2.3: Collision capsule init code

    Figure 2.3: Collision capsule init code

    Here, we are getting the capsule component (explained further in Chapter 3, Character Class Components and Blueprint Setup) of the character, which, by default, is the root component. Then, we are calling its InitCapsuleSize method, which takes in two parameters: the InRadius float and InHalfHeight float, respectively.

  7. Make sure the solution configuration setting in VS is set to Development Editor and click on the Local Windows Debugger button:
    Figure 2.4: Visual Studio build settings

    Figure 2.4: Visual Studio build settings

  8. Wait until you're able to see the following window in the bottom-left corner:

    Note

    If the window doesn't pop-up, you can open the window manually by opening Autos under Debug > Windows > Autos. Additionally, you may also use locals.

    Figure 2.5: Visual Studio variable watch window

    Figure 2.5: Visual Studio variable watch window

    this shows the object itself. The object contains variables and methods that it stores, and by expanding it, we're able to see the state of the entire object and its variables at the current line of code execution.

  9. Expand this, then ACharacter, and then CapsuleComponent. Here, you can see the values for the CapsuleHalfHeight = 88.0 and CapsuleRadius = 34.0 variables. Next to line 18, where the red dot initially was, you will see an arrow. This means that the code is at the end of line 17 and has not executed line 18 yet.
  10. Click the Step Into button to go to the next line of code (Shortcut: F11). Step Into will move into code inside the function (if present) on the line. On the other hand, Step Over will just execute the current code and move to the next line. Since there is no function on the current line, Step Into will mimic the Step Over functionality.
    Figure 2.6: Debug step into

    Figure 2.6: Debug step into

  11. Notice that the arrow has moved to line 21 and that the variables have been updated. CapsuleHalfHeight = 96.0 and CapsuleRadius = 42.0 are highlighted in red. Also, notice that the BaseTurnRate variable is initialized to  0.0:
    Figure 2.7: BaseTurnRate initial value

    Figure 2.7: BaseTurnRate initial value

  12. Step in (F11) once again to go to line 22. Now, the BaseTurnRate variable has a value of 45.0 and BaseLookUpRate is initialized to 0.0, as shown in the following screenshot:
    Figure 2.8: BaseTurnRate updated value

    Figure 2.8: BaseTurnRate updated value

  13. Step in (F11) once again to go to line 27. Now, the BaseLookUpRate variable has a value of 45.0.

Similarly, you are encouraged to step in and debug other sections of the code to not only familiarize yourself with the debugger but also to understand how the code works behind the scenes.

By completing this exercise, you've learned how to set up debug points in Visual Studio, as well as stop debugging at a point, and then continue line by line while watching an object and its variable's values. This is an important aspect for any developer, and many often use this tool to get rid of pesky bugs within code, especially when there's a lot of code flows and the number of variables is quite large.

Note

At any point, you can stop debugging, restart debugging, or continue with the rest of the code by using the following buttons on the top menu bar:

Figure 2.9: Debugging tools in Visual Studio

Figure 2.9: Debugging tools in Visual Studio

Now, we'll look at importing assets into an Unreal project.

Importing the Required Assets

Unreal Engine gives users the ability to import a wide range of file types for users to customize their projects. There are several import options that developers can tweak and play around with to match their required settings.

Some common file types that game developers often import are FBX for scenes, meshes, animations (exported from Maya and other similar software), movie files, images (mostly for the user interface), textures, sounds, data in CSV files, and fonts. These files may be obtained from the Epic Marketplace or any other means (such as the internet) and used within the project.

Assets can be imported by dragging and dropping them into the Content folder, or by clicking the Import button in the Content Browser.

Now let's tackle an exercise where we'll learn how to import FBX files and see how this is done.

Exercise 2.03: Importing a Character FBX File

This exercise will focus on importing a 3D model from an FBX file. FBX files are widely used to export and import 3D models, along with their materials, animations, and textures.

The following steps will help you complete this exercise:

  1. Download the SK_Mannequin.FBX, ThirdPersonIdle.FBX, ThirdPersonRun.FBX and ThirdPersonWalk.FBX files from the Chapter02 -> Exercise2.03 -> ExerciseFiles directory, which can be found on GitHub.

    Note

    The ExerciseFiles directory can be found on GitHub at the following link: https://packt.live/2IiqTzq.

  2. Open the blank project we created in Exercise 2.01, Creating an Empty C++ Project.
  3. In the Content Browser interface of the project, click Import:
    Figure 2.10: Content Browser Import button

    Figure 2.10: Content Browser Import button

  4. Browse to the directory of the files we downloaded in Step 1, select SK_Mannequin.FBX, and click on the Open button.
  5. Make sure the Import Animations button is unchecked and click the Import All button. You may get a warning here stating that There are no smoothing groups. You can ignore this for now. With that, you have successfully imported a skeletal mesh from an FBX file. Now, we need to import its animations.
  6. Click the Import button again, browse to the folder we created in Step 1, and select ThirdPersonIdle.fbx, ThirdPersonRun.fbx, and ThirdPersonWalk.fbx. Then click on the Open button.
  7. Make sure the skeleton is set to the one you imported in Step 5 and click Import All:
    Figure 2.11: Animation FBX Import Options

    Figure 2.11: Animation FBX Import Options

  8. Now, you can see the three animations (ThirdPersonIdle, ThirdPersonRun, and ThirdPersonWalk) inside the Content Browser.
  9. If you double-click on ThirdPersonIdle, you'll notice that the left arm is hanging down. This means that there's a retargeting issue. When the animations are imported separately from the skeleton, the Unreal Engine internally maps all the bones from the animation to the skeleton but sometimes that results in a glitch. We're now going to resolve this glitch.
    Figure 2.12: ThirdPersonIdle UE4 mannequin animation glitch

    Figure 2.12: ThirdPersonIdle UE4 mannequin animation glitch

  10. Open the SK_Mannequin Skeletal Mesh and open the Skeleton Tree tab if not open previously.
    Figure 2.13: SK_Mannequin Skeleton Tree tab select

    Figure 2.13: SK_Mannequin Skeleton Tree tab select

  11. Under Options enable the Show Retargeting Options checkbox.
    Figure 2.14: Enabling retargeting options

    Figure 2.14: Enabling retargeting options

  12. Now inside the skeleton tree, reduce the spine_01, thigh_l and thigh_r bones to enable better visibility.
  13. Now select the spine_01, thigh_l and thigh_r bones. Right click on them, and in the menu, click the Recursively Set Translation Retargeting Skeleton button. This will fix the bone translation issues we encountered before.
  14. Re-open the ThirdPersonIdle Animation to verify the hanging arm has been fixed.
    Figure 2.15: Fixed ThirdPersonIdle Animation

Figure 2.15: Fixed ThirdPersonIdle Animation

Note

You can locate the complete exercise code files on GitHub in the Chapter02 -> Exercise2.03 -> Ex2.03-Completed.rar directory by going to the following link: https://packt.live/2U8AScR

After extracting the .rar file, double-click the .uproject file. You will see a prompt asking Would you like to rebuild now?. Click Yes on that prompt so that it can build the necessary intermediate files, after which it should open the project in Unreal Editor automatically.

By completing this exercise, you've understood how to import assets and, more specifically, imported an FBX skeletal mesh and animation data into your project. This is crucial for the workflows of many game developers as assets are the building blocks of the entire game.

In the next section, we'll be looking at the Unreal core classes for creating a game, how important they are for creating a game or experience, and how to use them inside a project.

The Unreal Game Mode Class

Consider a situation where you want to be able to pause your game. All the logic and implementation required to be able to pause the game will be placed inside a single class. This class will be responsible for handling the game flow when a player enters the game. The game flow can be any action or a set of actions occurring in the game. For example, game pause, play, and restart are considered simple game flow actions. Similarly, in the case of a multiplayer game, we require all the network-related gameplay logic to be placed together. This is exactly what the Game Mode class is there for. 

Game Mode is a class that drives the game logic and imposes game-related rules on players. It essentially contains information about the current game being played, including gameplay variables and events, which are mentioned later on in this chapter. Game Mode can hold all the managers of the gameplay objects, it's a singleton class, and is directly accessible by any object or abstract class present in the game.

As with all the other classes, the Game Mode class can be extended in Blueprints or C++. This can be done to include extra functionality and logic that may be required to keep players updated about what's happening inside the game. 

Let's go over some example game logic that goes inside the Game Mode class:

  • Limiting the number of players that are allowed to enter the game
  • Controlling the Spawn location and Player Controller logic of newly connected players
  • Keeping track of the Game Score
  • Keeping track of the Game Win/Lose condition
  • Implementing the Game Over/Restart Game scenario

In the next section, we will look at the default classes provided by Game Mode.

Game Mode Default Classes

In addition to itself, Game Mode uses several classes to implement game logic. It allows you to specify classes for its following defaults:

  • Game Session Class: Handles admin-level game flow such as login approval.
  • Game State Class: Handles the state of the game so that clients can see what's going on inside the game.
  • Player Controller Class: The main class used to possess and control a pawn. Can be thought of as a brain that decides what to do.
  • Player State Class: Holds the current state of a player inside the game. 
  • HUD Class: Handles the user interface shown to the player.
  • Default Pawn Class: The main actor that the player controls. This is essentially the player character. 
  • Spectator Class: Being a subclass of the DefaultPawn class, the Spectator Pawn Class specifies the pawn responsible for spectating the game.
  • Replay Spectator Player Controller: The Player Controller responsible for manipulating replay during playback, within the game.
  • Server Stat Replicator Class: Responsible for replicating server stat net data.

You can either use the default classes as is, or you can specify your own for custom implementation and behavior. These classes will work in conjunction with Game Mode and will automatically run without being placed inside the world.

Gameplay Events

In terms of a multiplayer game, when many players enter the game, it becomes essential to handle logic to allow their entry into the game, maintain their state, as well as to allow them to view other players' states and handle their interactions.

Game Mode provides you with several events that can be overridden to handle such multiplayer gameplay logic. The following events are especially useful for networking features and abilities (which they are mostly used for):

  • On Post Log In: This event is called after the player is logged into the game successfully. From this point onward, it is safe to call replicated logic (used for networking in multiplayer games) on the Player Controller class.
  • Handle Starting New Player: This event is called after the On Post Log In event and can be used to define what happens to the newly entered player. By default, it creates a pawn for the newly connected player. 
  • SpawnDefaultPawnAtTransform: This event triggers the actual pawn spawning within the game. Newly connected players can be spawned at particular transforms or at preset player start positions placed within the level (which can be added by Dragging and Dropping the Player Start from the Models Window into the World).
  • On Logout: This event is called when a player leaves the game or is destroyed. 
  • On Restart Player: This event is called to respawn the player. Similar to SpawnDefaultPawnAtTransform, the player can be respawned at specific transforms or pre-specified locations (using the player start position).

Networking

The Game Mode class is not replicated to any clients or joined players. Its scope is only limited to the server where it is spawned. Essentially, the client-server model dictates that the clients only act as inputs within the game that is being played on the server. Therefore, the gameplay logic should not exist for the clients, but only for the server.

GameModeBase versus GameMode

From version 4.14 onward, Epic introduced the AGameModeBase class, which acts as the parent class for all Game Mode classes. It is essentially a simplified version of the AGameMode class.

However, the Game Mode class contains some additional functionality that is better suited for Multiplayer Shooter type games as it implements the Match State concept. By default, the Game Mode Base is included in new template-based projects.

Game Mode also contains a State Machine that handles and keeps track of the player's state.

Levels

Levels, in gaming, are a section or a part of a game. Since many games are quite large, they are broken down into different levels. A level of interest is loaded into the game for the player to play, and then when they are done with that, another level may be loaded in (while the current one will be loaded out) so that the player can proceed. To complete a game, a player usually needs to complete a set of specific tasks to move on to the next level, eventually completing the game.

A Game Mode can be directly applied to the level. The level, upon loading, will use the assigned Game Mode class to handle all logic and gameplay for that particular level and override the game mode of the project for this level. This can be applied using the World Settings tab after opening a level.

A Level Blueprint is a blueprint that runs with the level, but cannot be accessed outside the scope of the level. Game Mode can be accessed in any blueprint (including the level blueprint) by the Get Game Mode node. This can later be cast to your Game Mode class, to obtain a reference to it.

Note

A level can only have one Game Mode class assigned to it. However, a single Game Mode class can be assigned to multiple levels to imitate similar functionality and logic.

The Unreal Pawn Class

The Pawn class, in Unreal, is the most basic class of actors that can be possessed (either by a player or AI). It also graphically represents the player/bot in the game. Code inside this class should have everything to do with the game entities, including interaction, movement, and ability logic. The player can still only possess a single pawn at any time in the game. Also, the player can unpossess one pawn and possess another pawn during gameplay.

The Default Pawn

Unreal Engine gives developers a DefaultPawn class (which inherits from the base Pawn class). On top of the Pawn class, this class contains additional code that allows it to move within the world, as you would in the editor version of the game.

The Spectator Pawn

Some games offer features to spectate games. Let's say you're waiting for a friend to finish their game before joining you, so you go ahead and spectate their game. This gives you the ability to observe the game the player is playing, through a camera that you can move around to get a view of the players or the game. Some games also offer spectate modes that can travel back in time, to show a particular action of the game that happened in the past or at any point in the game.

As the name suggests, this is a special type of pawn that provides sample functionality to spectate a game. It contains all the basic tools (such as the Spectator Pawn Movement component) required to do so.

The Unreal Player Controller Class

The Player Controller class can be thought of as the player. It is essentially the soul of a pawn. A Player Controller takes input from the user and feeds it to the pawn and other classes for the player to interact with the game. However, you must take note of the following points while dealing with this class:

  • Unlike the pawn, there can only be one Player Controller that the player represents in a level. (Just like when you travel in an elevator. While inside one, you can only control that elevator, but you can then exit it and enter another elevator in order to control that one.)
  • The Player Controller persists throughout the game, but the pawn may not (for example, in a battle game, the player character may die and respawn, but the Player Controller would remain the same).
  • Due to the temporary nature of the pawn and the permanent nature of the Player Controller, developers need to keep in mind which code should be added to which class.

Let's understand this better through the next exercise.

Exercise 2.04: Setting Up the Game Mode, Player Controller, and Pawn

This exercise will use the blank project we created in Exercise 2.01, Creating an Empty C++ Project. We'll be adding our Game Mode, Player Controller, and Pawn class to the game and will be testing to see if our code works in Blueprints.

The following steps will help you complete this exercise:

  1. Open the project we created in Exercise 2.01, Creating an Empty C++ Project.
  2. Right-click inside the Content Browser and select Blueprint Class.
  3. Under the All Classes section, find and select the Game Mode class:
    Figure 2.16: Selecting the Game Mode class

    Figure 2.16: Selecting the Game Mode class

  4. Set its name to BP_MyGameMode.
  5. Repeat Steps 2-4 and select the Pawn class from under the Common Classes section, as shown in the preceding screenshot. Set the name of this class to BP_MyPawn.
  6. Repeat Steps 2-4 and select the Player Controller class under the Common Classes section, as shown in the preceding screenshot. Set the name of this class to BP_MyPC:
    Figure 2.17: Game Mode, Pawn, and Player Controller names

    Figure 2.17: Game Mode, Pawn, and Player Controller names

  7. Open BP_MyGameMode and open the Event Graph tab:
    Figure 2.18: Event Graph tab in Blueprint

    Figure 2.18: Event Graph tab in Blueprint

  8. Left-click and drag from the white pin in the Event BeginPlay node and then release the left mouse button to gain an Options menu. Type print and select the print node highlighted in the list:
    Figure 2.19: Print String node (Blueprint)

    Figure 2.19: Print String node (Blueprint)

  9. In the resultant Print String node that gets placed under the In String parameter, type My Game Mode has started!.
  10. Now, press the Compile and Save buttons on the top menu bar.
  11. Repeat Steps 7-10 for both the BP_MyPawn and BP_MyPC classes, setting the In String parameter to My Pawn has started! and My PC has started!, respectively.
  12. Finally, open the World Settings tab, and under the Game Mode section, use the dropdown to set the GameMode Override, Default Pawn Class, and Player Controller Class options to our respective classes:
    Figure 2.20: World Settings and Game Mode setup

    Figure 2.20: World Settings and Game Mode setup

  13. Click Play to play your game and see the three print statements on the top. This means that the current GameMode Override, Default Pawn Class, and Player Controller Class options have been set to your specified classes and are running their code:
    Figure 2.21: Output prints

Figure 2.21: Output prints

Note

You can locate the completed exercise code files on GitHub, in the Chapter02 -> Exercise2.04 -> Ex2.04-Completed.rar directory, at the following link: https://packt.live/3k7nS1K

After extracting the .rar file, double-click the .uproject file. You will see a prompt asking Would you like to rebuild now?. Click Yes on that prompt so that it can build the necessary intermediate files, after which it should open the project in Unreal Editor automatically.

Now that you know the basic classes and how they work in Unreal, in the next section, we will be looking at animations, what processes are involved, and how they complete them. We'll follow this with an exercise.

Animations

Animation is essential for adding life and richness to a game. Superb animations are one of the major factors that differentiate average games from the good and the great from the best. Visual fidelity is what keeps gamers excited and immersed in games, and hence animations are a core part of all games and experiences created in Unreal Engine.

Note

This chapter seeks to cover animation basics. A more in-depth approach to animation will be taken in Chapter 13, Blend Spaces 1D, Key Bindings, and State Machines.

Animation Blueprints

An Animation Blueprint is a specific kind of blueprint that allows you to control the animation of a Skeletal Mesh. It provides users with a graph specifically for animation-related tasks. Here, you can define the logic for computing the poses of a skeleton.

Note

A Skeletal Mesh is a skeleton-based mesh that has bones, all of which come together to give form to the mesh, whereas a Static Mesh (as the name suggests) is an un-animatable mesh. Skeletal Meshes are normally used for characters and life-like objects (for example, a player hero), whereas Static Meshes are used for basic or lifeless objects (for example, a wall).

Animation Blueprints provide two kinds of graphs: EventGraph and AnimGraph.

Event Graph

The Event Graph within an Animation Blueprint provides setup events related to animations, as we learned in Chapter 1, Unreal Engine Introduction, that can be used for variable manipulation and logic. Event graphs are mostly used within Animation Blueprints to update Blend Space values, which, in turn, drive the animations within AnimGraph. The most common events that are used here are as follows:

  • Blueprint Initialize Animation: Used to initialize the animation.
  • Blueprint Update Animation: This event is executed every frame, giving developers the ability to perform calculations and update its values as required:
Figure 2.22: Animation Event Graph

Figure 2.22: Animation Event Graph

In the preceding screenshot, you can see the default Event Graph. There are Event Blueprint Update Animation and Try Get Pawn Owner nodes here. You created new nodes and appended them to a graph to complete some meaningful tasks in Exercise 2.04, Setting Up the Game Mode, Player Controller, and Pawn.

The Anim Graph

The Anim Graph is dedicated to and responsible for playing animations and outputting the final pose of the skeleton, on a per-frame basis. It provides developers with special nodes to execute different logic. For example, the Blend node takes in multiple inputs and is used to decide which input is currently being used in the execution. This decision is usually dependent on some external input (such as an alpha value).

The Anim Graph works by evaluating nodes by following the flow of execution between the exec pins on the nodes being used.

In the following screenshot, you can see a single Output Pose node on the graph. This is the final pose output of the animation that will be visible on the relevant Skeletal Mesh within the game. We will be using this in Exercise 2.05, Creating a Mannequin Animation:

Figure 2.23: Animation AnimGraph

Figure 2.23: Animation AnimGraph

State Machines

You have already learned how animation nodes and logic can be set up, but one essential component is missing. Who decides when a particular animation or piece of logic should play or execute? This is where State Machines come into the picture. For example, a player may need to shift from crouching to a standing pose, so the animation needs to be updated. The code will call the Animation Blueprint, access the State Machine, and let it know that the state of the animation needs to be changed, resulting in a smooth animation transition.

A State Machine consists of states and rules that can be thought of as depicting the state of an animation. A State Machine can always be in one state at a particular time. A transition from one state to another is carried out when certain conditions (which are defined by rules) are met.

Transition Rules

Each Transition Rule contains a Boolean node by the name of Result. If the Boolean is true, the transition can occur and vice versa:

Figure 2.24: Transition Rules

Figure 2.24: Transition Rules

Blend Spaces

When you're provided with a bunch of animations, you can create a State Machine and run those animations. However, a problem is presented when you need to transition from one animation to another. If you simply switch the animation, it will glitch since the new animation's starting pose might be different from the old animation's ending pose.

Blend Spaces are special assets used to interpolate between different animations based on their alpha values. This, in turn, removes the glitch issue and interpolates between the two animations, causing a swift and smooth change in animation.

Blend Spaces are created either in one dimension, known as a Blend Space 1D, or two dimensions, known as a Blend Space. These blend any number of animations based on one or two input(s), respectively.

Exercise 2.05: Creating a Mannequin Animation

Now that you've gone through most of the concepts related to animations, we'll be diving in hands-on by adding some animation logic to the default mannequin. We'll be creating a Blend Space 1D, a State Machine, and Animation logic.

Our goal here is to create a running animation of our characters and thus gain insight into how animations work, as well as the way they are bound to the actual character in a 3D world.

The following steps will help you complete this exercise:

  1. Download and extract all the contents of the Chapter02 -> Exercise2.05 -> ExerciseFiles directory, which can be found on GitHub. You can extract this to any directory you're comfortable with using on your machine.

    Note

    The ExerciseFiles directory can be found on GitHub at the following link: https://packt.live/32tIFGJ.

  2. Double-click the CharAnim.uproject file to start the project.
  3. Press Play. Use the keyboard's W, A, S, D keys to move and the Spacebar to jump. Notice that, currently, there are no animations on the mannequin.
  4. In the Content folder, browse to Content -> Mannequin -> Animations.
  5. Right-click the Content folder, and from the Animation section, select Blend Space 1D.
  6. Select UE4_Mannequin_Skeleton.
  7. Rename the newly created file to BS_IdleRun.
  8. Double-click BS_IdleRun to open it.
  9. Under the Asset Details tab, inside the Axis Settings section, expand the Horizontal Axis section and set Name to Speed and Maximum Axis Value to 375.0:
    Figure 2.25: Blend Space 1D Axis Settings

    Figure 2.25: Blend Space 1D Axis Settings

  10. Head down to the Sample Interpolation section and set Target Weight Interpolation Speed Per Sec to 5.0.
  11. Drag and drop the ThirdPersonIdle, ThirdPersonWalk, and ThirdPersonRun animations into the graph separately:
    Figure 2.26: Blend Space previewer

    Figure 2.26: Blend Space previewer

  12. Under the Asset Details tab, in Blend Samples, set the following variable values:
    Figure 2.27: Blend Samples

    Figure 2.27: Blend Samples

  13. Click Save and close this Asset.
  14. Right-click inside the Content folder, and from the Animation section, select Animation Blueprint.
  15. In the Target Skeleton section, select UE4_Mannequin_Skeleton and then click the OK button:
    Figure 2.28: Creating the Animation Blueprint asset

    Figure 2.28: Creating the Animation Blueprint asset

  16. Name the file Anim_Mannequin and press Enter.
  17. Double-click the newly created Anim_Mannequin file.
  18. Next, go to the Event Graph tab.
  19. Create a boolean variable called IsInAir? by clicking the + icon in the variable section on the bottom left side. Be sure to assign the proper type:
    Figure 2.29: Adding variables

    Figure 2.29: Adding variables

  20. Create a float variable called Speed.
  21. Drag off the Try Get Pawn Owner return value node and type in Is Valid. Select the bottom one:
    Figure 2.30: Event Graph Is Valid node

    Figure 2.30: Event Graph Is Valid node

  22. Connect the Exec pin from the Event Blueprint Update Animation node to the Is Valid node:
    Figure 2.31: Connecting nodes

    Figure 2.31: Connecting nodes

  23. From the Try Get Pawn Owner node, use the Get Movement Component node.
  24. From the node obtained in Step 22, get the Is Falling node and connect the Boolean return value to a set node for the Is in Air? Boolean. Connect the SET node exec pin with the Is Valid exec pin:
    Figure 2.32: Is in Air Boolean setup

    Figure 2.32: Is in Air Boolean setup

  25. From the Try Get Pawn Owner node, use the Get Velocity node, get its VectorLength, and connect the output to the A Variable Set node of Speed:
    Figure 2.33: Speed Boolean setup

    Figure 2.33: Speed Boolean setup

  26. Next, head to the Anim Graph tab.
  27. Right-click anywhere inside AnimGraph, type state machine, and click on Add New State Machine:
    Figure 2.34: The Add New State Machine option

    Figure 2.34: The Add New State Machine option

  28. Make sure the node is selected and then press F2 to rename it MannequinStateMachine.
  29. Connect the output pin of MannequinStateMachine to the input pin for the Output Pose node and click the compile button on the top bar:
    Figure 2.35: Configuring the State Machine result in the Output Pose node

    Figure 2.35: Configuring the State Machine result in the Output Pose node

  30. Double-click the MannequinstateMachine node to enter the State Machine. You will see an Entry node. The state that will be connected to it will become the default state of the mannequin. In this exercise, this will be our Idle Animation.
  31. Right-click on an empty area inside the State Machine, and from the menu, select Add State. Press F2 to rename it Idle/Run.
  32. Drag from the icon next to the Entry text, point it inside the Idle/Run node, and then release it to connect it:
    Figure 2.36: Connecting Added State to Entry

    Figure 2.36: Connecting Added State to Entry

  33. Double-click on the Idle/Run state to open it.
  34. From the Asset Browser menu in the bottom-right corner, select and drag the BS_IdleRun Animation onto the graph. Get the Speed variable from the Variable section on the left and connect it, as shown here:
    Figure 2.37: Idle/Run state setup

    Figure 2.37: Idle/Run state setup

  35. Head back to MannequinStateMachine by clicking on its breadcrumb in the top banner:
    Figure 2.38: State Machine navigation breadcrumb

    Figure 2.38: State Machine navigation breadcrumb

  36. From the Asset Browser menu, drag and drop the ThirdPersonJump_Start Animation into the graph. Rename it Jump_Start.
  37. Repeat Step 35 for ThirdPersonJump_Loop and ThirdPerson_Jump and rename them Jump_Loop and Jump_End, respectively:
    Figure 2.39: State setup

    Figure 2.39: State setup

  38. Open the Jump_Start state. Click on the Play ThirdPersonJump_Start node. Uncheck Loop Animation in the Settings section.
  39. Open the Jump_Loop state and click on the Play ThirdPersonJump_Loop node. Set Play Rate to 0.75.
  40. Open the Jump_End state and click on the Play ThirdPerson_Jump node. Uncheck the Loop Animation Boolean.
  41. Since we can shift from Idle/Run to Jump_Start, drag from the Idle/Run state and drop it to the Jump_Start state. Similarly, Jump_Start leads to Jump_Loop, then to Jump_End, and finally back to Idle/Run.

    Drag and drop the arrows to set up the State Machine, as follows:

    Figure 2.40: State connections

    Figure 2.40: State connections

  42. Double-click the Idle/Run to Jump_Start transition rule icon and connect the output of the Is in Air? variable to the result:
    Figure 2.41: Idle/Run to Jump_Start transition rule setup

    Figure 2.41: Idle/Run to Jump_Start transition rule setup

  43. Open the Jump_Start to Jump_Loop transition rule. Get the Time Remaining (ratio) node for ThirdPersonJump_Start and check whether it is less than 0.1. Connect the resulting bool to the result:
    Figure 2.42: Jump_Start to Jump_End transition rule setup

    Figure 2.42: Jump_Start to Jump_End transition rule setup

  44. Open the Jump_Loop to Jump_End transition rule. Connect the output of the inverse of the Is in Air? variable to the result:
    Figure 2.43: Jump_Loop to Jump_End transition rule setup

    Figure 2.43: Jump_Loop to Jump_End transition rule setup

  45. Open the Jump_End to Idle/Run transition rule. Get the Time Remaining (ratio) node for ThirdPerson_Jump and check whether it is less than 0.1. Connect the resulting bool to the result:
    Figure 2.44: Jump_End to Idle/Run transition rule setup

    Figure 2.44: Jump_End to Idle/Run transition rule setup

  46. Close the Animation Blueprint.
  47. In the Content folder, browse to Content -> ThirdPersonBP -> Blueprints folder and open the ThirdPersonCharacter Blueprint.
  48. Select Mesh in the Components tab:
    Figure 2.45: Mesh component

    Figure 2.45: Mesh component

  49. In the Details tab, set Anim Class to the Animation Blueprint class that you created:
    Figure 2.46: Specifying the Animation Blueprint in the Skeletal Mesh component

    Figure 2.46: Specifying the Animation Blueprint in the Skeletal Mesh component

  50. Close the Blueprint.
  51. Play the game again and notice the animations.

    The following should be the output you achieve. As you can see, our character is running, and the running animation is being shown:

    Figure 2.47: Character running animation

Figure 2.47: Character running animation

Note

You can find the complete exercise code files on GitHub, in the Chapter02 -> Exercise2.05 -> Ex2.05-Completed.rar directory, at the following link: https://packt.live/3kdIlSL

After extracting the .rar file, double-click the .uproject file. You will see a prompt asking Would you like to rebuild now?. Click Yes on that prompt so that it can build the necessary intermediate files, after which it should open the project in Unreal Editor automatically.

By completing this exercise, you've understood how to create State Machines, a Blend Space 1D, the Animation Blueprint, and how to tie it all together with the Skeletal Mesh of a character. You've also worked on play rates, transitional speed and the transitional states, helping you understand how the world of animation intricately ties in together.

We kicked off this section by understanding how State Machines are used to represent and transition in-between Animation States. Next, we got to know how a Blend Space 1D gives us blending in-between those transitions. All this is used by the Animation Blueprint to decide what the current animation of the character is. Now, let's combine all these concepts together in an activity.

Activity 2.01: Linking Animations to a Character

Let's say, as an Unreal games developer, you've been provided with a character skeletal mesh and its animations, and you've been tasked with integrating them inside a project. In order to do that, in this activity, you'll be creating an Animation Blueprint, State Machines, and a Blend Space 1D of a new character. By completing this activity, you should be able to work with animations in Unreal Engine and link them to skeletal meshes.

The activity project folder contains a Third Person Template project, along with a new character, Ganfault.

Note

This character and its animations were downloaded from mixamo.com. These have been placed in the Content -> Ganfault folder on our GitHub repository: https://packt.live/35eCGrk

Mixamo.com is a website that sells 3D characters with animations and is sort of an asset marketplace only for 3D models. It also contains a library of free models, alongside the paid ones.

The following steps will help you complete this activity:

  1. Create a Blend Space 1D for the Walking/Running animation and to set up the Animation Blueprint.
  2. Next, go to Content -> ThirdPersonBP -> Blueprints and open the ThirdPersonCharacter Blueprint.
  3. Click the Skeletal Mesh component on the left, and inside the Details tab on the right, replace the SkeletalMesh reference with Ganfault.
  4. Similarly, update the Animations Blueprint section of the skeletal mesh component with the Animation Blueprint you created for Ganfault.

    Note

    For the State Machine, implement only Idle/Run and Jump State.

Once you've completed this activity, the Walk/Run and Jump animations should be working properly, as shown in the following output:

Figure 2.48: Activity 2.01 expected output (Left: Run; Right: Jump)

Figure 2.48: Activity 2.01 expected output (Left: Run; Right: Jump)

Note

The solution to this activity can be found at: https://packt.live/338jEBx.

By completing this activity, you now know how to navigate your way around Unreal Engine with regard to the project, debugging code, and working with Animations. You also understand State Machines, which represent transitions between the Animation States and the Blend Spaces 1D used in that transition. You are now able to add animation to 3D models based on gameplay events and inputs.

Summary

To summarize this chapter, we first learned how to create an empty project. Then, we learned about the folder structure and how to organize files in the project directory. After that, we looked at template-based projects. We also learned how to set breakpoints in code so that we can watch variable values and debug entire objects while the game is running, which would help us find and eradicate bugs in our code.

Thereafter, we saw how Game Mode, Player Pawn, and Player Controller are relevant classes used in Unreal Engine for setting up game flows (the execution order of code), as well as how they are set up inside a project.

Finally, we transitioned toward animation basics and worked with State Machines, Blend Spaces 1D, and Animation Blueprints to make our character animate (walk/run and jump) within the game according to the keyboard input.

Throughout this chapter, we became more familiar with the powerful tools in Unreal Engine that are essential to game development. Unreal's Game Mode and its default classes are required for making any kind of game or experience in Unreal Engine. Additionally, animations bring life to your character and help add layers of immersiveness inside your games. All game studios have animations, characters, and game logic since these are the core components that drive any game. These skills will help you numerous times throughout your game development journey.

In the next chapter, we will talk about the Character class in Unreal Engine, its components, and how to extend the class for additional setup. You'll be working on various exercises, followed by an activity.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Kickstart your career or dive into a new hobby by exploring game design with UE4 and C++
  • Learn the techniques needed to prototype and develop your own ideas
  • Reinforce your skills with project-based learning by building a series of games from scratch

Description

Game development can be both a creatively fulfilling hobby and a full-time career path. It's also an exciting way to improve your C++ skills and apply them in engaging and challenging projects. Game Development Projects with Unreal Engine starts with the basic skills you'll need to get started as a game developer. The fundamentals of game design will be explained clearly and demonstrated practically with realistic exercises. You’ll then apply what you’ve learned with challenging activities. 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. In this project, you'll explore line traces, collisions, projectiles, user interface, and sound effects, combining these concepts to showcase your new skills. You'll then move on to the second project; a side-scroller game, where you'll implement concepts including animation blending, enemy AI, spawning objects, and collectibles. The final project is an FPS game, where you will cover the key concepts behind creating a multiplayer environment. By the end of this Unreal Engine 4 game development book, you'll have the confidence and knowledge to get started on your own creative UE4 projects and bring your ideas to life.

Who is this book for?

This book is suitable for anyone who wants to get started using UE4 for game development. It will also be useful for anyone who has used Unreal Engine before and wants to consolidate, improve and apply their skills. To grasp the concepts explained in this book better, you must have prior knowledge of the basics of C++ and understand variables, functions, classes, polymorphism, and pointers. For full compatibility with the IDE used in this book, a Windows system is recommended.

What you will learn

  • Create a fully-functional third-person character and enemies
  • Build navigation with keyboard, mouse, gamepad, and touch controls
  • Program logic and game mechanics with collision and particle effects
  • Explore AI for games with Blackboards and Behavior Trees
  • Build character animations with Animation Blueprints and Montages
  • Test your game for mobile devices using mobile preview
  • Add polish to your game with visual and sound effects
  • Master the fundamentals of game UI design using a heads-up display
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Nov 27, 2020
Length: 822 pages
Edition : 1st
Language : English
ISBN-13 : 9781800209220
Languages :
Concepts :
Tools :

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
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

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to United States

Economy delivery 10 - 13 business days

Free $6.95

Premium delivery 6 - 9 business days

$21.95
(Includes tracking information)

Product Details

Publication date : Nov 27, 2020
Length: 822 pages
Edition : 1st
Language : English
ISBN-13 : 9781800209220
Languages :
Concepts :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.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
$199.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
$279.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 $ 153.97
Hands-On Artificial Intelligence with Unreal Engine
$43.99
Blueprints Visual Scripting for Unreal Engine
$65.99
Game Development Projects with Unreal Engine
$43.99
Total $ 153.97 Stars icon

Table of Contents

18 Chapters
1. Unreal Engine Introduction Chevron down icon Chevron up icon
2. Working with Unreal Engine Chevron down icon Chevron up icon
3. Character Class Components and Blueprint Setup Chevron down icon Chevron up icon
4. Player Input Chevron down icon Chevron up icon
5. Line Traces Chevron down icon Chevron up icon
6. Collision Objects Chevron down icon Chevron up icon
7. UE4 Utilities Chevron down icon Chevron up icon
8. User Interfaces Chevron down icon Chevron up icon
9. Audio-Visual Elements Chevron down icon Chevron up icon
10. Creating a SuperSideScroller Game Chevron down icon Chevron up icon
11. Blend Spaces 1D, Key Bindings, and State Machines Chevron down icon Chevron up icon
12. Animation Blending and Montages Chevron down icon Chevron up icon
13. Enemy Artificial Intelligence Chevron down icon Chevron up icon
14. Spawning the Player Projectile Chevron down icon Chevron up icon
15. Collectibles, Power-Ups, and Pickups Chevron down icon Chevron up icon
16. Multiplayer Basics Chevron down icon Chevron up icon
17. Remote Procedure Calls Chevron down icon Chevron up icon
18. Gameplay Framework Classes in Multiplayer 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.6
(35 Ratings)
5 star 77.1%
4 star 17.1%
3 star 0%
2 star 2.9%
1 star 2.9%
Filter icon Filter
Top Reviews

Filter reviews by




Titus Mickley Apr 13, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Full disclaimer: I was contacted by the authors of the book and gifted a review copy. No other sponsorship occurred. All they asked for was a balanced review in return.With that out of the way, I have been working in UE4 for about a year now so my memories of having to learn the engine are still relatively fresh. UE4 documentation is lacking compared to Unity in my opinion which made it more difficult to pick up without relying on scattered tutorials and shaky logic. This book however is extremely comprehensive in its teachings and content. Whether you are someone entirely new to UE4 or someone who has worked in it before, this book will prove useful at some point.With the advent of UE5 on the nearby horizon, I still see a reason to read this book if only for the sake of catching up with UE4 in preparation for any similarities still existing in UE5.
Amazon Verified review Amazon
Ingmar B Nov 22, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
I have reviewed the book on a surface level and skimmed over its contents to understand the topics and the style of delivery. I look forward to working through the book's chapters in more detail, following along practically. The book structure is laid out logically and clearly with each chapter leading on to more advanced content as you proceed. Each chapter can easily be read and studied independently, depending on what you already understand and what aspect of your project you need assistance with. The material is structured coherently enough to act as a quick reference guide for a specific topic you might be investigating and elaborates on the most important information with practical examples. I believe that this book will remain a fairly useful resource to me, alongside the original Unreal Engine documentation.Overall, I believe that this "Game Development Projects with Unreal Engine" book by Packt is a cohesive and well-curated collection of structured knowledge, unfolding into a clear sequence of steps and caters for various experience levels, whether you are new to the topic or already experienced in several aspects of the Unreal Engine. It offers a thorough investigation into many of the aspects related to your journey to becoming a game developer, using the Unreal Engine. The authors appear to be knowledgeable enough in the topic to confidently guide you across a fairly complicated discipline.I would recommend this book for anyone looking to supplement their learning with well-curated written information.
Amazon Verified review Amazon
Bradley Yachimowski May 16, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Disclaimer: I was contacted by the authors of the book and gifted a review copy.I have been programming with Unity game engine for many years. Back when I started game development Unreal Engine did not have a free option. This set me on a path with the free version of the Unity game engine, first as a hobbyist, and then as a developer. This was my first exposure to Unreal Engine 4, and I was impressed. As a newbie to Unreal Engine 4, I liked the “Game Development Projects with Unreal Engine” layout and the course progression. The book is full of visuals which adds clarification to the text and helps reduce errors when completing the projects. I found the book easy to read, and extremely rewarding. There are some areas in the book that are not covered in detail but from my beginner’s point of view, it is enough to gain a basic understanding of the components in Unreal Engine 4. No one book or course can explain all of the workings of the Unreal Engine or any other game engine. This book, in the hands of a qualified teacher, would make an excellent textbook for schools to teach games programming with Unreal Engine 4 to students. The information in this book, along with the Unreal Engine Documentation has enabled me to start developing my own projects. I love this book, and I would recommend it to anyone wanting to get started with Unreal Engine 4. To Hammad Fozi, Goncalo Marques, David Pereira, Devin Sherry, and all of the editors and reviewers: I thank you for your sacrifice and the maddening pace you had to keep in order to create this massive book and get it to us before the content became outdated. Well done.
Amazon Verified review Amazon
Christopher May 30, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Fantastic tool for Unreal Engine beginners! You can't go wrong with making this investment to motivate yourself learning more about UE4. With UE5 around the corner, it's a great time idea to start at the beginning and get knowledgeable about the fundamentals of Unreal Engine. I highly recommend.
Amazon Verified review Amazon
Frederico Ribeiro Barnabe Aug 03, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Ótimo produto eu recomendo
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact customercare@packt.com with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at customercare@packt.com using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on customercare@packt.com with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on customercare@packt.com within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on customercare@packt.com who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on customercare@packt.com within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela