Unreal Engine Basics

Getting started with Unreal Engine 4 game development. Covering UE4 Macros (UProperty and UFunction), combining C++ with blueprints, base classes like Pawns and Actors, and understanding GameMode, GameState, PlayerController, PlayerState and much more.

Building Blocks (Pawn, Actor, GameState, GameMode)

Video Player is loading.
Current Time 0:00
Duration 0:00
Loaded: 0%
Stream Type LIVE
Remaining Time 0:00
 
1x
  • Chapters
  • descriptions off, selected
  • captions off, selected

    Basic Building Blocks

    A Pawn is the base class of all Actors that can be controlled by players or AI. A Pawn is the physical representation of a player within the world.

    An Actor is an object that can be placed into a level. It’s a generic class that supports 3D transformations such as translation, rotation, and scale. Actors can also be thought of as containers that hold special types of Objects called Components.

    A Component is a special type of Object that Actors can attach to themselves as sub-objects. These are useful for sharing common behaviors, such as the ability to display a visual representation, play sounds.

    An object that can be placed into a level. Generic Class that supports 3D transformations such as translation, rotation, and scale.

    Which is the correct naming for a class named Vehicle that inherits from Actor?






    PlayerState & PLayerController

    The PlayerState is an individual player’s state such as score and health.

    PlayerController - interface between the Pawn and the human player controlling it. The PlayerController essentially represents the human player’s actions.

    The PlayerController persists throughout the game, while the Pawn can be transient. For example, in deathmatch style gameplay, you may die and respawn, so you would get a new Pawn but your PlayerController would be the same.

    Which class would manage a player's health?






    GameState & GameMode

    GameState - Tracks the game information. Such as game duration, state of each player, score, etc.

    For example if you wanted to track the game state of a counter strike match. We would track which round we’re on, number of rounds each team has won, time left in current round, whether bomb has been planted and so on.

    GameMode - Combines GameState, PlayerController, PlayerState, Default Pawn, HUD. Determines the rules of the game.

    Extending our previous example of counter strike, our GameMode would determine the rules for whether we’re playing bomb defusal, hostage rescue, or team deathmatch.

    Unreal Reflection System

    A reflection system is the ability of a program to examine itself, its data types, the members of a given class or value type can be discovered. This makes reflection a useful feature for development and code management tools.

    There is a great UE4 blog post by Michael Noland that describes in detail how the reflection program works. The link is included in the description. https://www.unrealengine.com/en-US/blog/unreal-property-system-reflection

    With our reflection system in place we can discuss a few of the most common UE4 Macros. The majority of these macros are used for passing meta data to the Unreal Header Tool (UHT).

    UPROPERTY - allows a variable to be replicated, serialized, and accessed from blueprints.

    UFUNCTION - allows a C++ function to be exposed via the UE reflection system and ultimately called from blueprints.

    UCLASS - generates reflection data for a class. The class must derive from UObject.

    GENERATED_BODY - UE4 replaces this with all the necessary boilerplate code that gets generated for the type.

    What C++ MACRO allows a variable to be replicated, serialized, and accessed via blueprints?

    What C++ MACRO allows a C++ function to be accessed via blueprints?