TExcelTAD
Home › Unreal Engine 5 with C++ › Field Notes: Gameplay & Production

Field Notes: Gameplay & Production

The previous field notes were about C++ and the engine. These are about building games with it: where to put logic, how to keep a team productive, and how to avoid the problems that only appear in week twelve.

1. Learn the gameplay framework before writing your own

New Unreal developers often build a "GameManager" actor that spawns players, tracks score, handles input and drives the UI, duplicating GameMode, GameState, PlayerController and the HUD badly. The framework classes exist because they solve networking, travel, respawning and spectating. Before inventing a manager, ask which framework class already owns the job (GameMode, GameState & PlayerState). For global services that don't fit, use subsystems (UGameInstanceSubsystem, UWorldSubsystem, ULocalPlayerSubsystem), which the engine creates and destroys with the right lifetime, rather than singletons or actors placed in every level.

2. Keep heavy logic out of Blueprint Tick

An Event Tick graph with a few dozen nodes on a hundred actors is a real chunk of the game thread. Move loops and per-frame math to C++, drive Blueprints with events (overlap, delegate, timer, ability callbacks), and use Blueprints for what they're good at: content, tuning and one-off scripting. Profile before and after (Profiling).

3. Test multiplayer from day one, if you'll ever ship it

Retrofitting replication into a single-player codebase is one of the most expensive refactors in game development. If multiplayer is even a maybe, run PIE with 2 players, Listen Server at least once a day, with Network Emulation set to a realistic profile. Bugs show up immediately: logic in BeginPlay that assumed the server, UI created on the wrong machine, client-side changes to replicated state.

4. Package weekly

Packaged builds catch what the editor hides: missing cooked assets (soft references, maps loaded by name), editor-only code in runtime modules, different load order, shader and PSO hitches, and the real performance. Automate a nightly BuildCookRun as soon as you have a build machine, and play the result, not just build it.

5. Name assets consistently

A common convention (several public style guides use it):

Prefix Asset
BP_ Blueprint class
WBP_ Widget Blueprint
ABP_ Animation Blueprint
AM_, AS_, BS_ Montage, Anim Sequence, Blend Space
SM_, SK_, SKEL_, PHYS_ Static Mesh, Skeletal Mesh, Skeleton, Physics Asset
M_, MI_, MF_, T_ Material, Material Instance, Material Function, Texture
GE_, GA_, GC_ Gameplay Effect, Ability, Cue
BT_, BB_, EQS_, ST_ Behavior Tree, Blackboard, Env Query, StateTree
IA_, IMC_, DA_, DT_, L_ Input Action, Mapping Context, Data Asset, Data Table, Level

Consistent names make the Content Browser searchable and let validation scripts check rules ("every BP_Enemy* has a behavior tree").

6. Data in data assets, not in code or Blueprints

Weapon stats, enemy archetypes, loot tables and wave definitions belong in UPrimaryDataAsset subclasses or Data Tables (CSV/JSON importable). Designers balance without asking a programmer, diffs are visible in review tools that understand them, and the Asset Manager can load them on demand.

7. Don't put gameplay in the Level Blueprint

The Level Blueprint can't be reused, inherited, or easily referenced from C++, and it's a merge-conflict magnet because every designer touching the level touches it. Use it for level-specific cinematics and one-off triggers at most; put reusable logic in actors placed in the level.

8. Pool what you spawn a lot

Spawning an actor initializes components, registers physics and rendering state, and runs construction logic: much more than a new. For projectiles, impact effects and damage numbers, keep a pool: deactivate instead of destroying, and reuse. Niagara has built-in pooling for effects (ENCPoolMethod). The model shows the difference in spawn calls for a weapon firing 10 rounds per second for 3 seconds, with projectiles living 0.5 s.

cpp · try it yourself
#include <iostream>
#include <vector>

struct Projectile { bool Active = false; double Life = 0; };

int main() {
    const double dt = 0.05, fireInterval = 0.1, lifetime = 0.5;
    int spawnsNoPool = 0, destroysNoPool = 0, spawnsPool = 0, reuses = 0;
    std::vector<Projectile> live;                       // without a pool
    std::vector<Projectile> pool;                       // with a pool

    double fireTimer = 0;
    for (int step = 0; step < 60; step++) {             // 3 seconds at 20 updates per second
        bool fire = fireTimer <= 1e-9;
        fireTimer = fire ? fireInterval - dt : fireTimer - dt;

        for (auto& p : live) p.Life -= dt;              // no pool: destroy expired, spawn new
        for (auto it = live.begin(); it != live.end();)
            if (it->Life <= 1e-9) { it = live.erase(it); destroysNoPool++; } else ++it;
        if (fire) { live.push_back({true, lifetime}); spawnsNoPool++; }

        for (auto& p : pool)                            // pool: deactivate expired, reuse inactive
            if (p.Active && (p.Life -= dt) <= 1e-9) p.Active = false;
        if (fire) {
            Projectile* freeOne = nullptr;
            for (auto& p : pool) if (!p.Active) { freeOne = &p; break; }
            if (freeOne) { *freeOne = {true, lifetime}; reuses++; }
            else { pool.push_back({true, lifetime}); spawnsPool++; }
        }
    }
    std::cout << "without pool: " << spawnsNoPool << " SpawnActor, " << destroysNoPool << " Destroy\n";
    std::cout << "with pool:    " << spawnsPool << " SpawnActor, " << reuses << " reuses, pool size " << pool.size() << "\n";
}
without pool: 30 SpawnActor, 25 Destroy
with pool:    5 SpawnActor, 25 reuses, pool size 5

The pool needs only as many projectiles as can be alive at once (fire rate × lifetime, here 5), however long the fight lasts.

9. Read Lyra

Lyra (free from Epic, on Fab / the launcher's samples) is a complete multiplayer shooter sample built the way Epic recommends: GAS with input tags, modular gameplay features ("experiences"), CommonUI, Enhanced Input, data-driven pawns, thread-safe AnimBPs. It is too big to copy as a starting point for a small game, but it is the best reference when you wonder "how would Epic structure this?". Read one system at a time.

10. Small, playable, every week

Unreal makes it easy to spend months on beautiful lighting in an empty level. Keep a playable build of the core loop at all times, with grey boxes if needed. Scope cuts are cheaper before content is made for the feature you cut. The general advice from the gamedev course applies twice over to an engine this capable.

Test yourself

Where should a global service such as a quest tracker that lives for the whole session go?

  1. An actor placed in every level
  2. A UGameInstanceSubsystem
  3. The Level Blueprint
  4. A static global variable

Why package the game every week?

  1. To save disk space
  2. Packaged builds reveal missing cooked assets, editor-only code and real performance that the editor hides
  3. Shipping builds compile faster
  4. It is required by Epic

How many projectiles must a pool hold for a weapon firing 10 per second with a 0.5 s projectile lifetime?

  1. 1
  2. About 5
  3. 30
  4. One per shot ever fired