The Editor, Levels & World Partition
Programmers spend less time in the editor than designers do, but you need to find your way around it: your C++ classes become things that are placed, configured and tested there.
The main windows
| Window | What you do there |
|---|---|
| Viewport | fly around (right mouse + WASD), select and move actors (W/E/R for move/rotate/scale) |
| Outliner | the list of actors in the current level, with folders |
| Details | the selected actor's components and every UPROPERTY marked EditAnywhere / EditInstanceOnly |
| Content Browser | assets on disk: meshes, materials, Blueprints, levels, and a C++ Classes folder showing your classes |
| Output Log | UE_LOG output, warnings, and the console (the ~ key in play, or the command box at the bottom) |
| World Settings | per-level settings, including the GameMode Override |
Play In Editor (PIE) runs the game inside the editor (Alt+P). The ⋮ menu next to Play chooses the mode (viewport, new window, standalone) and, for multiplayer testing, the Number of Players and Net Mode (Play As Listen Server, Play As Client). You will use those in the networking lessons.
Tip: During PIE, press F8 to eject from the player and inspect the running world: select actors, read their live property values in Details, then press F8 again to possess the player.
Levels and maps
A level (saved as a .umap) holds actors: geometry, lights, the player start, spawners. A game is a set of levels, and UGameplayStatics::OpenLevel travels between them:
#include "Kismet/GameplayStatics.h"
void AArenaGameMode::GoToNextArena()
{
UGameplayStatics::OpenLevel(this, FName(TEXT("L_Arena_02"))); // unloads the current world
}Inside one world you can also use level streaming: a persistent level stays loaded and sub-levels are loaded and unloaded around the player. That was the classic way to build large worlds. In UE5, open worlds use World Partition instead.
World Partition
New levels made from the Open World template use World Partition. The world is one big level, and the editor and runtime load it in grid cells around the player (or around the editor camera) instead of in hand-made sub-levels.
| Feature | What it does |
|---|---|
| Runtime grid / streaming | at runtime, cells within the loading range of a streaming source (usually the player) are loaded |
| One File Per Actor (OFPA) | each actor is saved in its own small file under __ExternalActors__, so two people can edit the same map without locking one huge .umap |
| Data Layers | groups of actors you switch on and off (night version, quest state, event decorations) |
| HLODs | merged, simplified meshes that stand in for unloaded cells far away |
| Is Spatially Loaded | an actor flag; turn it off for actors that must always exist (managers, the game director) |
The programmer's consequences:
- Actors you reference may not be loaded. A hard pointer from a quest giver to a door in a far cell keeps the door loaded or doesn't work at all. Look things up when needed, use soft references (lesson Weak & Soft Pointers), or keep gameplay managers non-spatial.
BeginPlayruns when a cell streams in, which can be long after the game started, andEndPlayruns when it streams out. Don't assume every actor exists at startup.- Version control: OFPA creates thousands of tiny files. That is good for collaboration but means your VCS must handle many files (see Perforce, Git LFS & .gitignore).
A model of grid streaming
The runtime decides which cells to load by measuring the distance from each streaming source to each cell. This model uses a 6×6 grid of 100 m cells and a 150 m loading range, and prints which cells are loaded (#) as the player walks east.
#include <iostream>
#include <cmath>
#include <vector>
struct Vec2 { double x, y; };
int main() {
const int grid = 6;
const double cell = 100.0, range = 150.0;
std::vector<Vec2> path = {{50, 250}, {250, 250}, {450, 250}};
for (const Vec2& p : path) {
std::cout << "player at (" << p.x << ", " << p.y << ")\n";
int loaded = 0;
for (int row = 0; row < grid; row++) {
for (int col = 0; col < grid; col++) {
// distance from the player to the nearest point of the cell's square
double cx = std::fmax(col * cell, std::fmin(p.x, (col + 1) * cell));
double cy = std::fmax(row * cell, std::fmin(p.y, (row + 1) * cell));
bool in = std::hypot(p.x - cx, p.y - cy) <= range;
loaded += in;
std::cout << (in ? '#' : '.');
}
std::cout << "\n";
}
std::cout << loaded << " of " << grid * grid << " cells loaded\n\n";
}
}player at (50, 250)
#.....
##....
###...
##....
#.....
......
9 of 36 cells loaded
player at (250, 250)
..#...
.###..
#####.
.###..
..#...
......
13 of 36 cells loaded
player at (450, 250)
....#.
...###
..####
...###
....#.
......
12 of 36 cells loaded
Real World Partition uses several grids (a coarse one for big landmarks, a fine one for props), and a cell also needs its data streamed from disk before it appears. Hence the classic open-world bug: a fast vehicle outruns streaming. Raising the loading range costs memory, so teams limit speed, add streaming hints, or block until cells are ready after a teleport.
Config files
Many settings you change in Project Settings are saved to Config/Default*.ini:
; Config/DefaultEngine.ini
[/Script/EngineSettings.GameMapsSettings]
GameDefaultMap=/Game/Maps/L_Arena_01.L_Arena_01
EditorStartupMap=/Game/Maps/L_Arena_01.L_Arena_01
GlobalDefaultGameMode=/Script/Arena.ArenaGameModeThese files are text, so diff them in code review. A surprising behaviour change after someone "just clicked a checkbox" usually shows up there.
Test yourself
What does One File Per Actor (OFPA) give a team using World Partition?
- Faster shader compiles
- Each actor saved in its own file, so several people can edit the same map
- Automatic LODs
- Smaller packaged games
In a World Partition map, when does an actor's BeginPlay run?
- Always at game start
- When its cell streams in, which can be much later
- Only in the editor
- Never
Which key ejects you from the player during Play In Editor?
- F5
- F8
- F11
- Esc