Overview

UWCGASDifficultySub is a World Subsystem that serves as the global manager for difficulty tiers in the Wonderscape GAS Ally plugin. It automatically initializes with each world (PIE, level streaming friendly), loads difficulty tier data assets from Project Settings, caches active tier information for O(1) runtime queries, broadcasts delegates on difficulty changes, and provides an internal API for other plugin subsystems to load difficulty-appropriate data.


Purpose

The Difficulty Subsystem orchestrates all difficulty tier management by providing:


How It Works

Initialization Flow

  1. Subsystem Startup: When the World initializes, this subsystem automatically loads via UE's subsystem lifecycle
  2. Load Plugin Settings: Retrieves configuration from UWCGASAllySettings via GetDefault<UWCGASAllySettings>()
  3. Load Difficulty Tier Assets: Iterates through Settings->DifficultyTiers array, loading each UWCGASDifficultyTier synchronously
  4. Build Tier Registry: For each valid tier, validates DifficultyTag and adds to RegisteredTiers TMap (Tag → SoftPtr) and LoadedTierAssets TMap (Tag → LoadedPtr)
  5. Cache Tier Info: Calls Tier->ToTierInfo() to create lightweight FWCGASDifficultyTierInfo and adds to CachedTierInfos array
  6. Sort by SortOrder: Sorts CachedTierInfos array ascending by SortOrder for UI display consistency