The Unreal Engine Developer Course - Learn C++ & Make Games
4.7 (14,775 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
92,074 students enrolled
Wishlisted Wishlist

Please confirm that you want to add The Unreal Engine Developer Course - Learn C++ & Make Games to your Wishlist.

Add to Wishlist

The Unreal Engine Developer Course - Learn C++ & Make Games

Learn C++ from scratch. How to make your first video game in Unreal engine. Gain confidence in programming.
Best Seller
4.7 (14,775 ratings)
Instead of using a simple lifetime average, Udemy calculates a course's star rating by considering a number of different factors such as the number of ratings, the age of ratings, and the likelihood of fraudulent ratings.
92,074 students enrolled
Last updated 9/2017
Current price: $10 Original price: $195 Discount: 95% off
23 hours left at this price!
30-Day Money-Back Guarantee
  • 55.5 hours on-demand video
  • 10 Supplemental Resources
  • Full lifetime access
  • Access on mobile and TV
  • Certificate of Completion
What Will I Learn?
  • Learn C++, the games industry standard language.
  • Develop strong and transferrable problem solving skills.
  • Gain an excellent knowledge of modern game development.
  • Learn how object oriented programming works in practice.
  • Gain a more fundamental understanding of computer operation.
View Curriculum
  • 64-bit PC capable of running Unreal 4 (recommended).
  • Or a Mac capable of running Unreal 4 (must support Metal).

NEW Testing Grounds FPS shipped, including...

  • Much more C++ and Blueprint.
  • AI Blackboards & Behavior Trees.
  • Environmental Query System (EQS).
  • Humanoid Animation Blending.
  • Never-ending Level Design.

This course started as a runaway success on Kickstarter. Get involved now, and get access to all future content as it's added. The final course will be over 50 hours of content and 300+ lectures.

Learn how to create and mod video games using Unreal Engine 4, the free-to-use game development platform used by AAA studios and indie developers worldwide.

We start super simple so you need no prior experience of Unreal or coding! With our online tutorials, you'll be amazed what you can achieve.

Benefit from our world-class support from both other students, and the instructors who are on the forums regularly. Go on to build several games including a tank game, and a First Person Shooter.

You will have access to a course forum where you can discuss topics on a course-wide basis, or down to the individual video. Our thriving discussion forum will help you learn and share ideas with other students.

You will learn C++, the powerful industry standard language from scratch. By the end of the course you'll be very confident in the basics of coding and game development, and hungry to learn more.

"Any serious game programmer needs to know C++"Jason Gregory, Lead Programmer at Naughty Dog (creators of Uncharted & The Last of Us)

Anyone who wants to learn to create games: Unreal Engine is a fantastic platform which enables you to make AAA-quality games. Furthermore these games can be created for Windows, consoles, MacOS, iOS, Android and Web from a single source!

If you're a complete beginner, we'll teach you all the coding and game design principles you'll need. If you're an artist, we'll teach you to bring your assets to life. If you're a coder, we'll teach you game design principles.

What this course DOESN'T cover...

Whereas this course is already huge, we can't possibly cover everything in that time. Here are some things we will not be covering...

  • Team collaboration topics.
  • Editor plugins or modifications.
  • Physics engine modification.
  • Multiplayer features.

Note: access to this course comes with an optional, free community site where you can share games and 3D models, as well as connect with other students.

Start your transformation now, you won't be disappointed!

Who is the target audience?
  • Competent and confident with using a computer.
  • Artists who want to bring their assets alive in a game engine.
  • Developers who want to re-skill across to coding.
  • Complete beginners who are willing to work hard.
  • Existing programmers who want to re-skill to game development.
Compare to Other Unreal Engine Courses
Curriculum For This Course
313 Lectures
Introduction and Setup
11 Lectures 56:32

Ben Tristem explains what this course is, and why you should consider taking it.

Preview 01:46

  • Section notes are attached to this video.
  • Who gets the most from this course.
  • What support to expect.
  • How to ask good questions.
  • What if I'm more experienced?
Welcome to the Course

  • Use the latest versions of Unreal
  • They work well with the latest Visual Studio
  • Why the videos use older versions
  • What to do if something is different.
A Note On Unreal Versions

  • Configure Visual Studio Community 2017.
  • If you’re on MacOS skip ahead 2 mins.

Software changes regularly. If your install options are different please post a screenshot in the Q&A so we can update the course. Thanks.

Setup Visual Studio or XCode

  • Start Unreal Engine Downloading too.
  • An overview of the Unreal install process.
  • What is an IDE and why you need it.
Preview 07:25

  • Get Visual Studio running.
  • Xcode is covered in the next video.
  • Write your first line of C++ code.
  • Check the code “compiles”.
  • Learn where to find the Output log.

(Unique Video Reference: 5_IS_URC)

Intro to Visual Studio 2015 on PC

  • Get Xcode running.
  • Write your first line of C++ code.
  • Check the code “compiles”.
  • Learn where to find the Output.
Intro to Xcode on MacOS

  • Expected vs Observed behaviour.
  • Creating a Minimal Viable Test case.
  • Useful information to include.
  • Explaining what has already been tried.
  • Sharing code the smart way.
  • Using Udemy Q&A effectively.
How to Ask Good Questions

  • Create a new Basic C++ project.
  • Take a quick look around Unreal.
  • Learn about saving and scenes.
  • Customise the Unreal Editor interface.
Preview 09:46

  • Well done getting setup.
  • Introduce yourself in the discussions.
  • Start the next section NOW.
  • Going from C# to C++.
Section 1 Wrap-Up

Check your basic understand of the Unreal ecosystem.

Section End QUIZ
10 questions

  • We answer your questions
  • Thanks for the intros.
  • Visual Studio on Mac?
  • Ben’s Momentum plugin.
  • And more.
Awkward paws...
Instructor Hangout
Bulls & Cows Word Console Game - Your First C++
41 Lectures 05:46:26
  • Welcome to the first actual coding video.
  • Why we’re doing this in the IDE only.
  • What you’ll be building, see resources.
  • You’ll learn types, loops, routines, classes.
  • We’ll follow Unreal’s coding style, and re-use.
  • Notes and resources are attached.
Intro, Notes & Section 2 Assets

  • You will be getting comfortable with Visual Studio
  • You write your first C++
  • We’ll have a simple and fun console game
  • You’ll be ready to dive into Unreal.

(Unique Video Reference: 1b_BC_URC )

Bull Cow Game Overview

  • How much planning should we do?
  • Define the emotional problem the game solves*
  • Chose concept, rules & requirements.
  • Start to think about the architecture.
  • Copy as much as possible into the code!
  • Document now what may change later.

* McConnell, Steve. Code Complete. Microsoft Press 2004. Chapter 3.3

S02 Game Design Document (GDD)

  • How projects and solutions relate.
  • Setting up a new command line project.
  • An overview of the structure of our solution.
  • (Adding main.cpp to our project).

(Unique Video Reference: 3_BC_URC)

How Solutions & Projects Relate

  • The difference between an engine and a library.
  • How this relates to this console application.
  • What is building / compiling code?
  • How the console knows where to find our code.
  • The syntax of a function in C++.
  • Write the minimal C++ program to remove error.
  • Testing our application runs without error.
C++ Function Syntax

  • # represents a “preprocessor directive”.
  • #include copies-and-pastes other code.
  • The idea of using library code.
  • Use <> for standard libraries.
  • Use “ “ for files you have created yourself.
  • Notice the namespace icon in autocomplete.
  • Import iostream library and use std namespace.
Using, #include and Namespaces

  • What a “magic number” is.
  • Why it’s a good idea to avoid them.
  • constexpr means “evaluated at compile time”.
  • Introduce coding standards*.
  • Use a constant for the word length.
  • *

Magic Numbers and Constants

  • The difference between \n and endl
  • Introducing pseudocode programming
  • Why we need to #import <string>
  • Getting input using cin
  • Discovering woes with our input buffer.
Variables and cin for Input

  • Re-cap the problem we have.
  • Why getline() is useful here.
  • Where to find C++ documentation.
  • A word on non-obvious solutions.
Using getline()

  • Programming is all about managing complexity.
  • We want to think about a few things at a time.
  • The idea of abstraction and encapsulation.
  • How functions help us simplify.
  • Write and call your first functions.
  • A warning about “side-effects” of functions.
  • Always use return at the end of your functions.
Simplifying With Functions

  • Why we need loops.
  • When to use for vs while.
  • The syntax of a for loop.
  • Think carefully about the first & last loop.
  • Write a for loop to repeat the game.
Iterating With For & While Loops

Consolodate your knowledge so far.

Mid Section Quiz
10 questions

  • More about levels of abstraction.
  • A word on being clever.
  • Using Visual Studio’s Extract “Extract Function”
  • What a header file (.h) is.
  • What’s refactoring, and why we do it.
  • Removing side-effects.
  • Where to find the course code on GitHub.
Clarity is Worth Fighting For

  • What a boolean is, and how to use it.
  • Only use when completely clear what you mean.
  • Use == for comparison.
  • Use && for logical AND.
  • Use || for logical OR.
  • Use [n] to access a string, starting at n=0.
  • Use ‘ ‘ for characters, and “ “ for strings.
Booleans and comparisons

  • What a do while loop is.
  • How it executes code one or more times.
  • Making our game play multiple times.
Using do and while in C++

  • Lookup the Turing machine.
  • A quick overview of the MVC pattern.
  • User defined types (classes).
  • About working at an interface level (black box).
  • An overview of class FBullCowGame
Preview 02:59

  • Introducing .h header files in C++.
  • Why the added complexity is worth it.
  • Defining the interface to our class.
  • Writing our first draft of FBullCowGame.h
Using Header Files as Contracts

  • NEVER use using namespace in a .h
  • In fact, why use it at all?
  • Create your .cpp files and #include
  • Don’t create chains of includes.
Including Our Own Header File

  • Relax, they’re just user defined types!
  • string FirstName; creates a string object
  • FBullCowGame BCGame; works the same way
  • These instances are initialised by “constructors”
  • Instantiating means “creating an instance of”
  • So we’re simply creating a game instance.
Instantiating Your Class

  • What is a getter method
  • Why we never access variables directly
  • How to call a method using the dot operator
  • Pros and cons of initialising in at compile time
  • Using “Rebuild Project” to make VS behave!
Writing & Using Getter Methods

  • const’s meaning depends on context
  • Generally means “I promise not to change this”
  • What this is depends on exactly where it appears
  • At the end of a member function, for example int GetCurrentTry() const; it prevents the function from modifying any member variables
  • This is a good safety feature.
Introducing the Const Keyword

  • Default constructor called when object created
  • Initialize in constructor when decided at runtime
  • Initialize in declaration if known at compile time
  • Constructor syntax simply: ClassName();
  • Set the member variables in constructor
  • Test this has worked.
Constructors For Initialisation

  • More on Pseudocode Programming Practice (PPP)
  • Reviewing our code and architecture
  • Using // TODO as a comment prefix
  • Introducing Visual Studio’s Task List
  • Planning our next wave of coding.
Pseudocode Programming

Wow, has it been 10 lectures already? Let's consolodate your knowledge.

Mid Section Quiz
10 questions

  • We’re substituting types to be “Unreal ready”
  • The declaration is using <alias> = <type>;
  • For example using int32 = int;
  • Why Unreal uses int32 rather than int
  • FText is for output, FString is “mutable”
  • Where to use each type of string
  • Map FText and FString to std::string
Using using for Type Aliases

  • struct is almost identical to class
  • It’s member variables (data) is public by default
  • Ideal for simple value types like BullCowCount
  • Outline BullCowCount SubmitGuess(FString)
Using struct for Simple Types

  • Why we need conditionals (selection)
  • Use if when it reads better (e.g. few conditions)
  • Use switch for multiple, simple conditions
  • (for loads of statements consider a table lookup)
  • The syntax of an if statement
  • Using if to write count bulls and cows.
Using if Statements in C++

  • A very brief intro to Visual Studio’s debugger
  • Set a break-point by clicking in margin
  • Watch values by highlighting in debug mode
  • Use “Continue” to cycle back to breakpoint.
Debugging 101

  • Centralising the hidden word length
  • Making this a property of the game class
  • Writing a getter to access this value
  • Updating our intro to vary with word length.
A Place for Everything

  • An enumerated type consists of named values
  • Use instead of coded meaning
  • Makes the code more readable and meaningful
  • Only defined values can be used - more robust
  • A benefit of C++ 11’s strongly typed enums
  • Creating an enum class for error checking.
Introducing enumerations

  • Use else if for the first time
  • Outline or CheckGuessValidity() method
  • Write working code for checking guess length
  • Use the debugger to test the return values.
Writing Error Checking Code

  • Use our error values to communicate with user
  • All our user interaction is via GameManager.cpp
  • We’ll use FText in this file, as it’s UI text
  • We can “switch” what we say based on the error
  • The syntax of a switch statement
  • Remember your break keywords!
Using switch Statements

  • Don’t get comfortable with compiler warnings
  • Refactor GetValidGuess() to remove warning
  • Rename SubmitGuess() to SubmitValidGuess()
  • Improve readability of SubmitValidGuess()
  • Get a warm fuzzy feeling!
Warm Fuzzy Feelings

  • Change our PlayGame() loop to a while
  • Implement our IsGameWon() function
Handling Game Win Condition

Wahoo, 10 more lectures down... are you feeling clever yet?

Mid Section Quiz
10 questions

Write a method to print a game summary to the screen once the game is over.

Win or Lose "Screen"

  • Algorithm: the recipe for solving a problem
  • or: 45th US Vice President’s dance style
  • Introducing the complexity of algorithms
  • A quick introduction to “Big O” notation
  • Comparing three ways of checking for isograms.

(Unique Video Reference: 33_BC_URC )

Introducing Big O Notation

  • The importance of knowing your data types
  • Introducing the std::map data type
  • #define TMap std::map to keep it ‘Unreal’
  • How we’ll be using the map
  • TMap<char, bool> LetterSeen; to declare
  • Using LetterSeen[Letter] to access
  • Wiring-up and pseudocoding IsIsogram()
TMap and map Data Structures

  • Introducing containers and iterators
  • Using a range-based for loop in Unreal*
  • Gently introducing the auto keyword
  • Finishing our IsIsogram()


Range-based for Loop

  • Gain confidence with a multi-stage challenge
  • A word on implicit dependencies
Design a Helper Function

  • Having someone else play test your game is vital
  • Silently take notes, or record screen if possible
  • Immediately go away and fix obvious bugs
  • For improvements consider 2nd or 3rd opinion
  • Repeat until the bug / issue rate plateaus.
Playtesting Your Game

  • About the flow channel*
  • map word length to max tries
  • Play test to determine correct difficulty.
  • * Read more in Sylvester, T. Designing Games - O’Reilly

Difficulty & Play Tuning

  • First impressions count (think reviews)
  • Don’t ship a half-baked product, even if digital
  • Check through your code (polish)
  • Ship to your customers (package).
Polishing & Packaging

Congratulations on getting this far. Check your knowledge, watch the wrap-up video and start the next section right away!

End Of Section Quiz
7 questions

  • HUGE congratulations on your progress
  • Over 5 hours of pure C++ learning
  • Over 30 challenges you’ve completed
  • The journey has only just begun
  • Share your source code for others to play
  • Here are some suggested improvements
  • Next we take the game logic into Unreal :-)
Section 2 Wrap-Up
Building Escape - Your First Unreal C++ Game
47 Lectures 07:28:12
  • Welcome to our first Unreal editor section.
  • You’ll learn simple level building.
  • We’ll be using meshes and materials.
  • C++ events accessed from Blueprint.
  • Calling C++ code from Blueprint.
  • And much more.

View and download the latest slides from Google Slides, link attached.

Intro, Notes & Section 3 Assets

The Concept, Rules and Requirements of our simple game.
S03 Game Design Document (GDD)

  • An overview of the finished project.

(Unique Video Reference: 1b_BE_URC)

Building Escape Overview

  • The what and why of Version Control Systems
  • Choosing your Version Control System (VCS)
  • What files to include / exclude
  • Commit = save a local snapshot
  • Reset = roll-back to a previous state
  • Branch, Push and Large File Support later.
Version Control 101

  • Derived files can be easily rebuilt
  • Other files (code, assets, level layout etc) can’t
  • Ignore most derived files for version control
  • Which folders to ignore in version control
  • Our starting .gitignore file for Unreal.
Ignoring Unreal Derived Files

  • Understand Unreal creates VS projects for us
  • How to re-generate VS project files
  • Writing our first .gitignore file
  • “Committing” our project for the first time.
Your First .gitignore for Unreal

  • Why changes to the starter scene aren’t tracked
  • Arranging a simple set of windows
  • Moving around in the 3D Viewport
  • Setting our start map, and committing
Preview 08:23

  • You’re about to meet pointers for the first time
  • The clue is when you see a * next to a type
  • Pointers are simply memory addresses
  • You have to “follow” the pointer to the object
  • Benefit: saves you from moving things in memory
  • Disadvantage: you can lose control of data.
A Pointers Primer

  • Introducing the idea of inheritance
  • Unreal’s scarily powerful class system
  • Exploring using the Class Viewer*
  • Inheritance for “is a” relationships
  • Components for “has a” relationships.
Unreal’s Class System

  • Using UE_LOG to print to the Output Console
  • Printing to the game screen

For more information read...,_Printing_Messages_To_Yourself_During_Runtime#Related_Tutorial

Runtime Messages for Feedback

  • Use GetOwner() to find the component’s owner
  • *AActor is a pointer to an actor, a new concept
  • Use -> to access methods through pointers
  • Use GetName() to find the object’s name
  • Use %s as a format operator for strings
  • Use * to “dereference” pointers.

(Unique Video Reference: 9_BE_URC)

Accessing Object Names

  • Converting old projects to IWYU.
  • Order of headers with IWYU.
  • Removing monolithic headers.
  • How to find headers.

(Unique Video Reference: 9b_BE_URC)

Include What You Use For 4.17+

Mid Section Quiz
10 questions

  • Introducing FVector
  • Mixing . and -> to access methods
  • Using multiple format operators
  • Finishing our PositionReport component.
Getting Transforms in C++

  • A little more about the editor & temporary actors
  • How to eject yourself from the possessed pawn
  • Snapping objects to the floor (END key)
  • Using the FRotator struct to represent rotation
  • Use SetActorRotation() to rotate objects.
Moving Objects With C++

  • A brief intro of BSP “vs” Static Meshes
  • Use Q, W, E keys to translate, rotate, scale
  • Make good use of grid snapping and quad view
  • Hold ALT + drag translate to duplicate an object
  • Hold L and double-click for temporary work Light
  • This is fiddly, try letting go of L and trying again.
Laying Out Geometry

  • A material is comprised of texture(s) and shader(s)
  • Textures are image files, shaders are GPU code
  • Unreal ships with some impressive examples
  • Unreal has powerful material editing tools
  • Applying materials to our room interior.
Applying Materials

  • A macro is a programmed cut-and-paste
  • This happens before the code is compiled
  • Can unlock powerful functionality
  • We don’t get code complete as standard
  • Can also create really weird build errors
  • Expose ATriggerVolume* to the Details window

(Unique Video Reference: 14_BE_URC)

Macros Starting with UPROPERTY

  • A trigger volume is a very versatile tool
  • A 3D volume that detects things entering / leaving
  • We’re going to use one as a pressure plate
  • How we’re going to specify what can open doors
  • Use IsOverlappingActor() on ATriggerVolume
  • Polling vs using events.
Using Trigger Volumes

  • We’ve used GetOwner() to search “bottom-up”
  • Now let’s use GetWorld() to search “top-down”
  • Game Mode specifies the Default Pawn Class
  • The Default Pawn is your “body”, is transient
  • The Player Controller is your “mind”, persist
  • PlayerController class has GetPawn()
Unreal’s PlayerController

  • Collisions volumes are also known as colliders
  • These tell the physics engine what hits what
  • A trigger volume just triggers code
  • A collider actually has physics simulated
  • Exploring how to add collision volumes
  • Prevent players from passing through the door!
Using Collision Volumes

  • Using GetWord()->GetTimeSeconds()
  • Making our game highly “play tunable”
  • Re-factoring our code for simplicity
  • Using a spotlight to provide “affordance”
  • Play-testing to ensure the game is annoying!
Using GetTimeSeconds()

  • We want to be able to lift the chair next
  • We’ll add a Grabber.cpp component to the player
  • The player is a temporary actor, appears on play
  • The Game Mode sets which Default Pawn to use
  • Create Default Pawn & Game Mode Blueprints
  • Specify our modified Default Pawn.
Grabbing System Overview

Mid Section Quiz
10 questions

  • Why Blueprint is helpful in this case
  • How to make a Blueprint from the Default Pawn
  • Note this Blueprint class inherits, an “is a” relation
  • A Blueprint is like a template
  • You make an “instance” in the scene
  • Explore “instantiating” from Blueprint & modifying.
Modifying the Default Pawn Actor

  • “Hard coding” means assets written into code
  • The DefaultPawn_BP is an asset
  • We want to be able to track changes to its name
  • It is convenient to use Blueprint for this purpose
  • Extending our C++ Game Mode with Blueprint
  • Selecting the new DefaultPawn_BP
Inherit Game Mode Blueprint

  • Know where the player is looking
  • Out-parameters can be confusing
  • A way of marking-up out parameters
  • Continuously logging player viewpoint.
Getting Player Viewpoint

  • How to add vectors
  • Calculating our line trace end point
  • Using debug functions for visualisation in Unreal
  • Use DrawDebugLine() to visualise the vectors.

(Unique Video Reference: 23_BE_URC)

Using DrawDebugLine

  • Line tracing (AKA ray casting) is a very useful tool
  • Imagine we shine a virtual laser into the world
  • We can use different view modes to visualise
  • Simulating physics sets the object channel.
Line Tracing AKA Ray-Casting

  • Meet references for the first time
  • LineTraceSingle may be deprecated
  • Build params inc. FCollisionQueryParams


  • How references and pointers compare
  • How to perform common operations in both
  • What the & and * symbols means in context
  • Challenge: Repoint and Rewrite
  • When to use references over pointers?

  • What to do if your Unreal solution keeps crashing
  • How to delete all temporary files
  • The order in which to reset things
Resetting Your Unreal Project

  • What FindComponentByClass() does
  • How to use it to find attached components
  • Introducing angle brackets <> for generics
  • Use nullptr to initialise your pointers
  • Log a useful error if the component isn’t attached.

(Unique Video Reference: 28_BE_URC)

Using FindComponentByClass()

  • Settings > Project Settings > Engine > Input
  • Action mappings are used for on / off actions
  • Axis mappings are used for analog values
  • You can give players a way or re-mapping
  • Many keys can bind to one action
  • How to call a function on a key press or release

(Unique Video Reference: 29_BE_URC)

Introducing Input Binding

  • How the arrow, dot and :: accessors work
  • Introducing virtual memory
  • Introducing permanent storage, stack & heap
  • Heap is also known as free store
  • How accessor operators relate to memory
  • Bind another input action
Accessors & Memory Layout

Mid Section Quiz
10 questions

  • A “hot loop” is code that get called often
  • TickComponent is a good example, every frame
  • Beware of code that you know will be called a lot
  • Make it clear what happens every tick
  • Refactor our code for speed...
  • ...and make it ready for for the physics handle.
Reducing Code in “Hot Loops”

  • Unreal provides a Physics Handle that’s ideal here
  • The Physics Handle component docs are scant*
  • Find an example of its use in the engine
  • Get the physics handle working.
Using Physics Handles

  • Using multiple getters for multiple return values
  • Less lines of clear code is better (143 at start)
  • Naming is really important, take the time
  • Comment the “why”, don’t assume it’s obvious
  • The “what” should be obvious...
  • … but it can be helpful to add clarification
Refactoring Rules

  • A TArray is Unreal’s go-to container class
  • Use to contain many elements of same type
  • We’ll use to contain all actors on pressure plate
  • Give our Default Pawn an eye-height and mass
  • Making our pressure-plate based on total mass.
Introducing Unreal’s TArray

  • Using auto& as an auto reference type
  • Automatically iterating over a TArray
  • Pattern: for (const auto* Iterator : Array)
  • How to find an actor’s mass
  • Tweaking and testing our mass values.
Iterating over TArray with for

  • Are you using source control? If not start now
  • You can “binary search” commits quite fast
  • For example 1024 commits takes max 10 tries!
  • Think “what changed” and “possible side-effects”
  • Remember you can eject with F8 during play.
Debugging Game Issues

  • You may want to re-size objects (e.g. panels)
  • Doing so will stretch the texture
  • You can re-scale a few ways
  • One way is in the material blueprint
  • UV mapping because we ran out of letters!
  • Using the TexCoord node in the material editor.
Managing Texture Tiling

  • Horrible crashes when we follow a nullptr
  • We must always check pointers before use
  • When declaring always initialise to nullptr
  • Look for * in your .h files to help find pointers
  • Also check before every use and handle nullptr
  • Sometimes we may chose not to, e.g. Owner.
Pointer Protection Process

  • Sometimes Blueprint’s the better choice
  • For example defining our door swing as a curve
  • We can create an event called OnOpenRequest
  • Using UPROPERTY (BlueprintAssignable)
Exposing Events to Blueprint

Mid Section Quiz
10 questions

  • The Timeline node in Blueprint has a curve editor
  • This is ideal for defining our door movement
  • How to use Timeline curves in Blueprint
  • Setting rotation from a Timeline.
Using Blueprint Timeline

  • Using Blueprint has superseded some code
  • It’s important there’s only 1 place per parameter
  • Creating a 2nd event: OnClose
Everything in its Place

  • Not all doors have the same absolute rotation
  • We want to store the door’s rotation at the start
  • … then use this value to make a relative rotation
  • We can use Blueprint variables for this
  • Making doors that face any direction work.
Using Variables in Blueprint

  • We’re going to trigger a simple sound in Blueprint
  • Later in the course we’ll use C++ too
  • However we’ll always reference our assets via BP
  • How to trigger a 3D sound.
SFX & Audio Clips

Section End Quiz
5 questions

  • Congratulations on another complete section
  • You’ve learnt so much, look at the lecture titles
  • Please carry-on a little on your own and share
  • Attached are useful resources
  • Start the next section as soon as you’re finished.
Section 3 Wrap-Up
Battle Tank - A Fun Tank Battle with Mortars
102 Lectures 19:11:45
  • Battle Tank is an open world tank fight
  • This will be a head to head battle
  • Other player can be human or simple AI
  • Heavy focus on control systems
  • Also learning terrains, UI, terrain sculpting & more
  • Dive right in and enjoy yourself!

(Unique Video Reference: 1_BT_URC)

Intro, Notes & Section 4 Assets

  • An overview of the finished Battle Tank project.

(Unique Video Reference: 1b_BT_URC)

Battle Tank Overview

  • The Concept, Rules and (initial) requirements
  • We’ll iterate around a loop while making this game
  • Constantly asking “what’s least fun”
  • Remember we’re not AAA studios
  • Let’s find the essence of fun of this game.
S04 Game Design Document (GDD)

  • Creating an online repository for your project
  • GitHub provides public hosting for free
  • We will use their default UnrealEngine .gitignore
  • We’ll then “clone” this repository to our machine
  • How to use a with markdown*
Setting Up a GitHub “Repo”

  • Creating an Unreal project in an existing “repo”
  • What’s good about Landscapes in Unreal Engine
  • How to add a Landscape in Unreal
  • How to delete a Landscape in Unreal.
Creating & Deleting Landscapes

  • You can change position & rotation later
  • Scale will impact terrain size, so set on creation
  • How to choose your “Section Size”
  • The effect of the “Number of Components”
  • Creating a landscape of a specific scale.
Landscape Setup & Scaling

  • Sculpt: hills, valleys & flat areas
  • Smooth, flatten & ramp: create useful features
  • Erosion & noise: make it more organic
  • Paint: use layered materials
  • Details: add details (foliage, trees, etc)
A Landscaping Process

  • Epic games launcher helps manage versions
  • Remember to commit your project first
  • You can then “Convert in-place”
  • Check your project runs OK in new version
  • Close everything and re-commit
  • How to tag a commit in GitHub.
Upgrading Engine Version

  • Create a material for your landscape
  • Set Usage > Used with Landscape
  • LandscapeLayerBlend node & Vector Parameters
  • Add at at least two layers & create LayerInfo
  • Paint the landscape from the Modes tab
  • Screenshot and share with us
Using Landscape Layers

  • Unreal’s tools are setup for photoreal landscapes
  • Once you set the bar high, the rest must match
  • An alternative is to opt for a low-poly look...
  • ...then you can focus on gameplay, story, sound
  • Can be a good choice for smaller teams
  • How to make low-poly, flat-shaded landscapes.
Flat Shading Low Poly Landscapes

  • How to make flat shading optional
  • Importing and exporting landscape heightmaps
  • Reducing the resolution of a landscape
  • Using a texture in a landscape material.
More Landscaping Tools

Mid Section Quiz
10 questions

  • Support keyboard, mouse & gamepad controller
  • Mapping player intentions to control inputs
  • Mapping control inputs to actor actuators
  • Introducing the concept of “fly by wire”.
Tank Control System

  • Import the tank in 4 static mesh parts
  • Assemble the parts using sockets
  • Create our Tank_BP and test.
Actors from Multiple Meshes

  • Add mass to the tank
  • Fine-tune track position
  • Replace root component in Tank_BP
  • Enable physics and assign a mass
  • Set the tank as the Default Pawn
  • Setup PlayerStart and debug start collisions.
Configuring a Tank

  • Horizontal Coordinate System
  • Setup a Camera Spring Arm
  • Why the Spring Arm alone isn’t enough
  • How rotations don’t “commute”
  • Binding mouse and gamepad to camera control.

(Unique Video Reference: 14_BT_URC)

3rd Person Camera Control

  • Use a Scene Root as azimuth gimbal
  • Use the Spring Arm for elevation control
  • Adjust the Spring Arm length
  • Set the camera rotation to 0 (down the arm)
  • Decide if you want the camera to roll or not.
Fixing 3rd Person Camera Rotation

  • Create a Widget Blueprint for the aim point
  • Decide the Player Controller with create the UI
  • Create widget and add to viewport in Blueprint
  • Override the Player Controller in the game mode.
User Interface (UI) in Unreal

  • Create a dedicated Scene for the Main Menu
  • Use the Level Blueprint to configure UI
  • Add a background image to get started.
Main Menu Screens

  • Show mouse cursor in Unreal UI

  • Use a Scale Box for background image scaling

  • Add a Start button

  • Customise fonts inside our UI Widget

  • Set anchors so UI scales to different aspect ratios.

UI Scale Box, Buttons & Mouse

  • Bind Start button event to Blueprint

  • Create custom WidgetReady event

  • Make Start menu button focused on play

  • Ensure we can quit from the game

  • Aim towards Steam “Full Controller Support”.

Controller Ready Navigation

  • Creating a stand-alone game
  • Setting the first level that loads
  • Making sure the input mode works
  • Setting-up for “Full Controller Support”.
Trial Packaging Your Game

Mid Section Quiz
9 questions

  • How delegation can hide information
  • Creating a custom Player Controller class
  • Re-parenting Blueprint classes onto our C++
Delegating to Components

  • A virtual method can be overridden by children
  • The override keyword is a sanity check
  • Use Super:: to include parents’ functionality
  • Use this to add BeginPlay() to PlayerController.
Using virtual and override

  • What is static polymorphism?
  • How is it used?
  • What is dynamic polymorphism?
  • How is that used?
Dynamic vs Static Polymorphism

  • How methods are called.
  • Why we need the virtual method.
  • How Vtables implement this.
  • See how the assembly changes.
Dynamic Polymorphism & Vtables

  • How to create a AIController based C++ class
  • Assigning an AI Controller to a Pawn
  • Verifying which pawns are possessed
  • Logging possession to the console.
Creating an AI Controller Class

  • Getting the AI to find the player position
  • We won’t implement line-of-sight for simplicity
  • UGameplayStatics::GetPlayerController()
  • Or GetWorld()->GetFirstPlayerController()
Get the Player Controller with C++

  • Revise adding engine methods into new classes
  • Pseudocode our initial aiming logic
  • Learn about Visual Assist for Visual Studio.
Add Tick() to PlayerController

  • Out parameters smell a little but are used a lot
  • Allows you to return a bool and a FVector
  • Alternative architecture would be a struct or class
  • We’ll do it this way to get you more comfortable with creating your own methods using out parameters.
Creating an Out Parameter Method

  • Use FVector2D() to store pixel coordinates
  • This is two floats, pixels can be non-integer
  • Revising UPROPERTY(EditAnywhere) and more.
Finding Screen Pixel Coordinates

  • How to find the camera look direction

  • What the WorldLocation parameter does

  • WorldDirection returned is a unit vector.

Using DeprojectScreenToWorld

  • We want world position of anything visible

  • GetWorld()->LineTraceSingleByChannel()

  • Use the ECC_Visibility channel for what’s seen

  • Remember HitResult is a rich object

  • Use HitResult.Location for Location member.

Using LineTraceSingleByChannel()

  • AI and Player possessed tanks aim the same way
  • Later the tank will delegate aiming
  • But the AI/Player controllers don’t care
  • This provides nice abstraction
  • We also hide implementation details
  • … and make the game more fair.
Unify Player & AI Aiming

Mid Section Quiz
10 questions

  • You can add required components in C++

  • Our Tank Aiming Component is a good candidate

  • We will delegate all AimAt() requests…

  • … regardless of their source (AI or player).

Create Default Sub Objects in C++

  • Why StaticMeshComponet is prefixed with U
  • Creating a setter for the barrel reference
  • How to name parameters in setters
  • Using BlueprintCallable() to call C++ from BP
  • Finding the start position of or projectile.

  • How speed and velocity relate

  • The high and low projectile arc

  • Setting a launch speed on the tank

  • Introducing SuggestProjectileVelocity()


  • Use SuggestProjectileVelocity() in Unreal
  • Work out where a projectile will land.
Predict Projectile Landing Point

  • A FRotaor is a struct
  • It contains Roll, Pitch and Yaw as floats
  • Convert using .Rotation() method
  • Report aim direction as a rotator
  • Log result to the console in Unreal.
Using FRotators in Unreal

  • If we #include in a .h file we create a “chain”

  • Any .h file that includes us will in-turn include

  • This can be hard to keep track of

  • To simply use a type, we can “forward declare”

  • Simply put class ClassName; under the includes

  • You’ll still need to #include in the .cpp to use.

Using Forward Declarations

  • In actor blueprints you have custom components
  • Static mesh components don’t appear by default
  • Use BlueprintSpawnableComponent annotation
  • Using hidecategories = ("CategoryName")

  • More about the Unreal Header Tool (UHT)
  • Pre-processing happens first, e.g. on macros
  • Then compilation produces .obj files
  • These .obj files are linked by the linker
  • How to #include strategically.
The C++ Compilation Process

  • How to disable or enable tick on various classes
  • GetWorld()->GetTimeSeconds() for logging
  • Documenting your execution flow for clarity
  • Change parameter names for clarity.
Review Our Execution Flow

  • If something’s weird break it down
  • Use logs or the debugger to follow each step
  • SuggestProjectileVelocity() has a bug*
  • … it MUST have an optional parameter!?
  • Moving to forward declarations.
How to Report Bugs

Mid Section Quiz
10 questions

  • FMath::Clamp<type>(Input, Min, Max);
  • Very useful for restricting value ranges
  • Clamp our Barrel’s elevation
  • Wire it to the aiming component
  • Test barrel elevation works.
Using Clamp() to Limit Values

This mid-section challenge will help you integrate your knowledge and really cement what you’ve done in the past few lectures. It will also give you a great foundation of practical understanding on which to build. Please give it a good shot before watching my solution.

CHALLENGE - Turret Rotation

This is the 2nd part of the solution to this section’s longer challenge. We’ll be finishing off the turret rotation, giving us complete barrel aiming control by the end :-)

(Unique Video Reference: 44_BT_URC)

CHALLENGE - Turret Rotation Pt.2

  • Create a public Fire() method on our tank
  • Bind input via Blueprint
  • Call this new C++ method to test
  • Create a Projectile class, and Blueprint it.
Setting Up Projectiles

  • Multiple versions of the engine take up GB
  • Upgrade Building Escape and Battle Tank
  • Learn more about using source control
  • Using Stash in source control
  • Fixing issue with overlapping collision volumes.
Upgrading to Unreal 4.12

  • About AutoWeld compound objects
  • Working through self-collision issues
  • Disabling gravity on subobjects
  • A reminder Unreal is designed for humanoids.
Working Round Awkward Bugs

  • Using TSubclassOf<Type>
  • More about forward declarations
  • How to use GetWorld()->SpawnActor()
  • How to spawn projectiles from a weapon.
Using SpawnActor<>() to Spawn

  • Recap use of CreateDefaultSubobject()
  • Use a ProjectileMovementComponent
  • Get our tank delegating launch to projectile.
Projectile Movement Components

  • Inline some code for readability
  • Inlining can also be called “defactoring”
  • Less lines of code is often better*
  • * everything else being equal
  • FPlatformTime::Seconds() is an accurate timer
  • Make AI tanks fire on every frame.
Making AI Tanks Fire

  • EditAnywhere allows all instances to be edited
  • For example each AI tank could be different
  • EditDefaultsOnly allows “architype” editing
  • In other words, all tanks must be the same
  • Think which you want in future.
EditAnywhere vs EditDefaultsOnly

Mid Section Quiz
10 questions

  • Using primitive colliders in Unreal
  • Adding a quit button to our main menu.
Adding a Quit Button

  • Base Tank Tracks on UStaticMeshComponent
  • Create a BlueprintCallable throttle method
  • Bind input to track throttles
  • Discuss what Input Axis Scale does.
Setup Track Throttles

  • GetComponentLocation() does what it says!
  • Find root: GetOwner()->GetRootComponent());
  • Cast to UPrimitiveComponent so you can…
  • AddForceAtLocation();
  • Estimate sensible defaults for driving forces.
ApplyForceAtLocation() in Action

  • You can assign a physics material under collision
  • Friction is combined between two surfaces
  • The coefficient is the proportion of the contact force that can be exerted sideways before slip.
  • Adjust friction and driving forces to get movement.

(Unique Video Reference: 55_BT_URC)

Physics Materials & Friction

  • Fly-by-wire means translating control intention
  • How control intention maps to track throttles
  • Creating a TankMovementComponent C++ class
  • Why inherit from UNavMovementComponent
Fly-by-Wire Control System

  • Bind some input for forward and backward
  • Make the method BlueprintCallable
  • Make TankMovementComponent a default on tank
  • Make a protected tank variable to store pointer
  • Make this pointer BlueprintReadOnly pointer
  • Test that you get a log of +/-1.
Using BlueprintReadOnly

  • Actor components require instance references
  • We were passing these references from the tank
  • But we could equally keep them locally
  • Move to composing our actor in Blueprint
  • Create an initialise method for aiming
  • Test it works and hail the simpler code.
A Better Component Architecture

  • Add IntendTurnRight() method
  • Bind firing input to the “A button”
  • Test we can move manually with fly-by-wire.
Completing Manual Tank Movement

  • Pathfinding is finding the shortest possible path
  • This requires some (artificial) intelligence
  • All pathfinding must happen on a navmesh
  • Adding Nav Mesh Bounds to the level
  • An overview of how MoveToActor() and RequestDirectMove() work.
Introducing AI Pathfinding

  • We have access to Unreal’s source code
  • Let’s look into the UNavMovementComponent.h
  • We’re looking for RequestDirectMove()
  • We’ll override it without calling Super
  • We can then get the golden MoveVelocity vector
  • AI tanks can now use our fly-by-wire controls!
Dissecting RequestDirectMove()

Mid Section Quiz
10 questions

  • Focusing on controlling forward speed of AI
  • If target in front, move forward full speed
  • If target to side, don’t move forward
  • Vary smoothly in-between
  • This sounds like a cosine function to me!
  • Using FVector::DotProduct()
DotProduct() Vector Operator

  • Focusing on controlling turning of AI
  • If target in front or behind* don’t rotate
  • If target to side rotate at full speed
  • This is the behaviour of a sin function
  • Using FVector::CrossProduct()
CrossProduct() Vector Operator

  • Private, protected or public? Use the safest
  • UPROPERY / UFUNCTION needed? Use “”
  • #include and forward declarations required?
Finalising Your Class Code

  • Remember “what’s the least fun thing about this?”
  • One thing is not knowing if you can fire
  • How to change crosshair colour in blueprint…
  • … according to the aiming component state
  • States: Locked, Aiming, Reloading
  • Referencing actor component from player UI.
How to Use Blueprint Variables

  • We met enum class around lecture 35
  • In Unreal we must annotate with UENUM()
  • We must specify the storage type (uint8)
  • See Unreal’s coding standards in Resources
  • Remember we use enums to encode meaning.
Using Enum(erations) in UE4

  • Move away from CreateDefaultSubObject()

  • Make aiming a BlueprintSpawanableComponent

  • Get our code re-compiling as soon as possible

  • Experience hard crash and add pointer protection

  • Possibly get exasperated that we can’t find the suspected null-pointer causing the crash.

Refactoring our Aiming Component

  • Hard crashes can be difficult to diagnose
  • Attach your IDE’s debugger to the Unreal editor
  • Use it to discover the source (often null pointer)
  • We can also probe using Print in blueprint.
Attaching a Debugger to Unreal

  • Adding log entries to C++ and BP helps you to uncover the timing over events in the engine
  • We’re doing this to discover exactly when Construct and Begin Play gets called in both C++ and Blueprint
  • Note dropped actors are constructed in editor.
Constructor & Begin Play Timing

  • We don’t have a Aiming Component reference

  • It is hard to find a sensible time to set it

  • Also we don’t need the reference on the tank

  • We can Get Components by Class in Blueprint

  • Mock-up our C++ code in Blueprint.

Decoupling Your Architecture

  • We want to expose a C++ function to Blueprint
  • We also want to pass a parameter (aiming ref.)
  • Multicast delegates only work like this for actors
  • We’re using a component so we use…
  • UFUNCTION(BlueprintImplementableEvent)
  • You don’t need to define the function!

Mid Section Quiz
10 questions

Using the ensure Assertion

  • Code architecture can be hard to see
  • Dependency mapping shakes-out the structure
  • Go through your .cpp files and look at includes
  • Map these as dependencies on a diagram
  • If it looks like spaghetti, you need to refactor!
Dependency Mapping

  • Congratulations on getting this far
  • We’re not teaching sterile solutions here
  • We’re showing you how to recognise real issues
  • … and how to tackle them sensibly
  • It’s not the easy path, but it is the valuable one.
Talking Head - Real World Skills

  • You should probably only refactor working code
  • Red means your code’s not working
  • Green means it is, even if the code is messy
  • We commit at green, then start refactoring.
Starting From Green

  • There is no need to cast the Pawn to a Tank
  • Doing so creates a dependency we don’t want
  • Remember a Tank is a Pawn
  • We simplify our architecture here.
Aiming Without the Tank

  • Removing our final dependencies
  • If you override BeginPlay() in an actor you should call Super::BeginPlay()
  • If you don’t override it at all, there’s no need to, your Blueprint Begin Play will still run.
Finishing our Refactoring

  • Actor Components use TickComponent not Tick
  • You can find the signature in docs online
  • Or by copying from the engine code
  • Remember to use override at to check
  • Remember to set the boolean in the constructor
  • GetWorld()->GetTimeSeconds() alternative.
Adding TickComponent() Back

  • FVectors are just structs containing float
  • You must “define equal” when comparing floats
  • The FVector::Equals() method allows this
  • Specify a tolerance, see docs in resources.
Are Two Floats Equal?

  • We can apply a sideways correction force
  • Remember Force = Mass * Acceleration
  • … and Acceleration = Speed / Time
  • So we calculate the force using the slippage speed,the frame time, and the tank mass
  • A way to calculate is FVector::DotProduct()
Programmatic Sideways Friction

  • We could use OnComponentHit in Blueprint
  • But we’re grown-ups so we’re going to use C++
  • Signature of OnHit(...) has changed in 4.12
  • Remember you need to make it a UFUNCTION
  • Details on next slide.
OnComponentHit Event in 4.12

  • Boolean flags usually make answers old
  • Try and think of a way of avoiding them
  • Revise the use of FMath::Clamp()
Avoiding Boolean Flags

Mid Section Quiz
10 questions

  • Use a literal glass ceiling to help with testing!
  • Sometimes the barrel takes the long route
  • A simple if() statement can help here
  • Find and fix another bug in the code
  • You can use %i formatter to log booleans.
Improving Tank Aiming

  • Expose the Acceptance Radius to blueprint
  • Tweak that value as EditAnywhere
  • Change back to EditDefaultsOnly once found
  • Prevent AI tanks firing until aiming is locked.
Tweaking Tank AI

  • Add a 4th enum state for out of ammo
  • Work around bug of blueprint select nodes not updating when we add new enum values in C++
  • Add a display for rounds remaining
  • Bind the UI to a GetRounds() method.
Making an Ammo Display

  • The tank components were built for the tank
  • It turns-out we can re-use movement and aiming
  • This is the benefit of re-usable components
  • We’ll create a self-aiming mortar tower.
Making an AutoMortar

  • Currently we .gitignore the Starter Content
  • Therefore we can’t track changes
  • We want a consistent starting point for particles
  • So we’re going to delete Starter Content
  • Lots depends on it so we use a special tool
  • That special tool is the reference viewer.
Using the Reference Viewer

  • We will compose our projectile in C++
  • Use SetRootComponent()
  • Use AttachTo(RootComponent)
  • You can set default properties in C++
  • Use UPROPERTY(VisibleAnywhere)
Preparing for Particles

  • Setup a Starter Content project
  • Use it to migrate assets to Battle Tank
  • Explore particle systems
  • Use world space for smoke trails
  • Create and share your smoke trail.
Introducing Particle Systems

  • Our smoke disappeared when viewed from side
  • This is due to the fixed particle bounding boxes
  • We can fix it by making the boxes dynamic
  • BUT we need to remove GPU rendered particles
  • … and test the performance hit is acceptable.
Particle Bounding Boxes

  • Use Message Log to see warnings
  • AttachTo() has become AttachToComponent()
  • Now must provide FAttachmentTransformRules
  • We’ll use KeepRelativeTransform for now
  • Write code to de-active launch blast and
  • Activate impact blast on impact.
Using FAttachmentTransformRules

Mid Section Quiz
10 questions

  • If you don’t AttachToComponent() then…
  • It will look like you’re attached but…
  • The transform may be broken and…
  • You’ll get really weird effects and…
  • Unreal may cache the issue...
  • So, always AttachToComponent() :-)
Radial Forces & Caching

  • Currently we don’t destroy our projectiles
  • This will cause slow-down and memory leakage
  • You won’t pass console testing with a leak
  • Tidy up after ourselves
  • Discuss projectile schemes
  • Destroy our projectiles with a timer.
Using GetTimerManager()

  • Unreal has an actor damage system
  • We’ll apply radial damage from the projectile
  • Then the AActor::TakeDamage() method will be called on the tank (and all other actors in radius)
  • We’ll then finish our damage system off
  • Solve the int or float damage question.
Using TakeDamage() on Actors

  • Add a UI Widget component to our tank
  • Make a very simple health progress bar
  • Wire the bar to the tank.
BlueprintPure & Health Bars

The Observer Pattern

  • We’re nearing the end of the section

  • You have several challenges over to try

  • These include various fixes and improvements...

  • Use StartSpectatingOnly() in Player Controller

  • DetachFromControllerPendingDestroy() in AI

  • Fixing a bug with our starting health

Finishing Off - Part 1

  • You can use the noise function on landscapes
  • Gameobjects are automatically destroyed when they travel a long way from the play area
  • Reviewing Unreal’s coding standards.
Finishing Off - Part 2

In this section we covered...

  • Basic terrain landscaping
  • Using and modifying the AI pathfinding system
  • A deep-dive into control systems
  • User Interface for the first time
  • A whole tonne of C++ and architecture.
Section 4 Wrap-Up

  • Our player controller line traces to aim

  • This can hit the UI in some circumstances

  • Change our line trace channel to ECC::Camera

  • Add a 1st person camera

  • Use the Toggle Visibility Blueprint node

  • Bind input and enjoy simple camera swapping.

Bonus - Switching Cameras

End of Section Quiz
7 questions
Testing Grounds FPS
111 Lectures 22:15:01
  • Welcome, fresh start, new energy
  • Did you go back and modify Building Escape?
  • Most ambitious section yet
  • Bookmark the live Google Slides
  • Comment on the slides, especially typos
  • Come say hi at
Preview 02:21

  • The concept of the game
  • The rules of the game
  • Some of the asset requirements for the game
  • Identify possible technical challenges.

(Unique Video Reference: 2_TG_URC)

Testing Grounds GDD

  • The distinction between Git vs GitHub
  • Use Unreal’s toolbar & SourceTree
  • Enable Git Large File Support (LFS)
  • Setup on GitHub (no or initial commit)
  • Push to GitHub and share*
  • Warning: may take a while on slow broadband.
Using Git LFS (Large File Support)

  • Limitations of Unreal’s connection to GitHub
  • How to reset to previous commit to combine
  • Presenting your public GitHub page well
  • Using Markdown to enrich formatting.
Marketing & Markdown

  • Upgrading my project to Unreal 4.13
  • An overview of the scene
  • How the First Person Character is composed
  • Adding a spiral staircase.
Use git clean to Revert Project

First Person Character Overview

  • Add a third person character to the scene
  • Caution about tidying files at this stage
  • Add a navmesh, and check it’s continuous.
The Third Person Character

  • Setup a Blueprint AI controller class
  • Behaviour Trees controll AI execution flow
  • Blackboards hold AI instance data
  • How to associate a behaviour tree with an AI
  • Testing that our behavior tree is running.
Introducing AI Behaviour Trees

  • Blackboard data is like member variables in code
  • Using blackboard data to set patrol points
  • Practice setting blackboard values in Blueprint
  • Test simple AI patrol behaviour.
Introducing AI Blackboard Data

  • Add a variable to the NPC’s blueprint
  • How to make a variable an array in blueprint
  • Introducing Target Point actors
  • Using target points to specify patrol routes.
Target Points and Patrol Routes

Mid Section Quiz
10 questions

  • Actors are more general than target points
  • How to select an actor from another actor
  • Getting the AI Controller to set Blackboard data
  • Testing our characters go to a set waypoint.
Using Any Actor for Waypoints

  • Use layers (usually used for visibility)
  • Use groups as a simple multi-select tool
  • Use tags, can be flexible but easy to forget
  • Use a parent Empty Actor, or a Folder
  • Group on game object (e.g. array on NPC)
  • The key is to know the pros and cons.
Options for Grouping Actors

  • How to use Blackboard Key Selector variables
  • Creating new Tasks in Behaviour Trees
  • Pseudocode programming in Blueprint
  • How to use the Execute AI node
  • How to use the Finish Execute node.
Blueprint Behaviour Tree Tasks

Modular Arithmetic & Cycles

  • The first rule of performance: “profile first”
  • Access profiler from Window > Developer Tools
  • Choose Session Front End
  • Select your running game session
  • Chose Profiler tab, and hit Data Preview
  • Search for your function and double-click.
Performance Profiling 101

  • Add “AIModule” and “GameplayTasks” to build
  • Inherit C++ class from UBTTaskNode
  • Override ExecuteTask()
  • Return EBTNodeResult::Succeeded;
  • Don’t try and extend in Blueprint
  • Use Blueprint XOR C++ for a given task.
C++ AI Behaviour Tree Tasks

  • Expose a blackboard key selector in C++
  • #include “BehaviorTree/BlackboardComponent.h”
  • OwnerComp.GetBlackboardComponent()
  • Use GetValueAsInt() etc to get the value
  • You can now access blackboard data in C++.
Reading Blackboard Data in C++

  • We have coupled our AI ChoseNextWaypoint task to the Third Person Character.
  • We have also specialised our Blueprint class with a variable, PatrolPoints.
  • These dependencies are undesirable, but we will proceed with our conversion.
The Consequences of Inheritance

  • OwnerComp.GetAIOwner() to get AI Controller
  • If you’re casting, you’re probably coupling
  • Use .Num() to get number of elements in TArray
  • Use TODO for reminders, to help you FOCUS
  • FOCUS = Follow One Course Until Successful.
Converting Blueprint to C++

  • We created PatrollingGuard by inheritance
  • How about if we want a patrolling tank?
  • Another option is to use an actor component
  • This is an age-old debate
  • Let’s get some real-world experience of the two
  • Convert to a component model.
Composition over Inheritance

Mid Section Quiz
10 questions

  • What we've covered recently
  • What's coming up.
Talking Head: What We've Covered So Far

  • Yes it should be easier than this, tell Epic!
  • How to remove CPP files from browser in Unreal
  • The process for deleting C++ classes.

(Unique Video Reference: 22_TG_URC)

How to Delete a C++ Class

  • Also called Material Instances
  • These allow modification with little overhead
  • How to create an instanced material.
Instanced Materials

  • Use AI Perception, it’s newer than Pawn Sensing
  • How to add AI Perception to your controller
  • Use the apostrophe key ‘ to enable AI debug
  • Remember Shift + F1, F8, F11 etc.
Introducing AI Perception

  • Use the On Target Perception Updated event
  • This reports the actor sensed
  • And the class of the sense (e.g. sight, hearing)
  • How to setup perception events.
OnTargetPerceptionUpdated Event

  • Hearing is a sense that compliments sight
  • How to set up AI Perception hearing sense
  • How to get hearing perception to trigger
  • Making your actor create a noise.
AI Hearing Perception in Unreal

  • The skeleton comprises the bones
  • Over the skeleton lays a skeletal mesh
  • Each vertex of the mesh connects to bone(s)
  • The animation tells the bones how to move
  • The bones tell the mesh how to move
  • The Animation BP controls the animations.
The Animation Starter Pack

  • How to change a mesh’s animation class
  • Matching the animation’s mesh to…
  • … the mesh selected on the character
  • You can apply instance changes to blueprint
  • However be careful what you take with you
  • Solving “can’t save… graph is linked” error.
Changing a Character’s Animation

  • You can start with a off-the-shelf blueprint
  • We can then add our reusable components
  • Another way of getting our desired character.

(Unique Video Reference: 29_TG_URC)

Customising a Character Blueprint

  • Behaviour trees can get complex
  • We want to keep a consistent level of abstraction
  • Behaviour trees can run “sub” trees
  • This helps us organise our project.
Sub Behaviour Trees

Mid Section Quiz
9 questions

  • Congratulations on getting this far in the course.
  • Recapping the AI work we have done so far.
  • Introducing the new instructor for the section: Sam.
Talking Head - Introducing Sam

  • Why refactoring is so important.
  • Refactor skills give you the edge.
  • What’s coming up in the next lectures.
Talking Head - Refactoring Superpowers

  • Deleting and Moving folders.
  • Ensuring deletion on the file-system.
  • Good file structure for Unreal.
  • Viewing the dependencies of an object.
  • How and when to fix redirectors.
Simplifying Our Project

  • Renaming CPP files.
  • How to deal with renaming blueprint parents.
  • Refactor class names in CPP.
  • Updating .generated.h files.
Renaming & Moving CPP

  • Repeating the renaming process.
  • Finishing our refactor.
  • Fixing CDO Constructor errors.
Solution: Renaming & Moving CPP

  • Reading existing source code for hints.
  • Creating a socket on a skeletal mesh.
  • Parenting a gun to that socket.
  • Removing unused assets.
Holding a Gun with Skeletal Sockets

  • The major components.
  • How to preview animations.
  • Definition of an animation and pose.
  • Understanding the AnimGraph.
  • Playing a custom animation.
Understanding Animation Blueprints

  • Why state machines?
  • What are state machines?
  • What’s inside a UE4 state?
  • How to add transitions.
  • Adding a shooting state.
Creating Animation State Machines

  • What is a blend space?
  • How to create a movement blend space.
  • Examining the existing Jog blend space.
  • Replicating for Ironsights.
Movement Blend Spaces

  • Creating an offset animation.
  • Applying an offset to a base.
  • Conditional blend nodes.
Offset Animations

  • Aim offset assets.
  • 1D vs 2D Aim offsets.
  • Editing an existing animation sequence.
Aiming Blend Spaces Offsets

  • Revising Behaviour Tree tasks.
  • Making our character face us.
  • Using AIController’s SetFocalPoint()
Rotating with SetFocalPoint()

  • More code reading.
  • Jumping between files in Visual Studio.
  • Difference between movement and rotation.
  • Mapping out complex systems.
Character Movement vs Rotation

  • Getting the control rotation.
  • Focus Actor vs Focal Point
  • Splitting rotators and setting pitch.
  • Controlling Animation BP properties.
Control Rotation for Aim

  • Creating a decorator.
  • Sequence vs Select nodes.
  • Aborting decorators early.
  • Clearing blackboard keys from blueprint.
  • Patrolling, agro and following.
Behaviour Tree Decorators

Mid Section Quiz
10 questions

  • Using decorators vs services.
  • Creating a service.
  • Deeper into behaviour tree states.
  • How to implement suspicion.
  • Giving our character breathing space.
  • Comparing BP Validity and NULL.
Behaviour Tree Services

  • Preventing Behaviour Tree flicker.
  • Creating mutually exclusive states.
Tweaking AI Behaviour

  • Viewing behaviour while playing.
  • Using tags on Actors.
  • Revising interrupting tasks.
  • Adding in multiple actors.

(Unique Video Reference: 46_TG_URC)

Debugging AI Behaviour

  • Create a Gun actor.
  • Move the firing code over.
  • Revising refactoring.
Refactoring to a Gun Actor

  • Revise spawning child actors.
  • Attaching actors to sub-components.
  • Attachment rule to sockets.
Attaching Actors to Components

  • Playing montage animations.
  • Connecting to actors in code.
  • Finishing our refactor.
Configuring the Gun

  • The pros and cons of LFS.
  • How to move files from LFS.
  • Tracking folder instead of extensions.
  • Where tracking happens.
Moving Files from LFS to Git

  • The pros and cons of LFS.
  • Organising your project for clarity.
  • How to deal with .umap assets.
To LFS or Not to LFS?

  • Previewing the gun with the skeleton.
  • Positioning the gun.
  • Child actors with Blueprint.
  • Using Child Actor Components.
Child Actor Components

  • Local vs component-space poses.
  • Understanding bone-space.
  • The principles of IK.
  • End effectors and Joint targets.
  • Mapping to the Two Bone IK node.
Introduction to Inverse Kinematics

  • Using the Two Bone IK node.
  • Effectors vs Joint targets

(Unique Video Reference: 53_TG_URC)

Inverse Kinematics with Animations

Mid Section Quiz
10 questions

  • Using UE4 built-in version control.
  • Diffing blueprints.
  • LFS vs Git assets in editor.
Comparing Blueprints with Diffs

  • Boolean blending in Unreal.
  • Setting variables in animation BP.
  • Making the AI aim.
Boolean Blending for Aim States

  • When to use additive identities.
  • Blending additive animations.
  • Creating an additive firing animation.
  • Controlling firing from the AI.
Adding Firing Animations

  • Synchronising sound and animation.
  • Creating custom notify events.
  • Hooking up our gun trigger to AI.
Animation Notify Events

  • Applying damage from a projectile.
  • Taking damage in a BP character.
  • Detaching a controller from a Pawn.
Taking Damage in Blueprint

  • Revision of BP refactoring.
  • Making our Animation BP clean.
  • Death animations on the AI.
Death Animations and Refactors

  • Swapping out a 1st to 3rd person character.
  • Wrapping rotations.
Switching 1st and 3rd Person

  • Own See vs Owner no see meshes.
  • Why 1st person Meshes.
  • Hooking up Fire input in TPCharacter.
Owner Invisible Meshes

Why we need two gun meshes.
Creating Blueprint components.
Scene components vs Actor components.
Camera rotation with control rotation.

Separating Firing from Gun Meshes

  • Local vs Global rotation.
  • UE4 optimizations for unpossesed characters.
Aiming Our 1st Person Camera

Mid Section Quiz
10 questions

  • Using the Arrow component.
  • How to architect an infinite runner.
  • Overview of how we want our levels to work.
Architecture of Infinite Runners

  • GameMode BP vs Level BP
  • Creating a blueprint GameMode
  • How to spawn tiled terrain.
  • Using a blueprint for-loop.
Spawning Terrain in the GameMode

Why we need level gating. Our approach to gating. Enabling/disabling collisions.
Level Gating for Testing Grounds

Creating material instances. Exposing material parameters. Swapping materials in blueprint. Adding affordance to our barriers.
Swapping Materials in Blueprint

When to delete previous tiles. How to get hold of the Game Mode. Spawning new tiles when needed. Keeping the minimal tiles in memory.
Garbage Collecting Previous Tiles

  • Fix camera glitch while strafing.
  • Merge the NPC and Player folders.
  • Revise redirectors.
  • Revise folder movement and deletion.
Merging Our TP and FP Files

  • Debug a projectile spawn issue.
  • Overview the collision system.
  • Understand hit and overlap notifications.
  • Review different Collision Presets
Hit vs Overlap Events

  • NavMesh and procedural terrain.
  • Dynamic NavMesh generation.
  • When LFS shouldn’t be used.
Dynamically Calculating NavMesh

  • Make the player tough for testing.
  • Deeply understand the AI system.
  • When is code too complex to debug?
  • Write high level pseudo code.
Keep It Simple Stupid

  • Parallel actions in Behaviour Trees.

  • Pseudocode-lead refactoring.

  • Aborting lower priority with decorators.

  • Organising conditional Behaviour Trees.

Parallel Behaviour Tree Tasks

Mid Section Quiz
10 questions

  • Implementing a conditional decorator.
  • Custom task nodes.
  • Clean up when task node is aborted.
Custom BT Tasks and Decorators

  • Updating to 4.15.0
  • Storing build data outside of .umaps.
External Build Data in 4.14+

  • Renaming to style guide
  • Problems of our existing architecture
  • Improved gun-centric architecture
  • Challenge: reinstating the gun actor.

(Unique Video Reference: 76_TG_URC)

Physical Gun Architecture

  • Creating and reparenting a character
  • Challenge: Converting the component hierarchy
  • Reviewing my Mannequin.cpp

(Unique Video Reference: 77_TG_URC )

Converting a Character BP to C++

  • Reviewing the architecture
  • Revision: binding input in C++
  • Challenge
  • Remove firing from Animation BP
  • Control trigger from AI

(Unique Video Reference: 78_TG_URC)

Who’s Pulled the Trigger?

  • How cooldown nodes work.
  • Adding gameplay tags.
  • Challenge: Let the AI Cooldown
  • Randomised burst of fire.
  • Separated into sub-behaviour trees.

(Unique Video Reference: 79_TG_URC)

Cooldown Nodes & Gameplay Tags

  • What is an animation slot?
  • How to blend by root bone.
  • "Caching" a pose.
  • Challenge: Create and Play Firing Montage

(Unique Video Reference: 80_TG_URC)

Animation Montages and Slots

  • Attach gun to correct mesh if player
  • Reattach gun when player dies
  • Challenge: Play Two Montages

(Unique Video Reference: 81_TG_URC )

Reattaching the Gun

Mid Section Quiz
9 questions

  • Importing asset pack.
  • Introduction to procedural terrain.
  • Creating ground mesh from BSP.
  • Challenge: creating spawnable props.

(Unique Video Reference: 82_TG_URC)

Procedural Level Generation

  • Create a Tile C++ class.
  • Expose a UFunction to spawn actors.
  • Functions to generate random data.
  • Challenge: generate a random spawn point.

(Unique Video Reference: 83_TG_URC )

Generating Random Numbers

  • Spawn an actor.
  • Randomise the number of actors.
  • Challenge: place the actors correctly.

(Unique Video Reference: 84_TG_URC )

Spawning Actors in the Tile

  • What is a Sweep?
  • How to Sphere Cast in C++.
  • Challenge: visualise the cast.

(Unique Video Reference: 85_TG_URC )

Sphere Casting in C++

  • Creating a Trace Channel.
  • Where to configure presets. 
  • Challenge: make it trace green.

(Unique Video Reference: 86_TG_URC )

Configure Custom Trace Channels

  • Writing an actor spawning algorithm.
  • Challenge: generate empty space.
  • Converting from local to global positions.

(Unique Video Reference: 87_TG_URC)

Spawning into Free Space

  • Adding randomised rotation.
  • Challenge: add randomised scale.
  • Tweaking the spawn radii.

(Unique Video Reference: 88_TG_URC )

Randomising Rotation & Scale

  • Flyweight pattern for rendering
  • Adding LOD for foliage.
  • Challenge: spawn grass instances.
  • Reviewing my code.
  • Configuring my component.

(Unique Video Reference: 89_TG_URC )

Flyweight Pattern for Foliage

  • Outline of EQS.
  • Enabling EQS.
  • Creating and testing queries.
  • CHALLENGE: Create a Waypoint Query.

(Unique Video Reference: 90_TG_URC )

Choosing Waypoint with EQS

  • Overviewing the navigation issue.
  • Getting hold of existing objects.
  • CHALLENGE: Finding NavMeshBoundsVolumes

(Unique Video Reference: 91_TG_URC )

Find Actors of Type from C++

  • Actor Pool architecture.
  • Creating the Actor Pool Component.
  • CHALLENGE: Plumb the Pool.

(Unique Video Reference: 92_TG_URC)

Plumbing an Actor Pool Setup

  • Using the Checkout API
  • Overview of object lifecycle
  • CHALLENGE: Return to Pool
  • Populate the initial pool.

(Unique Video Reference: 93_TG_URC)

Using the Pool API

  • Implementing checkout.
  • Challenge: Implement return and add.

(Unique Video Reference: 94_TG_URC)

Using TArray for Pools

  • Rebuilding the Navigation.
  • Offset the NavMeshBoundsVolumes.
  • CHALLENGE: Spawn on destroy.

(Unique Video Reference: 95_TG_URC )

Rebuilding Navigation Meshes

  • The AI spawning problem.
  • Combining parameters as structs.
  • CHALLENGE: SpawnPosition Generator Function.

(Unique Video Reference: 96_TG_URC )

Structs to Simplify Function Args

  • How to spawn AI.
  • PlaceAIPawns definition.
  • CHALLENGE: spawn AI in the world.

(Unique Video Reference: 97_TG_URC )

Spawning AI from C++

  • What is a template.

  • When would you use one?

  • What is the syntax for functions.

Understanding Function Templates

  • When copy and paste isn’t enough.
  • How to handle tricky types.
Template Specialization

  • Fixing out spawn issue.
  • When static polymorphism isn't enough.
  • How to use templates in classes.
  • Caveats to using templates in C++
Fixing Double Spawning

Procedural Generation Quiz
14 questions

  • Adding a GameMode Score.
  • CHALLENGE: Notify on Tile Conquered

(Unique Video Reference: 98_TG_URC)

Keeping Score

  • Extending the HUD class
  • Why use the HUD class
  • CHALLENGE: Create the scoring UI

(Unique Video Reference: 99_TG_URC )

Using the HUD Class

  • Adding PostProcessing Effects
  • CHALLENGE: Ease in on Damage

(Unique Video Reference: 100_TG_URC )

Post Processing for Tunnel Vision

  • Sharing your game
  • CHALLENGE: Recruit Some Testers
  • Changing the lighting
  • Firing lasers
  • Improving score UI
  • Shorter blackout effect

(Unique Video Reference: 101_TG_URC)

Recruiting Play Testers

  • Making death easier
  • How the camera works
  • Overview of SetViewTargetWithBlend
  • CHALLENGE: Smooth Blend the Camera

(Unique Video Reference: 102_TG_URC)

Smooth Blending the Camera

  • Unpossing with View Targets
  • Auto managed View Targets
  • CHALLENGE: Manually Manage the View Target

(Unique Video Reference: 103_TG_URC)

Possessing and the View Target

  • Peace before the storm
  • CHALLENGE 1: Fix the crashing issue
  • CHALLENGE 2: Make the Actors spawn
  • Parametrise the enemy count
  • BONUS: Fixing multiple camera transitions

(Unique Video Reference: 104_TG_URC)

The Calm Before The Storm

End of Section Quiz
6 questions

  • WELL DONE, over 50h of content
  • You've got a great understanding of Unreal
  • Your C++ knowledge is transferrable
  • Improve with: more weapons, pick-ups, progression
  • Please share screenshots / 20s video with community.

(Unique Video Reference: XXX_TG_URC )

Testing Grounds Wrap-up
Continuing Your GameDev Journey
1 Lecture 01:16
  • Find out about the Kickstarter that this course came from.
  • Ben's Unity course.
  • Ben & Mikey's Blender course.
Preview 01:16
About the Instructor
Ben Tristem
4.6 Average rating
60,711 Reviews
286,069 Students
10 Courses
Best-selling Instructor, Game Developer, Online Entrepreneur

Hi, I'm Ben. I have a degree in computing from Imperial College London, and a physics diploma from the Open University.

I started working for myself at the age of 15, and never looked back. I explored careers as varied as being a commercial pilot, stunt-man, rock climbing instructor, and more. None of these provided a continued challenge, and stable income in the same way technology does.

After building and selling a home computer support business, I became an angel investor and business mentor here in Cambridge UK. I fell in love with teaching game development through one of my investments, and I now spend all of my time sharing my passion with people like you.

I can't wait to help you experience the fulfilment, and financial freedom, that having a deep understanding of technology brings.

So why not start learning to make games with me and my team now?

See you soon!


Sam Pattuzzi
4.6 Average rating
17,685 Reviews
106,347 Students
3 Courses
Software Engineer, University of Cambridge

I wrote my first game when I was 14 and ever since, programming has been a key part of both work and play in my life. I studied Computer Science at the University of Cambridge where I still teach undergraduates. When I'm not teaching, I'm a freelance software engineer and enjoy my work with tech start-ups and social businesses.

For me, Udemy is the opportunity to combine my passions for teaching and programming. by Ben Tristem
4.6 Average rating
58,397 Reviews
280,763 Students
9 Courses
Learn to Make and Sell Games

GameDev tv was created by best-selling Udemy instructor Ben Tristem to help anyone learn how to develop, design, and sell indie games.  Our team supports Ben in making and maintaining high quality courses that are engaging and entertaining for more than 240,000 students.

GameDev tv offers comprehensive courses on Unity, Blender, Unreal and coding in C#, C++ and more.  Looking to learn about a topic that we don't cover?  Visit our community page and let us know.