Unreal Engine 4 Game Development Quick Start Guide - Rachel Cordone - E-Book

Unreal Engine 4 Game Development Quick Start Guide E-Book

Rachel Cordone

0,0
23,92 €

-100%
Sammeln Sie Punkte in unserem Gutscheinprogramm und kaufen Sie E-Books und Hörbücher mit bis zu 100% Rabatt.

Mehr erfahren.
Beschreibung

Learn how to use Unreal Engine 4 by building 3D and multiplayer games using Blueprints




Key Features



  • Learn the fundamentals of Unreal Engine such as project templates, Blueprints, and C++


  • Learn to design games; use UMG to create menus and HUDs, and replication to create multiplayer games


  • Build dynamic game elements using Animation Blueprints and Behavior Trees





Book Description



Unreal Engine is a popular game engine for developers to build high-end 2D and 3D games.






This book is a practical guide, starting off by quickly introducing you to the Unreal Engine 4 (UE4) ecosystem. You will learn how to create Blueprints and C++ code to define your game's functionality. You will be familiarized with the core systems of UE4 such as UMG, Animation Blueprints, and Behavior Trees. You will also learn how to use replication to create multiplayer games. By the end of this book, you will have a broad, solid knowledge base to expand upon on your journey with UE4.





What you will learn



  • Use project templates to give your game a head start


  • Create custom Blueprints and C++ classes and extend from Epic's base classes


  • Use UMG to create menus and HUDs for your game


  • Create more dynamic characters using Animation Blueprints


  • Learn how to create complex AI with Behavior Trees


  • Use replication to create multiplayer games


  • Optimize, test, and deploy a UE4 project





Who this book is for



Readers who already have some game development experience and Unity users who would like to try UE4 will all benefit from this book. Knowledge of basic Object-Oriented Programming topics such as variables, functions, and classes is assumed.

Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:

EPUB

Seitenzahl: 221

Veröffentlichungsjahr: 2019

Bewertungen
0,0
0
0
0
0
0
Mehr Informationen
Mehr Informationen
Legimi prüft nicht, ob Rezensionen von Nutzern stammen, die den betreffenden Titel tatsächlich gekauft oder gelesen/gehört haben. Wir entfernen aber gefälschte Rezensionen.



Unreal Engine 4 Game Development Quick Start Guide

 

 

 

 

Programming professional 3D games with Unreal Engine 4

 

 

 

 

 

 

 

 

 

 

 

 

Rachel Cordone

 

 

 

 

 

 

 

 

 

 

 

BIRMINGHAM - MUMBAI

Unreal Engine 4 Game Development Quick Start Guide

Copyright © 2019 Packt Publishing

All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.

Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book.

Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.

 

Commissioning Editor: Pavan RamchandaniAcquisition Editor:Siddharth MandalContent Development Editor:Roshan KumarTechnical Editor: Sushmeeta JenaCopy Editor: Safis EditingProject Coordinator:Namrata SwettaProofreader: Safis EditingIndexer: Pratik ShirodkarGraphics: Alishon MendonsaProduction Coordinator: Nilesh Mohite

First published: May 2019

Production reference: 1270519

Published by Packt Publishing Ltd. Livery Place 35 Livery Street Birmingham B3 2PB, UK.

ISBN 978-1-78995-068-7

www.packtpub.com

 
mapt.io

Mapt is an online digital library that gives you full access to over 5,000 books and videos, as well as industry leading tools to help you plan your personal development and advance your career. For more information, please visit our website.

Why subscribe?

Spend less time learning and more time coding with practical eBooks and Videos from over 4,000 industry professionals

Improve your learning with Skill Plans built especially for you

Get a free eBook or video every month

Mapt is fully searchable

Copy and paste, print, and bookmark content

Packt.com

Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.packt.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at [email protected] for more details.

At www.packt.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on Packt books and eBooks. 

Contributors

About the author

Rachel Cordone is a game designer and programmer who has been working with the Unreal Engine since the 1990's. She has worked with various game and simulation companies since 2003 on everything from PC, console, mobile, to VR and AR projects. For the past decade, Rachel has offered remote contract programming services to training software development companies including Northrop Grumman and Parsons Brinkerhoff. On the side, she makes video games through her company, Stubborn Horse Studios. She also wrote the book Unreal Development Kit Game Programming with UnrealScript for Packt.

I would like to thank all of the floppy-eared goats of the world, and my fiance for his support.

 

About the reviewer

Katax Emperore first encountered digital games when he got the Fire Attack series by Nintendo. One game stuck with him, a platform-based game called Shadow of the Beast by Psygnosis. He designs, develops, and teaches game design and programming. The Amiga platform created a high-quality gaming experience supported by an advanced architecture. It was a popular computer with real stereo sound, supported by advanced Direct Memory Access technology. He learned many aspects of programming, multitasking, DMA, interactive applications, I/O port mappings, graphic design, and 3D programming. When Microsoft introduced Windows 98, he learned programming, and 3D and graphic design, which led him to dedicate his education and career to the IT industry.

I am grateful to John Carmack, from id Software, for his efforts and great work on 3D graphic programming. What he invented back in 90's was the beginning of the wonderful genre of first-person shooter games. Also, I would like to thank Westwood Studios for introducing the Command and Conquer series to the gaming world. This game pioneered many aspects of modern real-time strategy games, which later powered many sub-genres in this area as well.

 

 

 

 

 

 

Packt is searching for authors like you

If you're interested in becoming an author for Packt, please visit authors.packtpub.com and apply today. We have worked with thousands of developers and tech professionals, just like you, to help them share their insight with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea.

Table of Contents

Title Page

Copyright and Credits

Unreal Engine 4 Game Development Quick Start Guide

About Packt

Why subscribe?

Packt.com

Contributors

About the author

About the reviewer

Packt is searching for authors like you

Preface

Who this book is for

What this book covers

To get the most out of this book

Download the example code files

Download the color images

Conventions used

Get in touch

Reviews

Introduction to Unreal Engine 4

Downloading the UE

Using project templates

Initial project setup

The Unreal editor

The Content Browser

The Viewport

Viewport options

Grid and snap settings

The toolbar

World Outliner

Details and World Settings

World settings

Editor preferences

Project settings

Input settings

Installing and using plugins

Adding marketplace items to your project

Summary

Programming Using Blueprints

The Blueprint window

Variables

Using variables in the Blueprint window

Working With Object/Actor References

Casting object references

Class default variables

Functions

Local variables

Events

Overridable functions

Graphs

Components

Common components

Component events

Time for action

Creating a Blueprint from scratch

One small material change

Creating a child Blueprint

Giving our game a goal

Summary

Adding C++ to a Blueprint Project

Technical requirements

Creating C++ classes in UE4

Using C++ classes in UE4

Using C++ variables in Blueprint

Using C++ functions in Blueprint

BlueprintCallable functions

BlueprintPure functions

Using out variables in C++

Using events in C++

Summary

Creating HUDs and Menus Using UMG

The Widget Blueprint window

Showing Widget Blueprints in our game

Setting up an interactive menu

Commonly used widgets

The Common section 

Button 

Checkbox

Image 

Progress Bar 

Slider 

Text

The Input section

ComboBox 

Editable Text 

The Primitive and Special Effects sections

Circular Throbber and Throbber 

Background Blur 

Using widget events

Widget set nodes

Variable binding

Adding widgets to other widgets

Modifying the Pickup class

Creating the child widget

Creating the container widget

Adding the container to the HUD

Summary

Animation Blueprints

Creating the attachment

Creating sockets on Skeletal Meshes

Spawning and attaching Actors

Animation retargeting

Setting up the source Skeleton

Setting up the target Skeleton

Retarget the animation

Adding a weapon Equip control

Modifying the Animation Blueprint

The AnimGraph

Modifying an Animation state

Summary

AI with Behavior Tree and Blackboard

Creating a simple AI

Creating a Pawn for the enemy

Creating a controller for the enemy Pawn

Adding a Nav Mesh

Behavior Trees

Creating and running a Behavior Tree

Setting up a simple Behavior Tree

Setting up a Blackboard

Assigning the Blackboard to a Behavior Tree

Creating a Behavior Tree task

Selectors

Decorators

Services

Setting up Service in Blackboard

Summary

Multiplayer Games

The client–server model

Testing a listen server

Replication

Variable replication

Event replication

Flow control in multiplayer

Actor replication

Multiplayer classes

GameMode and GameState

PlayerState, PlayerController, and Pawn

Summary

Optimization, Testing, and Packaging

Optimization

The Profiler

Blueprint Nativization

Debugging in UE4

Packing a project

Summary

Another Book You May Enjoy

Leave a review - let other readers know what you think

Preface

Unreal Engine 4 (UE4) can make developing your own games simple, even for those who have no prior programming experience.  This book will get you up to speed with the major features of UE4 quickly, and leave you with the resources required to expand your knowledge through other tutorials and official documentation.

Each chapter builds and expands on a working game. It won't be anything fancy, but you'll be able to see how UE4's systems interact by means of a working example.

Who this book is for

This book is aimed at readers who already have some game development experience and would suit Unity users who would like to try UE4. It is assumed that the reader has knowledge of basic object-oriented programming topics such as variables, functions, and classes. 

What this book covers

Chapter 1, Introduction to Unreal Engine 4, looks into how Unreal Engine can be downloaded and installed.  We will get a head start on the project's development. We will also learn how to use plugins and marketplace items to expand on the editor's capabilities and further simplify our own project's development.

Chapter 2, Programming Using Blueprints, shows how to create custom Blueprint classes and use variables and functions within Blueprint classes. You will also gain an understanding of the differences between functions and events.

Chapter 3, Adding C++ to a Blueprint Project, covers creating and using classes in UE4. You will also learn to create custom Blueprint Events in C++.

Chapter 4, Creating HUDs and Menus Using UMG, teaches you how to create widgets and how to set them up as menus and HUDs. It also demonstrates some of the more advanced uses of widgets, such as adding widgets to other widgets.

Chapter 5, Animation Blueprints, introduces a lot of information about Animation Blueprints and how to use them to make a character more dynamic. You will also learn how to modify a blueprint by taking various factors into account when creating a character.

Chapter 6, AI with Behavior Tree and Blackboard, shows how to create some simple AI by making your own Pawn and Controller with some code to make them run around a NavMesh.  You will also learn how to set up a Blackboard and how to use sequences, selectors, tasks, decorators, and services.

Chapter 7, Multiplayer Games, talks about multiplayer games and the different designs and thought processes that go into them. We will also get a clear idea of how to go about creating a multiplayer game without getting caught in some of the common pitfalls.

Chapter 8, Optimization, Testing, and Packaging, talks about optimization, testing, and packaging. You will also learn about debugging UE4 and packaging your game for distribution.

 

To get the most out of this book

Readers should have some previous programming experience, as this book includes explanations on how UE4 uses variables and functions with the Blueprint system.

Download the example code files

You can download the example code files for this book from your account at www.packt.com. If you purchased this book elsewhere, you can visit www.packt.com/support and register to have the files emailed directly to you.

You can download the code files by following these steps:

Log in or register at

www.packt.com

.

Select the

SUPPORT

tab.

Click on

Code Downloads & Errata

.

Enter the name of the book in the

Search

box and follow the onscreen instructions.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

WinRAR/7-Zip for Windows

Zipeg/iZip/UnRarX for Mac

7-Zip/PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Unreal-Engine-4-Game-Development-Quick-Start-Guide. In case there's an update to the code, it will be updated on the existing GitHub repository.

We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Download the color images

We also provide a PDF file that has color images of the screenshots/diagrams used in this book. You can download it here: https://www.packtpub.com/sites/default/files/downloads/9781789950687_ColorImages.pdf.

Conventions used

There are a number of text conventions used throughout this book.

CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles. Here is an example: "In our ThirdPersonCharacter blueprint, this can be seen with the CameraBoom and FollowCamera components"

A block of code is set as follows:

if ( MyActorReference != null ){ // This is the Is Valid output.}else{ // This is the Is Not Valid output. }

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

if (

MyActorReference != null

){ // This is the Is Valid output.}else{ // This is the Is Not Valid output. }

Bold: Indicates a new term, an important word, or words that you see onscreen. For example, words in menus or dialog boxes appear in the text like this. Here is an example: "Click on the Input subsection."

Warnings or important notes appear like this.
Tips and tricks appear like this.

Get in touch

Feedback from our readers is always welcome.

General feedback: If you have questions about any aspect of this book, mention the book title in the subject of your message and email us at [email protected].

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 would report this to us. Please visit www.packt.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details.

Piracy: If you come across any illegal copies of our works in any form on the Internet, we would be grateful if you would provide us with the location address or website name. Please contact us at [email protected] 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.

Reviews

Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions, we at Packt can understand what you think about our products, and our authors can see your feedback on their book. Thank you!

For more information about Packt, please visit packt.com.

Introduction to Unreal Engine 4

Welcome to Unreal Engine 4 (UE4)! Unreal Engine can make developing your own games simple, even for those of you with no prior programming experience. But, it is important to familiarize yourself with some of the major systems to save yourself time and headaches down the line. This book will get you up to speed with the major features of UE4 quickly, and leave you with the resources required to expand on your knowledge through other tutorials and official documentation.

This book is intended for people with some previous programming experience. I won't go into detail about how variables and functions work, but I will explain how UE4 uses them with the Blueprint system. We will go into more detail about some systems that are specific to game programming or to the UE itself, such as UMG and multiplayer.

We will use examples to learn. Each chapter will build and expand on a working game. It won't be anything fancy, but you'll be able to see how UE4's systems interact by means of a working example.

In this chapter, we will cover the following topics:

Downloading and installing the Unreal Engine

Using Project Templates to save time developing basic functionality

Explore the layout of the editor so we know where to find what we need in order to develop our game

Examine the settings we can use to fully customize our game and the editor itself to save development time

Adding plugins and marketplace items to further expand your development possibilities

So with that, let's get started!

Downloading the UE

Before we get into the engine itself, we need to download and install it as follows:

Search the internet for

Unreal Engine

, or head to this address at 

https://www.unrealengine.com

.

Create a free account with Epic Games and log in to it.

In the top right of the Unreal Engine site, you will find a link to the download. Download the

Epic Games

launcher.

Once it's done downloading, go ahead and install it.

Once that's done, open it up. This will load the

Epic Games

 launcher.

When the launcher opens, click the

Unreal Engine

button on the left-hand side:

Here, you will have four useful tabs at the top:

Here is a description of the items you can see in the preceding screenshot: 

Unreal Engine

: In addition to featured content, there are links to

AnswerHub

(like Stack Overflow, but UE4-specific),

Forums

, and a

Wiki

, with tutorials and engine documentation. There are also links to the

Roadmap

and

Blog

to see current and upcoming developments involving the engine.

Learn

: This is a more detailed tab for developers to find tutorials and documentation. This tab also includes demos and other samples. This is a great place to find inspiration for features that might otherwise not have been on your mind.

Marketplace

: This is the UE asset store. Art, code, animation, and plugins can all be found here. There is a free section to get you started, and frequent sales, so keep an eye on it!

Library

: This tab keeps track of your currently installed engine versions, your projects, and your marketplace purchases for easy installation.

This

Library

tab

is where we will begin. You can choose to install any engine version all the way back to 4.0.2, but, for the purpose of this book, we will be using the latest version, which is

 4.22.1 at th

e time of writing.

To start the installation, press the plus sign next to

Engine Versions

and select

4.22.1

with the drop-down arrow, and then press

Install

:

 

Once that's done, the Install button should change toLaunch, for example. For each project's initial setup, you'll press this button to launch whichever engine version you want the project to use. After that, the project will appear in yourMy Projectslist and you can launch them that way. You can also right-click on a project in theMy Projectslist to create a shortcut for it. That way, you won't even need to run the Epic Games launcher to dive right back into your project.

For now, hit theLaunchbutton on 4.22.1. The project browser will appear, as follows:

All of your existing projects will show in theProjectstab along with their engine version. Projects cannot be opened with a previous version of the engine, but it's usually fine to open a project with a later engine version.

You will just need to make sure any plugins your project uses will be compatible with the newer engine version.

Using project templates

In theNew Projecttab, you will find templates for various project types. These templates will give you a great head start, so you won't need to reinvent code that is common to specific game types. The templates are as follows:

Blank

: Only use this option if none of the following templates fit your project's genre. Usually, one of the other templates will cover what you need to get started, and everything about the template can be customized or deleted. But if your game project doesn't fall under anything else, you can use this option to create your entire game from scratch.

First Person

:

 This is the standard shooter template. It includes a first person arm mesh and a weapon that fires projectiles.

Flying

: This is a third-person view of a spaceship that can be flown around.

Handheld AR

: This includes everything you need to get started with augmented reality on a phone. Make sure your device supports ARKit for iOS devices, or ARCore for Android!

nDisplay

: This option is used for multimonitor/cave display setups. It is rarely used, but is an incredibly useful template when you need it.

Puzzle

: Most people associate the UE with top-of-the-line graphics, but even simple puzzle games can benefit from the workflow that Blueprints present.

Rolling

: Ball-based games will find their home here. All of these templates have keyboard, gamepad, and touch inputs already set up as appropriate. Here, the ball can be controlled with any of the three options.

Side Scroller

/

2D Side Scroller

: This is a standard Metroidvania camera setup. Which of these two you use depends on whether your art assets will be 2D or 3D.

Third Person

: This is a free rotating camera with a keyboard-controlled player, common for platformers and action games.

Top Down

: This can be easily confused with the

Third Person

template, but this one has a fixed camera with a Diablo style click-to-move player.

Twin Stick Shooter

: This is the 

Top Down

shooter template. Don't let the icon fool you; this template is just as suitable for a Hotline Miami style human player as it is for a bullet-hell spaceship one.

Vehicle

: This is the racing template. Another great feature of these templates is the ability to combine them. For instance, if you wanted to make a GTA style game where you could run around or drive cars, you could choose the

Third Person

template, and once you're in the Unreal editor, you could add the

Vehicle

template to your project as well.

Virtual Reality

: This includes hand models, teleportation, and grabbable objects.

Vehicle Advanced

: If your project needs more realistic vehicles than the simple physics of the vehicle template, this would be your choice.

Most of these templates can be used in both Blueprint and C++ projects (augmented reality (AR) and virtual reality (VR) templates are Blueprint only). Unless your goal is to solely use Blueprints or C++, don't worry too much about which project type to use. C++ can be added to Blueprint projects and vice versa.

One major exception to this is if you need to alter any of the engine code itself, or if you need dedicated servers for your game. Using the UE through the launcher with the official engine versions allows us to extend from the engine and its classes, but it doesn't let us modify the engine code directly. If you do need to do this, you will need to download and compile the engine yourself, which is fairly simple but outside the scope of this quick start guide. Most of the time, you can create and deploy your entire game without needing to touch the engine code.

Initial project setup

For this book, we will be using a Blueprint project with theThird Persontemplate, so select that.

Next, we need to choose from a few other options. These can also be changed later, so don't worry about choosing incorrectly. Here are the selections we need to make:

 

Desktop / Console

or

Mobile

: For this book, we will be using

Desktop / Console

as our target hardware.

 

Maximum Quality

or

Scalable

: We will use

Maximum Quality

here. Graphics settings can be changed once the project is created, and we will discuss some of those options later in this chapter.

 

With

or

Without Starter Content

: Most of the time, you'll want to include the starter content for quick prototyping. These assets can always be deleted from your project once they're no longer needed, but they are a great help when creating test levels:

Now, give your project a name and location and click Create Project. I will be naming the projectAwesomeGame, because we're awesome and your game will be awesome:

Now, we have to wait while the project is being created. This will take a while, and it might seem like it gets stuck at 90-something percent, but give it time and eventually, we'll get our first look at the editor!

The Unreal editor

Once the editor finishes loading, we will get our first look at it. This is what we will see:

The editor's layout will quickly be decipherable to anyone who has used Unity or another game engine before, but there's always the fear of clicking something and having everything go wonky, so let's take it panel by panel. We'll start at the bottom left with the Content Browser.

The Content Browser

This is where all of our game's content will appear, from code to static meshes, materials, sounds, and animations. If we press the arrow button in the top-left corner above the folders, we can see a complete folder view for the content in our project, as shown in the following screenshot:

To get a quick overview of the template you're using, you can press the play icon on the ThirdPerson Overviewasset (theThirdPersonBP