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:
-
Medium — AI-controlled NPCs incorrectly acquire player-owned faction state. Confidence: high.
Location: NarrativeGMCPawn.cpp:65.
GetFactionPlayerState()accepts any matching PlayerState. An AIController withbWantsPlayerStatereceives the GameMode’s PlayerState class; engineAPawn::PossessedByattaches it. If that controller possesses NPC A and later NPC B, B inherits A’s factions/team, andbDefaultFactionsAppliedprevents 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. -
Medium — Blueprint possession callbacks execute before faction initialization. Confidence: high.
Location: NarrativeGMCPawn.cpp:38.
EnginePawn.cpp:664attaches PlayerState, then:686–688firesReceivePossessedand controller-change notifications insideSuper::PossessedBy. Defaults are applied afterward. On first possession, Blueprint callbacks can read empty defaults; removing a default faction there is undone immediately afterward. EarlierBeginPlayonly initialized the pawn’s separate container.
Fix: initialize the incoming eligible PlayerState before callingSuper::PossessedBy, with the definition available. Preserve the once-only behavior on subsequent possessions. -
Medium — Existing pawn faction defaults disappear from effective player factions. Confidence: high.
Locations: NarrativeGMCPawn.cpp:57, NarrativeGMCPawn.h:96.
The retained editable pawnFactionsproperty previously contributed directly to gameplay. Possession now switches getters to PlayerState, but initialization transfers only definition factions. Blueprint class defaults stored in pawnFactionsare 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. -
Medium — Unpossessed surviving pawns revert to stale factions/team. Confidence: high.
Location: NarrativeGMCPawn.cpp:89.
EnginePawn.cpp:698clears 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 beforeSuper::UnPossessed, while retaining the player’s persistent state.
Additional checked limitations:
- Medium performance risk, high confidence in blocking behavior:
NarrativeGMCNPCPawn.cpp:26synchronously loads assets during possession/BeginPlay. EngineSoftObjectPtr.h:82–90callsTryLoadfor 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_Transientregression—the previous engine spawn implementation already sets it. NarrativePro’sPlayerDefinitionsassignment and character registration are guarded byCast<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