Astra Pr2b

Reviewed commit 01fbbee7ec716aa429438758a14d055de578c755 against the supplied diff and installed UE/GMC/NarrativePro sources. No files modified; no build run. Supplied compile log reports success, but does not verify lifecycle behavior.

All four original defects are addressed in their basic scenarios; ownership-transition regressions remain.

Original finding Closure
Player writes lost without a pawn/on respawn Closed for ordinary respawn using the same PlayerState. NarrativeGMCPlayerState.cpp:16–53 stores authoritative factions/team directly and applies defaults once.
Remote PlayerState queries depend on pawn relevance Closed. NarrativeGMCPlayerState.cpp:57–61 replicates both fields; getters read them directly. Engine PlayerState.cpp:22 sets bAlwaysRelevant=true.
Save system never initializes Closed. NarrativeGMCGameMode.cpp:21 now reaches NarrativePro NarrativeGameMode.cpp:20–30, which calls InitializeSaveSystem. This establishes bootstrap, not complete GMC save integration.
NPC definition factions never applied Closed on initial initialization with a valid asset. NarrativeGMCNPCPawn.cpp:23–30 loads and reads NPCDefinition. AI-controller reuse remains defective below.

Required fixes:

  1. Medium — AI-controlled NPCs incorrectly acquire player-owned faction state. Confidence: high.
    Location: NarrativeGMCPawn.cpp:65.
    GetFactionPlayerState() accepts any matching PlayerState. An AIController with bWantsPlayerState receives the GameMode’s PlayerState class; engine APawn::PossessedBy attaches it. If that controller possesses NPC A and later NPC B, B inherits A’s factions/team, and bDefaultFactionsApplied prevents B’s definition from taking effect.
    Fix: make faction ownership an explicit pawn policy; NPC pawns should retain pawn-owned state regardless of AI PlayerState. Do not depend solely on a client-side controller check: remote player controllers are absent on other clients.

  2. Medium — Blueprint possession callbacks execute before faction initialization. Confidence: high.
    Location: NarrativeGMCPawn.cpp:38.
    Engine Pawn.cpp:664 attaches PlayerState, then :686–688 fires ReceivePossessed and controller-change notifications inside Super::PossessedBy. Defaults are applied afterward. On first possession, Blueprint callbacks can read empty defaults; removing a default faction there is undone immediately afterward. Earlier BeginPlay only initialized the pawn’s separate container.
    Fix: initialize the incoming eligible PlayerState before calling Super::PossessedBy, with the definition available. Preserve the once-only behavior on subsequent possessions.

  3. Medium — Existing pawn faction defaults disappear from effective player factions. Confidence: high.
    Locations: NarrativeGMCPawn.cpp:57, NarrativeGMCPawn.h:96.
    The retained editable pawn Factions property previously contributed directly to gameplay. Possession now switches getters to PlayerState, but initialization transfers only definition factions. Blueprint class defaults stored in pawn Factions are ignored. Direct Blueprint property reads also continue returning the stale pawn container while interface getters return PlayerState data.
    Fix: migrate supported pawn-authored defaults into the first PlayerState initialization, and provide a Blueprint-accessible effective-faction getter. Deprecate or clearly separate the legacy property rather than silently changing its meaning.

  4. Medium — Unpossessed surviving pawns revert to stale factions/team. Confidence: high.
    Location: NarrativeGMCPawn.cpp:89.
    Engine Pawn.cpp:698 clears PlayerState during unpossession. The getters immediately fall back to pawn fields that were never updated by possessed-state mutations. A surviving pawn or corpse can therefore regain removed factions and lose its assigned team. The player’s PlayerState itself remains correct.
    Fix: snapshot effective factions/team into pawn storage on authority before Super::UnPossessed, while retaining the player’s persistent state.

Additional checked limitations:

  • Medium performance risk, high confidence in blocking behavior: NarrativeGMCNPCPawn.cpp:26 synchronously loads assets during possession/BeginPlay. Engine SoftObjectPtr.h:82–90 calls TryLoad for unloaded assets. Runtime NPC spawning can stall the server game thread; actual duration is unmeasured. Preload asynchronously and retain the asset before initialization.
  • GameMode compatibility: no new RF_Transient regression—the previous engine spawn implementation already sets it. NarrativePro’s PlayerDefinitions assignment and character registration are guarded by Cast<ANarrativePlayerCharacter> and therefore skip GMC pawns. The newly inherited configuration is inert until a GMC definition adapter exists; document/hide it or implement that adapter.
  • Authority: inspected mutation methods reject client writes; no new client-authority bypass found. Blueprint asset compatibility was assessed statically, not by loading assets.

PASS WITH FIXES