Overview

WCGASWorldContextSubsystem is a World Subsystem that serves as the central runtime authority for the World Context System in the Wonderscape GAS Ally plugin. It automatically initializes when a game world begins, loads context data definitions from Project Settings, builds runtime lookup maps for O(1) context queries, manages three layers of contexts (global, zone-based, per-actor), provides the query API for damage calculations and effect modifications, integrates with the Difficulty Subsystem for modifier scaling, and coordinates with Context Volumes for spatial context zones.


Purpose

The World Context Subsystem orchestrates all environmental context management by providing:


How It Works

Initialization Flow

  1. Subsystem Startup: When a game world initializes, UE automatically creates this subsystem (filtered via ShouldCreateSubsystem to only run in game worlds, not editor preview)
  2. Load Context Data: Calls LoadContextData() which retrieves configuration from UWCGASAllySettings via GetDefault<UWCGASAllySettings>()
  3. Build Context Registry: Iterates through Settings->WorldContextData array, loading each UWCGASWorldContextData synchronously and validating ContextTag
  4. Build Cached Data: For each context asset, creates FWCGASCachedContextData with pre-processed element rules in fast lookup format (ElementTag → ModType → Value)
  5. Register Context: Adds cached data to ContextDataRegistry TMap (ContextTag → CachedData) for O(1) lookups