├── DA RepGraph Template ├── DAReplicationGraph.cpp └── DAReplicationGraph.h ├── DARepGraphExample ├── Config │ ├── DefaultEditor.ini │ ├── DefaultEditorPerProjectUserSettings.ini │ ├── DefaultEngine.ini │ ├── DefaultGame.ini │ └── DefaultInput.ini ├── Content │ ├── BP_PBW.uasset │ ├── BP_Projectile.uasset │ ├── BP_Weapon.uasset │ ├── Geometry │ │ └── Meshes │ │ │ ├── 1M_Cube.uasset │ │ │ ├── 1M_Cube_Chamfer.uasset │ │ │ ├── CubeMaterial.uasset │ │ │ └── TemplateFloor.uasset │ ├── M4A1_mat.uasset │ ├── Mannequin │ │ ├── Animations │ │ │ ├── ThirdPersonIdle.uasset │ │ │ ├── ThirdPersonJump_End.uasset │ │ │ ├── ThirdPersonJump_Loop.uasset │ │ │ ├── ThirdPersonJump_Start.uasset │ │ │ ├── ThirdPersonRun.uasset │ │ │ ├── ThirdPersonWalk.uasset │ │ │ ├── ThirdPerson_AnimBP.uasset │ │ │ ├── ThirdPerson_IdleRun_2D.uasset │ │ │ └── ThirdPerson_Jump.uasset │ │ └── Character │ │ │ ├── Materials │ │ │ ├── M_UE4Man_Body.uasset │ │ │ ├── M_UE4Man_ChestLogo.uasset │ │ │ └── MaterialLayers │ │ │ │ ├── ML_GlossyBlack_Latex_UE4.uasset │ │ │ │ ├── ML_Plastic_Shiny_Beige.uasset │ │ │ │ ├── ML_Plastic_Shiny_Beige_LOGO.uasset │ │ │ │ ├── ML_SoftMetal_UE4.uasset │ │ │ │ ├── T_ML_Aluminum01.uasset │ │ │ │ ├── T_ML_Aluminum01_N.uasset │ │ │ │ ├── T_ML_Rubber_Blue_01_D.uasset │ │ │ │ └── T_ML_Rubber_Blue_01_N.uasset │ │ │ ├── Mesh │ │ │ ├── SK_Mannequin.uasset │ │ │ ├── SK_Mannequin_PhysicsAsset.uasset │ │ │ └── UE4_Mannequin_Skeleton.uasset │ │ │ └── Textures │ │ │ ├── UE4Man_Logo_N.uasset │ │ │ ├── UE4_LOGO_CARD.uasset │ │ │ ├── UE4_Mannequin_MAT_MASKA.uasset │ │ │ └── UE4_Mannequin__normals.uasset │ ├── SKM_M4.uasset │ ├── SKM_M4_PhysicsAsset.uasset │ ├── SKM_M4_Skeleton.uasset │ ├── StarterContent │ │ ├── Architecture │ │ │ ├── Floor_400x400.uasset │ │ │ ├── Pillar_50x500.uasset │ │ │ ├── SM_AssetPlatform.uasset │ │ │ ├── Wall_400x200.uasset │ │ │ ├── Wall_400x300.uasset │ │ │ ├── Wall_400x400.uasset │ │ │ ├── Wall_500x500.uasset │ │ │ ├── Wall_Door_400x300.uasset │ │ │ ├── Wall_Door_400x400.uasset │ │ │ ├── Wall_Window_400x300.uasset │ │ │ └── Wall_Window_400x400.uasset │ │ └── Shapes │ │ │ ├── Shape_Cone.uasset │ │ │ ├── Shape_Cube.uasset │ │ │ ├── Shape_Cylinder.uasset │ │ │ ├── Shape_NarrowCapsule.uasset │ │ │ ├── Shape_Pipe.uasset │ │ │ ├── Shape_Pipe_180.uasset │ │ │ ├── Shape_Pipe_90.uasset │ │ │ ├── Shape_Plane.uasset │ │ │ ├── Shape_QuadPyramid.uasset │ │ │ ├── Shape_Sphere.uasset │ │ │ ├── Shape_Torus.uasset │ │ │ ├── Shape_TriPyramid.uasset │ │ │ ├── Shape_Trim.uasset │ │ │ ├── Shape_Trim_90_In.uasset │ │ │ ├── Shape_Trim_90_Out.uasset │ │ │ ├── Shape_Tube.uasset │ │ │ ├── Shape_Wedge_A.uasset │ │ │ ├── Shape_Wedge_B.uasset │ │ │ └── Shape_WideCapsule.uasset │ ├── ThirdPerson │ │ └── Meshes │ │ │ ├── Bump_StaticMesh.uasset │ │ │ ├── CubeMaterial.uasset │ │ │ ├── LeftArm_StaticMesh.uasset │ │ │ ├── Linear_Stair_StaticMesh.uasset │ │ │ ├── RampMaterial.uasset │ │ │ ├── Ramp_StaticMesh.uasset │ │ │ └── RightArm_StaticMesh.uasset │ └── ThirdPersonCPP │ │ ├── Blueprints │ │ └── ThirdPersonCharacter.uasset │ │ └── Maps │ │ ├── ThirdPersonExampleMap.umap │ │ └── ThirdPersonExampleMap_BuiltData.uasset ├── DARepGraphExample.uproject └── Source │ ├── DARepGraphExample.Target.cs │ ├── DARepGraphExample │ ├── DABuildableWall.cpp │ ├── DABuildableWall.h │ ├── DACharacter.cpp │ ├── DACharacter.h │ ├── DAProjectile.cpp │ ├── DAProjectile.h │ ├── DARepGraphExample.Build.cs │ ├── DARepGraphExample.cpp │ ├── DARepGraphExample.h │ ├── DARepGraphExampleGameMode.cpp │ ├── DARepGraphExampleGameMode.h │ ├── DAReplicationGraph.cpp │ ├── DAReplicationGraph.h │ ├── DAWeapon.cpp │ ├── DAWeapon.h │ ├── DAWeaponPickup.cpp │ └── DAWeaponPickup.h │ └── DARepGraphExampleEditor.Target.cs ├── LICENSE └── README.md /DA RepGraph Template/DAReplicationGraph.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - Dennis "MazyModz" Andersson. 2 | 3 | /* 4 | MIT License 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files 6 | (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | persons to whom the Software is furnished to do so, subject to the following conditions: 9 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 11 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 12 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 13 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | */ 15 | 16 | #include "DAReplicationGraph.h" 17 | #include "Engine/LevelScriptActor.h" 18 | 19 | #if WITH_GAMEPLAY_DEBUGGER 20 | #include "GameplayDebuggerCategoryReplicator.h" 21 | #endif 22 | 23 | void UDAReplicationGraph::ResetGameWorldState() 24 | { 25 | Super::ResetGameWorldState(); 26 | AlwaysRelevantStreamingLevelActors.Empty(); 27 | 28 | for (auto& ConnectionList : { Connections, PendingConnections }) 29 | { 30 | for (UNetReplicationGraphConnection* Connection : ConnectionList) 31 | { 32 | for (UReplicationGraphNode* ConnectionNode : Connection->GetConnectionGraphNodes()) 33 | { 34 | UDAReplicationGraphNode_AlwaysRelevant_ForConnection* Node = Cast(ConnectionNode); 35 | if (Node != nullptr) 36 | { 37 | Node->ResetGameWorldState(); 38 | } 39 | } 40 | } 41 | } 42 | } 43 | 44 | void UDAReplicationGraph::InitConnectionGraphNodes(UNetReplicationGraphConnection* ConnectionManager) 45 | { 46 | UDAReplicationGraphNode_AlwaysRelevant_ForConnection* Node = CreateNewNode(); 47 | ConnectionManager->OnClientVisibleLevelNameAdd.AddUObject(Node, &UDAReplicationGraphNode_AlwaysRelevant_ForConnection::OnClientLevelVisibilityAdd); 48 | ConnectionManager->OnClientVisibleLevelNameRemove.AddUObject(Node, &UDAReplicationGraphNode_AlwaysRelevant_ForConnection::OnClientLevelVisibilityRemove); 49 | 50 | AddConnectionGraphNode(Node, ConnectionManager); 51 | } 52 | 53 | void UDAReplicationGraph::InitGlobalActorClassSettings() 54 | { 55 | Super::InitGlobalActorClassSettings(); 56 | 57 | // ---------------------------------------- 58 | // Assign mapping to classes 59 | 60 | auto SetRule = [&](UClass* InClass, EClassRepPolicy Mapping) { ClassRepPolicies.Set(InClass, Mapping); }; 61 | 62 | SetRule(AReplicationGraphDebugActor::StaticClass(), EClassRepPolicy::NotRouted); 63 | SetRule(ALevelScriptActor::StaticClass(), EClassRepPolicy::NotRouted); 64 | SetRule(AInfo::StaticClass(), EClassRepPolicy::RelevantAllConnections); 65 | 66 | #if WITH_GAMEPLAY_DEBUGGER 67 | SetRule(AGameplayDebuggerCategoryReplicator::StaticClass(), EClassRepPolicy::NotRouted); 68 | #endif 69 | 70 | TArray ReplicatedClasses; 71 | for (TObjectIterator Itr; Itr; ++Itr) 72 | { 73 | UClass* Class = *Itr; 74 | AActor* ActorCDO = Cast(Class->GetDefaultObject()); 75 | 76 | // Do not add the actor if it does not replicate 77 | if (!ActorCDO || !ActorCDO->GetIsReplicated()) 78 | { 79 | continue; 80 | } 81 | 82 | // Do not add SKEL and REINST classes 83 | FString ClassName = Class->GetName(); 84 | if (ClassName.StartsWith("SKEL_") || ClassName.StartsWith("REINST_")) 85 | { 86 | continue; 87 | } 88 | 89 | ReplicatedClasses.Add(Class); 90 | 91 | // if we already have mapped it to the policy, dont do it again 92 | if (ClassRepPolicies.Contains(Class, false)) 93 | { 94 | continue; 95 | } 96 | 97 | auto ShouldSpatialize = [](const AActor* Actor) 98 | { 99 | return Actor->GetIsReplicated() && (!(Actor->bAlwaysRelevant || Actor->bOnlyRelevantToOwner || Actor->bNetUseOwnerRelevancy)); 100 | }; 101 | 102 | UClass* SuperClass = Class->GetSuperClass(); 103 | if (AActor* SuperCDO = Cast(SuperClass->GetDefaultObject())) 104 | { 105 | if (SuperCDO->GetIsReplicated() == ActorCDO->GetIsReplicated() 106 | && SuperCDO->bAlwaysRelevant == ActorCDO->bAlwaysRelevant 107 | && SuperCDO->bOnlyRelevantToOwner == ActorCDO->bOnlyRelevantToOwner 108 | && SuperCDO->bNetUseOwnerRelevancy == ActorCDO->bNetUseOwnerRelevancy) 109 | { 110 | continue; 111 | } 112 | 113 | if (ShouldSpatialize(ActorCDO) == false && ShouldSpatialize(SuperCDO) == true) 114 | { 115 | NonSpatializedClasses.Add(Class); 116 | } 117 | } 118 | 119 | if (ShouldSpatialize(ActorCDO) == true) 120 | { 121 | SetRule(Class, EClassRepPolicy::Spatialize_Dynamic); 122 | } 123 | else if (ActorCDO->bAlwaysRelevant && !ActorCDO->bOnlyRelevantToOwner) 124 | { 125 | SetRule(Class, EClassRepPolicy::RelevantAllConnections); 126 | } 127 | } 128 | 129 | // -------------------------------------- 130 | // Explicitly set replication info for our classes 131 | 132 | TArray ExplicitlySetClasses; 133 | 134 | auto SetClassInfo = [&](UClass* InClass, FClassReplicationInfo& RepInfo) 135 | { 136 | GlobalActorReplicationInfoMap.SetClassInfo(InClass, RepInfo); 137 | ExplicitlySetClasses.Add(InClass); 138 | }; 139 | 140 | FClassReplicationInfo PawnClassInfo; 141 | PawnClassInfo.CullDistanceSquared = 300000.f * 300000.f; 142 | SetClassInfo(APawn::StaticClass(), PawnClassInfo); 143 | 144 | for (UClass* ReplicatedClass : ReplicatedClasses) 145 | { 146 | if (ExplicitlySetClasses.FindByPredicate([&](const UClass* InClass) { return ReplicatedClass->IsChildOf(InClass); }) != nullptr) 147 | { 148 | continue; 149 | } 150 | 151 | bool bSptatilize = IsSpatialized(ClassRepPolicies.GetChecked(ReplicatedClass)); 152 | 153 | FClassReplicationInfo ClassInfo; 154 | InitClassReplicationInfo(ClassInfo, ReplicatedClass, bSptatilize, NetDriver->NetServerMaxTickRate); 155 | GlobalActorReplicationInfoMap.SetClassInfo(ReplicatedClass, ClassInfo); 156 | } 157 | 158 | // ------------------------------- 159 | // Bind events here 160 | 161 | #if WITH_GAMEPLAY_DEBUGGER 162 | AGameplayDebuggerCategoryReplicator::NotifyDebuggerOwnerChange.AddUObject(this, &UDAReplicationGraph::OnGameplayDebuggerOwnerChange); 163 | #endif 164 | } 165 | 166 | void UDAReplicationGraph::InitGlobalGraphNodes() 167 | { 168 | PreAllocateRepList(3, 12); 169 | PreAllocateRepList(6, 12); 170 | PreAllocateRepList(128, 64); 171 | PreAllocateRepList(512, 16); 172 | 173 | 174 | // --------------------------------- 175 | // Create our grid node 176 | GridNode = CreateNewNode(); 177 | GridNode->CellSize = GridCellSize; 178 | GridNode->SpatialBias = FVector2D(SpatialBiasX, SpatialBiasY); 179 | 180 | if (bDisableSpatialRebuilding == true) 181 | { 182 | GridNode->AddSpatialRebuildBlacklistClass(AActor::StaticClass()); 183 | } 184 | 185 | AddGlobalGraphNode(GridNode); 186 | 187 | // --------------------------------- 188 | // Create our always relevant node 189 | AlwaysRelevantNode = CreateNewNode(); 190 | AddGlobalGraphNode(AlwaysRelevantNode); 191 | } 192 | 193 | void UDAReplicationGraph::RouteAddNetworkActorToNodes(const FNewReplicatedActorInfo& ActorInfo, FGlobalActorReplicationInfo& GlobalInfo) 194 | { 195 | EClassRepPolicy MappingPolicy = GetMappingPolicy(ActorInfo.Class); 196 | switch (MappingPolicy) 197 | { 198 | case EClassRepPolicy::RelevantAllConnections: 199 | { 200 | if (ActorInfo.StreamingLevelName == NAME_None) 201 | { 202 | AlwaysRelevantNode->NotifyAddNetworkActor(ActorInfo); 203 | } 204 | else 205 | { 206 | FActorRepListRefView& RepList = AlwaysRelevantStreamingLevelActors.FindOrAdd(ActorInfo.StreamingLevelName); 207 | RepList.PrepareForWrite(); 208 | RepList.ConditionalAdd(ActorInfo.Actor); 209 | } 210 | break; 211 | } 212 | 213 | case EClassRepPolicy::Spatialize_Static: 214 | { 215 | GridNode->AddActor_Static(ActorInfo, GlobalInfo); 216 | break; 217 | } 218 | 219 | case EClassRepPolicy::Spatialize_Dynamic: 220 | { 221 | GridNode->AddActor_Dynamic(ActorInfo, GlobalInfo); 222 | break; 223 | } 224 | 225 | case EClassRepPolicy::Spatialize_Dormancy: 226 | { 227 | GridNode->AddActor_Dormancy(ActorInfo, GlobalInfo); 228 | break; 229 | } 230 | 231 | default: 232 | { 233 | break; 234 | } 235 | } 236 | } 237 | 238 | void UDAReplicationGraph::RouteRemoveNetworkActorToNodes(const FNewReplicatedActorInfo& ActorInfo) 239 | { 240 | EClassRepPolicy MappingPolicy = GetMappingPolicy(ActorInfo.Class); 241 | switch (MappingPolicy) 242 | { 243 | case EClassRepPolicy::RelevantAllConnections: 244 | { 245 | if (ActorInfo.StreamingLevelName == NAME_None) 246 | { 247 | AlwaysRelevantNode->NotifyRemoveNetworkActor(ActorInfo); 248 | } 249 | else 250 | { 251 | FActorRepListRefView& RepList = AlwaysRelevantStreamingLevelActors.FindOrAdd(ActorInfo.StreamingLevelName); 252 | RepList.Remove(ActorInfo.Actor); 253 | } 254 | break; 255 | } 256 | 257 | case EClassRepPolicy::Spatialize_Static: 258 | { 259 | GridNode->RemoveActor_Static(ActorInfo); 260 | break; 261 | } 262 | 263 | case EClassRepPolicy::Spatialize_Dynamic: 264 | { 265 | GridNode->RemoveActor_Dynamic(ActorInfo); 266 | break; 267 | } 268 | 269 | case EClassRepPolicy::Spatialize_Dormancy: 270 | { 271 | GridNode->RemoveActor_Dormancy(ActorInfo); 272 | break; 273 | } 274 | 275 | default: 276 | { 277 | break; 278 | } 279 | } 280 | } 281 | 282 | void UDAReplicationGraph::InitClassReplicationInfo(FClassReplicationInfo& Info, UClass* InClass, bool bSpatilize, float ServerMaxTickRate) 283 | { 284 | if (AActor* CDO = Cast(InClass->GetDefaultObject())) 285 | { 286 | if (bSpatilize == true) 287 | { 288 | Info.CullDistanceSquared = CDO->NetCullDistanceSquared; 289 | } 290 | 291 | Info.ReplicationPeriodFrame = FMath::Max((uint32)FMath::RoundToFloat(ServerMaxTickRate / CDO->NetUpdateFrequency), 1); 292 | } 293 | } 294 | 295 | class UDAReplicationGraphNode_AlwaysRelevant_ForConnection* UDAReplicationGraph::GetAlwaysRelevantNode(APlayerController* PlayerController) 296 | { 297 | if (PlayerController != NULL) 298 | { 299 | if (UNetConnection* NetConnection = PlayerController->NetConnection) 300 | { 301 | if (UNetReplicationGraphConnection* GraphConnection = FindOrAddConnectionManager(NetConnection)) 302 | { 303 | for (UReplicationGraphNode* ConnectionNode : GraphConnection->GetConnectionGraphNodes()) 304 | { 305 | UDAReplicationGraphNode_AlwaysRelevant_ForConnection* Node = Cast(ConnectionNode); 306 | if (Node != NULL) 307 | { 308 | return Node; 309 | } 310 | } 311 | } 312 | } 313 | } 314 | 315 | return nullptr; 316 | } 317 | 318 | #if WITH_GAMEPLAY_DEBUGGER 319 | void UDAReplicationGraph::OnGameplayDebuggerOwnerChange(AGameplayDebuggerCategoryReplicator* Debugger, APlayerController* OldOwner) 320 | { 321 | if (UDAReplicationGraphNode_AlwaysRelevant_ForConnection* Node = GetAlwaysRelevantNode(OldOwner)) 322 | { 323 | Node->GameplayDebugger = nullptr; 324 | } 325 | 326 | if (UDAReplicationGraphNode_AlwaysRelevant_ForConnection* Node = GetAlwaysRelevantNode(Debugger->GetReplicationOwner())) 327 | { 328 | Node->GameplayDebugger = Debugger; 329 | } 330 | } 331 | #endif 332 | 333 | EClassRepPolicy UDAReplicationGraph::GetMappingPolicy(const UClass* InClass) 334 | { 335 | return ClassRepPolicies.Get(InClass) != NULL ? *ClassRepPolicies.Get(InClass) : EClassRepPolicy::NotRouted; 336 | } 337 | 338 | // -------------------------------------------------- 339 | // UDAReplicationGraphNode_AlwaysRelevant_ForConnection 340 | 341 | void UDAReplicationGraphNode_AlwaysRelevant_ForConnection::GatherActorListsForConnection(const FConnectionGatherActorListParameters& Params) 342 | { 343 | Super::GatherActorListsForConnection(Params); 344 | 345 | UDAReplicationGraph* RepGraph = CastChecked(GetOuter()); 346 | 347 | FPerConnectionActorInfoMap& ConnectionActorInfoMap = Params.ConnectionManager.ActorInfoMap; 348 | TMap& AlwaysRelevantStreamingLevelActors = RepGraph->AlwaysRelevantStreamingLevelActors; 349 | 350 | for (int32 Idx = AlwaysRelevantStreamingLevels.Num() - 1; Idx >= 0; --Idx) 351 | { 352 | FName StreamingLevel = AlwaysRelevantStreamingLevels[Idx]; 353 | FActorRepListRefView* ListPtr = AlwaysRelevantStreamingLevelActors.Find(StreamingLevel); 354 | 355 | if (ListPtr == nullptr) 356 | { 357 | AlwaysRelevantStreamingLevels.RemoveAtSwap(Idx, 1, false); 358 | continue; 359 | } 360 | 361 | FActorRepListRefView& RepList = *ListPtr; 362 | if (RepList.Num() > 0) 363 | { 364 | bool bAllDormant = true; 365 | for (FActorRepListType Actor : RepList) 366 | { 367 | FConnectionReplicationActorInfo& ConnectionActorInfo = ConnectionActorInfoMap.FindOrAdd(Actor); 368 | if (ConnectionActorInfo.bDormantOnConnection == false) 369 | { 370 | bAllDormant = false; 371 | break; 372 | } 373 | } 374 | 375 | if (bAllDormant == true) 376 | { 377 | AlwaysRelevantStreamingLevels.RemoveAtSwap(Idx, 1, false); 378 | } 379 | else 380 | { 381 | Params.OutGatheredReplicationLists.AddReplicationActorList(RepList); 382 | } 383 | } 384 | } 385 | 386 | #if WITH_GAMEPLAY_DEBUGGER 387 | if (GameplayDebugger != NULL) 388 | { 389 | ReplicationActorList.ConditionalAdd(GameplayDebugger); 390 | } 391 | #endif 392 | } 393 | 394 | void UDAReplicationGraphNode_AlwaysRelevant_ForConnection::OnClientLevelVisibilityAdd(FName LevelName, UWorld* LevelWorld) 395 | { 396 | AlwaysRelevantStreamingLevels.Add(LevelName); 397 | } 398 | 399 | void UDAReplicationGraphNode_AlwaysRelevant_ForConnection::OnClientLevelVisibilityRemove(FName LevelName) 400 | { 401 | AlwaysRelevantStreamingLevels.Remove(LevelName); 402 | } 403 | 404 | void UDAReplicationGraphNode_AlwaysRelevant_ForConnection::ResetGameWorldState() 405 | { 406 | AlwaysRelevantStreamingLevels.Empty(); 407 | } 408 | -------------------------------------------------------------------------------- /DA RepGraph Template/DAReplicationGraph.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - Dennis "MazyModz" Andersson. 2 | 3 | /* 4 | MIT License 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files 6 | (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | persons to whom the Software is furnished to do so, subject to the following conditions: 9 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 10 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 11 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 12 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 13 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 14 | */ 15 | 16 | #pragma once 17 | 18 | #include "CoreMinimal.h" 19 | #include "ReplicationGraph.h" 20 | #include "DAReplicationGraph.generated.h" 21 | 22 | enum class EClassRepPolicy : uint8 23 | { 24 | NotRouted, 25 | RelevantAllConnections, 26 | 27 | // -------------------------------- 28 | // Spatialized routes into the grid node 29 | 30 | Spatialize_Static, // Used for actors for frequent updates / updates every frame 31 | Spatialize_Dynamic, // For do need updates every frame 32 | Spatialize_Dormancy // Actors that can either be Static or Dynamic determined by their AActor::NetDormancy state 33 | }; 34 | 35 | class UReplicationGraphNode_ActorList; 36 | class UReplicationGraphNode_GridSpatialization2D; 37 | class UReplicationGraphNode_AlwaysRelevant_ForConnection; 38 | class AGameplayDebuggerCategoryReplicator; 39 | 40 | /** 41 | * 42 | */ 43 | UCLASS(Transient, config=Engine) 44 | class UDAReplicationGraph : public UReplicationGraph 45 | { 46 | public: 47 | 48 | GENERATED_BODY() 49 | 50 | // ~ begin UReplicationGraph implementation 51 | virtual void ResetGameWorldState() override; 52 | virtual void InitConnectionGraphNodes(UNetReplicationGraphConnection* ConnectionManager) override; 53 | virtual void InitGlobalActorClassSettings() override; 54 | virtual void InitGlobalGraphNodes() override; 55 | virtual void RouteAddNetworkActorToNodes(const FNewReplicatedActorInfo& ActorInfo, FGlobalActorReplicationInfo& GlobalInfo) override; 56 | virtual void RouteRemoveNetworkActorToNodes(const FNewReplicatedActorInfo& ActorInfo) override; 57 | // ~ end UReplicationGraph 58 | 59 | /** Sets class replication info for a class */ 60 | void InitClassReplicationInfo(FClassReplicationInfo& Info, UClass* InClass, bool bSpatilize, float ServerMaxTickRate); 61 | 62 | UPROPERTY() 63 | TArray SpatializedClasses; 64 | 65 | UPROPERTY() 66 | TArray NonSpatializedClasses; 67 | 68 | UPROPERTY() 69 | TArray AlwaysRelevantClasses; 70 | 71 | // ------------------------------------- 72 | // ReplicationGraph Nodes 73 | 74 | /** 75 | * This is probably the most important node in the replication graph 76 | * 77 | * Carves the map up into grids and determines if an actor should send network updates 78 | * to a connection depending on the different pre-defined grids 79 | */ 80 | UPROPERTY() 81 | UReplicationGraphNode_GridSpatialization2D* GridNode; 82 | 83 | UPROPERTY() 84 | UReplicationGraphNode_ActorList* AlwaysRelevantNode; 85 | 86 | /** Maps the actors the needs to be always relevant across streaming levels */ 87 | TMap AlwaysRelevantStreamingLevelActors; 88 | 89 | protected: 90 | 91 | /** Gets the connection always relevant node from a player controller */ 92 | class UDAReplicationGraphNode_AlwaysRelevant_ForConnection* GetAlwaysRelevantNode(APlayerController* PlayerController); 93 | 94 | #if WITH_GAMEPLAY_DEBUGGER 95 | void OnGameplayDebuggerOwnerChange(AGameplayDebuggerCategoryReplicator* Debugger, APlayerController* OldOwner); 96 | #endif 97 | 98 | FORCEINLINE bool IsSpatialized(EClassRepPolicy Mapping) 99 | { 100 | return Mapping >= EClassRepPolicy::Spatialize_Static; 101 | } 102 | 103 | /** Gets the mapping to used for the given class */ 104 | EClassRepPolicy GetMappingPolicy(const UClass* InClass); 105 | 106 | /** Maps a class to a mapping policy */ 107 | TClassMap ClassRepPolicies; 108 | 109 | float GridCellSize = 10000.f; // The size of one grid cell in the grid node 110 | float SpatialBiasX = -150000.f; // "Min X" for replication 111 | float SpatialBiasY = -200000.f; // "Min Y" for replication 112 | bool bDisableSpatialRebuilding = true; 113 | }; 114 | 115 | UCLASS() 116 | class UDAReplicationGraphNode_AlwaysRelevant_ForConnection : public UReplicationGraphNode_AlwaysRelevant_ForConnection 117 | { 118 | public: 119 | 120 | GENERATED_BODY() 121 | 122 | // ~ begin UReplicationGraphNode_AlwaysRelevant_ForConnection implementation 123 | virtual void GatherActorListsForConnection(const FConnectionGatherActorListParameters& Params) override; 124 | // ~ end UReplicationGraphNode_AlwaysRelevant_ForConnection 125 | 126 | void OnClientLevelVisibilityAdd(FName LevelName, UWorld* LevelWorld); 127 | void OnClientLevelVisibilityRemove(FName LevelName); 128 | 129 | void ResetGameWorldState(); 130 | 131 | #if WITH_GAMEPLAY_DEBUGGER 132 | AGameplayDebuggerCategoryReplicator* GameplayDebugger = nullptr; 133 | #endif 134 | 135 | protected: 136 | 137 | /** Stores levelstreaming actors */ 138 | TArray> AlwaysRelevantStreamingLevels; 139 | }; 140 | -------------------------------------------------------------------------------- /DARepGraphExample/Config/DefaultEditor.ini: -------------------------------------------------------------------------------- 1 | [UnrealEd.SimpleMap] 2 | SimpleMapName=/Game/ThirdPersonCPP/Maps/ThirdPersonExampleMap 3 | 4 | [EditoronlyBP] 5 | bAllowClassAndBlueprintPinMatching=true 6 | bReplaceBlueprintWithClass= true 7 | bDontLoadBlueprintOutsideEditor= true 8 | bBlueprintIsNotBlueprintType= true 9 | 10 | 11 | -------------------------------------------------------------------------------- /DARepGraphExample/Config/DefaultEditorPerProjectUserSettings.ini: -------------------------------------------------------------------------------- 1 | [ContentBrowser] 2 | ContentBrowserTab1.SelectedPaths=/Game/ThirdPersonCPP -------------------------------------------------------------------------------- /DARepGraphExample/Config/DefaultEngine.ini: -------------------------------------------------------------------------------- 1 | [/Script/EngineSettings.GameMapsSettings] 2 | GameDefaultMap=/Game/ThirdPersonCPP/Maps/ThirdPersonExampleMap 3 | EditorStartupMap=/Game/ThirdPersonCPP/Maps/ThirdPersonExampleMap 4 | GlobalDefaultGameMode="/Script/DARepGraphExample.DARepGraphExampleGameMode" 5 | 6 | [/Script/IOSRuntimeSettings.IOSRuntimeSettings] 7 | MinimumiOSVersion=IOS_10 8 | bSupportsPortraitOrientation=False 9 | bSupportsUpsideDownOrientation=False 10 | bSupportsLandscapeLeftOrientation=True 11 | PreferredLandscapeOrientation=LandscapeLeft 12 | 13 | [/Script/OnlineSubsystemSteam.SteamNetDriver] 14 | ReplicationDriverClassName="/Script/DARepGraphExample.DAReplicationGraph" 15 | 16 | [/Script/OnlineSubsystemUtils.IpNetDriver] 17 | ReplicationDriverClassName="/Script/DARepGraphExample.DAReplicationGraph" 18 | 19 | [/Script/Engine.Engine] 20 | +ActiveGameNameRedirects=(OldGameName="TP_ThirdPerson",NewGameName="/Script/DARepGraphExample") 21 | +ActiveGameNameRedirects=(OldGameName="/Script/TP_ThirdPerson",NewGameName="/Script/DARepGraphExample") 22 | +ActiveClassRedirects=(OldClassName="TP_ThirdPersonGameMode",NewClassName="DARepGraphExampleGameMode") 23 | +ActiveClassRedirects=(OldClassName="TP_ThirdPersonCharacter",NewClassName="DARepGraphExampleCharacter") 24 | 25 | [/Script/HardwareTargeting.HardwareTargetingSettings] 26 | TargetedHardwareClass=Desktop 27 | AppliedTargetedHardwareClass=Desktop 28 | DefaultGraphicsPerformance=Maximum 29 | AppliedDefaultGraphicsPerformance=Maximum 30 | 31 | [/Script/Engine.PhysicsSettings] 32 | DefaultGravityZ=-980.000000 33 | DefaultTerminalVelocity=4000.000000 34 | DefaultFluidFriction=0.300000 35 | SimulateScratchMemorySize=262144 36 | RagdollAggregateThreshold=4 37 | TriangleMeshTriangleMinAreaThreshold=5.000000 38 | bEnableAsyncScene=False 39 | bEnableShapeSharing=False 40 | bEnablePCM=True 41 | bEnableStabilization=False 42 | bWarnMissingLocks=True 43 | bEnable2DPhysics=False 44 | PhysicErrorCorrection=(PingExtrapolation=0.100000,PingLimit=100.000000,ErrorPerLinearDifference=1.000000,ErrorPerAngularDifference=1.000000,MaxRestoredStateError=1.000000,MaxLinearHardSnapDistance=400.000000,PositionLerp=0.000000,AngleLerp=0.400000,LinearVelocityCoefficient=100.000000,AngularVelocityCoefficient=10.000000,ErrorAccumulationSeconds=0.500000,ErrorAccumulationDistanceSq=15.000000,ErrorAccumulationSimilarity=100.000000) 45 | LockedAxis=Invalid 46 | DefaultDegreesOfFreedom=Full3D 47 | BounceThresholdVelocity=200.000000 48 | FrictionCombineMode=Average 49 | RestitutionCombineMode=Average 50 | MaxAngularVelocity=3600.000000 51 | MaxDepenetrationVelocity=0.000000 52 | ContactOffsetMultiplier=0.020000 53 | MinContactOffset=2.000000 54 | MaxContactOffset=8.000000 55 | bSimulateSkeletalMeshOnDedicatedServer=True 56 | DefaultShapeComplexity=CTF_UseSimpleAndComplex 57 | bDefaultHasComplexCollision=True 58 | bSuppressFaceRemapTable=False 59 | bSupportUVFromHitResults=False 60 | bDisableActiveActors=False 61 | bDisableKinematicStaticPairs=False 62 | bDisableKinematicKinematicPairs=False 63 | bDisableCCD=False 64 | bEnableEnhancedDeterminism=False 65 | MaxPhysicsDeltaTime=0.033333 66 | bSubstepping=False 67 | bSubsteppingAsync=False 68 | MaxSubstepDeltaTime=0.016667 69 | MaxSubsteps=6 70 | SyncSceneSmoothingFactor=0.000000 71 | AsyncSceneSmoothingFactor=0.990000 72 | InitialAverageFrameRate=0.016667 73 | PhysXTreeRebuildRate=10 74 | DefaultBroadphaseSettings=(bUseMBPOnClient=False,bUseMBPOnServer=False,MBPBounds=(Min=(X=0.000000,Y=0.000000,Z=0.000000),Max=(X=0.000000,Y=0.000000,Z=0.000000),IsValid=0),MBPNumSubdivs=2) 75 | -------------------------------------------------------------------------------- /DARepGraphExample/Config/DefaultGame.ini: -------------------------------------------------------------------------------- 1 | [/Script/EngineSettings.GeneralProjectSettings] 2 | ProjectID=AA6F2E4340621F243496899EAB049353 3 | ProjectName=Third Person Game Template 4 | 5 | [StartupActions] 6 | bAddPacks=True 7 | InsertPack=(PackSource="StarterContent.upack",PackName="StarterContent") 8 | -------------------------------------------------------------------------------- /DARepGraphExample/Config/DefaultInput.ini: -------------------------------------------------------------------------------- 1 | 2 | [/Script/Engine.InputSettings] 3 | -AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) 4 | -AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) 5 | -AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) 6 | -AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.25,Exponent=1.f,Sensitivity=1.f)) 7 | -AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f)) 8 | -AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.f,Exponent=1.f,Sensitivity=0.07f)) 9 | +AxisConfig=(AxisKeyName="Gamepad_LeftX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 10 | +AxisConfig=(AxisKeyName="Gamepad_LeftY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 11 | +AxisConfig=(AxisKeyName="Gamepad_RightX",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 12 | +AxisConfig=(AxisKeyName="Gamepad_RightY",AxisProperties=(DeadZone=0.250000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 13 | +AxisConfig=(AxisKeyName="MouseX",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False)) 14 | +AxisConfig=(AxisKeyName="MouseY",AxisProperties=(DeadZone=0.000000,Sensitivity=0.070000,Exponent=1.000000,bInvert=False)) 15 | +AxisConfig=(AxisKeyName="MotionController_Left_Thumbstick_Z",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 16 | +AxisConfig=(AxisKeyName="MotionController_Right_Thumbstick_Z",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 17 | +AxisConfig=(AxisKeyName="MouseWheelAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 18 | +AxisConfig=(AxisKeyName="Gamepad_LeftTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 19 | +AxisConfig=(AxisKeyName="Gamepad_RightTriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 20 | +AxisConfig=(AxisKeyName="MotionController_Left_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 21 | +AxisConfig=(AxisKeyName="MotionController_Left_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 22 | +AxisConfig=(AxisKeyName="MotionController_Left_TriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 23 | +AxisConfig=(AxisKeyName="MotionController_Left_Grip1Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 24 | +AxisConfig=(AxisKeyName="MotionController_Left_Grip2Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 25 | +AxisConfig=(AxisKeyName="MotionController_Right_Thumbstick_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 26 | +AxisConfig=(AxisKeyName="MotionController_Right_Thumbstick_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 27 | +AxisConfig=(AxisKeyName="MotionController_Right_TriggerAxis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 28 | +AxisConfig=(AxisKeyName="MotionController_Right_Grip1Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 29 | +AxisConfig=(AxisKeyName="MotionController_Right_Grip2Axis",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 30 | +AxisConfig=(AxisKeyName="Gamepad_Special_Left_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 31 | +AxisConfig=(AxisKeyName="Gamepad_Special_Left_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 32 | +AxisConfig=(AxisKeyName="OculusTouch_Left_Thumbstick",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 33 | +AxisConfig=(AxisKeyName="OculusTouch_Left_FaceButton1",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 34 | +AxisConfig=(AxisKeyName="OculusTouch_Left_Trigger",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 35 | +AxisConfig=(AxisKeyName="OculusTouch_Left_FaceButton2",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 36 | +AxisConfig=(AxisKeyName="OculusTouch_Left_IndexPointing",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 37 | +AxisConfig=(AxisKeyName="OculusTouch_Left_ThumbUp",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 38 | +AxisConfig=(AxisKeyName="OculusTouch_Right_Thumbstick",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 39 | +AxisConfig=(AxisKeyName="OculusTouch_Right_FaceButton1",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 40 | +AxisConfig=(AxisKeyName="OculusTouch_Right_Trigger",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 41 | +AxisConfig=(AxisKeyName="OculusTouch_Right_FaceButton2",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 42 | +AxisConfig=(AxisKeyName="OculusTouch_Right_IndexPointing",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 43 | +AxisConfig=(AxisKeyName="OculusTouch_Right_ThumbUp",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 44 | +AxisConfig=(AxisKeyName="OculusTouchpad_Touchpad_X",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 45 | +AxisConfig=(AxisKeyName="OculusTouchpad_Touchpad_Y",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 46 | +AxisConfig=(AxisKeyName="SteamVR_Knuckles_Left_HandGrip",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 47 | +AxisConfig=(AxisKeyName="SteamVR_Knuckles_Left_IndexGrip",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 48 | +AxisConfig=(AxisKeyName="SteamVR_Knuckles_Left_MiddleGrip",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 49 | +AxisConfig=(AxisKeyName="SteamVR_Knuckles_Left_RingGrip",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 50 | +AxisConfig=(AxisKeyName="SteamVR_Knuckles_Left_PinkyGrip",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 51 | +AxisConfig=(AxisKeyName="SteamVR_Knuckles_Right_HandGrip",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 52 | +AxisConfig=(AxisKeyName="SteamVR_Knuckles_Right_IndexGrip",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 53 | +AxisConfig=(AxisKeyName="SteamVR_Knuckles_Right_MiddleGrip",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 54 | +AxisConfig=(AxisKeyName="SteamVR_Knuckles_Right_RingGrip",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 55 | +AxisConfig=(AxisKeyName="SteamVR_Knuckles_Right_PinkyGrip",AxisProperties=(DeadZone=0.000000,Sensitivity=1.000000,Exponent=1.000000,bInvert=False)) 56 | bAltEnterTogglesFullscreen=True 57 | bF11TogglesFullscreen=True 58 | bUseMouseForTouch=False 59 | bEnableMouseSmoothing=True 60 | bEnableFOVScaling=True 61 | bCaptureMouseOnLaunch=True 62 | bDefaultViewportMouseLock=False 63 | bAlwaysShowTouchInterface=False 64 | bShowConsoleOnFourFingerTap=True 65 | bEnableGestureRecognizer=False 66 | bUseAutocorrect=False 67 | DefaultViewportMouseCaptureMode=CapturePermanently_IncludingInitialMouseDown 68 | DefaultViewportMouseLockMode=LockOnCapture 69 | FOVScale=0.011110 70 | DoubleClickTime=0.200000 71 | +ActionMappings=(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=SpaceBar) 72 | +ActionMappings=(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=Gamepad_FaceButton_Bottom) 73 | +ActionMappings=(ActionName="ResetVR",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=R) 74 | +ActionMappings=(ActionName="ResetVR",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=MotionController_Left_Grip1) 75 | +ActionMappings=(ActionName="Jump",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=OculusTouchpad_Touchpad) 76 | +ActionMappings=(ActionName="FireWeapon",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=LeftMouseButton) 77 | +ActionMappings=(ActionName="BuildWall",bShift=False,bCtrl=False,bAlt=False,bCmd=False,Key=F) 78 | +AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=W) 79 | +AxisMappings=(AxisName="MoveForward",Scale=-1.000000,Key=S) 80 | +AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=Up) 81 | +AxisMappings=(AxisName="MoveForward",Scale=-1.000000,Key=Down) 82 | +AxisMappings=(AxisName="MoveForward",Scale=1.000000,Key=Gamepad_LeftY) 83 | +AxisMappings=(AxisName="MoveRight",Scale=-1.000000,Key=A) 84 | +AxisMappings=(AxisName="MoveRight",Scale=1.000000,Key=D) 85 | +AxisMappings=(AxisName="MoveRight",Scale=1.000000,Key=Gamepad_LeftX) 86 | +AxisMappings=(AxisName="TurnRate",Scale=1.000000,Key=Gamepad_RightX) 87 | +AxisMappings=(AxisName="TurnRate",Scale=-1.000000,Key=Left) 88 | +AxisMappings=(AxisName="TurnRate",Scale=1.000000,Key=Right) 89 | +AxisMappings=(AxisName="Turn",Scale=1.000000,Key=MouseX) 90 | +AxisMappings=(AxisName="LookUpRate",Scale=1.000000,Key=Gamepad_RightY) 91 | +AxisMappings=(AxisName="LookUp",Scale=-1.000000,Key=MouseY) 92 | DefaultTouchInterface=/Engine/MobileResources/HUD/DefaultVirtualJoysticks.DefaultVirtualJoysticks 93 | ConsoleKey=None 94 | -ConsoleKeys=Tilde 95 | +ConsoleKeys=Section 96 | 97 | 98 | -------------------------------------------------------------------------------- /DARepGraphExample/Content/BP_PBW.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/BP_PBW.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/BP_Projectile.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/BP_Projectile.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/BP_Weapon.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/BP_Weapon.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Geometry/Meshes/1M_Cube.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Geometry/Meshes/1M_Cube.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Geometry/Meshes/1M_Cube_Chamfer.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Geometry/Meshes/1M_Cube_Chamfer.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Geometry/Meshes/CubeMaterial.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Geometry/Meshes/CubeMaterial.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Geometry/Meshes/TemplateFloor.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Geometry/Meshes/TemplateFloor.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/M4A1_mat.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/M4A1_mat.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Animations/ThirdPersonIdle.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Animations/ThirdPersonIdle.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Animations/ThirdPersonJump_End.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Animations/ThirdPersonJump_End.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Animations/ThirdPersonJump_Loop.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Animations/ThirdPersonJump_Loop.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Animations/ThirdPersonJump_Start.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Animations/ThirdPersonJump_Start.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Animations/ThirdPersonRun.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Animations/ThirdPersonRun.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Animations/ThirdPersonWalk.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Animations/ThirdPersonWalk.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Animations/ThirdPerson_AnimBP.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Animations/ThirdPerson_AnimBP.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Animations/ThirdPerson_IdleRun_2D.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Animations/ThirdPerson_IdleRun_2D.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Animations/ThirdPerson_Jump.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Animations/ThirdPerson_Jump.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Character/Materials/M_UE4Man_Body.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Character/Materials/M_UE4Man_Body.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Character/Materials/M_UE4Man_ChestLogo.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Character/Materials/M_UE4Man_ChestLogo.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Character/Materials/MaterialLayers/ML_GlossyBlack_Latex_UE4.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Character/Materials/MaterialLayers/ML_GlossyBlack_Latex_UE4.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Character/Materials/MaterialLayers/ML_Plastic_Shiny_Beige.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Character/Materials/MaterialLayers/ML_Plastic_Shiny_Beige.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Character/Materials/MaterialLayers/ML_Plastic_Shiny_Beige_LOGO.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Character/Materials/MaterialLayers/ML_Plastic_Shiny_Beige_LOGO.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Character/Materials/MaterialLayers/ML_SoftMetal_UE4.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Character/Materials/MaterialLayers/ML_SoftMetal_UE4.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Character/Materials/MaterialLayers/T_ML_Aluminum01.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Character/Materials/MaterialLayers/T_ML_Aluminum01.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Character/Materials/MaterialLayers/T_ML_Aluminum01_N.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Character/Materials/MaterialLayers/T_ML_Aluminum01_N.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Character/Materials/MaterialLayers/T_ML_Rubber_Blue_01_D.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Character/Materials/MaterialLayers/T_ML_Rubber_Blue_01_D.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Character/Materials/MaterialLayers/T_ML_Rubber_Blue_01_N.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Character/Materials/MaterialLayers/T_ML_Rubber_Blue_01_N.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Character/Mesh/SK_Mannequin.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Character/Mesh/SK_Mannequin.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Character/Mesh/SK_Mannequin_PhysicsAsset.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Character/Mesh/SK_Mannequin_PhysicsAsset.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Character/Mesh/UE4_Mannequin_Skeleton.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Character/Mesh/UE4_Mannequin_Skeleton.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Character/Textures/UE4Man_Logo_N.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Character/Textures/UE4Man_Logo_N.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Character/Textures/UE4_LOGO_CARD.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Character/Textures/UE4_LOGO_CARD.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Character/Textures/UE4_Mannequin_MAT_MASKA.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Character/Textures/UE4_Mannequin_MAT_MASKA.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/Mannequin/Character/Textures/UE4_Mannequin__normals.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/Mannequin/Character/Textures/UE4_Mannequin__normals.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/SKM_M4.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/SKM_M4.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/SKM_M4_PhysicsAsset.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/SKM_M4_PhysicsAsset.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/SKM_M4_Skeleton.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/SKM_M4_Skeleton.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Architecture/Floor_400x400.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Architecture/Floor_400x400.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Architecture/Pillar_50x500.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Architecture/Pillar_50x500.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Architecture/SM_AssetPlatform.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Architecture/SM_AssetPlatform.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Architecture/Wall_400x200.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Architecture/Wall_400x200.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Architecture/Wall_400x300.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Architecture/Wall_400x300.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Architecture/Wall_400x400.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Architecture/Wall_400x400.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Architecture/Wall_500x500.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Architecture/Wall_500x500.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Architecture/Wall_Door_400x300.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Architecture/Wall_Door_400x300.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Architecture/Wall_Door_400x400.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Architecture/Wall_Door_400x400.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Architecture/Wall_Window_400x300.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Architecture/Wall_Window_400x300.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Architecture/Wall_Window_400x400.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Architecture/Wall_Window_400x400.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_Cone.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_Cone.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_Cube.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_Cube.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_Cylinder.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_Cylinder.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_NarrowCapsule.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_NarrowCapsule.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_Pipe.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_Pipe.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_Pipe_180.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_Pipe_180.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_Pipe_90.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_Pipe_90.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_Plane.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_Plane.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_QuadPyramid.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_QuadPyramid.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_Sphere.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_Sphere.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_Torus.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_Torus.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_TriPyramid.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_TriPyramid.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_Trim.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_Trim.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_Trim_90_In.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_Trim_90_In.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_Trim_90_Out.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_Trim_90_Out.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_Tube.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_Tube.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_Wedge_A.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_Wedge_A.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_Wedge_B.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_Wedge_B.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/StarterContent/Shapes/Shape_WideCapsule.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/StarterContent/Shapes/Shape_WideCapsule.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/ThirdPerson/Meshes/Bump_StaticMesh.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/ThirdPerson/Meshes/Bump_StaticMesh.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/ThirdPerson/Meshes/CubeMaterial.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/ThirdPerson/Meshes/CubeMaterial.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/ThirdPerson/Meshes/LeftArm_StaticMesh.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/ThirdPerson/Meshes/LeftArm_StaticMesh.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/ThirdPerson/Meshes/Linear_Stair_StaticMesh.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/ThirdPerson/Meshes/Linear_Stair_StaticMesh.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/ThirdPerson/Meshes/RampMaterial.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/ThirdPerson/Meshes/RampMaterial.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/ThirdPerson/Meshes/Ramp_StaticMesh.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/ThirdPerson/Meshes/Ramp_StaticMesh.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/ThirdPerson/Meshes/RightArm_StaticMesh.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/ThirdPerson/Meshes/RightArm_StaticMesh.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/ThirdPersonCPP/Blueprints/ThirdPersonCharacter.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/ThirdPersonCPP/Blueprints/ThirdPersonCharacter.uasset -------------------------------------------------------------------------------- /DARepGraphExample/Content/ThirdPersonCPP/Maps/ThirdPersonExampleMap.umap: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/ThirdPersonCPP/Maps/ThirdPersonExampleMap.umap -------------------------------------------------------------------------------- /DARepGraphExample/Content/ThirdPersonCPP/Maps/ThirdPersonExampleMap_BuiltData.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/MazyModz/UE4-DAReplicationGraphExample/f2305945a17fbfecdbe403f7ef7b9560f07b655b/DARepGraphExample/Content/ThirdPersonCPP/Maps/ThirdPersonExampleMap_BuiltData.uasset -------------------------------------------------------------------------------- /DARepGraphExample/DARepGraphExample.uproject: -------------------------------------------------------------------------------- 1 | { 2 | "FileVersion": 3, 3 | "EngineAssociation": "4.21", 4 | "Category": "", 5 | "Description": "", 6 | "Modules": [ 7 | { 8 | "Name": "DARepGraphExample", 9 | "Type": "Runtime", 10 | "LoadingPhase": "Default", 11 | "AdditionalDependencies": [ 12 | "Engine", 13 | "ReplicationGraph" 14 | ] 15 | } 16 | ], 17 | "Plugins": [ 18 | { 19 | "Name": "ReplicationGraph", 20 | "Enabled": true 21 | } 22 | ] 23 | } 24 | -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExample.Target.cs: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2018 Epic Games, Inc. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | using System.Collections.Generic; 5 | 6 | public class DARepGraphExampleTarget : TargetRules 7 | { 8 | public DARepGraphExampleTarget(TargetInfo Target) : base(Target) 9 | { 10 | Type = TargetType.Game; 11 | ExtraModuleNames.Add("DARepGraphExample"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExample/DABuildableWall.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - Dennis "MazyModz" Andersson. 2 | 3 | /* 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files 6 | (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | persons to whom the Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 13 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 14 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 15 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | 17 | */ 18 | 19 | #include "DABuildableWall.h" 20 | 21 | // Sets default values 22 | ADABuildableWall::ADABuildableWall() 23 | { 24 | // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. 25 | PrimaryActorTick.bCanEverTick = false; 26 | bReplicates = true; 27 | bReplicateMovement = true; 28 | } 29 | 30 | // Called when the game starts or when spawned 31 | void ADABuildableWall::BeginPlay() 32 | { 33 | Super::BeginPlay(); 34 | 35 | } 36 | 37 | // Called every frame 38 | void ADABuildableWall::Tick(float DeltaTime) 39 | { 40 | Super::Tick(DeltaTime); 41 | 42 | } 43 | 44 | -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExample/DABuildableWall.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - Dennis "MazyModz" Andersson. 2 | 3 | /* 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files 6 | (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | persons to whom the Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 13 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 14 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 15 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "CoreMinimal.h" 22 | #include "Runtime/Engine/Classes/Engine/StaticMeshActor.h" 23 | #include "DABuildableWall.generated.h" 24 | 25 | UCLASS() 26 | class DAREPGRAPHEXAMPLE_API ADABuildableWall : public AStaticMeshActor 27 | { 28 | GENERATED_BODY() 29 | 30 | public: 31 | // Sets default values for this actor's properties 32 | ADABuildableWall(); 33 | 34 | protected: 35 | // Called when the game starts or when spawned 36 | virtual void BeginPlay() override; 37 | 38 | public: 39 | // Called every frame 40 | virtual void Tick(float DeltaTime) override; 41 | 42 | }; 43 | -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExample/DACharacter.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - Dennis "MazyModz" Andersson. 2 | 3 | /* 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files 6 | (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | persons to whom the Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 13 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 14 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 15 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | 17 | */ 18 | 19 | #include "DACharacter.h" 20 | #include "HeadMountedDisplayFunctionLibrary.h" 21 | #include "Camera/CameraComponent.h" 22 | #include "Components/CapsuleComponent.h" 23 | #include "Components/InputComponent.h" 24 | #include "GameFramework/CharacterMovementComponent.h" 25 | #include "GameFramework/Controller.h" 26 | #include "GameFramework/SpringArmComponent.h" 27 | #include "UnrealNetwork.h" 28 | #include "DAWeapon.h" 29 | #include "DABuildableWall.h" 30 | 31 | FOnNewWeapon ADACharacter::OnNewWeapon; 32 | 33 | ////////////////////////////////////////////////////////////////////////// 34 | // ADACharacter 35 | 36 | ADACharacter::ADACharacter() 37 | { 38 | // Set size for collision capsule 39 | GetCapsuleComponent()->InitCapsuleSize(42.f, 96.0f); 40 | 41 | // set our turn rates for input 42 | BaseTurnRate = 45.f; 43 | BaseLookUpRate = 45.f; 44 | 45 | // Don't rotate when the controller rotates. Let that just affect the camera. 46 | bUseControllerRotationPitch = false; 47 | bUseControllerRotationYaw = false; 48 | bUseControllerRotationRoll = false; 49 | 50 | // Configure character movement 51 | GetCharacterMovement()->bOrientRotationToMovement = true; // Character moves in the direction of input... 52 | GetCharacterMovement()->RotationRate = FRotator(0.0f, 540.0f, 0.0f); // ...at this rotation rate 53 | GetCharacterMovement()->JumpZVelocity = 600.f; 54 | GetCharacterMovement()->AirControl = 0.2f; 55 | 56 | // Create a camera boom (pulls in towards the player if there is a collision) 57 | CameraBoom = CreateDefaultSubobject(TEXT("CameraBoom")); 58 | CameraBoom->SetupAttachment(RootComponent); 59 | CameraBoom->TargetArmLength = 300.0f; // The camera follows at this distance behind the character 60 | CameraBoom->bUsePawnControlRotation = true; // Rotate the arm based on the controller 61 | 62 | // Create a follow camera 63 | FollowCamera = CreateDefaultSubobject(TEXT("FollowCamera")); 64 | FollowCamera->SetupAttachment(CameraBoom, USpringArmComponent::SocketName); // Attach the camera to the end of the boom and let the boom adjust to match the controller orientation 65 | FollowCamera->bUsePawnControlRotation = false; // Camera does not rotate relative to arm 66 | 67 | // Note: The skeletal mesh and anim blueprint references on the Mesh component (inherited from Character) 68 | // are set in the derived blueprint asset named MyCharacter (to avoid direct content references in C++) 69 | } 70 | 71 | void ADACharacter::StartFire() 72 | { 73 | if ((IsLocallyControlled() == true) && (Weapon != NULL)) 74 | { 75 | Weapon->FireWeapon(); 76 | } 77 | } 78 | 79 | void ADACharacter::BuildWall() 80 | { 81 | if ((IsLocallyControlled() == true) && (WallClass != NULL)) 82 | { 83 | ServerBuildWall(); 84 | } 85 | } 86 | 87 | void ADACharacter::ServerBuildWall_Implementation() 88 | { 89 | FVector Location = GetActorLocation() + (GetActorForwardVector() * 200); 90 | FRotator Rotation = GetActorRotation(); 91 | 92 | GetWorld()->SpawnActor(WallClass, Location, Rotation); 93 | } 94 | bool ADACharacter::ServerBuildWall_Validate() 95 | { 96 | return true; 97 | } 98 | 99 | void ADACharacter::BeginPlay() 100 | { 101 | Super::BeginPlay(); 102 | 103 | if ((Role > ROLE_AutonomousProxy) && (WeaponClass != NULL)) 104 | { 105 | Weapon = GetWorld()->SpawnActor(WeaponClass, FTransform()); 106 | if (Weapon != nullptr) 107 | { 108 | Weapon->OwnerPawn = this; 109 | Weapon->AttachToComponent(GetMesh(), FAttachmentTransformRules(EAttachmentRule::SnapToTarget, false), AttachSocketName); 110 | 111 | OnNewWeapon.Broadcast(this, Weapon, NULL); 112 | } 113 | } 114 | } 115 | 116 | void ADACharacter::GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const 117 | { 118 | Super::GetLifetimeReplicatedProps(OutLifetimeProps); 119 | DOREPLIFETIME(ADACharacter, Weapon); 120 | } 121 | 122 | void ADACharacter::ServerFireWeapon_Implementation(const FVector& MuzzleLocation) 123 | { 124 | if (Weapon != NULL) 125 | { 126 | Weapon->ServerFireWeapon(MuzzleLocation); 127 | } 128 | } 129 | bool ADACharacter::ServerFireWeapon_Validate(const FVector& MuzzleLocation) 130 | { 131 | return true; 132 | } 133 | 134 | ////////////////////////////////////////////////////////////////////////// 135 | // Input 136 | 137 | void ADACharacter::SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) 138 | { 139 | // Set up gameplay key bindings 140 | check(PlayerInputComponent); 141 | PlayerInputComponent->BindAction("Jump", IE_Pressed, this, &ACharacter::Jump); 142 | PlayerInputComponent->BindAction("Jump", IE_Released, this, &ACharacter::StopJumping); 143 | 144 | PlayerInputComponent->BindAxis("MoveForward", this, &ADACharacter::MoveForward); 145 | PlayerInputComponent->BindAxis("MoveRight", this, &ADACharacter::MoveRight); 146 | 147 | // We have 2 versions of the rotation bindings to handle different kinds of devices differently 148 | // "turn" handles devices that provide an absolute delta, such as a mouse. 149 | // "turnrate" is for devices that we choose to treat as a rate of change, such as an analog joystick 150 | PlayerInputComponent->BindAxis("Turn", this, &APawn::AddControllerYawInput); 151 | PlayerInputComponent->BindAxis("TurnRate", this, &ADACharacter::TurnAtRate); 152 | PlayerInputComponent->BindAxis("LookUp", this, &APawn::AddControllerPitchInput); 153 | PlayerInputComponent->BindAxis("LookUpRate", this, &ADACharacter::LookUpAtRate); 154 | 155 | // handle touch devices 156 | PlayerInputComponent->BindTouch(IE_Pressed, this, &ADACharacter::TouchStarted); 157 | PlayerInputComponent->BindTouch(IE_Released, this, &ADACharacter::TouchStopped); 158 | 159 | // VR headset functionality 160 | PlayerInputComponent->BindAction("ResetVR", IE_Pressed, this, &ADACharacter::OnResetVR); 161 | 162 | PlayerInputComponent->BindAction("FireWeapon", IE_Pressed, this, &ADACharacter::StartFire); 163 | PlayerInputComponent->BindAction("BuildWall", IE_Pressed, this, &ADACharacter::BuildWall); 164 | } 165 | 166 | 167 | void ADACharacter::OnResetVR() 168 | { 169 | UHeadMountedDisplayFunctionLibrary::ResetOrientationAndPosition(); 170 | } 171 | 172 | void ADACharacter::TouchStarted(ETouchIndex::Type FingerIndex, FVector Location) 173 | { 174 | Jump(); 175 | } 176 | 177 | void ADACharacter::TouchStopped(ETouchIndex::Type FingerIndex, FVector Location) 178 | { 179 | StopJumping(); 180 | } 181 | 182 | void ADACharacter::TurnAtRate(float Rate) 183 | { 184 | // calculate delta for this frame from the rate information 185 | AddControllerYawInput(Rate * BaseTurnRate * GetWorld()->GetDeltaSeconds()); 186 | } 187 | 188 | void ADACharacter::LookUpAtRate(float Rate) 189 | { 190 | // calculate delta for this frame from the rate information 191 | AddControllerPitchInput(Rate * BaseLookUpRate * GetWorld()->GetDeltaSeconds()); 192 | } 193 | 194 | void ADACharacter::MoveForward(float Value) 195 | { 196 | if ((Controller != NULL) && (Value != 0.0f)) 197 | { 198 | // find out which way is forward 199 | const FRotator Rotation = Controller->GetControlRotation(); 200 | const FRotator YawRotation(0, Rotation.Yaw, 0); 201 | 202 | // get forward vector 203 | const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::X); 204 | AddMovementInput(Direction, Value); 205 | } 206 | } 207 | 208 | void ADACharacter::MoveRight(float Value) 209 | { 210 | if ( (Controller != NULL) && (Value != 0.0f) ) 211 | { 212 | // find out which way is right 213 | const FRotator Rotation = Controller->GetControlRotation(); 214 | const FRotator YawRotation(0, Rotation.Yaw, 0); 215 | 216 | // get right vector 217 | const FVector Direction = FRotationMatrix(YawRotation).GetUnitAxis(EAxis::Y); 218 | // add movement in that direction 219 | AddMovementInput(Direction, Value); 220 | } 221 | } 222 | -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExample/DACharacter.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - Dennis "MazyModz" Andersson. 2 | 3 | /* 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files 6 | (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | persons to whom the Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 13 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 14 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 15 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "CoreMinimal.h" 22 | #include "GameFramework/Character.h" 23 | #include "DACharacter.generated.h" 24 | 25 | DECLARE_MULTICAST_DELEGATE_ThreeParams(FOnNewWeapon, class ADACharacter*, class ADAWeapon* /* New Weapon */, class ADAWeapon* /* OldWeapon */) 26 | 27 | UCLASS(config=Game) 28 | class ADACharacter : public ACharacter 29 | { 30 | GENERATED_BODY() 31 | 32 | /** Camera boom positioning the camera behind the character */ 33 | UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true")) 34 | class USpringArmComponent* CameraBoom; 35 | 36 | /** Follow camera */ 37 | UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category = Camera, meta = (AllowPrivateAccess = "true")) 38 | class UCameraComponent* FollowCamera; 39 | public: 40 | ADACharacter(); 41 | 42 | static FOnNewWeapon OnNewWeapon; 43 | 44 | /** Base turn rate, in deg/sec. Other scaling may affect final turn rate. */ 45 | UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Camera) 46 | float BaseTurnRate; 47 | 48 | /** Base look up/down rate, in deg/sec. Other scaling may affect final rate. */ 49 | UPROPERTY(VisibleAnywhere, BlueprintReadOnly, Category=Camera) 50 | float BaseLookUpRate; 51 | 52 | UFUNCTION(Server, Reliable, WithValidation) 53 | void ServerFireWeapon(const FVector& MuzzleLocation); 54 | 55 | UPROPERTY(Replicated) 56 | class ADAWeapon* Weapon; 57 | 58 | virtual void StartFire(); 59 | 60 | virtual void BuildWall(); 61 | 62 | UFUNCTION(Server, Reliable, WithValidation) 63 | void ServerBuildWall(); 64 | 65 | UPROPERTY(EditDefaultsOnly, Category="Character") 66 | TSubclassOf WeaponClass; 67 | 68 | UPROPERTY(EditDefaultsOnly, Category="Character") 69 | TSubclassOf WallClass; 70 | 71 | UPROPERTY(EditDefaultsOnly, Category="Character") 72 | FName AttachSocketName = TEXT("WeaponSocket"); 73 | 74 | virtual void BeginPlay() override; 75 | 76 | protected: 77 | 78 | /** Resets HMD orientation in VR. */ 79 | void OnResetVR(); 80 | 81 | /** Called for forwards/backward input */ 82 | void MoveForward(float Value); 83 | 84 | /** Called for side to side input */ 85 | void MoveRight(float Value); 86 | 87 | /** 88 | * Called via input to turn at a given rate. 89 | * @param Rate This is a normalized rate, i.e. 1.0 means 100% of desired turn rate 90 | */ 91 | void TurnAtRate(float Rate); 92 | 93 | /** 94 | * Called via input to turn look up/down at a given rate. 95 | * @param Rate This is a normalized rate, i.e. 1.0 means 100% of desired turn rate 96 | */ 97 | void LookUpAtRate(float Rate); 98 | 99 | /** Handler for when a touch input begins. */ 100 | void TouchStarted(ETouchIndex::Type FingerIndex, FVector Location); 101 | 102 | /** Handler for when a touch input stops. */ 103 | void TouchStopped(ETouchIndex::Type FingerIndex, FVector Location); 104 | 105 | protected: 106 | // APawn interface 107 | virtual void SetupPlayerInputComponent(class UInputComponent* PlayerInputComponent) override; 108 | // End of APawn interface 109 | 110 | public: 111 | /** Returns CameraBoom subobject **/ 112 | FORCEINLINE class USpringArmComponent* GetCameraBoom() const { return CameraBoom; } 113 | /** Returns FollowCamera subobject **/ 114 | FORCEINLINE class UCameraComponent* GetFollowCamera() const { return FollowCamera; } 115 | }; 116 | 117 | -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExample/DAProjectile.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - Dennis "MazyModz" Andersson. 2 | 3 | /* 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files 6 | (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | persons to whom the Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 13 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 14 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 15 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | 17 | */ 18 | 19 | #include "DAProjectile.h" 20 | 21 | // Sets default values 22 | ADAProjectile::ADAProjectile() 23 | { 24 | // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. 25 | PrimaryActorTick.bCanEverTick = true; 26 | 27 | ProjMovement = CreateDefaultSubobject (TEXT("ProjMovement")); 28 | ProjMovement->bRotationFollowsVelocity = true; 29 | ProjMovement->bInterpMovement = true; 30 | ProjMovement->bInterpRotation = true; 31 | ProjMovement->bShouldBounce = true; 32 | ProjMovement->MaxSpeed = 8000.0f; 33 | ProjMovement->InitialSpeed = 15000.0f; 34 | ProjMovement->SetIsReplicated(true); 35 | 36 | bReplicates = true; 37 | bReplicateMovement = true; 38 | 39 | SetMobility(EComponentMobility::Movable); 40 | } 41 | 42 | // Called when the game starts or when spawned 43 | void ADAProjectile::BeginPlay() 44 | { 45 | Super::BeginPlay(); 46 | } 47 | 48 | // Called every frame 49 | void ADAProjectile::Tick(float DeltaTime) 50 | { 51 | Super::Tick(DeltaTime); 52 | } 53 | 54 | void ADAProjectile::PostNetReceiveVelocity(const FVector& NewVelocity) 55 | { 56 | ProjMovement->Velocity = NewVelocity; 57 | } 58 | 59 | -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExample/DAProjectile.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - Dennis "MazyModz" Andersson. 2 | 3 | /* 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files 6 | (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | persons to whom the Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 13 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 14 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 15 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "CoreMinimal.h" 22 | #include "Runtime/Engine/Classes/Engine/StaticMeshActor.h" 23 | #include "Runtime/Engine/Classes/GameFramework/ProjectileMovementComponent.h" 24 | #include "DAProjectile.generated.h" 25 | 26 | UCLASS() 27 | class DAREPGRAPHEXAMPLE_API ADAProjectile : public AStaticMeshActor 28 | { 29 | GENERATED_BODY() 30 | 31 | UPROPERTY(Category="Components", VisibleDefaultsOnly, BlueprintReadOnly, Meta=(AllowPrivateAccess="true")) 32 | UProjectileMovementComponent* ProjMovement; 33 | 34 | public: 35 | // Sets default values for this actor's properties 36 | ADAProjectile(); 37 | 38 | protected: 39 | // Called when the game starts or when spawned 40 | virtual void BeginPlay() override; 41 | 42 | public: 43 | // Called every frame 44 | virtual void Tick(float DeltaTime) override; 45 | 46 | virtual void PostNetReceiveVelocity(const FVector& NewVelocity) override; 47 | }; 48 | -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExample/DARepGraphExample.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2018 Epic Games, Inc. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | 5 | public class DARepGraphExample : ModuleRules 6 | { 7 | public DARepGraphExample(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; 10 | 11 | PublicDependencyModuleNames.AddRange(new string[] { "Core", "CoreUObject", "Engine", "InputCore", "HeadMountedDisplay" }); 12 | PrivateDependencyModuleNames.AddRange(new string[] { "ReplicationGraph" }); 13 | 14 | bool bTargetConfig = Target.Configuration != UnrealTargetConfiguration.Shipping && Target.Configuration != UnrealTargetConfiguration.Test; 15 | if (Target.bBuildDeveloperTools || bTargetConfig) 16 | { 17 | PrivateDependencyModuleNames.Add("GameplayDebugger"); 18 | PublicDefinitions.Add("WITH_GAMEPLAY_DEBUGGER=1"); 19 | } 20 | else 21 | { 22 | PublicDefinitions.Add("WITH_GAMEPLAY_DEBUGGER=0"); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExample/DARepGraphExample.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2018 Epic Games, Inc. All Rights Reserved. 2 | 3 | #include "DARepGraphExample.h" 4 | #include "Modules/ModuleManager.h" 5 | 6 | IMPLEMENT_PRIMARY_GAME_MODULE( FDefaultGameModuleImpl, DARepGraphExample, "DARepGraphExample" ); 7 | -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExample/DARepGraphExample.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2018 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExample/DARepGraphExampleGameMode.cpp: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2018 Epic Games, Inc. All Rights Reserved. 2 | 3 | #include "DARepGraphExampleGameMode.h" 4 | #include "DACharacter.h" 5 | #include "UObject/ConstructorHelpers.h" 6 | 7 | ADARepGraphExampleGameMode::ADARepGraphExampleGameMode() 8 | { 9 | // set default pawn class to our Blueprinted character 10 | static ConstructorHelpers::FClassFinder PlayerPawnBPClass(TEXT("/Game/ThirdPersonCPP/Blueprints/ThirdPersonCharacter")); 11 | if (PlayerPawnBPClass.Class != NULL) 12 | { 13 | DefaultPawnClass = PlayerPawnBPClass.Class; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExample/DARepGraphExampleGameMode.h: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2018 Epic Games, Inc. All Rights Reserved. 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "GameFramework/GameModeBase.h" 7 | #include "DARepGraphExampleGameMode.generated.h" 8 | 9 | UCLASS(minimalapi) 10 | class ADARepGraphExampleGameMode : public AGameModeBase 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | ADARepGraphExampleGameMode(); 16 | }; 17 | 18 | 19 | 20 | -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExample/DAReplicationGraph.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - Dennis "MazyModz" Andersson. 2 | 3 | /* 4 | 5 | MIT License 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files 8 | (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 10 | persons to whom the Software is furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 15 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 17 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | */ 20 | 21 | #include "DAReplicationGraph.h" 22 | #include "Engine/LevelScriptActor.h" 23 | 24 | #if WITH_GAMEPLAY_DEBUGGER 25 | #include "GameplayDebuggerCategoryReplicator.h" 26 | #endif 27 | 28 | #include "DAProjectile.h" 29 | #include "DABuildableWall.h" 30 | #include "DACharacter.h" 31 | #include "DAWeapon.h" 32 | 33 | void UDAReplicationGraph::ResetGameWorldState() 34 | { 35 | Super::ResetGameWorldState(); 36 | AlwaysRelevantStreamingLevelActors.Empty(); 37 | 38 | for (auto& ConnectionList : { Connections, PendingConnections }) 39 | { 40 | for (UNetReplicationGraphConnection* Connection : ConnectionList) 41 | { 42 | for (UReplicationGraphNode* ConnectionNode : Connection->GetConnectionGraphNodes()) 43 | { 44 | UDAReplicationGraphNode_AlwaysRelevant_ForConnection* Node = Cast(ConnectionNode); 45 | if (Node != nullptr) 46 | { 47 | Node->ResetGameWorldState(); 48 | } 49 | } 50 | } 51 | } 52 | } 53 | 54 | void UDAReplicationGraph::InitConnectionGraphNodes(UNetReplicationGraphConnection* ConnectionManager) 55 | { 56 | UDAReplicationGraphNode_AlwaysRelevant_ForConnection* Node = CreateNewNode(); 57 | ConnectionManager->OnClientVisibleLevelNameAdd.AddUObject(Node, &UDAReplicationGraphNode_AlwaysRelevant_ForConnection::OnClientLevelVisibilityAdd); 58 | ConnectionManager->OnClientVisibleLevelNameRemove.AddUObject(Node, &UDAReplicationGraphNode_AlwaysRelevant_ForConnection::OnClientLevelVisibilityRemove); 59 | 60 | AddConnectionGraphNode(Node, ConnectionManager); 61 | } 62 | 63 | void UDAReplicationGraph::InitGlobalActorClassSettings() 64 | { 65 | Super::InitGlobalActorClassSettings(); 66 | 67 | // ---------------------------------------- 68 | // Assign mapping to classes 69 | 70 | auto SetRule = [&](UClass* InClass, EClassRepPolicy Mapping) { ClassRepPolicies.Set(InClass, Mapping); }; 71 | 72 | SetRule(AReplicationGraphDebugActor::StaticClass(), EClassRepPolicy::NotRouted); 73 | SetRule(ALevelScriptActor::StaticClass(), EClassRepPolicy::NotRouted); 74 | SetRule(AInfo::StaticClass(), EClassRepPolicy::RelevantAllConnections); 75 | SetRule(ADAProjectile::StaticClass(), EClassRepPolicy::Spatialize_Dynamic); 76 | SetRule(ADABuildableWall::StaticClass(), EClassRepPolicy::Spatialize_Static); 77 | 78 | #if WITH_GAMEPLAY_DEBUGGER 79 | SetRule(AGameplayDebuggerCategoryReplicator::StaticClass(), EClassRepPolicy::NotRouted); 80 | #endif 81 | 82 | TArray ReplicatedClasses; 83 | for (TObjectIterator Itr; Itr; ++Itr) 84 | { 85 | UClass* Class = *Itr; 86 | AActor* ActorCDO = Cast(Class->GetDefaultObject()); 87 | 88 | // Do not add the actor if it does not replicate 89 | if (!ActorCDO || !ActorCDO->GetIsReplicated()) 90 | { 91 | continue; 92 | } 93 | 94 | // Do not add SKEL and REINST classes 95 | FString ClassName = Class->GetName(); 96 | if (ClassName.StartsWith("SKEL_") || ClassName.StartsWith("REINST_")) 97 | { 98 | continue; 99 | } 100 | 101 | ReplicatedClasses.Add(Class); 102 | 103 | // if we already have mapped it to the policy, dont do it again 104 | if (ClassRepPolicies.Contains(Class, false)) 105 | { 106 | continue; 107 | } 108 | 109 | auto ShouldSpatialize = [](const AActor* Actor) 110 | { 111 | return Actor->GetIsReplicated() && (!(Actor->bAlwaysRelevant || Actor->bOnlyRelevantToOwner || Actor->bNetUseOwnerRelevancy)); 112 | }; 113 | 114 | UClass* SuperClass = Class->GetSuperClass(); 115 | if (AActor* SuperCDO = Cast(SuperClass->GetDefaultObject())) 116 | { 117 | if (SuperCDO->GetIsReplicated() == ActorCDO->GetIsReplicated() 118 | && SuperCDO->bAlwaysRelevant == ActorCDO->bAlwaysRelevant 119 | && SuperCDO->bOnlyRelevantToOwner == ActorCDO->bOnlyRelevantToOwner 120 | && SuperCDO->bNetUseOwnerRelevancy == ActorCDO->bNetUseOwnerRelevancy) 121 | { 122 | continue; 123 | } 124 | 125 | if (ShouldSpatialize(ActorCDO) == false && ShouldSpatialize(SuperCDO) == true) 126 | { 127 | NonSpatializedClasses.Add(Class); 128 | } 129 | } 130 | 131 | if (ShouldSpatialize(ActorCDO) == true) 132 | { 133 | SetRule(Class, EClassRepPolicy::Spatialize_Dynamic); 134 | } 135 | else if (ActorCDO->bAlwaysRelevant && !ActorCDO->bOnlyRelevantToOwner) 136 | { 137 | SetRule(Class, EClassRepPolicy::RelevantAllConnections); 138 | } 139 | } 140 | 141 | // -------------------------------------- 142 | // Explicitly set replication info for our classes 143 | 144 | TArray ExplicitlySetClasses; 145 | 146 | auto SetClassInfo = [&](UClass* InClass, FClassReplicationInfo& RepInfo) 147 | { 148 | GlobalActorReplicationInfoMap.SetClassInfo(InClass, RepInfo); 149 | ExplicitlySetClasses.Add(InClass); 150 | }; 151 | 152 | FClassReplicationInfo PawnClassInfo; 153 | PawnClassInfo.CullDistanceSquared = 300000.f * 300000.f; 154 | SetClassInfo(APawn::StaticClass(), PawnClassInfo); 155 | 156 | for (UClass* ReplicatedClass : ReplicatedClasses) 157 | { 158 | if (ExplicitlySetClasses.FindByPredicate([&](const UClass* InClass) { return ReplicatedClass->IsChildOf(InClass); }) != nullptr) 159 | { 160 | continue; 161 | } 162 | 163 | bool bSptatilize = IsSpatialized(ClassRepPolicies.GetChecked(ReplicatedClass)); 164 | 165 | FClassReplicationInfo ClassInfo; 166 | InitClassReplicationInfo(ClassInfo, ReplicatedClass, bSptatilize, NetDriver->NetServerMaxTickRate); 167 | GlobalActorReplicationInfoMap.SetClassInfo(ReplicatedClass, ClassInfo); 168 | } 169 | 170 | // ------------------------------- 171 | // Bind events here 172 | 173 | ADACharacter::OnNewWeapon.AddUObject(this, &UDAReplicationGraph::OnCharacterNewWeapon); 174 | 175 | #if WITH_GAMEPLAY_DEBUGGER 176 | AGameplayDebuggerCategoryReplicator::NotifyDebuggerOwnerChange.AddUObject(this, &UDAReplicationGraph::OnGameplayDebuggerOwnerChange); 177 | #endif 178 | } 179 | 180 | void UDAReplicationGraph::InitGlobalGraphNodes() 181 | { 182 | PreAllocateRepList(3, 12); 183 | PreAllocateRepList(6, 12); 184 | PreAllocateRepList(128, 64); 185 | PreAllocateRepList(512, 16); 186 | 187 | 188 | // --------------------------------- 189 | // Create our grid node 190 | GridNode = CreateNewNode(); 191 | GridNode->CellSize = GridCellSize; 192 | GridNode->SpatialBias = FVector2D(SpatialBiasX, SpatialBiasY); 193 | 194 | if (bDisableSpatialRebuilding == true) 195 | { 196 | GridNode->AddSpatialRebuildBlacklistClass(AActor::StaticClass()); 197 | } 198 | 199 | AddGlobalGraphNode(GridNode); 200 | 201 | // --------------------------------- 202 | // Create our always relevant node 203 | AlwaysRelevantNode = CreateNewNode(); 204 | AddGlobalGraphNode(AlwaysRelevantNode); 205 | } 206 | 207 | void UDAReplicationGraph::RouteAddNetworkActorToNodes(const FNewReplicatedActorInfo& ActorInfo, FGlobalActorReplicationInfo& GlobalInfo) 208 | { 209 | EClassRepPolicy MappingPolicy = GetMappingPolicy(ActorInfo.Class); 210 | switch (MappingPolicy) 211 | { 212 | case EClassRepPolicy::RelevantAllConnections: 213 | { 214 | if (ActorInfo.StreamingLevelName == NAME_None) 215 | { 216 | AlwaysRelevantNode->NotifyAddNetworkActor(ActorInfo); 217 | } 218 | else 219 | { 220 | FActorRepListRefView& RepList = AlwaysRelevantStreamingLevelActors.FindOrAdd(ActorInfo.StreamingLevelName); 221 | RepList.PrepareForWrite(); 222 | RepList.ConditionalAdd(ActorInfo.Actor); 223 | } 224 | break; 225 | } 226 | 227 | case EClassRepPolicy::Spatialize_Static: 228 | { 229 | GridNode->AddActor_Static(ActorInfo, GlobalInfo); 230 | break; 231 | } 232 | 233 | case EClassRepPolicy::Spatialize_Dynamic: 234 | { 235 | GridNode->AddActor_Dynamic(ActorInfo, GlobalInfo); 236 | break; 237 | } 238 | 239 | case EClassRepPolicy::Spatialize_Dormancy: 240 | { 241 | GridNode->AddActor_Dormancy(ActorInfo, GlobalInfo); 242 | break; 243 | } 244 | 245 | default: 246 | { 247 | break; 248 | } 249 | } 250 | } 251 | 252 | void UDAReplicationGraph::RouteRemoveNetworkActorToNodes(const FNewReplicatedActorInfo& ActorInfo) 253 | { 254 | EClassRepPolicy MappingPolicy = GetMappingPolicy(ActorInfo.Class); 255 | switch (MappingPolicy) 256 | { 257 | case EClassRepPolicy::RelevantAllConnections: 258 | { 259 | if (ActorInfo.StreamingLevelName == NAME_None) 260 | { 261 | AlwaysRelevantNode->NotifyRemoveNetworkActor(ActorInfo); 262 | } 263 | else 264 | { 265 | FActorRepListRefView& RepList = AlwaysRelevantStreamingLevelActors.FindOrAdd(ActorInfo.StreamingLevelName); 266 | RepList.Remove(ActorInfo.Actor); 267 | } 268 | break; 269 | } 270 | 271 | case EClassRepPolicy::Spatialize_Static: 272 | { 273 | GridNode->RemoveActor_Static(ActorInfo); 274 | break; 275 | } 276 | 277 | case EClassRepPolicy::Spatialize_Dynamic: 278 | { 279 | GridNode->RemoveActor_Dynamic(ActorInfo); 280 | break; 281 | } 282 | 283 | case EClassRepPolicy::Spatialize_Dormancy: 284 | { 285 | GridNode->RemoveActor_Dormancy(ActorInfo); 286 | break; 287 | } 288 | 289 | default: 290 | { 291 | break; 292 | } 293 | } 294 | } 295 | 296 | void UDAReplicationGraph::InitClassReplicationInfo(FClassReplicationInfo& Info, UClass* InClass, bool bSpatilize, float ServerMaxTickRate) 297 | { 298 | if (AActor* CDO = Cast(InClass->GetDefaultObject())) 299 | { 300 | if (bSpatilize == true) 301 | { 302 | Info.CullDistanceSquared = CDO->NetCullDistanceSquared; 303 | } 304 | 305 | Info.ReplicationPeriodFrame = FMath::Max((uint32)FMath::RoundToFloat(ServerMaxTickRate / CDO->NetUpdateFrequency), 1); 306 | } 307 | } 308 | 309 | class UDAReplicationGraphNode_AlwaysRelevant_ForConnection* UDAReplicationGraph::GetAlwaysRelevantNode(APlayerController* PlayerController) 310 | { 311 | if (PlayerController != NULL) 312 | { 313 | if (UNetConnection* NetConnection = PlayerController->NetConnection) 314 | { 315 | if (UNetReplicationGraphConnection* GraphConnection = FindOrAddConnectionManager(NetConnection)) 316 | { 317 | for (UReplicationGraphNode* ConnectionNode : GraphConnection->GetConnectionGraphNodes()) 318 | { 319 | UDAReplicationGraphNode_AlwaysRelevant_ForConnection* Node = Cast(ConnectionNode); 320 | if (Node != NULL) 321 | { 322 | return Node; 323 | } 324 | } 325 | } 326 | } 327 | } 328 | 329 | return nullptr; 330 | } 331 | 332 | #if WITH_GAMEPLAY_DEBUGGER 333 | void UDAReplicationGraph::OnGameplayDebuggerOwnerChange(AGameplayDebuggerCategoryReplicator* Debugger, APlayerController* OldOwner) 334 | { 335 | if (UDAReplicationGraphNode_AlwaysRelevant_ForConnection* Node = GetAlwaysRelevantNode(OldOwner)) 336 | { 337 | Node->GameplayDebugger = nullptr; 338 | } 339 | 340 | if (UDAReplicationGraphNode_AlwaysRelevant_ForConnection* Node = GetAlwaysRelevantNode(Debugger->GetReplicationOwner())) 341 | { 342 | Node->GameplayDebugger = Debugger; 343 | } 344 | } 345 | #endif 346 | 347 | void UDAReplicationGraph::OnCharacterNewWeapon(class ADACharacter* Pawn, class ADAWeapon* NewWeapon, class ADAWeapon* OldWeapon) 348 | { 349 | if (!Pawn || Pawn->GetWorld() != GetWorld()) 350 | { 351 | return; 352 | } 353 | 354 | FGlobalActorReplicationInfo& ActorInfo = GlobalActorReplicationInfoMap.Get(Pawn); 355 | ActorInfo.DependentActorList.PrepareForWrite(); 356 | 357 | if (NewWeapon != nullptr) 358 | { 359 | ActorInfo.DependentActorList.Add(NewWeapon); 360 | } 361 | 362 | if (OldWeapon != nullptr) 363 | { 364 | ActorInfo.DependentActorList.Remove(OldWeapon); 365 | } 366 | } 367 | 368 | EClassRepPolicy UDAReplicationGraph::GetMappingPolicy(const UClass* InClass) 369 | { 370 | return ClassRepPolicies.Get(InClass) != NULL ? *ClassRepPolicies.Get(InClass) : EClassRepPolicy::NotRouted; 371 | } 372 | 373 | // -------------------------------------------------- 374 | // UDAReplicationGraphNode_AlwaysRelevant_ForConnection 375 | 376 | void UDAReplicationGraphNode_AlwaysRelevant_ForConnection::GatherActorListsForConnection(const FConnectionGatherActorListParameters& Params) 377 | { 378 | Super::GatherActorListsForConnection(Params); 379 | 380 | UDAReplicationGraph* RepGraph = CastChecked(GetOuter()); 381 | 382 | FPerConnectionActorInfoMap& ConnectionActorInfoMap = Params.ConnectionManager.ActorInfoMap; 383 | TMap& AlwaysRelevantStreamingLevelActors = RepGraph->AlwaysRelevantStreamingLevelActors; 384 | 385 | for (int32 Idx = AlwaysRelevantStreamingLevels.Num() - 1; Idx >= 0; --Idx) 386 | { 387 | FName StreamingLevel = AlwaysRelevantStreamingLevels[Idx]; 388 | FActorRepListRefView* ListPtr = AlwaysRelevantStreamingLevelActors.Find(StreamingLevel); 389 | 390 | if (ListPtr == nullptr) 391 | { 392 | AlwaysRelevantStreamingLevels.RemoveAtSwap(Idx, 1, false); 393 | continue; 394 | } 395 | 396 | FActorRepListRefView& RepList = *ListPtr; 397 | if (RepList.Num() > 0) 398 | { 399 | bool bAllDormant = true; 400 | for (FActorRepListType Actor : RepList) 401 | { 402 | FConnectionReplicationActorInfo& ConnectionActorInfo = ConnectionActorInfoMap.FindOrAdd(Actor); 403 | if (ConnectionActorInfo.bDormantOnConnection == false) 404 | { 405 | bAllDormant = false; 406 | break; 407 | } 408 | } 409 | 410 | if (bAllDormant == true) 411 | { 412 | AlwaysRelevantStreamingLevels.RemoveAtSwap(Idx, 1, false); 413 | } 414 | else 415 | { 416 | Params.OutGatheredReplicationLists.AddReplicationActorList(RepList); 417 | } 418 | } 419 | } 420 | 421 | #if WITH_GAMEPLAY_DEBUGGER 422 | if (GameplayDebugger != NULL) 423 | { 424 | ReplicationActorList.ConditionalAdd(GameplayDebugger); 425 | } 426 | #endif 427 | } 428 | 429 | void UDAReplicationGraphNode_AlwaysRelevant_ForConnection::OnClientLevelVisibilityAdd(FName LevelName, UWorld* LevelWorld) 430 | { 431 | AlwaysRelevantStreamingLevels.Add(LevelName); 432 | } 433 | 434 | void UDAReplicationGraphNode_AlwaysRelevant_ForConnection::OnClientLevelVisibilityRemove(FName LevelName) 435 | { 436 | AlwaysRelevantStreamingLevels.Remove(LevelName); 437 | } 438 | 439 | void UDAReplicationGraphNode_AlwaysRelevant_ForConnection::ResetGameWorldState() 440 | { 441 | AlwaysRelevantStreamingLevels.Empty(); 442 | } 443 | -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExample/DAReplicationGraph.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - Dennis "MazyModz" Andersson. 2 | 3 | /* 4 | 5 | MIT License 6 | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files 8 | (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, 9 | copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 10 | persons to whom the Software is furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 15 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 16 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 17 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 18 | 19 | */ 20 | 21 | #pragma once 22 | 23 | #include "CoreMinimal.h" 24 | #include "ReplicationGraph.h" 25 | #include "DAReplicationGraph.generated.h" 26 | 27 | enum class EClassRepPolicy : uint8 28 | { 29 | NotRouted, 30 | RelevantAllConnections, 31 | 32 | // -------------------------------- 33 | // Spatialized routes into the grid node 34 | 35 | Spatialize_Static, // Used for actors for frequent updates / updates every frame 36 | Spatialize_Dynamic, // For do need updates every frame 37 | Spatialize_Dormancy // Actors that can either be Static or Dynamic determined by their AActor::NetDormancy state 38 | }; 39 | 40 | class UReplicationGraphNode_ActorList; 41 | class UReplicationGraphNode_GridSpatialization2D; 42 | class UReplicationGraphNode_AlwaysRelevant_ForConnection; 43 | class AGameplayDebuggerCategoryReplicator; 44 | 45 | /** 46 | * 47 | */ 48 | UCLASS(Transient, config=Engine) 49 | class DAREPGRAPHEXAMPLE_API UDAReplicationGraph : public UReplicationGraph 50 | { 51 | public: 52 | 53 | GENERATED_BODY() 54 | 55 | // ~ begin UReplicationGraph implementation 56 | virtual void ResetGameWorldState() override; 57 | virtual void InitConnectionGraphNodes(UNetReplicationGraphConnection* ConnectionManager) override; 58 | virtual void InitGlobalActorClassSettings() override; 59 | virtual void InitGlobalGraphNodes() override; 60 | virtual void RouteAddNetworkActorToNodes(const FNewReplicatedActorInfo& ActorInfo, FGlobalActorReplicationInfo& GlobalInfo) override; 61 | virtual void RouteRemoveNetworkActorToNodes(const FNewReplicatedActorInfo& ActorInfo) override; 62 | // ~ end UReplicationGraph 63 | 64 | /** Sets class replication info for a class */ 65 | void InitClassReplicationInfo(FClassReplicationInfo& Info, UClass* InClass, bool bSpatilize, float ServerMaxTickRate); 66 | 67 | UPROPERTY() 68 | TArray SpatializedClasses; 69 | 70 | UPROPERTY() 71 | TArray NonSpatializedClasses; 72 | 73 | UPROPERTY() 74 | TArray AlwaysRelevantClasses; 75 | 76 | // ------------------------------------- 77 | // ReplicationGraph Nodes 78 | 79 | /** 80 | * This is probably the most important node in the replication graph 81 | * 82 | * Carves the map up into grids and determines if an actor should send network updates 83 | * to a connection depending on the different pre-defined grids 84 | */ 85 | UPROPERTY() 86 | UReplicationGraphNode_GridSpatialization2D* GridNode; 87 | 88 | UPROPERTY() 89 | UReplicationGraphNode_ActorList* AlwaysRelevantNode; 90 | 91 | /** Maps the actors the needs to be always relevant across streaming levels */ 92 | TMap AlwaysRelevantStreamingLevelActors; 93 | 94 | protected: 95 | 96 | /** Gets the connection always relevant node from a player controller */ 97 | class UDAReplicationGraphNode_AlwaysRelevant_ForConnection* GetAlwaysRelevantNode(APlayerController* PlayerController); 98 | 99 | #if WITH_GAMEPLAY_DEBUGGER 100 | void OnGameplayDebuggerOwnerChange(AGameplayDebuggerCategoryReplicator* Debugger, APlayerController* OldOwner); 101 | #endif 102 | 103 | UFUNCTION() 104 | void OnCharacterNewWeapon(class ADACharacter* Pawn, class ADAWeapon* NewWeapon, class ADAWeapon* OldWeapon); 105 | 106 | FORCEINLINE bool IsSpatialized(EClassRepPolicy Mapping) 107 | { 108 | return Mapping >= EClassRepPolicy::Spatialize_Static; 109 | } 110 | 111 | /** Gets the mapping to used for the given class */ 112 | EClassRepPolicy GetMappingPolicy(const UClass* InClass); 113 | 114 | /** Maps a class to a mapping policy */ 115 | TClassMap ClassRepPolicies; 116 | 117 | float GridCellSize = 10000.f; // The size of one grid cell in the grid node 118 | float SpatialBiasX = -150000.f; // "Min X" for replication 119 | float SpatialBiasY = -200000.f; // "Min Y" for replication 120 | bool bDisableSpatialRebuilding = true; 121 | }; 122 | 123 | UCLASS() 124 | class UDAReplicationGraphNode_AlwaysRelevant_ForConnection : public UReplicationGraphNode_AlwaysRelevant_ForConnection 125 | { 126 | public: 127 | 128 | GENERATED_BODY() 129 | 130 | // ~ begin UReplicationGraphNode_AlwaysRelevant_ForConnection implementation 131 | virtual void GatherActorListsForConnection(const FConnectionGatherActorListParameters& Params) override; 132 | // ~ end UReplicationGraphNode_AlwaysRelevant_ForConnection 133 | 134 | void OnClientLevelVisibilityAdd(FName LevelName, UWorld* LevelWorld); 135 | void OnClientLevelVisibilityRemove(FName LevelName); 136 | 137 | void ResetGameWorldState(); 138 | 139 | #if WITH_GAMEPLAY_DEBUGGER 140 | AGameplayDebuggerCategoryReplicator* GameplayDebugger = nullptr; 141 | #endif 142 | 143 | protected: 144 | 145 | /** Stores levelstreaming actors */ 146 | TArray> AlwaysRelevantStreamingLevels; 147 | }; -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExample/DAWeapon.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - Dennis "MazyModz" Andersson. 2 | 3 | /* 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files 6 | (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | persons to whom the Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 13 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 14 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 15 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | 17 | */ 18 | 19 | #include "DAWeapon.h" 20 | #include "UnrealNetwork.h" 21 | #include "DACharacter.h" 22 | #include "DAProjectile.h" 23 | 24 | // Sets default values 25 | ADAWeapon::ADAWeapon() 26 | { 27 | PrimaryActorTick.bCanEverTick = false; 28 | 29 | bReplicates = true; 30 | bReplicateMovement = true; 31 | 32 | SetActorEnableCollision(false); 33 | } 34 | 35 | void ADAWeapon::GetLifetimeReplicatedProps(TArray & OutLifetimeProps) const 36 | { 37 | Super::GetLifetimeReplicatedProps(OutLifetimeProps); 38 | DOREPLIFETIME(ADAWeapon, OwnerPawn); 39 | } 40 | 41 | // Called when the game starts or when spawned 42 | void ADAWeapon::BeginPlay() 43 | { 44 | Super::BeginPlay(); 45 | } 46 | 47 | // Called every frame 48 | void ADAWeapon::Tick(float DeltaTime) 49 | { 50 | Super::Tick(DeltaTime); 51 | } 52 | 53 | FVector ADAWeapon::GetMuzzleLocation() const 54 | { 55 | USkeletalMeshComponent* MeshComp = GetSkeletalMeshComponent(); 56 | if (MeshComp != NULL) 57 | { 58 | return MeshComp->GetSocketLocation(TEXT("Muzzle")); 59 | } 60 | else 61 | { 62 | return GetActorLocation(); 63 | } 64 | } 65 | 66 | FVector ADAWeapon::GetAimLocation() const 67 | { 68 | if (OwnerPawn != NULL) 69 | { 70 | FVector Location; 71 | FRotator Rotation; 72 | OwnerPawn->GetActorEyesViewPoint(Location, Rotation); 73 | 74 | FHitResult OutHit(ForceInit); 75 | FVector End = Rotation.Vector() * 10000000; 76 | GetWorld()->LineTraceSingleByChannel(OutHit, Location, End, ECC_Visibility); 77 | 78 | return OutHit.Location; 79 | } 80 | else 81 | { 82 | return FVector::ZeroVector; 83 | } 84 | } 85 | 86 | void ADAWeapon::FireWeapon() 87 | { 88 | if (OwnerPawn != NULL && OwnerPawn->IsLocallyControlled() == true) 89 | { 90 | ServerFireWeapon(GetMuzzleLocation()); 91 | } 92 | } 93 | 94 | void ADAWeapon::ServerFireWeapon(const FVector& MuzzleLocation) 95 | { 96 | if ((ProjectileClass != NULL) && (OwnerPawn != NULL)) 97 | { 98 | if (HasAuthority() == true) 99 | { 100 | FRotator Direction = (GetAimLocation() - MuzzleLocation).Rotation(); 101 | GetWorld()->SpawnActor(ProjectileClass, FTransform(Direction, MuzzleLocation, FVector(0.25f, 0.25f, 0.25f))); 102 | } 103 | else 104 | { 105 | OwnerPawn->ServerFireWeapon(MuzzleLocation); 106 | } 107 | } 108 | } 109 | 110 | -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExample/DAWeapon.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - Dennis "MazyModz" Andersson. 2 | 3 | /* 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files 6 | (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | persons to whom the Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 13 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 14 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 15 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "CoreMinimal.h" 22 | #include "Runtime/Engine/Classes/Animation/SkeletalMeshActor.h" 23 | #include "DAWeapon.generated.h" 24 | 25 | class ADAProjectile; 26 | 27 | UCLASS(Abstract) 28 | class DAREPGRAPHEXAMPLE_API ADAWeapon : public ASkeletalMeshActor 29 | { 30 | GENERATED_BODY() 31 | 32 | public: 33 | ADAWeapon(); 34 | 35 | UPROPERTY(Replicated) 36 | class ADACharacter* OwnerPawn; 37 | 38 | virtual void BeginPlay() override; 39 | virtual void Tick(float DeltaTime) override; 40 | 41 | FVector GetMuzzleLocation() const; 42 | FVector GetAimLocation() const; 43 | 44 | virtual void FireWeapon(); 45 | virtual void ServerFireWeapon(const FVector& MuzzleLocation); 46 | 47 | UPROPERTY(EditDefaultsOnly, Category="Weapon") 48 | TSubclassOf ProjectileClass; 49 | }; 50 | -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExample/DAWeaponPickup.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - Dennis "MazyModz" Andersson. 2 | 3 | /* 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files 6 | (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | persons to whom the Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 13 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 14 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 15 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | 17 | */ 18 | 19 | #include "DAWeaponPickup.h" 20 | 21 | // Sets default values 22 | ADAWeaponPickup::ADAWeaponPickup() 23 | { 24 | // Set this actor to call Tick() every frame. You can turn this off to improve performance if you don't need it. 25 | PrimaryActorTick.bCanEverTick = true; 26 | 27 | } 28 | 29 | // Called when the game starts or when spawned 30 | void ADAWeaponPickup::BeginPlay() 31 | { 32 | Super::BeginPlay(); 33 | 34 | } 35 | 36 | // Called every frame 37 | void ADAWeaponPickup::Tick(float DeltaTime) 38 | { 39 | Super::Tick(DeltaTime); 40 | 41 | } 42 | 43 | -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExample/DAWeaponPickup.h: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2018 - Dennis "MazyModz" Andersson. 2 | 3 | /* 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files 6 | (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, 7 | copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit 8 | persons to whom the Software is furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 11 | 12 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 13 | TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 14 | THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 15 | CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 16 | 17 | */ 18 | 19 | #pragma once 20 | 21 | #include "CoreMinimal.h" 22 | #include "GameFramework/Actor.h" 23 | #include "DAWeaponPickup.generated.h" 24 | 25 | UCLASS() 26 | class DAREPGRAPHEXAMPLE_API ADAWeaponPickup : public AActor 27 | { 28 | GENERATED_BODY() 29 | 30 | public: 31 | // Sets default values for this actor's properties 32 | ADAWeaponPickup(); 33 | 34 | protected: 35 | // Called when the game starts or when spawned 36 | virtual void BeginPlay() override; 37 | 38 | public: 39 | // Called every frame 40 | virtual void Tick(float DeltaTime) override; 41 | 42 | }; 43 | -------------------------------------------------------------------------------- /DARepGraphExample/Source/DARepGraphExampleEditor.Target.cs: -------------------------------------------------------------------------------- 1 | // Copyright 1998-2018 Epic Games, Inc. All Rights Reserved. 2 | 3 | using UnrealBuildTool; 4 | using System.Collections.Generic; 5 | 6 | public class DARepGraphExampleEditorTarget : TargetRules 7 | { 8 | public DARepGraphExampleEditorTarget(TargetInfo Target) : base(Target) 9 | { 10 | Type = TargetType.Editor; 11 | ExtraModuleNames.Add("DARepGraphExample"); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 Dennis "MazyModz" Andersson 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # UE4-DAReplicationGraphExample 2 | An example project of how to use the ReplicationGraph in Unreal Engine. Also a template version of my ReplicationGraph is provided so you can use that in your project and create a child class from it. 3 | 4 | Video tutorial can be found here: https://www.youtube.com/watch?v=7P11RwKfuEM 5 | 6 | 7 | Also other useful docs: 8 | 9 | Wiki Docs: https://docs.unrealengine.com/en-US/Engine/Networking/ReplicationGraph 10 | 11 | Epic Livestream: https://www.youtube.com/watch?v=CDnNAAzgltw 12 | --------------------------------------------------------------------------------