Skip to content

Sein Fog Of War (Default)

Class · USeinFogOfWarDefault : USeinFogOfWar

Parent: Sein Fog Of War

#include "Default/SeinFogOfWarDefault.h"

Computes what each player can see: hides the map under fog, reveals cells around units that have vision, and remembers explored ground once you’ve been there. This is the fog-of-war system selected out of the box.

Each observer (one per player ID) gets its own grid of per-cell visibility bits: bit 0 is a sticky Explored flag that stays lit for the rest of the match once revealed, and bits 1-7 are live vision layers (bit 1 = Normal sight, bits 2-7 = custom layers such as Thermal or Stealth) that clear the moment nothing is looking. Live bits are reference-counted per cell, so a cell stays visible while any source covers it and only goes dark when the last one leaves.

Vision is stamped each sim tick from every entity carrying a vision component: for each source an eye position is taken at the unit’s sim Z plus its EyeHeight, and line-of-sight to every cell in range is tested with an integer Bresenham walk whose ray Z is interpolated from the eye down to the target cell. That elevation-aware trace is the true-sight behavior — a unit on a roof looking down still has a wall between them block the far ground. Terrain always occludes; static baked blockers and runtime dynamic blockers (smoke, destructibles) occlude only when their layer mask covers the stamp’s bit, so smoke can hide Normal sight while letting Thermal through. A delta-refcount cache short-circuits any source whose pose and stamp set are unchanged since last tick, so most stationary units cost nothing; changed sources fan out across worker threads (parallel compute, serial apply). All observers stamp against the same tick-N snapshot, keeping the result lockstep-identical on every client.

This is also the “FogOfWar” layer provider on the unified level-data bake: it runs its own occluder box-sweep at its own coarser cell size (an integer multiple of the shared grid) and adopts the substrate’s shared ground height, loading its runtime grid back from that baked channel. When no bake is present the grid auto-sizes from the Sein Level Volumes in the level.

float BakeTraceHeadroom · default 400.0f · min 0.0

Editable in defaults and on instances

Vertical extent (world units) above the tallest fog volume that bake traces start from. Bump if any sight-blocker geometry sits near the top of your volumes.

float StaticBlockerMinHeight · default 15.0f · min 0.0

Editable in defaults and on instances

Minimum gap (world units) between the top trace hit and the ground trace hit below it for the difference to register as a static blocker. Filters mesh-thickness noise (e.g. terrain with a few-cm- thick top surface shouldn’t read as a 3cm blocker).

TEnumAsByte<ECollisionChannel> BakeTraceChannel · default ECC_Visibility

Editable in defaults and on instances

Collision channel bake traces sample for ground + blocker detection. ECC_Visibility is the correct default — walls / buildings / terrain respond to it by default. Teams with a custom “SightBlocker” channel can override here.

int32 InitTraceCellCap · default 4096 · min 0

Editable in defaults and on instances

Cap cell count for the per-cell terrain trace at init. Beyond this, cells snap to volume mid-Z (avoids multi-second editor hitch on huge maps when no bake is loaded). Bake itself has no cap — it’s an explicit designer action with progress UI.