PR-2: factions and GMC framework¶
Static verification only, 2026-10-24. No compiler, UnrealBuildTool, Build.bat, RunUAT, editor or PIE was run. Guarded compilation and the following PIE checks remain required.
Files changed¶
Source/NarrativeGMC/{Public,Private}/Character/NarrativeGMCPawn.{h,cpp}: implement faction interface; replicate pawn factions; seed definition defaults on authority; restrict faction/team mutations to authority; ensure aggregator before the pawn and its components enter GMC BeginPlay.Source/NarrativeGMC/{Public,Private}/Framework/NarrativeGMCPlayerState.{h,cpp}: delegate faction and team access to the pawn, removing duplicate state.Source/NarrativeGMC/{Public,Private}/Framework/NarrativeGMCPlayerController.{h,cpp}: derive from GMC controller; ensure local aggregator before parent BeginPlay.Source/NarrativeGMC/{Public,Private}/Framework/NarrativeGMCGameMode.{h,cpp}: select Narrative game state; ensure server aggregator and world-time source in InitGame.Source/NarrativeGMC/Private/Framework/NarrativeGMCWorld.h: shared local aggregator creation, reusing a map-authored instance.- This verification receipt.
Installed API evidence¶
Marketplace root: C:\Program Files\Epic Games\UE_5.7\Engine\Plugins\Marketplace.
GMC below means GMCv2Adv86c4f5f6b4ebV10/Source/GMCCore;
NP means Narrativeed3f9374a6eV6/Source/NarrativeArsenal.
All were read directly; no Program Files files were modified.
| Added API / contract | Installed header evidence |
|---|---|
AGMC_PlayerController and its object-initializer constructor, BeginPlay() |
GMC/Public/Actors/GMCPlayerController.h:12,18,20 |
AGMC_Aggregator; exactly one per world (GMC getter contract) |
GMC/Public/Actors/GMCAggregator.h:12,22-26 |
AGMC_WorldTimeReplicator; exactly one world-time source |
GMC/Public/Replication/WorldTime.h:8-17 |
ANarrativeGameState : AGameStateBase |
NP/Public/UnrealFramework/NarrativeGameState.h:248 |
AddFaction(const FGameplayTag&), RemoveFaction(const FGameplayTag&), GetFactions() const |
NP/Public/UnrealFramework/NarrativeTeamAgentInterface.h:24,27,30; unimplemented GetFactions asserts |
UCharacterDefinition::DefaultFactions |
NP/Public/Character/CharacterDefinition.h:41 |
Core UE APIs are outside Marketplace, under Engine/Source:
| Added API | Installed header evidence |
|---|---|
AGameModeBase::InitGame(const FString&, const FString&, FString&), GameStateClass |
Runtime/Engine/Classes/GameFramework/GameModeBase.h:58-62,92 |
UWorld::SpawnActor<T>(const FActorSpawnParameters& = ...) |
Runtime/Engine/Classes/Engine/World.h:3674-3676 |
TActorIterator<T>(const UWorld*, ...), bool conversion |
Runtime/Engine/Public/EngineUtils.h:582,394 |
AActor::HasAuthority() |
Runtime/Engine/Classes/GameFramework/Actor.h:1941 |
APlayerState::GetPawn() const |
Runtime/Engine/Classes/GameFramework/PlayerState.h:193 |
FGenericTeamId::NoTeam, generic team getter/setter |
Runtime/AIModule/Classes/GenericTeamAgentInterface.h:67,86,89 |
FGameplayTagContainer::AppendTags, AddTag, RemoveTag, EmptyContainer |
Runtime/GameplayTags/Classes/GameplayTagContainer.h:477,499,525,607 |
DOREPLIFETIME |
Runtime/Engine/Public/Net/UnrealNetwork.h:259 |
Lifecycle evidence: installed GMC/Private/Actors/GMCPlayerController.cpp:40-50,
GMC/Private/Actors/GMCPawn.cpp:30-40, and
GMC/Private/Components/GMCReplicationComponent.cpp:341-357 register with the
aggregator during BeginPlay. Engine Runtime/Engine/Private/Actor.cpp:4753-4770
dispatches component BeginPlay inside actor BeginPlay. Therefore the pawn and
controller create/find the local aggregator before calling Super. This covers
clients even if a replicated pawn arrives before their controller. Aggregators
are not replicated (GMC/Private/Actors/GMCAggregator.cpp:22-39), so a server-only
spawn would leave clients unaggregated. Existing level aggregators are reused.
The world-time source is needed by the GMC controller's time sync
(GMC/Private/Actors/GMCPlayerController.cpp:59-79). It is spawned only by the
server GameMode; installed GMC/Private/Replication/WorldTime.cpp:7-10 sets
replication and always relevance, and :32-44 starts its authority timer.
Clients never spawn a second world-time source. InitGame reuses a map-authored
source. A map with duplicate preplaced GMC singleton actors remains invalid.
Migration / scope¶
The pawn owns factions and generic TeamId. PlayerState has no second copy.
Migrate Blueprint references to the old PlayerState Factions property to the
pawn or interface; configure default factions on the pawn/CharacterDefinition.
An unpossessed PlayerState returns empty factions / NoTeam and drops mutations.
Faction transfer across respawn/save/load is deferred to the later persistence
work. Definition assignment must precede BeginPlay for default seeding; the
separate PlayerDefinition/NPCDefinition initialization work is PR-7/PR-10.
Remote client interface calls do not send an RPC; authority makes changes.
Manual PIE acceptance¶
- After the separate guarded build passes, use a test map with a NarrativeGMC GameMode (or derived BP), the bridge pawn/controller, and a CharacterDefinition with a configured faction. Configure Narrative faction attitudes in the project's existing Narrative settings. Add a hostile NarrativePro BP_NPC.
- Start a listen server with two clients. In each PIE world verify exactly one GMC aggregator; on the server and each client verify one GMC world-time replicator. Repeat using one preplaced aggregator/world-time actor to confirm neither is duplicated. Confirm the game state is ANarrativeGameState.
- Query GetFactions and GetTeamAttitudeTowards on the server, owning client and simulated proxy: no check(false); configured hostile attitude is returned. Let the BP_NPC acquire the player with its normal sensing setup. Other NPC gameplay limitations remain outside PR-2.
- On authority add then remove a faction through both pawn and PlayerState interface references; verify pawn/PlayerState queries match on all peers after replication. Set generic team ID through either reference and verify the same. Client-local mutations must have no effect. Unpossess and query PlayerState: empty/NoTeam, no crash.
- Walk/look with both players at 0 ms, then 200 ms emulation (and 5% loss). Toggle emulation to provoke correction. Confirm GMC time synchronizes, moves are acknowledged, and logs contain no incompatible-controller errors or sustained discarded-move warnings. Use GMC's time-sync diagnostics/debugger to inspect corrections; initial values can settle after joining.