Sein Fog Of War
Class · USeinFogOfWar : UObject
#include "SeinFogOfWar.h"
abstract: use a subclass
Abstract base for fog-of-war implementations. An implementation tracks, per player, which cells are explored and which are currently visible on each vision layer, and answers whether an entity is visible to an observer. Choose the class with Fog Of War Class in the Fog Of War settings. The shipped implementation is Sein Fog Of War (Default).
C++ members (25)
bool HasRuntimeData() const;True if the impl has usable runtime data (grid dims populated, baked substrate channel loaded or grid procedurally initialized). Queries return no-visibility when false. Default: false — subclasses report their own grid state.ISeinLevelLayerProvider* GetLevelDataProvider();This fog’s layer-provider face, or null if it contributes no channel to the unified level-data bake. The fog subsystem registers a non-null result so the shared bake runs this fog’s BakeLayer. Default: null (doesn’t participate).FSeinStaticEnvironmentAdoptionResult LoadFromSubstrate(const USeinLevelData& Substrate);Owner-guarded static-grid adoption. Custom implementations override LoadFromSubstrateImpl, not this mutation gate. NotApplicable preserves the no-bake/non-participating fallback; Rejected carries the precise reason bootstrap must not freeze this static environment.void RegisterSource(FSeinEntityHandle Entity, const FSeinVisionSourceParams& Params);Register a new vision source. Impl is responsible for stamping on the next tick. Safe to call with a handle that was never registered (no double-register).void UpdateSource(FSeinEntityHandle Entity, const FSeinVisionSourceParams& Params);Update an already-registered source (position/radius/owner changed). Impl should diff against prior state + apply refcount deltas only to affected cells. No-op if the entity isn’t registered.void UnregisterSource(FSeinEntityHandle Entity);Unregister a source + roll back its last stamp footprint. No-op if the entity isn’t registered.void RegisterBlocker(FSeinEntityHandle Entity, const FSeinVisionBlockerParams& Params);void UpdateBlocker(FSeinEntityHandle Entity, const FSeinVisionBlockerParams& Params);void UnregisterBlocker(FSeinEntityHandle Entity);void InitGridFromVolumes(UWorld* World);Owner-guarded no-bake static-grid initialization. Custom implementations override InitGridFromVolumesImpl.void TickStamps(UWorld* World);uint64 GetVisibilityRevision() const;Zero opts out of navigation caching for custom visibility implementations.uint8 GetCellBitfield(FSeinPlayerID Observer, const FFixedVector& WorldPos) const;Full EVNNNNNN byte at the cell containing WorldPos, from Observer’s VisionGroup. Returns 0 if the position is outside the grid or the impl has no runtime data.bool GetObserverGrid(FSeinPlayerID Observer, TArray<uint8>& OutCells, FFixedVector& OutOrigin, FFixedPoint& OutCellSize, int32& OutWidth, int32& OutHeight) const;Bulk read of one observer’s whole visibility grid — for render/UI consumers that need the entire field at once (e.g. a fog-of-war overlay that uploads the grid to a texture) instead of N per-cell point queries. Fills OutCells with the row-major EVNNNNNN bitfields (length OutWidth*OutHeight, index Y*OutWidth + X — same layout GetCellBitfield reads) and reports the grid’s world-space OutOrigin (min corner) + OutCellSize so the caller can map world XY <-> cell. When the observer has no VisionGroup yet (has seen nothing), OutCells is zero-filled at the grid dims — everything reads unexplored — and the call still returns true. Returns false only when the impl has no runtime grid at all (queries would return no-visibility). Default: false (no grid).bool IsCellVisible(FSeinPlayerID Observer, const FFixedVector& WorldPos, uint8 LayerMask = SEIN_FOW_BIT_NORMAL) const;Convenience: true if any of LayerMask’s bits are set in the cell’s bitfield. Caller passes SEIN_FOW_BIT_NORMAL, SEIN_FOW_MASK_VISIBLE, or a custom mask.bool IsCellExplored(FSeinPlayerID Observer, const FFixedVector& WorldPos) const;Convenience: true if the Explored bit is set. Sticky — once true for a cell, stays true for the rest of the match.void GetEffectiveVisionSources(const USeinWorldSubsystem& Sim, FSeinPlayerID Observer, TArray<FSeinPlayerID>& OutSources) const;Everyone whose VisionGroup Observer may consume: Observer first, then — only when any grant exists — every registered player A whose directional A -> Observer ShareVision diplomacy is granted. Order beyond the leading self entry carries no meaning; every consumer composes commutatively (bitwise OR / any-of). Deterministic: the ledger is canonical sim state. An invalid Observer yields just itself (the permissive no-filtering convention is the caller’s branch, as before).uint8 GetEffectiveCellBitfield(const USeinWorldSubsystem& Sim, FSeinPlayerID Observer, const FFixedVector& WorldPos) const;GetCellBitfield composed across GetEffectiveVisionSources — the shared-vision-aware point query render/UI consumers should prefer. Identical to the plain query when no ShareVision grant targets Observer.bool GetEffectiveObserverGrid(const USeinWorldSubsystem& Sim, FSeinPlayerID Observer, TArray<uint8>& OutCells, FFixedVector& OutOrigin, FFixedPoint& OutCellSize, int32& OutWidth, int32& OutHeight) const;GetObserverGrid composed across GetEffectiveVisionSources (cell-wise OR). Same contract and layout as GetObserverGrid; identical output when no ShareVision grant targets Observer.bool IsEntityVisibleToObserver(FSeinPlayerID Observer, USeinWorldSubsystem& Sim, FSeinEntityHandle Target) const;Whether the entity Target is currently visible to Observer. Single source of truth for the fog visibility decision — same check theUSeinFogOfWarVisibilitySubsystemuses to toggle actor visibility, and the same check game queries / minimap / UI should use to gate per-player information leakage. Logic, in order: 1. Target is out of the world (abstract) → hidden from everyone. 2. Observer is invalid → permissive (true). Caller hasn’t specified a viewer; no filtering. 3. Target’s owner == Observer → visible. Owner always sees their own units / buildings / deployments regardless of fog. 4.FSeinFogVisibilityPayload::FogVisibilityPolicy: - AlwaysVisible → true. - currently spotted (a matching emission-layer bit is live in the footprint) → true for every remaining policy. - VisibleOnceSeen → otherwise visible iff Observer has EVER had live vision of this entity (per-entity sticky latch — see HasObserverSeenEntity). A thing that appears in explored-but- unseen fog stays hidden until it is actually seen. - VisibleOnceExplored → otherwise visible iff any cell in the footprint has the sticky per-cell Explored bit set for Observer (reveals on terrain scouting, even if the entity itself was never seen). - VisionLayersOnly (default) → otherwise hidden. Implementation lives in the cpp so subclasses can override if they want different per-player policy. Base impl readsFSeinFogVisibilityPayloadfrom sim storage for both the emission mask AND the persistence policy (single component, two fields — authored onUSeinEntityBridgeComponent’s top-level visibility fields and carried into the entity by the bridge’s archetype).bool IsEntityInSight(FSeinPlayerID Observer, USeinWorldSubsystem& Sim, FSeinEntityHandle Target) const;True when Observer’s current vision, shared vision included, covers Target’s footprint on a layer it emits: what line-of-sight checks read. Persistence policies don’t apply, so a remembered structure is not in sight. The owner always sees its own entities; nobody sees one out of the world.uint8 GetEntityVisibleBits(FSeinPlayerID Observer, USeinWorldSubsystem& Sim, FSeinEntityHandle Target) const;Compute the OR of EVNNNNNN bits visible to Observer across the target entity’s volumetric footprint, so a wide tank whose center sits one cell off from a watching infantry still reads as visible. Subclasses iterate the entity’sFSeinExtentsPayload::Stamps (if present) and OR the bitfields of every covered cell. This base impl falls back to a single-point query at the entity transform — preserves correctness for entities without an extents component (props, projectiles, etc. that don’t need volumetric checks).bool HasObserverSeenEntity(FSeinPlayerID Observer, FSeinEntityHandle Target) const;Whether Observer has EVER had live vision of Target at least once this match — the per-entity sticky latch backing the VisibleOnceSeen policy. Maintained per fog tick by impls that support it (the default impl latches in TickStamps off the freshly-stamped per-player grid). Base default returns false, so an impl that doesn’t track this degrades VisibleOnceSeen to VisionLayersOnly — safe (never reveals more than current live vision; no information leak).void DrawDebug(UWorld* World) const;Per-frame debug draw hook. Called each tick while the fog show flag is on. Default: no-op — the framework’s shipped cell viz goes through a scene-proxy debug component (lands with the debug pass).void CollectDebugCellQuads(FSeinPlayerID Observer, int32 VisibleBitIndex, TArray<FVector>& OutCenters, TArray<FColor>& OutColors, float& OutHalfExtent) const;Collect cell geometry for scene-proxy rendering, for one observer’s VisionGroup. VisibleBitIndex in [0, 7] selects which EVNNNNNN bit paints as “visible” (0 = E, 1 = V, 2..7 = N0..N5); driven by Sein.FogOfWar.Show.Layer. Default impls emit one quad per cell with per-cell color derived from which bits are set (visible / blocker / default). Default virtual: no cells.