Download LyraStarterGame/Source/LyraGame/System/LyraReplicationGraph.h from Alexhas2/unitysamples: direct link, hf CLI and curl.
- Browser
- Download file 4.85 kB
-
https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/System/LyraReplicationGraph.h
- Command line
-
hf download hf://datasets/Alexhas2/unitysamples/LyraStarterGame/Source/LyraGame/System/LyraReplicationGraph.h
-
curl -L -o LyraReplicationGraph.h https://huggingface.co/datasets/Alexhas2/unitysamples/resolve/main/LyraStarterGame/Source/LyraGame/System/LyraReplicationGraph.h
4.85 kB
| // Copyright Epic Games, Inc. All Rights Reserved. | |
| class AGameplayDebuggerCategoryReplicator; | |
| DECLARE_LOG_CATEGORY_EXTERN(LogLyraRepGraph, Display, All); | |
| /** Lyra Replication Graph implementation. See additional notes in LyraReplicationGraph.cpp! */ | |
| UCLASS(transient, config=Engine) | |
| class ULyraReplicationGraph : public UReplicationGraph | |
| { | |
| GENERATED_BODY() | |
| public: | |
| ULyraReplicationGraph(); | |
| virtual void ResetGameWorldState() override; | |
| virtual void InitGlobalActorClassSettings() override; | |
| virtual void InitGlobalGraphNodes() override; | |
| virtual void InitConnectionGraphNodes(UNetReplicationGraphConnection* RepGraphConnection) override; | |
| virtual void RouteAddNetworkActorToNodes(const FNewReplicatedActorInfo& ActorInfo, FGlobalActorReplicationInfo& GlobalInfo) override; | |
| virtual void RouteRemoveNetworkActorToNodes(const FNewReplicatedActorInfo& ActorInfo) override; | |
| UPROPERTY() | |
| TArray<TObjectPtr<UClass>> AlwaysRelevantClasses; | |
| UPROPERTY() | |
| TObjectPtr<UReplicationGraphNode_GridSpatialization2D> GridNode; | |
| UPROPERTY() | |
| TObjectPtr<UReplicationGraphNode_ActorList> AlwaysRelevantNode; | |
| TMap<FName, FActorRepListRefView> AlwaysRelevantStreamingLevelActors; | |
| void OnGameplayDebuggerOwnerChange(AGameplayDebuggerCategoryReplicator* Debugger, APlayerController* OldOwner); | |
| void PrintRepNodePolicies(); | |
| private: | |
| void AddClassRepInfo(UClass* Class, EClassRepNodeMapping Mapping); | |
| void RegisterClassRepNodeMapping(UClass* Class); | |
| EClassRepNodeMapping GetClassNodeMapping(UClass* Class) const; | |
| void RegisterClassReplicationInfo(UClass* Class); | |
| bool ConditionalInitClassReplicationInfo(UClass* Class, FClassReplicationInfo& ClassInfo); | |
| void InitClassReplicationInfo(FClassReplicationInfo& Info, UClass* Class, bool Spatialize) const; | |
| EClassRepNodeMapping GetMappingPolicy(UClass* Class); | |
| bool IsSpatialized(EClassRepNodeMapping Mapping) const { return Mapping >= EClassRepNodeMapping::Spatialize_Static; } | |
| TClassMap<EClassRepNodeMapping> ClassRepNodePolicies; | |
| /** Classes that had their replication settings explictly set by code in ULyraReplicationGraph::InitGlobalActorClassSettings */ | |
| TArray<UClass*> ExplicitlySetClasses; | |
| }; | |
| UCLASS() | |
| class ULyraReplicationGraphNode_AlwaysRelevant_ForConnection : public UReplicationGraphNode_AlwaysRelevant_ForConnection | |
| { | |
| GENERATED_BODY() | |
| public: | |
| virtual void NotifyAddNetworkActor(const FNewReplicatedActorInfo& Actor) override { } | |
| virtual bool NotifyRemoveNetworkActor(const FNewReplicatedActorInfo& ActorInfo, bool bWarnIfNotFound=true) override { return false; } | |
| virtual void NotifyResetAllNetworkActors() override { } | |
| virtual void GatherActorListsForConnection(const FConnectionGatherActorListParameters& Params) override; | |
| virtual void LogNode(FReplicationGraphDebugInfo& DebugInfo, const FString& NodeName) const override; | |
| void OnClientLevelVisibilityAdd(FName LevelName, UWorld* StreamingWorld); | |
| void OnClientLevelVisibilityRemove(FName LevelName); | |
| void ResetGameWorldState(); | |
| AGameplayDebuggerCategoryReplicator* GameplayDebugger = nullptr; | |
| private: | |
| TArray<FName, TInlineAllocator<64> > AlwaysRelevantStreamingLevelsNeedingReplication; | |
| bool bInitializedPlayerState = false; | |
| }; | |
| /** | |
| This is a specialized node for handling PlayerState replication in a frequency limited fashion. It tracks all player states but only returns a subset of them to the replication driver each frame. | |
| This is an optimization for large player connection counts, and not a requirement. | |
| */ | |
| UCLASS() | |
| class ULyraReplicationGraphNode_PlayerStateFrequencyLimiter : public UReplicationGraphNode | |
| { | |
| GENERATED_BODY() | |
| ULyraReplicationGraphNode_PlayerStateFrequencyLimiter(); | |
| virtual void NotifyAddNetworkActor(const FNewReplicatedActorInfo& Actor) override { } | |
| virtual bool NotifyRemoveNetworkActor(const FNewReplicatedActorInfo& ActorInfo, bool bWarnIfNotFound=true) override { return false; } | |
| virtual bool NotifyActorRenamed(const FRenamedReplicatedActorInfo& Actor, bool bWarnIfNotFound=true) override { return false; } | |
| virtual void GatherActorListsForConnection(const FConnectionGatherActorListParameters& Params) override; | |
| virtual void PrepareForReplication() override; | |
| virtual void LogNode(FReplicationGraphDebugInfo& DebugInfo, const FString& NodeName) const override; | |
| /** How many actors we want to return to the replication driver per frame. Will not suppress ForceNetUpdate. */ | |
| int32 TargetActorsPerFrame = 2; | |
| private: | |
| TArray<FActorRepListRefView> ReplicationActorLists; | |
| FActorRepListRefView ForceNetUpdateReplicationActorList; | |
| }; |