Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Game Development Projects with Unreal Engine

You're reading from   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
Product type Paperback
Published in Nov 2020
Publisher Packt
ISBN-13 9781800209220
Length 822 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (5):
Arrow left icon
Hammad Fozi Hammad Fozi
Author Profile Icon Hammad Fozi
Hammad Fozi
Devin Sherry Devin Sherry
Author Profile Icon Devin Sherry
Devin Sherry
Gustavo Reis Gustavo Reis
Author Profile Icon Gustavo Reis
Gustavo Reis
David Pereira David Pereira
Author Profile Icon David Pereira
David Pereira
Gonçalo Marques Gonçalo Marques
Author Profile Icon Gonçalo Marques
Gonçalo Marques
+1 more Show less
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface
1. Unreal Engine Introduction 2. Working with Unreal Engine FREE CHAPTER 3. Character Class Components and Blueprint Setup 4. Player Input 5. Line Traces 6. Collision Objects 7. UE4 Utilities 8. User Interfaces 9. Audio-Visual Elements 10. Creating a SuperSideScroller Game 11. Blend Spaces 1D, Key Bindings, and State Machines 12. Animation Blending and Montages 13. Enemy Artificial Intelligence 14. Spawning the Player Projectile 15. Collectibles, Power-Ups, and Pickups 16. Multiplayer Basics 17. Remote Procedure Calls 18. Gameplay Framework Classes in Multiplayer

About the Book

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.

About the Authors

Hammad Fozi is a lead game developer (Unreal Engine) at BIG IMMERSIVE.

Gonçalo Marques has been an active gamer since the age of 6. He worked as a freelancer for a Portuguese startup, Sensei Tech, where he developed an internal system using UE4 to produce datasets that assist with machine learning.

David Pereira started this game development career in 1998, where he learned to use Clickteam's The Games Factory and started making his own small games. David would like to acknowledge the following people: I would like to thank my girlfriend, my family and my friends for supporting me on this journey. This book is dedicated to my grandmother Teresa ("E vai daí ós'pois...!").

Devin Sherry is a technical designer at the game studio called People Can Fly and works on their newest IP that is built with Unreal Engine 4. Devin studied game development and game design at the University of Advancing Technology, where he obtained a bachelor's degree in game design in 2012.

Audience

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.

About the Chapters

Chapter 1, Unreal Engine Introduction, explores the Unreal Engine editor. You will be introduced to the editor's interface, see how to manipulate actors in a level, understand the basics of the blueprint visual scripting language, and discover how to create material assets that can then be used by meshes.

Chapter 2, Working with Unreal Engine, introduces Unreal Engine game fundamentals, along with how to create a C++ project and set up the Content Folder of projects. You'll also be introduced to the topic of animations.

Chapter 3, Character Class Components and Blueprint Setup, introduces you to the Unreal Character class, along with the concept of object inheritance and how to work with input mappings.

Chapter 4, Player Input, introduces the topic of player input. You will learn how to associate a keypress or a touch input with an in-game action, such as jumping or moving, through the use of action mappings and axis mappings.

Chapter 5, Line Traces, starts a new project called Dodgeball. In this chapter, you will learn about the concept of line traces and the various ways in which they can be used in games.

Chapter 6, Collision Objects, explores the topic of object collision. You will learn about collision components, collision events, and physics simulation. You will also study the topic of timers, the projectile movement component, and physical materials.

Chapter 7, UE4 Utilities, teaches you how to implement some useful utilities available in Unreal Engine, including actor components, interfaces, and blueprint function libraries, which will help keep your projects well-structured and approachable for other people that join your team.

Chapter 8, User Interfaces, explores the topic of game UI. You will learn how to make menus and HUDs using Unreal Engine's UI system, UMG, as well as how to display the player character's health using a progress bar.

Chapter 9, Audio-Visual Elements, introduces the topic of sounds and particle effects in Unreal Engine. You will learn how to import sound files to the project and use them as both 2D and 3D sounds, as well as how to add existing particle systems to the game. Lastly, a new level will be made that uses all the game mechanics built in the last few chapters to conclude the Dodgeball project.

Chapter 10, Creating a SuperSideScroller Game, breaks down the SuperSideScroller game project's game mechanics. You will create the C++ SideScroller project template through the Epic Games Launcher, and learn the basic concepts of animation by manipulating the default mannequin skeleton and importing a custom skeletal mesh.

Chapter 11, Blend Spaces 1D, Key Bindings, and State Machines, introduces you to the tools available for developing smooth animation blending with Blend Spaces 1D and animation state machines. You will also jump into C++ code to develop the sprinting mechanics of the player character with the help of key bindings and the character movement component.

Chapter 12, Animation Blending and Montages, introduces you to animation montages and animation blending functionality within animation blueprints to develop the player's character throwing animation. You will learn about animation slots and use layered blends per bone to properly blend between the character's movement animations and the throw animation.

Chapter 13, Enemy Artificial Intelligence, covers AI and how to develop AI using behavior trees and blackboards. You will implement an AI that patrols along a custom path using a blueprint actor that you will develop.

Chapter 14, Spawning the Player Projectile, introduces you to Anim Notifies and how to spawn objects in the game world. You will implement a custom Anim Notify that spawns the player projectile at a specific frame of the throw animation. You will also develop functionality for the player projectile that allows this projectile to destroy enemy AI.

Chapter 15, Collectibles, Power-Ups, and Pickups, demonstrates how to create a custom potion power-up that manipulates the player's movement, as well as a collectible coin for the player character. You will also learn more about UMG by developing a simple UI to count the number of collectibles found by the player.

Chapter 16, Multiplayer Basics, introduces you to important multiplayer concepts such as the server-client architecture, connections, actor ownership, roles, and variable replication. You'll also learn how to make a 2D blendspace and how to use the Transform Modify Bone node. You'll start working on a multiplayer FPS project by creating a character that walks, jumps, looks up/down, and has two replicated stats: health and armor.

Chapter 17, Remote Procedure Calls, introduces you to remote procedure calls, how to use enumerations in Unreal Engine 4, and how to use bi-directional circular array indexing. You'll also expand the multiplayer FPS project by adding the concept of weapons and ammo.

Chapter 18, Gameplay Framework Classes in Multiplayer, is the final chapter of this book and explains where the gameplay framework classes exist in multiplayer, how to use the game state and player state classes, as well as how to implement some useful built-in functionality. You'll also see how to use match states and other concepts in game mode. Finally, you'll finish the multiplayer FPS project by adding the concepts of death, respawn, scoreboard, kill limit, and pickups.

Conventions

Code words in the text, folder names, filenames, file extensions, pathnames, dummy URLs, and user input are shown as follows:

"Open Project Settings and go to the Collision subsection within the Engine section."

Words that you see on the screen, for example, in menus or dialog boxes, also appear in the text like this:

"Click the New Object Channel button, name it Dodgeball, and set its Default Response to Block."

A block of code is set as follows:

if (bCanSeePlayer)
{
  //Start throwing dodgeballs
  GetWorldTimerManager().SetTimer(ThrowTimerHandle,this,  &AEnemyCharacter::ThrowDodgeball,ThrowingInterval,true,  ThrowingDelay);
}

New terms, abbreviations, and important words are shown like this: "In this chapter, we're going to cover Remote Procedure Calls (RPCs), which is another important multiplayer concept that allows the server to execute functions on the clients and vice versa."

Before You Begin

This section will guide you through the installation and configuration steps to get you set up with the necessary working environment.

Installing Visual Studio

Because we'll be using C++ while working with Unreal Engine 4, we'll need an IDE (Integrated Development Environment) that easily works alongside the engine. Visual Studio Community is the best IDE you have available for this purpose on Windows. If you're using macOS or Linux, you'll have to use another IDE, such as Visual Studio Code, QT Creator, or Xcode (available exclusively on macOS).

The instructions given in this book are specific to Visual Studio Community on Windows, so if you are using a different OS and/or IDE, then you will need to do your research on how to set these up for use in your working environment. In this section, you'll be taken through the installation of Visual Studio, so that you can easily edit UE4's C++ files:

  1. Go to the Visual Studio download web page at https://visualstudio.microsoft.com/downloads. The recommended Visual Studio Community version for the Unreal Engine 4 version we'll be using in this book (4.24.3) is Visual Studio Community 2019. Be sure to download that version.
  2. When you do, open the executable file that you just downloaded. It should eventually take you to the following window where you'll be able to pick the modules of your Visual Studio installation. There, you'll have to tick the Game Development with C++ module and then click the Install button in the bottom-right corner of the window. After you click that button, Visual Studio will start downloading and installing. When the installation is complete, it may ask you to reboot your PC. After rebooting your PC, Visual Studio should be installed and ready for use.
  3. When you run Visual Studio for the first time, you may see a few windows, the first one of which is the login window. If you have a Microsoft Outlook/Hotmail account, you should use that account to log in, otherwise, you can skip login by clicking Not now, maybe later.

    Note

    If you don't input an email address, you will only have 30 days to use Visual Studio before it locks out and you have to input an email address to continue using it.

  4. After that, you will be asked to choose a color scheme. The Dark theme is the most popular and the one we will be using in this section.

Finally, you can select the Start Visual Studio option. When you do so, however, you can close it again. We will be taking a deeper look at how to use Visual Studio in one of the first chapters in this book.

Epic Games Launcher

To access Unreal Engine 4, you'll need to download the Epic Games Launcher, available at this link: https://www.unrealengine.com/get-now. This link will allow you to download the Epic Games Launcher for Windows and macOS. If you use Linux, you'll have to download the Unreal Engine source code and compile it from the source – https://docs.unrealengine.com/en-US/GettingStarted/DownloadingUnrealEngine:

  1. There, you'll have to choose the Publishing License option and click the SELECT button below it. This license will allow you to use UE4 to create projects that you can publish directly to your users (in a digital game store, for instance). The Creators License, however, will not allow you to publish your work directly to your end users.
  2. After that, you'll be asked to accept the terms and conditions, and once you accept those, a .msi file will be downloaded to your computer. Open this .msi file when it finishes downloading, which will prompt you to install the Epic Games Launcher. Follow the installation instructions and then launch the Epic Games Launcher. When you do so, you should be greeted with a login screen.
  3. If you already have an account, you can simply log in with your existing credentials. If you don't, you'll have to sign up for an Epic Games account by clicking the Sign Up text at the bottom.

    Once you log in with your account, you should be greeted by the Home tab. From there, you'll want to go to the Unreal Engine tab by clicking the text that says Unreal Engine.

  4. When you've done that, you'll be greeted with the Unreal Engine tab. The Unreal Engine tab acts as a hub for Unreal Engine resources. From this page, you'll be able to access the following:
    • The News page, on which you'll be able to take a look at all the latest Unreal Engine news.
    • The Youtube channel, on which you'll be able to watch dozens of tutorials and live streams that go into detail about several different Unreal Engine topics.
    • The AnswerHub page, on which you'll be able to see, ask, and answer questions posed and answered by the Unreal Engine community.
    • The Forums page, on which you'll be able to access the Unreal Engine forums.
    • The Roadmap page, on which you'll be able to access the Unreal Engine roadmap, including features delivered in past versions of the engine, as well as features that are currently in development for future versions.
  5. At the top of the Epic Games Launcher, while in the Unreal Engine tab, you'll be able to see several other tabs, such as the Unreal Engine tab (the sub-tab you're currently seeing), the Learn tab, and the Marketplace tab. Let's take a look at these Unreal Engine sub-tabs.
  6. The Learn tab will allow you to access several resources related to learning how to use Unreal Engine 4. From here, you'll be able to access the Get Started with Unreal Engine 4 page, which will take you to a page that allows you to choose how you want to begin learning about Unreal Engine 4.
  7. You'll also be able to access the Documentation page, which contains a reference to the classes used in the engine's source code, and the Unreal Online Learning page, which contains several courses on specific topics of Unreal Engine 4.
  8. To the right of the Learn tab is the Marketplace tab. This tab shows you several assets and code plugins made by members of the Unreal Engine community. Here, you'll be able to find 3D assets, music, levels, and code plugins that will help you advance and accelerate the development of your game.
  9. Finally, to the right of the Marketplace tab, we have the Library tab. Here, you'll be able to browse and manage all your Unreal Engine version installations, your Unreal Engine projects, and your Marketplace asset vault. Because we have none of these things yet, these sections are all empty. Let's change that.
  10. Click the yellow plus sign to the right of the ENGINE VERSIONS text. This should make a new icon show up, where you'll be able to choose your desired Unreal Engine version.
  11. Throughout this book, we'll be using version 4.24.3 of Unreal Engine. After you've selected that version, click the Install button:
    Figure 0.1: The icon that allows you to install Unreal Engine 4.24.3

    Figure 0.1: The icon that allows you to install Unreal Engine 4.24.3

  12. After you've done this, you'll be able to choose the installation directory for this Unreal Engine version, which will be of your choosing, and you should then click the Install button again.

    Note

    If you are having issues installing the 4.24 version, make sure to install it on your D drive, with the shortest path possible (that is, don't try to install it too many folders deep and make sure those folders have short names).

  13. This will result in the installation of Unreal Engine 4.24.3 starting. When the installation is done, you can launch the editor by clicking the Launch button of the version icon:
    Figure 0.2: The version icon once installation has finished

Figure 0.2: The version icon once installation has finished

Code Bundle

You can find the code files for this book on GitHub at https://packt.live/38urh8v. Here, you will find the exercise code, activity solutions, images, and any other assets such as datasets that are required to complete the practical elements in this book.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have any questions about this book, please mention the book title in the subject of your message and email us at customercare@packtpub.com.

Errata: Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you have found a mistake in this book, we would be grateful if you could report this to us. Please visit www.packtpub.com/support/errata and complete the form.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you could provide us with the location address or website name. Please contact us at copyright@packt.com with a link to the material.

If you are interested in becoming an author: If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, please visit authors.packtpub.com.

Please leave a review

Let us know what you think by leaving a detailed, impartial review on Amazon. We appreciate all feedback – it helps us continue to make great products and help aspiring developers build their skills. Please spare a few minutes to give your thoughts – it makes a big difference to us.

lock icon The rest of the chapter is locked
Next Section arrow right
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime