TExcelTAD
Home › Unreal Engine 5 with C++ › Unreal Engine 5 Intro

Unreal Engine 5 Intro

Unreal Engine is the engine behind a large share of high-end 3D games, and it is the usual choice in studios that write gameplay in C++. It gives you a renderer (Lumen and Nanite), physics (Chaos), animation, AI, networking and a complete editor. It also has a gameplay framework: a set of classes such as GameMode, PlayerController and Character, which already decides how a match starts, who owns a pawn and what replicates to whom.

That framework is the hard part to learn and the main reason Unreal pays off. A Unity or Godot project starts empty and you build its structure. An Unreal project starts with a structure, and your job is to put your code in the right place within it.

What this course covers

Section You will be able to
Getting Started install the engine (launcher or source), set up Visual Studio or Rider, read a project's modules and Build.cs
Gameplay Framework pick the right class for each job: Actor or Component, GameMode or GameState, Pawn or Controller
C++ and Reflection write UCLASS/UPROPERTY/UFUNCTION correctly and know why the garbage collector needs them
Blueprints and C++ expose C++ to designers and decide what belongs in each
Input, Physics, Rendering, Animation Enhanced Input, traces and collision channels, materials, Lumen/Nanite, Animation Blueprints and montages
AI AIController, NavMesh, Behavior Trees, EQS and StateTree
Gameplay Ability System tags, attributes, effects and abilities
Networking replication, RPCs, authority and prediction
Performance and Shipping, Toolkit Unreal Insights, stat commands, packaging with RunUAT, Live Coding, version control, plugins

The course ends with two Field Notes lessons, a set of exercises and a Mini Project: a small third-person arena with one AI enemy and one ability.

How the examples work

Unreal code cannot run in a browser. Every lesson therefore has two kinds of code.

Engine code is shown as you would write it in a UE 5.x project, in plain cpp blocks without a Run button. It is real code with real specifiers. Where an API changed between 5.x releases, the lesson says so.

cpp
// HealthComponent.h (engine code: compiles inside an Unreal project, not here)
#pragma once

#include "CoreMinimal.h"
#include "Components/ActorComponent.h"
#include "HealthComponent.generated.h"

UCLASS(ClassGroup = (Arena), meta = (BlueprintSpawnableComponent))
class ARENA_API UHealthComponent : public UActorComponent
{
    GENERATED_BODY()

public:
    UFUNCTION(BlueprintCallable, Category = "Health")
    void ApplyDamage(float Amount);

private:
    UPROPERTY(EditDefaultsOnly, Category = "Health")
    float MaxHealth = 100.f;

    UPROPERTY(VisibleInstanceOnly, Category = "Health")
    float Health = 100.f;
};

Runnable models are short programs in standard C++20, which you can run on the page with ▶ Run (Compiler Explorer). Each one rebuilds a single engine idea from scratch: a reflection table, a mark-and-sweep garbage collector, a multicast delegate, a gameplay-tag matcher, a behavior tree. Seeing the mechanism in 60 lines makes the engine's behaviour predictable instead of magical.

cpp · try it yourself
#include <iostream>
#include <iomanip>
#include <algorithm>

// A model of the HealthComponent above: the same rules, no engine.
struct HealthComponent {
    float MaxHealth = 100.f;
    float Health = 100.f;

    void ApplyDamage(float Amount) {
        if (Amount <= 0.f || Health <= 0.f) return;      // ignore heals and hits on the dead
        Health = std::max(0.f, Health - Amount);
        std::cout << "took " << Amount << ", health " << Health << "/" << MaxHealth
                  << (Health == 0.f ? " -> died" : "") << "\n";
    }
};

int main() {
    std::cout << std::fixed << std::setprecision(1);
    HealthComponent hc;
    for (float hit : {30.f, -5.f, 45.f, 40.f, 10.f}) hc.ApplyDamage(hit);
}
took 30.0, health 70.0/100.0
took 45.0, health 25.0/100.0
took 40.0, health 0.0/100.0 -> died

Note: Models simplify. The real UHealthComponent would broadcast a delegate, replicate Health and be garbage-collected. Each of those gets its own lesson, and its own model.

Engine version

The course targets Unreal Engine 5.x, with the APIs current in the 5.4–5.7 releases. UE4 code you find online often still compiles, but it uses raw UObject* members where UE5 uses TObjectPtr, and the legacy input system (BindAxis) where UE5 uses Enhanced Input. When you read old tutorials, translate as you go.

Prerequisites

  • C++: classes, inheritance, virtual functions, pointers and references, templates at the level of "I can use std::vector<T>". The C++ course covers it.
  • Vectors, dot products and rotations: Math for Games. Unreal is left-handed, Z-up and measures in centimetres.
  • The game loop, deltaTime and state machines: Game Development Roadmap & Fundamentals.

A Windows PC with a recent GPU is the comfortable setup. macOS (Xcode) and Linux are supported, and the Getting the Engine lesson says what to expect on each.

Test yourself

Why is Unreal's gameplay framework both the hardest and most valuable part to learn?

  1. It is only available in Blueprints
  2. It already defines where match rules, player input, ownership and replication live, so your code must fit into it
  3. It replaces C++ entirely
  4. It is optional and rarely used

How do the code examples in this course run?

  1. Unreal runs in the browser
  2. Engine code is shown only; plain C++ models of the same idea run on Compiler Explorer
  3. Everything is pseudo-code
  4. Blueprints are executed by the site

Which change will you meet most often when reading UE4-era code?

  1. TObjectPtr members and Enhanced Input in UE5 instead of raw UObject* members and BindAxis
  2. C++ was replaced by C#
  3. Actors no longer exist
  4. UPROPERTY was removed