├── .buildkite ├── .gitignore ├── hooks │ └── pre-command ├── premerge.definition.yaml ├── premerge.steps.yaml ├── release.definition.yaml └── release.steps.yaml ├── .editorconfig ├── .gitattributes ├── .github ├── issue-template.md └── pull-request-template.md ├── .gitignore ├── CHANGELOG.md ├── CONTRIBUTING.md ├── LICENSE.md ├── OWNERS.yml ├── OWNERS_ALIASES.yml ├── README.md ├── RequireSetup ├── Setup.bat ├── Setup.sh ├── SetupIncTraceLibs.bat ├── SpatialGDK ├── Build │ ├── Programs │ │ └── Improbable.Unreal.Scripts │ │ │ ├── Build │ │ │ ├── Build.cs │ │ │ ├── Build.csproj │ │ │ └── packages.config │ │ │ ├── CodeGenerator │ │ │ ├── Base │ │ │ │ ├── Bundle.cs │ │ │ │ ├── ICodeGenerator.cs │ │ │ │ ├── Model.cs │ │ │ │ ├── SchemaBundleLoader.cs │ │ │ │ ├── Text.cs │ │ │ │ └── TypeDescription.cs │ │ │ ├── CodeGenerator.csproj │ │ │ ├── Program.cs │ │ │ ├── README.md │ │ │ └── Unreal │ │ │ │ ├── EnumGenerator.cs │ │ │ │ ├── HeaderGenerator.cs │ │ │ │ ├── HelperFunctions.cs │ │ │ │ ├── InterfaceGenerator.cs │ │ │ │ ├── MapEquals.cs │ │ │ │ ├── Serialization.cs │ │ │ │ ├── SourceGenerator.cs │ │ │ │ ├── Types.cs │ │ │ │ └── UnrealGenerator.cs │ │ │ ├── Common │ │ │ ├── Common.cs │ │ │ ├── Common.csproj │ │ │ └── LinuxScripts.cs │ │ │ ├── DeploymentLauncher │ │ │ ├── DeploymentLauncher.cs │ │ │ └── DeploymentLauncher.csproj │ │ │ ├── Improbable.Unreal.Scripts.sln │ │ │ ├── Linter │ │ │ ├── Linter.cs │ │ │ └── Linter.csproj │ │ │ ├── WorkerCoordinator │ │ │ ├── AbstractWorkerCoordinator.cs │ │ │ ├── BuildTargets.targets │ │ │ ├── CoordinatorConnection.cs │ │ │ ├── Logger.cs │ │ │ ├── ManagedWorkerCoordinator.cs │ │ │ ├── Program.cs │ │ │ ├── RegisseurWorkerCoordinator.cs │ │ │ ├── SpatialConfig │ │ │ │ ├── cloud_launch_sim_player_deployment.json │ │ │ │ └── spatialos.SimulatedPlayerCoordinator.worker.json │ │ │ ├── Util.cs │ │ │ └── WorkerCoordinator.csproj │ │ │ ├── WriteLinuxScript │ │ │ ├── WriteLinuxScript.cs │ │ │ └── WriteLinuxScript.csproj │ │ │ └── packages │ │ │ └── Newtonsoft.Json.12.0.2 │ │ │ ├── LICENSE.md │ │ │ └── lib │ │ │ └── net45 │ │ │ └── Newtonsoft.Json.dll │ └── Scripts │ │ ├── BuildWorker.bat │ │ ├── DeploymentLauncher.bat │ │ ├── ExternalSchemaCodegen.bat │ │ └── FindMSBuild.bat ├── Content │ └── SpatialDebugger │ │ ├── BP_SpatialDebugger.uasset │ │ ├── Materials │ │ └── TranslucentWorkerRegion.uasset │ │ └── Textures │ │ ├── Auth.uasset │ │ ├── AuthIntent.uasset │ │ ├── Box.uasset │ │ ├── LockClosed.uasset │ │ └── LockOpen.uasset ├── Documentation │ ├── README.md │ └── spatialos-gdkforunreal-header.png ├── Extras │ ├── core-sdk.version │ ├── fastbuild │ │ ├── README.md │ │ ├── install.ps1 │ │ ├── uninstall-0.96.ps1 │ │ └── uninstall.ps1 │ ├── git │ │ └── post-merge │ ├── internal-documentation │ │ ├── how-to-write-good-release-notes.md │ │ └── release-process.md │ ├── linting │ │ ├── Fix.bat │ │ └── Test.bat │ ├── schema │ │ ├── authority_intent.schema │ │ ├── component_presence.schema │ │ ├── core_types.schema │ │ ├── debug_metrics.schema │ │ ├── global_state_manager.schema │ │ ├── heartbeat.schema │ │ ├── net_owning_client_worker.schema │ │ ├── not_streamed.schema │ │ ├── relevant.schema │ │ ├── rpc_components.schema │ │ ├── rpc_payload.schema │ │ ├── server_worker.schema │ │ ├── spatial_debugging.schema │ │ ├── spawndata.schema │ │ ├── spawner.schema │ │ ├── tombstone.schema │ │ ├── unreal_metadata.schema │ │ └── virtual_worker_translation.schema │ ├── spot.version │ ├── templates │ │ └── WorkerJsonTemplate.json │ └── worker-sdk-upgrade.md ├── Raw │ └── SpatialDebugger │ │ └── Textures │ │ ├── Auth.png │ │ ├── AuthIntent.png │ │ ├── Box.png │ │ ├── LockClosed.png │ │ └── LockOpen.png ├── Resources │ ├── Cloud.png │ ├── Cloud@0.5x.png │ ├── Icon128.png │ ├── Inspector.png │ ├── Inspector@0.5x.png │ ├── None.png │ ├── None@0.5x.png │ ├── SPATIALOS_LOGO_WHITE.png │ ├── Schema.png │ ├── Schema@0.5x.png │ ├── Snapshot.png │ ├── Snapshot@0.5x.png │ ├── StartCloud.png │ ├── StartCloud@0.5x.png │ ├── StartLocal.png │ ├── StartLocal@0.5x.png │ ├── StopCloud.png │ ├── StopCloud@0.5x.png │ ├── StopLocal.png │ └── StopLocal@0.5x.png ├── Source │ ├── .gitignore │ ├── SpatialGDK │ │ ├── Private │ │ │ ├── EngineClasses │ │ │ │ ├── Components │ │ │ │ │ ├── ActorInterestComponent.cpp │ │ │ │ │ └── SpatialPingComponent.cpp │ │ │ │ ├── SpatialActorChannel.cpp │ │ │ │ ├── SpatialFastArrayNetSerialize.cpp │ │ │ │ ├── SpatialGameInstance.cpp │ │ │ │ ├── SpatialLoadBalanceEnforcer.cpp │ │ │ │ ├── SpatialNetBitReader.cpp │ │ │ │ ├── SpatialNetBitWriter.cpp │ │ │ │ ├── SpatialNetConnection.cpp │ │ │ │ ├── SpatialNetDriver.cpp │ │ │ │ ├── SpatialPackageMapClient.cpp │ │ │ │ ├── SpatialReplicationGraph.cpp │ │ │ │ ├── SpatialVirtualWorkerTranslationManager.cpp │ │ │ │ └── SpatialVirtualWorkerTranslator.cpp │ │ │ ├── Interop │ │ │ │ ├── Connection │ │ │ │ │ ├── LegacySpatialWorkerConnection.cpp │ │ │ │ │ ├── OutgoingMessages.cpp │ │ │ │ │ ├── SpatialConnectionManager.cpp │ │ │ │ │ └── SpatialViewWorkerConnection.cpp │ │ │ │ ├── GlobalStateManager.cpp │ │ │ │ ├── SpatialClassInfoManager.cpp │ │ │ │ ├── SpatialDispatcher.cpp │ │ │ │ ├── SpatialInterestConstraints.cpp │ │ │ │ ├── SpatialNetDriverLoadBalancingHandler.cpp │ │ │ │ ├── SpatialNetDriverLoadBalancingHandler.h │ │ │ │ ├── SpatialOutputDevice.cpp │ │ │ │ ├── SpatialPlayerSpawner.cpp │ │ │ │ ├── SpatialRPCService.cpp │ │ │ │ ├── SpatialReceiver.cpp │ │ │ │ ├── SpatialSender.cpp │ │ │ │ ├── SpatialSnapshotManager.cpp │ │ │ │ ├── SpatialStaticComponentView.cpp │ │ │ │ └── SpatialWorkerFlags.cpp │ │ │ ├── LoadBalancing │ │ │ │ ├── AbstractLBStrategy.cpp │ │ │ │ ├── GridBasedLBStrategy.cpp │ │ │ │ ├── LayeredLBStrategy.cpp │ │ │ │ ├── OwnershipLockingPolicy.cpp │ │ │ │ ├── SpatialMultiWorkerSettings.cpp │ │ │ │ └── WorkerRegion.cpp │ │ │ ├── Schema │ │ │ │ ├── ClientEndpoint.cpp │ │ │ │ ├── MulticastRPCs.cpp │ │ │ │ ├── ServerEndpoint.cpp │ │ │ │ └── UnrealObjectRef.cpp │ │ │ ├── SimulatedPlayers │ │ │ │ └── SimPlayerBPFunctionLibrary.cpp │ │ │ ├── SpatialGDKConsoleCommands.cpp │ │ │ ├── SpatialGDKModule.cpp │ │ │ ├── SpatialGDKSettings.cpp │ │ │ ├── SpatialView │ │ │ │ ├── AuthorityRecord.cpp │ │ │ │ ├── CommandRequest.cpp │ │ │ │ ├── CommandResponse.cpp │ │ │ │ ├── ComponentData.cpp │ │ │ │ ├── ComponentUpdate.cpp │ │ │ │ ├── ConnectionHandler │ │ │ │ │ └── SpatialOSConnectionHandler.cpp │ │ │ │ ├── EntityComponentRecord.cpp │ │ │ │ ├── EntityComponentUpdateRecord.cpp │ │ │ │ ├── EntityPresenceRecord.cpp │ │ │ │ ├── EntityQuery.cpp │ │ │ │ ├── OpList │ │ │ │ │ ├── EntityComponentOpList.cpp │ │ │ │ │ └── ViewDeltaLegacyOpList.cpp │ │ │ │ ├── ViewCoordinator.cpp │ │ │ │ ├── ViewDelta.cpp │ │ │ │ └── WorkerView.cpp │ │ │ ├── Tests │ │ │ │ ├── RPCServiceTest.cpp │ │ │ │ ├── SpatialView │ │ │ │ │ ├── AuthorityRecordTest.cpp │ │ │ │ │ ├── EntityComponentRecordTest.cpp │ │ │ │ │ ├── EntityComponentTestUtils.h │ │ │ │ │ ├── EntityComponentUpdateRecordTest.cpp │ │ │ │ │ ├── ViewDeltaTest.cpp │ │ │ │ │ └── WorkerViewTest.cpp │ │ │ │ ├── TestingComponentViewHelpers.cpp │ │ │ │ └── TestingSchemaHelpers.cpp │ │ │ └── Utils │ │ │ │ ├── ComponentFactory.cpp │ │ │ │ ├── ComponentReader.cpp │ │ │ │ ├── EntityFactory.cpp │ │ │ │ ├── EntityPool.cpp │ │ │ │ ├── InspectionColors.cpp │ │ │ │ ├── Interest │ │ │ │ └── NetCullDistanceInterest.cpp │ │ │ │ ├── InterestFactory.cpp │ │ │ │ ├── OpUtils.cpp │ │ │ │ ├── RPCContainer.cpp │ │ │ │ ├── RPCRingBuffer.cpp │ │ │ │ ├── SchemaUtils.cpp │ │ │ │ ├── SpatialDebugger.cpp │ │ │ │ ├── SpatialLatencyTracer.cpp │ │ │ │ ├── SpatialLoadBalancingHandler.cpp │ │ │ │ ├── SpatialLoadBalancingHandler.h │ │ │ │ ├── SpatialMetrics.cpp │ │ │ │ ├── SpatialMetricsDisplay.cpp │ │ │ │ └── SpatialStatics.cpp │ │ ├── Public │ │ │ ├── EngineClasses │ │ │ │ ├── Components │ │ │ │ │ ├── ActorInterestComponent.h │ │ │ │ │ └── SpatialPingComponent.h │ │ │ │ ├── SpatialActorChannel.h │ │ │ │ ├── SpatialFastArrayNetSerialize.h │ │ │ │ ├── SpatialGameInstance.h │ │ │ │ ├── SpatialLoadBalanceEnforcer.h │ │ │ │ ├── SpatialNetBitReader.h │ │ │ │ ├── SpatialNetBitWriter.h │ │ │ │ ├── SpatialNetConnection.h │ │ │ │ ├── SpatialNetDriver.h │ │ │ │ ├── SpatialPackageMapClient.h │ │ │ │ ├── SpatialPendingNetGame.h │ │ │ │ ├── SpatialReplicationGraph.h │ │ │ │ ├── SpatialVirtualWorkerTranslationManager.h │ │ │ │ ├── SpatialVirtualWorkerTranslator.h │ │ │ │ └── SpatialWorldSettings.h │ │ │ ├── Interop │ │ │ │ ├── Connection │ │ │ │ │ ├── ConnectionConfig.h │ │ │ │ │ ├── LegacySpatialWorkerConnection.h │ │ │ │ │ ├── OutgoingMessages.h │ │ │ │ │ ├── SpatialConnectionManager.h │ │ │ │ │ ├── SpatialOSWorkerInterface.h │ │ │ │ │ ├── SpatialViewWorkerConnection.h │ │ │ │ │ ├── SpatialWorkerConnection.h │ │ │ │ │ └── WorkerConnectionCoordinator.h │ │ │ │ ├── GlobalStateManager.h │ │ │ │ ├── SpatialClassInfoManager.h │ │ │ │ ├── SpatialConditionMapFilter.h │ │ │ │ ├── SpatialDispatcher.h │ │ │ │ ├── SpatialInterestConstraints.h │ │ │ │ ├── SpatialOSDispatcherInterface.h │ │ │ │ ├── SpatialOutputDevice.h │ │ │ │ ├── SpatialPlayerSpawner.h │ │ │ │ ├── SpatialRPCService.h │ │ │ │ ├── SpatialReceiver.h │ │ │ │ ├── SpatialSender.h │ │ │ │ ├── SpatialSnapshotManager.h │ │ │ │ ├── SpatialStaticComponentView.h │ │ │ │ └── SpatialWorkerFlags.h │ │ │ ├── LoadBalancing │ │ │ │ ├── AbstractLBStrategy.h │ │ │ │ ├── AbstractLockingPolicy.h │ │ │ │ ├── GridBasedLBStrategy.h │ │ │ │ ├── LayeredLBStrategy.h │ │ │ │ ├── OwnershipLockingPolicy.h │ │ │ │ ├── SpatialMultiWorkerSettings.h │ │ │ │ └── WorkerRegion.h │ │ │ ├── Schema │ │ │ │ ├── AuthorityIntent.h │ │ │ │ ├── ClientEndpoint.h │ │ │ │ ├── ClientRPCEndpointLegacy.h │ │ │ │ ├── Component.h │ │ │ │ ├── ComponentPresence.h │ │ │ │ ├── DynamicComponent.h │ │ │ │ ├── Heartbeat.h │ │ │ │ ├── Interest.h │ │ │ │ ├── MulticastRPCs.h │ │ │ │ ├── NetOwningClientWorker.h │ │ │ │ ├── PlayerSpawner.h │ │ │ │ ├── RPCPayload.h │ │ │ │ ├── ServerEndpoint.h │ │ │ │ ├── ServerRPCEndpointLegacy.h │ │ │ │ ├── ServerWorker.h │ │ │ │ ├── SpatialDebugging.h │ │ │ │ ├── SpawnData.h │ │ │ │ ├── StandardLibrary.h │ │ │ │ ├── Tombstone.h │ │ │ │ ├── UnrealMetadata.h │ │ │ │ └── UnrealObjectRef.h │ │ │ ├── SimulatedPlayers │ │ │ │ └── SimPlayerBPFunctionLibrary.h │ │ │ ├── SpatialCommonTypes.h │ │ │ ├── SpatialConstants.h │ │ │ ├── SpatialGDKConsoleCommands.h │ │ │ ├── SpatialGDKLoader.h │ │ │ ├── SpatialGDKModule.h │ │ │ ├── SpatialGDKSettings.h │ │ │ ├── SpatialView │ │ │ │ ├── AuthorityRecord.h │ │ │ │ ├── CommandRequest.h │ │ │ │ ├── CommandResponse.h │ │ │ │ ├── ComponentData.h │ │ │ │ ├── ComponentUpdate.h │ │ │ │ ├── ConnectionHandler │ │ │ │ │ ├── AbstractConnectionHandler.h │ │ │ │ │ └── SpatialOSConnectionHandler.h │ │ │ │ ├── EntityComponentId.h │ │ │ │ ├── EntityComponentRecord.h │ │ │ │ ├── EntityComponentTypes.h │ │ │ │ ├── EntityComponentUpdateRecord.h │ │ │ │ ├── EntityPresenceRecord.h │ │ │ │ ├── EntityQuery.h │ │ │ │ ├── MessagesToSend.h │ │ │ │ ├── OpList │ │ │ │ │ ├── EntityComponentOpList.h │ │ │ │ │ ├── OpList.h │ │ │ │ │ ├── SplitOpList.h │ │ │ │ │ ├── ViewDeltaLegacyOpList.h │ │ │ │ │ └── WorkerConnectionOpList.h │ │ │ │ ├── OutgoingComponentMessage.h │ │ │ │ ├── OutgoingMessages.h │ │ │ │ ├── ViewCoordinator.h │ │ │ │ ├── ViewDelta.h │ │ │ │ └── WorkerView.h │ │ │ ├── Tests │ │ │ │ ├── TestActor.h │ │ │ │ ├── TestDefinitions.h │ │ │ │ ├── TestingComponentViewHelpers.h │ │ │ │ └── TestingSchemaHelpers.h │ │ │ └── Utils │ │ │ │ ├── ComponentFactory.h │ │ │ │ ├── ComponentReader.h │ │ │ │ ├── EngineVersionCheck.h │ │ │ │ ├── EntityFactory.h │ │ │ │ ├── EntityPool.h │ │ │ │ ├── ErrorCodeRemapping.h │ │ │ │ ├── GDKPropertyMacros.h │ │ │ │ ├── InspectionColors.h │ │ │ │ ├── Interest │ │ │ │ └── NetCullDistanceInterest.h │ │ │ │ ├── InterestFactory.h │ │ │ │ ├── LayerInfo.h │ │ │ │ ├── OpUtils.h │ │ │ │ ├── RPCContainer.h │ │ │ │ ├── RPCRingBuffer.h │ │ │ │ ├── RepDataUtils.h │ │ │ │ ├── RepLayoutUtils.h │ │ │ │ ├── SchemaDatabase.h │ │ │ │ ├── SchemaOption.h │ │ │ │ ├── SchemaUtils.h │ │ │ │ ├── SnapshotGenerationTemplate.h │ │ │ │ ├── SpatialActorUtils.h │ │ │ │ ├── SpatialDebugger.h │ │ │ │ ├── SpatialLatencyPayload.h │ │ │ │ ├── SpatialLatencyTracer.h │ │ │ │ ├── SpatialMetrics.h │ │ │ │ ├── SpatialMetricsDisplay.h │ │ │ │ └── SpatialStatics.h │ │ ├── SpatialGDK.Build.cs │ │ └── SpatialGDK_APL.xml │ ├── SpatialGDKEditor │ │ ├── Private │ │ │ ├── CloudDeploymentConfiguration.cpp │ │ │ ├── SchemaGenerator │ │ │ │ ├── SchemaGenerator.cpp │ │ │ │ ├── SchemaGenerator.h │ │ │ │ ├── SpatialGDKEditorSchemaGenerator.cpp │ │ │ │ ├── TypeStructure.cpp │ │ │ │ ├── TypeStructure.h │ │ │ │ └── Utils │ │ │ │ │ ├── CodeWriter.cpp │ │ │ │ │ ├── CodeWriter.h │ │ │ │ │ ├── ComponentIdGenerator.h │ │ │ │ │ ├── DataTypeUtilities.cpp │ │ │ │ │ └── DataTypeUtilities.h │ │ │ ├── SnapshotGenerator │ │ │ │ └── SpatialGDKEditorSnapshotGenerator.cpp │ │ │ ├── SpatialGDKDefaultLaunchConfigGenerator.cpp │ │ │ ├── SpatialGDKDefaultWorkerJsonGenerator.cpp │ │ │ ├── SpatialGDKDevAuthTokenGenerator.cpp │ │ │ ├── SpatialGDKEditor.cpp │ │ │ ├── SpatialGDKEditorCloudLauncher.cpp │ │ │ ├── SpatialGDKEditorCommandLineArgsManager.cpp │ │ │ ├── SpatialGDKEditorLayoutDetails.cpp │ │ │ ├── SpatialGDKEditorModule.cpp │ │ │ ├── SpatialGDKEditorPackageAssembly.cpp │ │ │ ├── SpatialGDKEditorSettings.cpp │ │ │ ├── SpatialLaunchConfigCustomization.cpp │ │ │ ├── SpatialRuntimeVersionCustomization.cpp │ │ │ ├── Utils │ │ │ │ ├── LaunchConfigurationEditor.cpp │ │ │ │ └── TransientUObjectEditor.cpp │ │ │ └── WorkerTypeCustomization.cpp │ │ ├── Public │ │ │ ├── CloudDeploymentConfiguration.h │ │ │ ├── SpatialGDKDefaultLaunchConfigGenerator.h │ │ │ ├── SpatialGDKDefaultWorkerJsonGenerator.h │ │ │ ├── SpatialGDKDevAuthTokenGenerator.h │ │ │ ├── SpatialGDKEditor.h │ │ │ ├── SpatialGDKEditorCloudLauncher.h │ │ │ ├── SpatialGDKEditorCommandLineArgsManager.h │ │ │ ├── SpatialGDKEditorLayoutDetails.h │ │ │ ├── SpatialGDKEditorModule.h │ │ │ ├── SpatialGDKEditorPackageAssembly.h │ │ │ ├── SpatialGDKEditorSchemaGenerator.h │ │ │ ├── SpatialGDKEditorSettings.h │ │ │ ├── SpatialGDKEditorSnapshotGenerator.h │ │ │ ├── SpatialLaunchConfigCustomization.h │ │ │ ├── SpatialRuntimeVersionCustomization.h │ │ │ ├── Utils │ │ │ │ ├── LaunchConfigurationEditor.h │ │ │ │ └── TransientUObjectEditor.h │ │ │ └── WorkerTypeCustomization.h │ │ └── SpatialGDKEditor.Build.cs │ ├── SpatialGDKEditorCommandlet │ │ ├── Private │ │ │ ├── Commandlets │ │ │ │ ├── CookAndGenerateSchemaCommandlet.cpp │ │ │ │ ├── CookAndGenerateSchemaCommandlet.h │ │ │ │ ├── GenerateSchemaAndSnapshotsCommandlet.cpp │ │ │ │ ├── GenerateSchemaAndSnapshotsCommandlet.h │ │ │ │ ├── GenerateSchemaCommandlet.cpp │ │ │ │ ├── GenerateSchemaCommandlet.h │ │ │ │ ├── GenerateSnapshotCommandlet.cpp │ │ │ │ └── GenerateSnapshotCommandlet.h │ │ │ ├── SpatialGDKEditorCommandletModule.cpp │ │ │ └── SpatialGDKEditorCommandletPrivate.h │ │ ├── Public │ │ │ └── SpatialGDKEditorCommandletModule.h │ │ └── SpatialGDKEditorCommandlet.Build.cs │ ├── SpatialGDKEditorToolbar │ │ ├── Private │ │ │ ├── SpatialGDKCloudDeploymentConfiguration.cpp │ │ │ ├── SpatialGDKEditorToolbar.cpp │ │ │ ├── SpatialGDKEditorToolbarCommands.cpp │ │ │ └── SpatialGDKEditorToolbarStyle.cpp │ │ ├── Public │ │ │ ├── SpatialGDKCloudDeploymentConfiguration.h │ │ │ ├── SpatialGDKEditorToolbar.h │ │ │ ├── SpatialGDKEditorToolbarCommands.h │ │ │ └── SpatialGDKEditorToolbarStyle.h │ │ └── SpatialGDKEditorToolbar.Build.cs │ ├── SpatialGDKFunctionalTests │ │ ├── Private │ │ │ ├── SpatialFunctionalTest.cpp │ │ │ ├── SpatialFunctionalTestAutoDestroyComponent.cpp │ │ │ ├── SpatialFunctionalTestBlueprintLibrary.cpp │ │ │ ├── SpatialFunctionalTestFlowController.cpp │ │ │ ├── SpatialFunctionalTestFlowControllerSpawner.cpp │ │ │ ├── SpatialFunctionalTestGridLBStrategy.cpp │ │ │ ├── SpatialFunctionalTestLBDelegationInterface.cpp │ │ │ ├── SpatialFunctionalTestStep.cpp │ │ │ ├── SpatialFunctionalTestWorkerDelegationComponent.cpp │ │ │ ├── SpatialGDKFunctionalTestsModule.cpp │ │ │ ├── SpatialGDKFunctionalTestsPrivate.h │ │ │ └── Test1x2GridStrategy.cpp │ │ ├── Public │ │ │ ├── SpatialFunctionalTest.h │ │ │ ├── SpatialFunctionalTestAutoDestroyComponent.h │ │ │ ├── SpatialFunctionalTestBlueprintLibrary.h │ │ │ ├── SpatialFunctionalTestFlowController.h │ │ │ ├── SpatialFunctionalTestFlowControllerSpawner.h │ │ │ ├── SpatialFunctionalTestGridLBStrategy.h │ │ │ ├── SpatialFunctionalTestLBDelegationInterface.h │ │ │ ├── SpatialFunctionalTestStep.h │ │ │ ├── SpatialFunctionalTestWorkerDelegationComponent.h │ │ │ ├── SpatialGDKFunctionalTestsModule.h │ │ │ └── Test1x2GridStrategy.h │ │ ├── SpatialGDK │ │ │ ├── CrossServerAndClientOrchestrationTest │ │ │ │ ├── CrossServerAndClientOrchestrationFlowController.cpp │ │ │ │ ├── CrossServerAndClientOrchestrationFlowController.h │ │ │ │ ├── CrossServerAndClientOrchestrationTest.cpp │ │ │ │ └── CrossServerAndClientOrchestrationTest.h │ │ │ ├── DormancyAndTombstoneTest │ │ │ │ ├── DormancyAndTombstoneTest.cpp │ │ │ │ ├── DormancyAndTombstoneTest.h │ │ │ │ ├── DormancyTestActor.cpp │ │ │ │ └── DormancyTestActor.h │ │ │ ├── RegisterAutoDestroyActorsTest │ │ │ │ ├── RegisterAutoDestroyActorsTest.cpp │ │ │ │ └── RegisterAutoDestroyActorsTest.h │ │ │ ├── SpatialTestCharacterMovement │ │ │ │ ├── CharacterMovementTestGameMode.cpp │ │ │ │ ├── CharacterMovementTestGameMode.h │ │ │ │ ├── SpatialTestCharacterMovement.cpp │ │ │ │ ├── SpatialTestCharacterMovement.h │ │ │ │ ├── TestMovementCharacter.cpp │ │ │ │ └── TestMovementCharacter.h │ │ │ ├── SpatialTestPossession │ │ │ │ ├── SpatialTestPossession.cpp │ │ │ │ ├── SpatialTestPossession.h │ │ │ │ ├── SpatialTestRepossession.cpp │ │ │ │ ├── SpatialTestRepossession.h │ │ │ │ ├── TestPossessionPawn.cpp │ │ │ │ └── TestPossessionPawn.h │ │ │ ├── TestActors │ │ │ │ ├── ReplicatedTestActorBase.cpp │ │ │ │ └── ReplicatedTestActorBase.h │ │ │ ├── UNR-3066 │ │ │ │ ├── OwnerOnlyPropertyReplication.cpp │ │ │ │ ├── OwnerOnlyPropertyReplication.h │ │ │ │ ├── OwnerOnlyTestPawn.cpp │ │ │ │ └── OwnerOnlyTestPawn.h │ │ │ ├── UNR-3157 │ │ │ │ ├── RPCInInterfaceActor.cpp │ │ │ │ ├── RPCInInterfaceActor.h │ │ │ │ ├── RPCInInterfaceTest.cpp │ │ │ │ ├── RPCInInterfaceTest.h │ │ │ │ └── RPCTestInterface.h │ │ │ └── UNR-3761 │ │ │ │ ├── SpatialTestNetReference │ │ │ │ ├── CubeWithReferences.cpp │ │ │ │ ├── CubeWithReferences.h │ │ │ │ ├── SpatialTestNetReference.cpp │ │ │ │ └── SpatialTestNetReference.h │ │ │ │ └── SpatialTestReplicatedStartupActor │ │ │ │ ├── ReplicatedStartupActorGameMode.cpp │ │ │ │ ├── ReplicatedStartupActorGameMode.h │ │ │ │ ├── ReplicatedStartupActorPlayerController.cpp │ │ │ │ ├── ReplicatedStartupActorPlayerController.h │ │ │ │ ├── SpatialTestReplicatedStartupActor.cpp │ │ │ │ └── SpatialTestReplicatedStartupActor.h │ │ └── SpatialGDKFunctionalTests.Build.cs │ ├── SpatialGDKServices │ │ ├── Private │ │ │ ├── LocalDeploymentManager.cpp │ │ │ ├── LocalReceptionistProxyServerManager.cpp │ │ │ ├── SSpatialOutputLog.cpp │ │ │ ├── SpatialCommandUtils.cpp │ │ │ ├── SpatialGDKServicesModule.cpp │ │ │ └── SpatialGDKServicesPrivate.h │ │ ├── Public │ │ │ ├── LocalDeploymentManager.h │ │ │ ├── LocalReceptionistProxyServerManager.h │ │ │ ├── SSpatialOutputLog.h │ │ │ ├── SpatialCommandUtils.h │ │ │ ├── SpatialGDKServicesConstants.h │ │ │ └── SpatialGDKServicesModule.h │ │ └── SpatialGDKServices.Build.cs │ └── SpatialGDKTests │ │ ├── Examples │ │ ├── SpatialGDKExampleTest.cpp │ │ └── SpatialGDKTestGuidelines.h │ │ ├── Private │ │ ├── SpatialGDKTestsModule.cpp │ │ └── SpatialGDKTestsPrivate.h │ │ ├── Public │ │ └── SpatialGDKTestsModule.h │ │ ├── SpatialGDK │ │ ├── EngineClasses │ │ │ ├── SpatialVirtualWorkerTranslationManager │ │ │ │ └── SpatialVirtualWorkerTranslationManagerTest.cpp │ │ │ └── SpatialVirtualWorkerTranslator │ │ │ │ └── SpatialVirtualWorkerTranslatorTest.cpp │ │ ├── Interop │ │ │ ├── Connection │ │ │ │ ├── SpatialConnectionManagerTest.cpp │ │ │ │ ├── SpatialOSWorkerInterface │ │ │ │ │ ├── SpatialOSWorkerConnectionSpy.cpp │ │ │ │ │ └── SpatialOSWorkerConnectionSpy.h │ │ │ │ └── SpatialWorkerConnectionTest.cpp │ │ │ ├── SpatialOSDispatcherInterface │ │ │ │ ├── SpatialOSDispatcherSpy.cpp │ │ │ │ └── SpatialOSDispatcherSpy.h │ │ │ └── SpatialWorkerFlags │ │ │ │ ├── SpatialWorkerFlagsTest.cpp │ │ │ │ ├── WorkerFlagsTestSpyObject.cpp │ │ │ │ └── WorkerFlagsTestSpyObject.h │ │ ├── LoadBalanceEnforcer │ │ │ └── SpatialLoadBalanceEnforcerTest.cpp │ │ ├── LoadBalancing │ │ │ ├── AbstractLBStrategy │ │ │ │ └── LBStrategyStub.h │ │ │ ├── GridBasedLBStrategy │ │ │ │ ├── GridBasedLBStrategyTest.cpp │ │ │ │ ├── TestGridBasedLBStrategy.cpp │ │ │ │ └── TestGridBasedLBStrategy.h │ │ │ ├── LayeredLBStrategy │ │ │ │ ├── LayeredLBStrategyTest.cpp │ │ │ │ └── TestLayeredLBStrategy.h │ │ │ └── OwnershipLockingPolicy │ │ │ │ └── OwnershipLockingPolicyTest.cpp │ │ ├── Schema │ │ │ └── UnrealObjectRef │ │ │ │ └── UnrealObjectRefTests.cpp │ │ └── Utils │ │ │ ├── CheckoutRadiusConstraintUtils │ │ │ └── NetCullDistanceInterestTest.cpp │ │ │ ├── Misc │ │ │ └── SpatialActivationFlagsTest.cpp │ │ │ └── RPCContainer │ │ │ ├── ObjectDummy.cpp │ │ │ ├── ObjectDummy.h │ │ │ ├── ObjectSpy.cpp │ │ │ ├── ObjectSpy.h │ │ │ ├── ObjectStub.cpp │ │ │ ├── ObjectStub.h │ │ │ └── RPCContainerTest.cpp │ │ ├── SpatialGDKEditor │ │ └── SpatialGDKEditorSchemaGenerator │ │ │ ├── ExpectedSchema │ │ │ ├── NonSpatialTypeActor.schema │ │ │ ├── SpatialTypeActor.schema │ │ │ ├── SpatialTypeActorComponent.schema │ │ │ ├── SpatialTypeActorWithActorComponent.schema │ │ │ ├── SpatialTypeActorWithMultipleActorComponents.schema │ │ │ ├── SpatialTypeActorWithMultipleObjectComponents.schema │ │ │ └── rpc_endpoints.schema │ │ │ ├── ExpectedSchema_425 │ │ │ ├── NonSpatialTypeActor.schema │ │ │ ├── SpatialTypeActor.schema │ │ │ ├── SpatialTypeActorComponent.schema │ │ │ ├── SpatialTypeActorWithActorComponent.schema │ │ │ ├── SpatialTypeActorWithMultipleActorComponents.schema │ │ │ ├── SpatialTypeActorWithMultipleObjectComponents.schema │ │ │ └── rpc_endpoints.schema │ │ │ ├── SchemaGenObjectStub.cpp │ │ │ ├── SchemaGenObjectStub.h │ │ │ └── SpatialGDKEditorSchemaGeneratorTest.cpp │ │ ├── SpatialGDKServices │ │ └── LocalDeploymentManager │ │ │ ├── LocalDeploymentManagerTest.cpp │ │ │ ├── LocalDeploymentManagerUtilities.cpp │ │ │ └── LocalDeploymentManagerUtilities.h │ │ └── SpatialGDKTests.Build.cs └── SpatialGDK.uplugin └── ci ├── README.md ├── ReleaseTool.Tests ├── ReleaseTool.Tests.csproj └── UpdateChangelogTests.cs ├── ReleaseTool ├── AssemblyInfo.cs ├── BuildkiteAgent.cs ├── Common.cs ├── EntryPoint.cs ├── GitClient.cs ├── GitHubClient.cs ├── PrepCommand.cs ├── ReleaseCommand.cs ├── ReleaseTool.csproj └── WorkingDirectoryScope.cs ├── Tools.sln ├── build-and-send-slack-notification.ps1 ├── build-project.ps1 ├── build-project.sh ├── check-version-file.sh ├── cleanup.ps1 ├── cleanup.sh ├── common-release.sh ├── common.ps1 ├── docker ├── entrypoint.sh └── release-tool.Dockerfile ├── gdk_build.template.steps.yaml ├── generate-and-upload-build-steps.sh ├── generate-release-qa-trigger.sh ├── generate-unrealengine-premerge-trigger.sh ├── get-engine.ps1 ├── get-engine.sh ├── prepare-release.sh ├── release.sh ├── report-tests.ps1 ├── run-tests.ps1 ├── run-tests.sh ├── setup-build-test-gdk.ps1 ├── setup-build-test-gdk.sh ├── setup-gdk.ps1 ├── unreal-engine.version └── upload-test-metrics.sh /.buildkite/.gitignore: -------------------------------------------------------------------------------- 1 | !*.yaml -------------------------------------------------------------------------------- /.buildkite/hooks/pre-command: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -u -o pipefail 4 | if [[ -n "${DEBUG-}" ]]; then 5 | set -x 6 | fi 7 | 8 | if [[ ${BUILDKITE_AGENT_META_DATA_OS} == darwin* ]]; then 9 | ./ci/cleanup.sh 10 | elif [[ ${BUILDKITE_AGENT_META_DATA_OS} == linux* ]]; then 11 | echo "Running a linux agent, no need for any cleanup." 12 | exit 0 13 | else 14 | powershell -noprofile -noninteractive -file "./ci/cleanup.ps1" 15 | fi 16 | -------------------------------------------------------------------------------- /.buildkite/premerge.definition.yaml: -------------------------------------------------------------------------------- 1 | agent_queue_id: trigger-pipelines 2 | description: Build Unreal GDK 3 | github: 4 | branch_configuration: [] 5 | default_branch: "master" 6 | pull_request_branch_filter_configuration: [] 7 | teams: 8 | - name: Everyone 9 | permission: BUILD_AND_READ 10 | - name: gbu/develop/unreal 11 | permission: MANAGE_BUILD_AND_READ -------------------------------------------------------------------------------- /.buildkite/release.definition.yaml: -------------------------------------------------------------------------------- 1 | agent_queue_id: trigger-pipelines 2 | description: Releases all UnrealGDK associated repos to `release` branches. 3 | github: 4 | branch_configuration: [] 5 | default_branch: master 6 | pull_request_branch_filter_configuration: [] 7 | teams: 8 | - name: Everyone 9 | permission: READ_ONLY 10 | - name: gbu/develop/unreal 11 | permission: MANAGE_BUILD_AND_READ 12 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | [*] 7 | charset = utf-8 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | indent_style = space 11 | 12 | [*.version] 13 | insert_final_newline = false 14 | 15 | [*.cs] 16 | indent_size = 4 17 | 18 | [*.{cpp,h}] 19 | indent_style = tab 20 | 21 | [*.json] 22 | indent_size = 2 23 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | *.go text eol=lf 3 | 4 | # Bat files should not be normalized 5 | *.bat -text 6 | 7 | # Don't count vendored go code as part of language stats. 8 | go/src/improbable.io/vendor/* linguist-vendored 9 | -------------------------------------------------------------------------------- /.github/issue-template.md: -------------------------------------------------------------------------------- 1 | 2 | We are accepting issues and we want your [feedback](../README.md#give-us-feedback). 3 | 4 | ------- 5 | 6 | ## Description 7 | Describe your issue. 8 | 9 | ## Expected behavior 10 | Tell us what should happen. 11 | 12 | ## Current behavior 13 | Tell us what happens instead of the expected behavior. 14 | 15 | ## Possible solution 16 | This is not obligatory but if you have a preference, please suggest a fix for the bug. 17 | 18 | ## Steps to reproduce 19 | Provide an unambiguous set of steps to reproduce this bug. Include code snippets if relevant. 20 | 21 | 1. 22 | 2. 23 | 3. 24 | 4. 25 | 26 | ## Environment 27 | What were you trying to accomplish? 28 | 29 | Please include your spatial diagnose output in full. 30 | 31 | Please detail your OS and Unreal Engine versions. 32 | 33 | Provide a general summary of the issue in the title field above. -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | ## Contributions policy 2 | 3 | We welcome contributions, subject to the signing of our Contributor License Agreement (CLA). Our CLA is the licence on which our contributors submit their contributions to us. The purpose of this is to grant us, Improbable, the right to use those contributions. This is an industry standard process for accepting contributions, as it creates clarity between both parties about the licence terms for any contributions. 4 | 5 | The terms of the CLA are set out [here](https://drive.google.com/file/d/0B6CKLzAF0ahqVURSTVdZS29MYXg5VWkzdFRHNmY2S25keHJj/view?usp=sharing), please ensure that you review these terms prior to submitting any contributions. 6 | 7 | If you wish to submit a contribution on the terms of our CLA, please contact cla@improbable.io to receive a copy of the CLA to sign and return to Improbable. 8 | 9 | ## Feedback 10 | 11 | We welcome any and all 12 | [feedback](./README.md#give-us-feedback) on the GDK and SpatialOS. 13 | 14 | ## Coding standards 15 | 16 | See the [GDK for Unreal C++ coding standards guide](./SpatialGDK/Documentation/contributions/unreal-gdk-coding-standards.md). 17 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | Copyright 2019 Improbable Worlds Limited 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 4 | 5 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 6 | 7 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 8 | -------------------------------------------------------------------------------- /OWNERS.yml: -------------------------------------------------------------------------------- 1 | --- 2 | filters: 3 | 'CHANGELOG\.md$': 4 | approvers: 5 | - sig-tech-writers 6 | labels: 7 | - docs/changelog 8 | -------------------------------------------------------------------------------- /OWNERS_ALIASES.yml: -------------------------------------------------------------------------------- 1 | aliases: 2 | sig-tech-writers: 3 | - anne-edwards # Anne Edwards 4 | - ElleEss # Laura Holmwood 5 | - SPPWilliams # Simon Williams 6 | -------------------------------------------------------------------------------- /RequireSetup: -------------------------------------------------------------------------------- 1 | Increment the below number whenever it is required to run Setup.bat as part of a new commit. 2 | Our git hooks will detect this file has been updated and automatically run Setup.bat on pull. 3 | 4 | 61 5 | -------------------------------------------------------------------------------- /SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/Build/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/CodeGenerator/Base/ICodeGenerator.cs: -------------------------------------------------------------------------------- 1 | using Improbable.CodeGen.Base; 2 | using System.Collections.Generic; 3 | 4 | namespace Improbable.Codegen.Base 5 | { 6 | public interface ICodeGenerator 7 | { 8 | List GenerateFiles(Bundle bundle); 9 | } 10 | 11 | public class GeneratedFile 12 | { 13 | public GeneratedFile(string RelativeFilePath, string Contents) 14 | { 15 | this.RelativeFilePath = RelativeFilePath; 16 | this.Contents = Contents; 17 | } 18 | public string RelativeFilePath { get; set; } 19 | public string Contents { get; set; } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/CodeGenerator/Base/SchemaBundleLoader.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Text; 3 | using Newtonsoft.Json; 4 | using Newtonsoft.Json.Serialization; 5 | 6 | namespace Improbable.CodeGen.Base 7 | { 8 | public static class SchemaBundleLoader 9 | { 10 | public static Bundle LoadBundle(string filename) 11 | { 12 | if (!File.Exists(filename)) 13 | { 14 | throw new FileNotFoundException($"Could not find schema bundle file at {Path.GetFullPath(filename)}"); 15 | } 16 | 17 | var contractResolver = new DefaultContractResolver 18 | { 19 | NamingStrategy = new PascalCaseNamingStrategy() 20 | }; 21 | 22 | var settings = new JsonSerializerSettings 23 | { 24 | ContractResolver = contractResolver, 25 | MissingMemberHandling = MissingMemberHandling.Error 26 | }; 27 | 28 | var bundleFile = JsonConvert.DeserializeObject(File.ReadAllText(filename, Encoding.UTF8), settings); 29 | 30 | return new Bundle(bundleFile); 31 | } 32 | 33 | private class PascalCaseNamingStrategy : NamingStrategy 34 | { 35 | protected override string ResolvePropertyName(string name) 36 | { 37 | var pascal = char.ToLowerInvariant(name[0]) + name.Substring(1, name.Length - 1); 38 | return pascal; 39 | } 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/CodeGenerator/Unreal/EnumGenerator.cs: -------------------------------------------------------------------------------- 1 | using Improbable.CodeGen.Base; 2 | using System; 3 | using System.Linq; 4 | 5 | namespace Improbable.CodeGen.Unreal 6 | { 7 | static class EnumGenerator 8 | { 9 | public static string GenerateTopLevelEnum(EnumDefinition enumDefinition, Bundle bundle) 10 | { 11 | var enumNamespace = Text.GetNamespaceFromTypeName(enumDefinition.QualifiedName); 12 | 13 | return $@"// Generated by {UnrealGenerator.GeneratorTitle} 14 | 15 | #pragma once 16 | 17 | #include 18 | #include 19 | 20 | {string.Join(Environment.NewLine, enumNamespace.Select(t => $"namespace {t} {{"))} 21 | 22 | {GenerateEnum(enumDefinition.Name, enumDefinition, bundle)} 23 | 24 | {string.Join(Environment.NewLine, enumNamespace.Reverse().Select(t => $"}} // namespace {t}"))} 25 | "; 26 | } 27 | 28 | public static string GenerateEnum(string name, EnumDefinition enumDefinition, Bundle bundle) 29 | { 30 | 31 | return $@"// Generated from {bundle.TypeToFileName[enumDefinition.QualifiedName]}({enumDefinition.SourceReference.Line},{enumDefinition.SourceReference.Column}) 32 | enum class {name} : uint32 33 | {{ 34 | {Text.Indent(1, string.Join(Environment.NewLine, enumDefinition.Values.Select(v => $"{v.Name} = {v.Value},")))} 35 | }};"; 36 | } 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/CodeGenerator/Unreal/MapEquals.cs: -------------------------------------------------------------------------------- 1 | using Improbable.Codegen.Base; 2 | using Improbable.CodeGen.Base; 3 | using System.Collections.Generic; 4 | 5 | namespace Improbable.CodeGen.Unreal 6 | { 7 | public static class MapEquals 8 | { 9 | public static string HeaderName = "MapEquals.h"; 10 | 11 | public static List GenerateMapEquals() 12 | { 13 | return new List 14 | { 15 | new GeneratedFile(HeaderName, GenerateHeader()), 16 | }; 17 | } 18 | 19 | private static string GenerateHeader() 20 | { 21 | return $@"#pragma once 22 | 23 | template 24 | bool operator==(TMap Map1, TMap Map2) 25 | {{ 26 | {Text.Indent(1, $@"if (Map1.Num() != Map2.Num()) 27 | {{ 28 | {Text.Indent(1, "return false;")} 29 | }} 30 | for (const TPair& Elem : Map1) 31 | {{ 32 | {Text.Indent(1, $@"if (Elem.Value != Map2.FindRef(Elem.Key)) 33 | {{ 34 | {Text.Indent(1, "return false;")} 35 | }}")} 36 | }} 37 | return true;")} 38 | }} 39 | "; 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/WorkerCoordinator/SpatialConfig/cloud_launch_sim_player_deployment.json: -------------------------------------------------------------------------------- 1 | { 2 | "template": "sim_players", 3 | "world": { 4 | "chunkEdgeLengthMeters": 50, 5 | "snapshots": { 6 | "snapshotWritePeriodSeconds": 0 7 | }, 8 | "dimensions": { 9 | "xMeters": 300, 10 | "zMeters": 300 11 | } 12 | }, 13 | "load_balancing": { 14 | "layer_configurations": [ 15 | { 16 | "layer": "SimulatedPlayerCoordinator", 17 | "rectangle_grid": { 18 | "cols": 10, 19 | "rows": 1 20 | } 21 | } 22 | ] 23 | }, 24 | "workers": [ 25 | { 26 | "worker_type": "SimulatedPlayerCoordinator", 27 | "flags": [ 28 | { 29 | "name": "coordinator_start_delay_millis", 30 | "value": "10000" 31 | } 32 | ], 33 | "permissions": [ 34 | { 35 | "all": {} 36 | } 37 | ] 38 | } 39 | ] 40 | } -------------------------------------------------------------------------------- /SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/WriteLinuxScript/WriteLinuxScript.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | using System; 4 | using System.IO; 5 | using System.Linq; 6 | using Improbable.Unreal.Build.Common; 7 | 8 | namespace Improbable.Unreal.Build.Util 9 | { 10 | public static class WriteLinuxScript 11 | { 12 | public static void Main(string[] args) 13 | { 14 | var help = args.Count(arg => arg == "/?" || arg.ToLowerInvariant() == "--help") > 0; 15 | 16 | var exitCode = 0; 17 | if (args.Length < 2 && !help) 18 | { 19 | help = true; 20 | exitCode = 1; 21 | } 22 | 23 | if (help) 24 | { 25 | Console.WriteLine("Usage: "); 26 | Environment.Exit(exitCode); 27 | } 28 | 29 | var outputFile = Path.GetFullPath(args[0]); 30 | var baseGameName = args[1]; 31 | 32 | Improbable.Common.WriteHeading(" > Writing Linux worker start script."); 33 | 34 | // Write out the wrapper shell script to work around issues between UnrealEngine and our cloud Linux environments. 35 | // Also ensure script uses Linux line endings 36 | LinuxScripts.WriteWithLinuxLineEndings(LinuxScripts.GetUnrealWorkerShellScript(baseGameName), outputFile); 37 | } 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/packages/Newtonsoft.Json.12.0.2/LICENSE.md: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2007 James Newton-King 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of 6 | this software and associated documentation files (the "Software"), to deal in 7 | the Software without restriction, including without limitation the rights to 8 | use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 9 | the Software, and to permit persons to whom the Software is furnished to do so, 10 | 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, FITNESS 17 | FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 18 | COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 19 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 20 | CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | -------------------------------------------------------------------------------- /SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/packages/Newtonsoft.Json.12.0.2/lib/net45/Newtonsoft.Json.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/packages/Newtonsoft.Json.12.0.2/lib/net45/Newtonsoft.Json.dll -------------------------------------------------------------------------------- /SpatialGDK/Build/Scripts/DeploymentLauncher.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set DEPLOYMENT_LAUNCHER_EXE_PATH="%~dp0..\..\Binaries\ThirdParty\Improbable\Programs\DeploymentLauncher\DeploymentLauncher.exe" 4 | 5 | if not exist %DEPLOYMENT_LAUNCHER_EXE_PATH% ( 6 | echo Error: Deployment launcher executable not found! Please run Setup.bat in your UnrealGDK root to generate it. 7 | pause 8 | exit /b 1 9 | ) 10 | 11 | %DEPLOYMENT_LAUNCHER_EXE_PATH% %* 12 | 13 | pause 14 | 15 | exit /b %ERRORLEVEL% 16 | -------------------------------------------------------------------------------- /SpatialGDK/Build/Scripts/FindMSBuild.bat: -------------------------------------------------------------------------------- 1 | rem Convenient code to find MSBuild.exe from https://github.com/microsoft/vswhere 2 | 3 | @echo off 4 | 5 | if not defined MSBUILD_EXE ( 6 | set MSBUILD_EXE= 7 | 8 | if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" ( 9 | for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -latest -products * -requires Microsoft.Component.MSBuild -find MSBuild\**\Bin\MSBuild.exe`) do ( 10 | if exist %%i ( 11 | set MSBUILD_EXE="%%i" 12 | exit /b 0 13 | ) 14 | ) 15 | ) 16 | 17 | for /f "usebackq tokens=*" %%i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere" -prerelease -latest -requires Microsoft.Component.MSBuild -property installationPath`) do ( 18 | if exist "%%i\MSBuild\Current\Bin\MSBuild.exe" ( 19 | set MSBUILD_EXE="%%i\MSBuild\Current\Bin\MSBuild.exe" 20 | exit /b 0 21 | ) 22 | 23 | if exist "%%i\MSBuild\15.0\Bin\MSBuild.exe" ( 24 | set MSBUILD_EXE="%%i\MSBuild\15.0\Bin\MSBuild.exe" 25 | exit /b 0 26 | ) 27 | ) 28 | 29 | exit /b 1 30 | ) 31 | -------------------------------------------------------------------------------- /SpatialGDK/Content/SpatialDebugger/BP_SpatialDebugger.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Content/SpatialDebugger/BP_SpatialDebugger.uasset -------------------------------------------------------------------------------- /SpatialGDK/Content/SpatialDebugger/Materials/TranslucentWorkerRegion.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Content/SpatialDebugger/Materials/TranslucentWorkerRegion.uasset -------------------------------------------------------------------------------- /SpatialGDK/Content/SpatialDebugger/Textures/Auth.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Content/SpatialDebugger/Textures/Auth.uasset -------------------------------------------------------------------------------- /SpatialGDK/Content/SpatialDebugger/Textures/AuthIntent.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Content/SpatialDebugger/Textures/AuthIntent.uasset -------------------------------------------------------------------------------- /SpatialGDK/Content/SpatialDebugger/Textures/Box.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Content/SpatialDebugger/Textures/Box.uasset -------------------------------------------------------------------------------- /SpatialGDK/Content/SpatialDebugger/Textures/LockClosed.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Content/SpatialDebugger/Textures/LockClosed.uasset -------------------------------------------------------------------------------- /SpatialGDK/Content/SpatialDebugger/Textures/LockOpen.uasset: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Content/SpatialDebugger/Textures/LockOpen.uasset -------------------------------------------------------------------------------- /SpatialGDK/Documentation/README.md: -------------------------------------------------------------------------------- 1 | # The SpatialOS GDK for Unreal documentation 2 | 3 | The GDK's documentation is available at https://documentation.improbable.io/gdk-for-unreal/docs. -------------------------------------------------------------------------------- /SpatialGDK/Documentation/spatialos-gdkforunreal-header.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Documentation/spatialos-gdkforunreal-header.png -------------------------------------------------------------------------------- /SpatialGDK/Extras/core-sdk.version: -------------------------------------------------------------------------------- 1 | 14.6.1 2 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/git/post-merge: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | changed_files="$(git diff-tree -r --name-only --no-commit-id ORIG_HEAD HEAD)" 4 | echo "${changed_files}" | grep --quiet "RequireSetup" && sh Setup.sh 5 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/linting/Fix.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | setlocal 4 | 5 | pushd "%~dp0..\" 6 | 7 | set LINTER_EXE="Binaries\ThirdParty\Improbable\Programs\Linter.exe" 8 | if not exist %LINTER_EXE% ( 9 | echo Error: Could not find %LINTER_EXE%. Please run Setup.bat in your UnrealGDK root to generate it. 10 | pause 11 | exit /b 1 12 | ) 13 | 14 | echo This will analyze the SpatialGDK module and plugins for any formatting issues and fix them. 15 | set /p CONTINUE=Would you like to continue?[Y/N]: 16 | if /I "%CONTINUE%" == "Y" ( 17 | %LINTER_EXE% fix "Source\SpatialGDK\Public" ^ 18 | "Source\SpatialGDK\Private" ^ 19 | "Source\SpatialGDK\Legacy" ^ 20 | "Plugins" 21 | ) 22 | 23 | popd 24 | 25 | pause 26 | exit /b %ERRORLEVEL% 27 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/linting/Test.bat: -------------------------------------------------------------------------------- 1 | @if not defined TEAMCITY_CAPTURE_ENV ( echo off ) else ( echo on ) 2 | 3 | setlocal 4 | 5 | pushd "%~dp0..\" 6 | 7 | call :MarkStartOfBlock "%~0" 8 | 9 | set LINTER_EXE="Binaries\ThirdParty\Improbable\Programs\Linter.exe" 10 | if not exist %LINTER_EXE% ( 11 | echo Error: Could not find %LINTER_EXE%. Please run Setup.bat in your UnrealGDK root to generate it. 12 | if not defined TEAMCITY_CAPTURE_ENV pause 13 | exit /b 1 14 | ) 15 | 16 | %LINTER_EXE% check "Source\SpatialGDK\Public" ^ 17 | "Source\SpatialGDK\Private" ^ 18 | "Source\SpatialGDK\Legacy" ^ 19 | "Plugins" 20 | 21 | call :MarkEndOfBlock "%~0" 22 | 23 | popd 24 | 25 | if not defined TEAMCITY_CAPTURE_ENV pause 26 | exit /b %ERRORLEVEL% 27 | 28 | :MarkStartOfBlock 29 | if defined TEAMCITY_CAPTURE_ENV ( 30 | echo ##teamcity[blockOpened name='%~1'] 31 | ) else ( 32 | echo Starting: %~1 33 | ) 34 | exit /b 0 35 | 36 | :MarkEndOfBlock 37 | if defined TEAMCITY_CAPTURE_ENV ( 38 | echo ##teamcity[blockClosed name='%~1'] 39 | ) else ( 40 | echo Finished: %~1 41 | ) 42 | exit /b 0 43 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/schema/authority_intent.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | package unreal; 3 | 4 | component AuthorityIntent { 5 | id = 9980; 6 | // Id assigned to the Unreal server worker which should be authoritative for this entity. 7 | // 0 is reserved as an invalid/unset value. 8 | uint32 virtual_worker_id = 1; 9 | } 10 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/schema/component_presence.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | package unreal; 3 | 4 | // The ComponentPresence component should be present on all entities. 5 | component ComponentPresence { 6 | id = 9972; 7 | 8 | // The component_list is a list of component IDs that should be present on 9 | // this entity. This should be useful in future for deducing entity completeness 10 | // without critical sections but is used currently just for enabling dynamic 11 | // components in a multi-worker environment. 12 | list component_list = 1; 13 | } 14 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/schema/core_types.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | package unreal; 3 | 4 | type Void { 5 | } 6 | 7 | // Below, option property types are used for boolean behaviour where an empty 8 | // boolean indicates false. This is cheaper for having that property set to false 9 | // because empty options types involve no idea being sent across the network. 10 | type UnrealObjectRef { 11 | EntityId entity = 1; 12 | uint32 offset = 2; 13 | option path = 3; 14 | // Not all objects should be loaded on clients as a result of resolving 15 | // a reference, e.g. anything inside streaming levels should not be loaded. 16 | option no_load_on_client = 4; 17 | option outer = 5; 18 | // Actors such as the game state, game mode and level script Actors (formerly 19 | // known as Singletons) can be referred to by their class path in the case of an 20 | // authoritative server that hasn't checked the singleton entity yet. This bool 21 | // will indicate that non-auth servers should try to load such Actors from 22 | // their package map. 23 | option use_class_path_to_load_object = 6; 24 | } 25 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/schema/debug_metrics.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | package unreal; 3 | 4 | import "unreal/gdk/core_types.schema"; 5 | 6 | type ModifySettingPayload { 7 | string setting_name = 1; 8 | float setting_value = 2; 9 | } 10 | 11 | component DebugMetrics { 12 | id = 9984; 13 | command Void start_rpc_metrics(Void); 14 | command Void stop_rpc_metrics(Void); 15 | command Void modify_spatial_settings(ModifySettingPayload); 16 | } 17 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/schema/global_state_manager.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | package unreal; 3 | 4 | type ShutdownMultiProcessRequest { 5 | } 6 | 7 | type ShutdownMultiProcessResponse { 8 | } 9 | 10 | type ShutdownAdditionalServersEvent { 11 | } 12 | 13 | component DeploymentMap { 14 | id = 9994; 15 | string map_url = 1; 16 | bool accepting_players = 2; 17 | uint32 session_id = 3; 18 | uint32 schema_hash = 4; 19 | } 20 | 21 | component StartupActorManager { 22 | id = 9993; 23 | bool can_begin_play = 1; 24 | } 25 | 26 | component GSMShutdown { 27 | id = 9992; 28 | command ShutdownMultiProcessResponse begin_shutdown_multiprocess(ShutdownMultiProcessRequest); 29 | event ShutdownAdditionalServersEvent shutdown_additional_servers; 30 | } 31 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/schema/heartbeat.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | package unreal; 3 | 4 | type HeartbeatEvent { 5 | } 6 | 7 | component Heartbeat { 8 | id = 9991; 9 | event HeartbeatEvent heartbeat; 10 | bool client_has_quit = 1; 11 | } 12 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/schema/net_owning_client_worker.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | package unreal; 3 | 4 | // The NetOwningClientWorker component should be present on all entities 5 | // representing Actors or subobjects which can have owning connections. 6 | component NetOwningClientWorker { 7 | id = 9971; 8 | 9 | // The worker_id is an optional worker ID string that is set by the 10 | // simulating worker when the Actor or subobject becomes net-owned by 11 | // a client connection. The enforcer uses this value to update the 12 | // EntityACL entry for the client RPC endpoint (and Heartbeat component, 13 | // if present). 14 | option worker_id = 1; 15 | } 16 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/schema/not_streamed.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | package unreal; 3 | 4 | // Actor that is a part of the PersistentLevel or created with SpawnActor 5 | component NotStreamed { 6 | id = 9986; 7 | } 8 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/schema/relevant.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | package unreal; 3 | 4 | component AlwaysRelevant { 5 | id = 9983; 6 | } 7 | 8 | component Dormant { 9 | id = 9981; 10 | } 11 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/schema/rpc_components.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | package unreal; 3 | 4 | import "unreal/gdk/core_types.schema"; 5 | import "unreal/gdk/rpc_payload.schema"; 6 | 7 | component UnrealClientRPCEndpointLegacy { 8 | id = 9990; 9 | // Set to true when authority is gained, indicating that RPCs can be received 10 | bool ready = 1; 11 | event UnrealRPCPayload client_to_server_rpc_event; 12 | } 13 | 14 | component UnrealServerRPCEndpointLegacy { 15 | id = 9989; 16 | // Set to true when authority is gained, indicating that RPCs can be received 17 | bool ready = 1; 18 | event UnrealRPCPayload server_to_client_rpc_event; 19 | } 20 | 21 | component UnrealServerToServerCommandEndpoint { 22 | id = 9973; 23 | command Void server_to_server_rpc_command(UnrealRPCPayload); 24 | } 25 | 26 | component UnrealMulticastRPCEndpointLegacy { 27 | id = 9987; 28 | event UnrealRPCPayload unreliable_multicast_rpc; 29 | } 30 | 31 | // Component that contains a list of RPCs to be executed 32 | // as a part of entity creation request 33 | component RPCsOnEntityCreation { 34 | id = 9985; 35 | list rpcs = 1; 36 | command Void clear_rpcs(Void); 37 | } 38 | 39 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/schema/rpc_payload.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | package unreal; 3 | 4 | type TracePayload { 5 | bytes trace_id = 1; 6 | bytes span_id = 2; 7 | } 8 | 9 | type UnrealRPCPayload { 10 | uint32 offset = 1; 11 | uint32 rpc_index = 2; 12 | bytes rpc_payload = 3; 13 | option rpc_trace = 4; 14 | } 15 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/schema/server_worker.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | package unreal; 3 | 4 | import "unreal/gdk/core_types.schema"; 5 | import "unreal/gdk/spawner.schema"; 6 | 7 | type ForwardSpawnPlayerRequest { 8 | SpawnPlayerRequest spawn_player_request = 1; 9 | UnrealObjectRef player_start = 2; 10 | string client_worker_id = 3; 11 | } 12 | 13 | type ForwardSpawnPlayerResponse { 14 | bool success = 1; 15 | } 16 | 17 | component ServerWorker { 18 | id = 9974; 19 | string worker_name = 1; 20 | bool ready_to_begin_play = 2; 21 | command ForwardSpawnPlayerResponse forward_spawn_player(ForwardSpawnPlayerRequest); 22 | } 23 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/schema/spatial_debugging.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | package unreal; 3 | 4 | component SpatialDebugging { 5 | id = 9975; 6 | 7 | // Id assigned to the Unreal server worker which is authoritative for this entity. 8 | // 0 is reserved as an invalid/unset value. 9 | uint32 authoritative_virtual_worker_id = 1; 10 | 11 | // The color for the authoritative virtual worker. 12 | uint32 authoritative_color = 2; 13 | 14 | // Id assigned to the Unreal server worker which should be authoritative for this entity. 15 | // 0 is reserved as an invalid/unset value. 16 | uint32 intent_virtual_worker_id = 3; 17 | 18 | // The color for the intended virtual worker. 19 | uint32 intent_color = 4; 20 | 21 | // Whether or not the entity is locked. 22 | bool is_locked = 5; 23 | } 24 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/schema/spawndata.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | package unreal; 3 | 4 | type Rotator { 5 | float pitch = 1; 6 | float yaw = 2; 7 | float roll = 3; 8 | } 9 | 10 | type Vector3f { 11 | float x = 1; 12 | float y = 2; 13 | float z = 3; 14 | } 15 | 16 | component SpawnData { 17 | // When Unreal replicates actors for the first time, it serializes their location, rotation, 18 | // scale, and velocity, regardless of whether the actor replicates movement. In our case, 19 | // location is represented by Spatial position, and this component contains the rest. 20 | id = 9999; 21 | Vector3f location = 1; 22 | Rotator rotation = 2; 23 | Vector3f scale = 3; 24 | Vector3f velocity = 4; 25 | } 26 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/schema/spawner.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | package unreal; 3 | 4 | type SpawnPlayerRequest { 5 | string url = 1; 6 | bytes unique_id = 2; 7 | string online_platform_name = 3; 8 | bool simulated = 4; 9 | } 10 | 11 | type SpawnPlayerResponse { } 12 | 13 | component PlayerSpawner { 14 | id = 9998; 15 | command SpawnPlayerResponse spawn_player(SpawnPlayerRequest); 16 | } 17 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/schema/tombstone.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | package unreal; 3 | 4 | component Tombstone { 5 | id = 9982; 6 | } 7 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/schema/unreal_metadata.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | package unreal; 3 | 4 | import "unreal/gdk/core_types.schema"; 5 | 6 | component UnrealMetadata { 7 | id = 9996; 8 | option stably_named_ref = 1; // Exists when entity represents a stably named Actor (RF_WasLoaded) 9 | string class_path = 2; 10 | option net_startup = 3; // Exists only when entity has a stably_named_ref 11 | } 12 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/schema/virtual_worker_translation.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | package unreal; 3 | 4 | // The VirtualWorkerMapping tells the system which physical worker should currently be simulating 5 | // an area assigned to a given virtual worker ID. The virtual worker ID is assigned by the 6 | // authoritative VirtualWorkerTranslator and that is responsible for keeping the Translation records 7 | // up to date. 8 | 9 | type VirtualWorkerMapping { 10 | uint32 virtual_worker_id = 1; 11 | string physical_worker_name = 2; 12 | EntityId server_worker_entity = 3; 13 | } 14 | 15 | component VirtualWorkerTranslation { 16 | id = 9979; 17 | transient list virtual_worker_mapping = 1; 18 | } 19 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/spot.version: -------------------------------------------------------------------------------- 1 | 20191029.144741.87a7d78768 2 | -------------------------------------------------------------------------------- /SpatialGDK/Extras/worker-sdk-upgrade.md: -------------------------------------------------------------------------------- 1 | # Upgrading the Worker SDK version 2 | 3 | When upgrading the Worker SDK version for the Unreal GDK, you also need to follow some additional steps to ensure that the Worker SDK works with Unreal. 4 | 5 | ## Update the OpenSSL version for iOS 6 | 7 | Check whether the Worker SDK has changed their OpenSSL version. If yes, check in the [OpenSSL.Build.cs](https://github.com/improbableio/UnrealEngine/blob/4.22-SpatialOSUnrealGDK-release/Engine/Source/ThirdParty/OpenSSL/OpenSSL.Build.cs) whether we link compatible headers for iOS. If not, you will have to update this file and add the necessary headers to the Engine. 8 | This is necessary to ensure that iOS works as expected. 9 | 10 | To test whether it works you need to start a local deployment, build out an iOS client that is able to connect to that local deployment and see whether it crashes. If the versions are not compatible, it should fail when calling `ConnectAsync` inside the Worker SDK due to the wrong symbols being loaded. -------------------------------------------------------------------------------- /SpatialGDK/Raw/SpatialDebugger/Textures/Auth.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Raw/SpatialDebugger/Textures/Auth.png -------------------------------------------------------------------------------- /SpatialGDK/Raw/SpatialDebugger/Textures/AuthIntent.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Raw/SpatialDebugger/Textures/AuthIntent.png -------------------------------------------------------------------------------- /SpatialGDK/Raw/SpatialDebugger/Textures/Box.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Raw/SpatialDebugger/Textures/Box.png -------------------------------------------------------------------------------- /SpatialGDK/Raw/SpatialDebugger/Textures/LockClosed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Raw/SpatialDebugger/Textures/LockClosed.png -------------------------------------------------------------------------------- /SpatialGDK/Raw/SpatialDebugger/Textures/LockOpen.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Raw/SpatialDebugger/Textures/LockOpen.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/Cloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/Cloud.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/Cloud@0.5x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/Cloud@0.5x.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/Icon128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/Icon128.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/Inspector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/Inspector.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/Inspector@0.5x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/Inspector@0.5x.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/None.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/None.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/None@0.5x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/None@0.5x.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/SPATIALOS_LOGO_WHITE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/SPATIALOS_LOGO_WHITE.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/Schema.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/Schema.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/Schema@0.5x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/Schema@0.5x.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/Snapshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/Snapshot.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/Snapshot@0.5x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/Snapshot@0.5x.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/StartCloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/StartCloud.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/StartCloud@0.5x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/StartCloud@0.5x.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/StartLocal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/StartLocal.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/StartLocal@0.5x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/StartLocal@0.5x.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/StopCloud.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/StopCloud.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/StopCloud@0.5x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/StopCloud@0.5x.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/StopLocal.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/StopLocal.png -------------------------------------------------------------------------------- /SpatialGDK/Resources/StopLocal@0.5x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/spatialos/UnrealGDK/884b06543c9216e9ac57b62d4d7bbc1eaf83ce27/SpatialGDK/Resources/StopLocal@0.5x.png -------------------------------------------------------------------------------- /SpatialGDK/Source/.gitignore: -------------------------------------------------------------------------------- 1 | Generated/ 2 | WorkerSDK/ -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Private/EngineClasses/Components/ActorInterestComponent.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "EngineClasses/Components/ActorInterestComponent.h" 4 | 5 | #include "Schema/Interest.h" 6 | #include "Interop/SpatialClassInfoManager.h" 7 | 8 | void UActorInterestComponent::PopulateFrequencyToConstraintsMap(const USpatialClassInfoManager& ClassInfoManager, SpatialGDK::FrequencyToConstraintsMap& OutFrequencyToQueryConstraints) const 9 | { 10 | // Loop through the user specified queries to extract the constraints and frequencies. 11 | // We don't construct the actual query at this point because the interest factory enforces the result types. 12 | for (const auto& QueryData : Queries) 13 | { 14 | if (!QueryData.Constraint) 15 | { 16 | continue; 17 | } 18 | 19 | SpatialGDK::QueryConstraint NewQueryConstraint{}; 20 | QueryData.Constraint->CreateConstraint(ClassInfoManager, NewQueryConstraint); 21 | 22 | // If there is already a query defined with this frequency, group them to avoid making too many queries down the line. 23 | // This avoids any extra cost due to duplicate result types across the network if they are large. 24 | if (OutFrequencyToQueryConstraints.Find(QueryData.Frequency)) 25 | { 26 | OutFrequencyToQueryConstraints.Find(QueryData.Frequency)->Add(NewQueryConstraint); 27 | continue; 28 | } 29 | 30 | TArray ConstraintList = { NewQueryConstraint }; 31 | OutFrequencyToQueryConstraints.Add(QueryData.Frequency, ConstraintList); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialReplicationGraph.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "EngineClasses/SpatialReplicationGraph.h" 4 | 5 | #include "EngineClasses/SpatialActorChannel.h" 6 | #include "EngineClasses/SpatialNetDriver.h" 7 | 8 | UActorChannel* USpatialReplicationGraph::GetOrCreateSpatialActorChannel(UObject* TargetObject) 9 | { 10 | if (TargetObject != nullptr) 11 | { 12 | if (USpatialNetDriver* SpatialNetDriver = Cast(NetDriver)) 13 | { 14 | return SpatialNetDriver->GetOrCreateSpatialActorChannel(TargetObject); 15 | } 16 | 17 | checkNoEntry(); 18 | } 19 | 20 | return nullptr; 21 | } 22 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialWorkerFlags.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "Interop/SpatialWorkerFlags.h" 4 | 5 | bool USpatialWorkerFlags::GetWorkerFlag(const FString& InFlagName, FString& OutFlagValue) const 6 | { 7 | if (const FString* ValuePtr = WorkerFlags.Find(InFlagName)) 8 | { 9 | OutFlagValue = *ValuePtr; 10 | return true; 11 | } 12 | 13 | return false; 14 | } 15 | 16 | void USpatialWorkerFlags::ApplyWorkerFlagUpdate(const Worker_FlagUpdateOp& Op) 17 | { 18 | FString NewName = FString(UTF8_TO_TCHAR(Op.name)); 19 | 20 | if (Op.value != nullptr) 21 | { 22 | FString NewValue = FString(UTF8_TO_TCHAR(Op.value)); 23 | FString& ValueFlag = WorkerFlags.FindOrAdd(NewName); 24 | ValueFlag = NewValue; 25 | OnWorkerFlagsUpdated.Broadcast(NewName, NewValue); 26 | } 27 | else 28 | { 29 | WorkerFlags.Remove(NewName); 30 | } 31 | } 32 | 33 | void USpatialWorkerFlags::BindToOnWorkerFlagsUpdated(const FOnWorkerFlagsUpdatedBP& InDelegate) 34 | { 35 | OnWorkerFlagsUpdated.Add(InDelegate); 36 | } 37 | 38 | void USpatialWorkerFlags::UnbindFromOnWorkerFlagsUpdated(const FOnWorkerFlagsUpdatedBP& InDelegate) 39 | { 40 | OnWorkerFlagsUpdated.Remove(InDelegate); 41 | } 42 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Private/LoadBalancing/AbstractLBStrategy.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "LoadBalancing/AbstractLBStrategy.h" 4 | 5 | #include "EngineClasses/SpatialNetDriver.h" 6 | 7 | UAbstractLBStrategy::UAbstractLBStrategy() 8 | : Super() 9 | , LocalVirtualWorkerId(SpatialConstants::INVALID_VIRTUAL_WORKER_ID) 10 | { 11 | } 12 | 13 | void UAbstractLBStrategy::SetLocalVirtualWorkerId(VirtualWorkerId InLocalVirtualWorkerId) 14 | { 15 | LocalVirtualWorkerId = InLocalVirtualWorkerId; 16 | } 17 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Private/Schema/ClientEndpoint.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "Schema/ClientEndpoint.h" 4 | 5 | namespace SpatialGDK 6 | { 7 | 8 | ClientEndpoint::ClientEndpoint(const Worker_ComponentData& Data) 9 | : ReliableRPCBuffer(ERPCType::ServerReliable) 10 | , UnreliableRPCBuffer(ERPCType::ServerUnreliable) 11 | { 12 | ReadFromSchema(Schema_GetComponentDataFields(Data.schema_type)); 13 | } 14 | 15 | void ClientEndpoint::ApplyComponentUpdate(const Worker_ComponentUpdate& Update) 16 | { 17 | ReadFromSchema(Schema_GetComponentUpdateFields(Update.schema_type)); 18 | } 19 | 20 | void ClientEndpoint::ReadFromSchema(Schema_Object* SchemaObject) 21 | { 22 | RPCRingBufferUtils::ReadBufferFromSchema(SchemaObject, ReliableRPCBuffer); 23 | RPCRingBufferUtils::ReadBufferFromSchema(SchemaObject, UnreliableRPCBuffer); 24 | RPCRingBufferUtils::ReadAckFromSchema(SchemaObject, ERPCType::ClientReliable, ReliableRPCAck); 25 | RPCRingBufferUtils::ReadAckFromSchema(SchemaObject, ERPCType::ClientUnreliable, UnreliableRPCAck); 26 | } 27 | 28 | } // namespace SpatialGDK 29 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Private/Schema/MulticastRPCs.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "Schema/MulticastRPCs.h" 4 | 5 | namespace SpatialGDK 6 | { 7 | 8 | MulticastRPCs::MulticastRPCs(const Worker_ComponentData& Data) 9 | : MulticastRPCBuffer(ERPCType::NetMulticast) 10 | { 11 | ReadFromSchema(Schema_GetComponentDataFields(Data.schema_type)); 12 | } 13 | 14 | void MulticastRPCs::ApplyComponentUpdate(const Worker_ComponentUpdate& Update) 15 | { 16 | ReadFromSchema(Schema_GetComponentUpdateFields(Update.schema_type)); 17 | } 18 | 19 | void MulticastRPCs::ReadFromSchema(Schema_Object* SchemaObject) 20 | { 21 | RPCRingBufferUtils::ReadBufferFromSchema(SchemaObject, MulticastRPCBuffer); 22 | 23 | // This is a special field that is set when creating a MulticastRPCs component with initial RPCs. 24 | // The server that first gains authority over the component will set last sent RPC ID to be equal 25 | // to this so the clients that already checked out this entity can execute initial RPCs. 26 | Schema_FieldId FieldId = RPCRingBufferUtils::GetInitiallyPresentMulticastRPCsCountFieldId(); 27 | if (Schema_GetUint32Count(SchemaObject, FieldId) > 0) 28 | { 29 | InitiallyPresentMulticastRPCsCount = Schema_GetUint32(SchemaObject, FieldId); 30 | } 31 | } 32 | 33 | } // namespace SpatialGDK 34 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Private/Schema/ServerEndpoint.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "Schema/ServerEndpoint.h" 4 | 5 | namespace SpatialGDK 6 | { 7 | 8 | ServerEndpoint::ServerEndpoint(const Worker_ComponentData& Data) 9 | : ReliableRPCBuffer(ERPCType::ClientReliable) 10 | , UnreliableRPCBuffer(ERPCType::ClientUnreliable) 11 | { 12 | ReadFromSchema(Schema_GetComponentDataFields(Data.schema_type)); 13 | } 14 | 15 | void ServerEndpoint::ApplyComponentUpdate(const Worker_ComponentUpdate& Update) 16 | { 17 | ReadFromSchema(Schema_GetComponentUpdateFields(Update.schema_type)); 18 | } 19 | 20 | void ServerEndpoint::ReadFromSchema(Schema_Object* SchemaObject) 21 | { 22 | RPCRingBufferUtils::ReadBufferFromSchema(SchemaObject, ReliableRPCBuffer); 23 | RPCRingBufferUtils::ReadBufferFromSchema(SchemaObject, UnreliableRPCBuffer); 24 | RPCRingBufferUtils::ReadAckFromSchema(SchemaObject, ERPCType::ServerReliable, ReliableRPCAck); 25 | RPCRingBufferUtils::ReadAckFromSchema(SchemaObject, ERPCType::ServerUnreliable, UnreliableRPCAck); 26 | } 27 | 28 | } // namespace SpatialGDK 29 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Private/SimulatedPlayers/SimPlayerBPFunctionLibrary.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "SimulatedPlayers/SimPlayerBPFunctionLibrary.h" 4 | 5 | #include "Engine/GameInstance.h" 6 | #include "Kismet/GameplayStatics.h" 7 | 8 | DEFINE_LOG_CATEGORY_STATIC(LogSimulatedPlayer, Log, All); 9 | 10 | bool USimPlayerBPFunctionLibrary::IsSimulatedPlayer(const UObject* WorldContextObject) 11 | { 12 | UGameInstance* GameInstance = UGameplayStatics::GetGameInstance(WorldContextObject); 13 | if (GameInstance == nullptr) 14 | { 15 | UE_LOG(LogSimulatedPlayer, Warning, TEXT("Cannot check if player is simulated: cannot get GameInstance. Defaulting to false.")); 16 | return false; 17 | } 18 | 19 | return GameInstance->IsSimulatedPlayer(); 20 | } 21 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Private/SpatialGDKConsoleCommands.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "SpatialGDKConsoleCommands.h" 4 | 5 | #include "SpatialConstants.h" 6 | #include "Engine/Engine.h" 7 | 8 | DEFINE_LOG_CATEGORY(LogSpatialGDKConsoleCommands) 9 | 10 | namespace SpatialGDKConsoleCommands 11 | { 12 | void ConsoleCommand_ConnectToLocator(const TArray& Args, UWorld* World) 13 | { 14 | if (Args.Num() != 2) 15 | { 16 | UE_LOG(LogSpatialGDKConsoleCommands, Log, TEXT("ConsoleCommand_ConnectToLocator takes 2 arguments (login, playerToken). Only %d given."), Args.Num()); 17 | return; 18 | } 19 | 20 | FURL URL; 21 | URL.Host = SpatialConstants::LOCATOR_HOST; 22 | FString Login = SpatialConstants::URL_LOGIN_OPTION + Args[0]; 23 | FString PlayerIdentity = SpatialConstants::URL_PLAYER_IDENTITY_OPTION + Args[1]; 24 | URL.AddOption(*PlayerIdentity); 25 | URL.AddOption(*Login); 26 | 27 | FString Error; 28 | FWorldContext &WorldContext = GEngine->GetWorldContextFromWorldChecked(World); 29 | GEngine->Browse(WorldContext, URL, Error); 30 | } 31 | 32 | FAutoConsoleCommandWithWorldAndArgs ConnectToLocatorCommand = FAutoConsoleCommandWithWorldAndArgs( 33 | TEXT("ConnectToLocator"), 34 | TEXT("Usage: ConnectToLocator "), 35 | FConsoleCommandWithWorldAndArgsDelegate::CreateStatic(&ConsoleCommand_ConnectToLocator) 36 | ); 37 | } 38 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Private/SpatialGDKModule.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "SpatialGDKModule.h" 4 | 5 | #define LOCTEXT_NAMESPACE "FSpatialGDKModule" 6 | 7 | DEFINE_LOG_CATEGORY(LogSpatialGDKModule); 8 | 9 | IMPLEMENT_MODULE(FSpatialGDKModule, SpatialGDK) 10 | 11 | void FSpatialGDKModule::StartupModule() 12 | { 13 | } 14 | 15 | void FSpatialGDKModule::ShutdownModule() 16 | { 17 | } 18 | 19 | #undef LOCTEXT_NAMESPACE 20 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Private/SpatialView/EntityPresenceRecord.cpp: -------------------------------------------------------------------------------- 1 | #include "SpatialView/EntityPresenceRecord.h" 2 | 3 | namespace SpatialGDK 4 | { 5 | 6 | void EntityPresenceRecord::AddEntity(Worker_EntityId EntityId) 7 | { 8 | if (EntitiesRemoved.RemoveSingleSwap(EntityId) == 0) 9 | { 10 | EntitiesAdded.Add(EntityId); 11 | } 12 | } 13 | 14 | void EntityPresenceRecord::RemoveEntity(Worker_EntityId EntityId) 15 | { 16 | if (EntitiesAdded.RemoveSingleSwap(EntityId) == 0) 17 | { 18 | EntitiesRemoved.Add(EntityId); 19 | } 20 | } 21 | 22 | void EntityPresenceRecord::Clear() 23 | { 24 | EntitiesAdded.Empty(); 25 | EntitiesRemoved.Empty(); 26 | } 27 | 28 | const TArray& EntityPresenceRecord::GetEntitiesAdded() const 29 | { 30 | return EntitiesAdded; 31 | } 32 | 33 | const TArray& EntityPresenceRecord::GetEntitiesRemoved() const 34 | { 35 | return EntitiesRemoved; 36 | } 37 | 38 | } // namespace SpatialGDK 39 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Private/Tests/SpatialView/ViewDeltaTest.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "Tests/TestDefinitions.h" 4 | 5 | #include "SpatialView/ViewDelta.h" 6 | 7 | #define VIEWDELTA_TEST(TestName) \ 8 | GDK_TEST(Core, ViewDelta, TestName) 9 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Private/Tests/TestingComponentViewHelpers.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "Tests/TestingComponentViewHelpers.h" 4 | 5 | #include "CoreMinimal.h" 6 | 7 | void TestingComponentViewHelpers::AddEntityComponentToStaticComponentView(USpatialStaticComponentView& StaticComponentView, 8 | const Worker_EntityId EntityId, 9 | const Worker_ComponentId ComponentId, 10 | Schema_ComponentData* ComponentData, 11 | const Worker_Authority Authority) 12 | { 13 | Worker_AddComponentOp AddComponentOp; 14 | AddComponentOp.entity_id = EntityId; 15 | AddComponentOp.data.component_id = ComponentId; 16 | AddComponentOp.data.schema_type = ComponentData; 17 | StaticComponentView.OnAddComponent(AddComponentOp); 18 | 19 | Worker_AuthorityChangeOp AuthorityChangeOp; 20 | AuthorityChangeOp.entity_id = EntityId; 21 | AuthorityChangeOp.component_id = ComponentId; 22 | AuthorityChangeOp.authority = Authority; 23 | StaticComponentView.OnAuthorityChange(AuthorityChangeOp); 24 | } 25 | 26 | void TestingComponentViewHelpers::AddEntityComponentToStaticComponentView(USpatialStaticComponentView& StaticComponentView, 27 | const Worker_EntityId EntityId, 28 | const Worker_ComponentId ComponentId, 29 | const Worker_Authority Authority) 30 | { 31 | AddEntityComponentToStaticComponentView(StaticComponentView, EntityId, ComponentId, Schema_CreateComponentData(), Authority); 32 | } 33 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Private/Tests/TestingSchemaHelpers.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "Tests/TestingSchemaHelpers.h" 4 | 5 | #include "CoreMinimal.h" 6 | #include "SpatialConstants.h" 7 | #include "Utils/SchemaUtils.h" 8 | 9 | #include 10 | 11 | Schema_Object* TestingSchemaHelpers::CreateTranslationComponentDataFields() 12 | { 13 | Worker_ComponentData Data = {}; 14 | Data.component_id = SpatialConstants::VIRTUAL_WORKER_TRANSLATION_COMPONENT_ID; 15 | Data.schema_type = Schema_CreateComponentData(); 16 | return Schema_GetComponentDataFields(Data.schema_type); 17 | } 18 | 19 | void TestingSchemaHelpers::AddTranslationComponentDataMapping(Schema_Object* ComponentDataFields, VirtualWorkerId VWId, const PhysicalWorkerName& WorkerName) 20 | { 21 | Schema_Object* SchemaObject = Schema_AddObject(ComponentDataFields, SpatialConstants::VIRTUAL_WORKER_TRANSLATION_MAPPING_ID); 22 | Schema_AddUint32(SchemaObject, SpatialConstants::MAPPING_VIRTUAL_WORKER_ID, VWId); 23 | SpatialGDK::AddStringToSchema(SchemaObject, SpatialConstants::MAPPING_PHYSICAL_WORKER_NAME, WorkerName); 24 | } 25 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Private/Utils/SchemaUtils.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "Utils/SchemaUtils.h" 4 | 5 | #include "Schema/UnrealObjectRef.h" 6 | 7 | namespace SpatialGDK 8 | { 9 | 10 | void GetFullPathFromUnrealObjectReference(const FUnrealObjectRef& ObjectRef, FString& OutPath) 11 | { 12 | if (!ObjectRef.Path.IsSet()) 13 | { 14 | return; 15 | } 16 | 17 | if (ObjectRef.Outer.IsSet()) 18 | { 19 | GetFullPathFromUnrealObjectReference(*ObjectRef.Outer, OutPath); 20 | OutPath.Append(TEXT(".")); 21 | } 22 | 23 | OutPath.Append(*ObjectRef.Path); 24 | } 25 | 26 | } // namespace SpatialGDK 27 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/EngineClasses/Components/ActorInterestComponent.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Components/ActorComponent.h" 7 | #include "Interop/SpatialInterestConstraints.h" 8 | #include "Schema/Interest.h" 9 | 10 | #include "ActorInterestComponent.generated.h" 11 | 12 | class USpatialClassInfoManager; 13 | 14 | /** 15 | * Creates a set of SpatialOS Queries for describing interest that this actor has in other entities. 16 | */ 17 | UCLASS(ClassGroup=(SpatialGDK), NotSpatialType, Meta=(BlueprintSpawnableComponent)) 18 | class SPATIALGDK_API UActorInterestComponent final : public UActorComponent 19 | { 20 | GENERATED_BODY() 21 | 22 | public: 23 | UActorInterestComponent() = default; 24 | ~UActorInterestComponent() = default; 25 | 26 | void PopulateFrequencyToConstraintsMap(const USpatialClassInfoManager& ClassInfoManager, SpatialGDK::FrequencyToConstraintsMap& OutFrequencyToQueryConstraints) const; 27 | 28 | /** 29 | * Whether to use NetCullDistanceSquared to generate constraints relative to the Actor that this component is attached to. 30 | */ 31 | UPROPERTY(BlueprintReadOnly, EditDefaultsOnly, Category = "Interest") 32 | bool bUseNetCullDistanceSquaredForCheckoutRadius = true; 33 | 34 | /** 35 | * The Queries associated with this component. 36 | */ 37 | UPROPERTY(BlueprintReadonly, EditDefaultsOnly, Category = "Interest") 38 | TArray Queries; 39 | 40 | }; 41 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialNetBitReader.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "UObject/CoreNet.h" 7 | 8 | #include "Schema/UnrealObjectRef.h" 9 | 10 | DECLARE_LOG_CATEGORY_EXTERN(LogSpatialNetBitReader, All, All); 11 | 12 | class USpatialPackageMapClient; 13 | 14 | class SPATIALGDK_API FSpatialNetBitReader : public FNetBitReader 15 | { 16 | public: 17 | FSpatialNetBitReader(USpatialPackageMapClient* InPackageMap, uint8* Source, int64 CountBits, TSet& InDynamicRefs, TSet& InUnresolvedRefs); 18 | 19 | using FArchive::operator<<; // For visibility of the overloads we don't override 20 | 21 | virtual FArchive& operator<<(UObject*& Value) override; 22 | 23 | virtual FArchive& operator<<(struct FWeakObjectPtr& Value) override; 24 | 25 | UObject* ReadObject(bool& bUnresolved); 26 | 27 | protected: 28 | void DeserializeObjectRef(FUnrealObjectRef& ObjectRef); 29 | 30 | TSet& DynamicRefs; 31 | TSet& UnresolvedRefs; 32 | }; 33 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialNetBitWriter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "UObject/CoreNet.h" 7 | #include "Schema/UnrealObjectRef.h" 8 | 9 | DECLARE_LOG_CATEGORY_EXTERN(LogSpatialNetSerialize, All, All); 10 | 11 | class USpatialPackageMapClient; 12 | 13 | class SPATIALGDK_API FSpatialNetBitWriter : public FNetBitWriter 14 | { 15 | public: 16 | FSpatialNetBitWriter(USpatialPackageMapClient* InPackageMap); 17 | 18 | using FArchive::operator<<; // For visibility of the overloads we don't override 19 | 20 | virtual FArchive& operator<<(UObject*& Value) override; 21 | 22 | virtual FArchive& operator<<(struct FWeakObjectPtr& Value) override; 23 | 24 | protected: 25 | void SerializeObjectRef(FUnrealObjectRef& ObjectRef); 26 | }; 27 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialPendingNetGame.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Engine/PendingNetGame.h" 7 | #include "UObject/ObjectMacros.h" 8 | 9 | #include "SpatialPendingNetGame.generated.h" 10 | 11 | //UPendingNetGame needs to have its dllexport defined: "class ENGINE_API UPendingNetGame". This can count as a bug, we can submit a PR. 12 | UCLASS(transient) 13 | class USpatialPendingNetGame : public UPendingNetGame 14 | { 15 | GENERATED_UCLASS_BODY() 16 | 17 | //Made virtual in PendingNetGame.h 18 | virtual void InitNetDriver() override; 19 | 20 | virtual void SendJoin() override; 21 | 22 | }; 23 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialReplicationGraph.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "ReplicationGraph.h" 6 | 7 | #include "SpatialReplicationGraph.generated.h" 8 | 9 | class UActorChannel; 10 | class UObject; 11 | 12 | UCLASS(Transient) 13 | class SPATIALGDK_API USpatialReplicationGraph : public UReplicationGraph 14 | { 15 | GENERATED_BODY() 16 | 17 | public: 18 | 19 | //~ Begin UReplicationGraph Interface 20 | virtual UActorChannel* GetOrCreateSpatialActorChannel(UObject* TargetObject) override; 21 | //~ End UReplicationGraph Interface 22 | 23 | }; 24 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialWorldSettings.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "LoadBalancing/SpatialMultiWorkerSettings.h" 6 | #include "SpatialGDKSettings.h" 7 | #include "Utils/LayerInfo.h" 8 | #include "Utils/SpatialStatics.h" 9 | 10 | #include "GameFramework/WorldSettings.h" 11 | #include "Templates/SubclassOf.h" 12 | 13 | #include "SpatialWorldSettings.generated.h" 14 | 15 | UCLASS() 16 | class SPATIALGDK_API ASpatialWorldSettings : public AWorldSettings 17 | { 18 | GENERATED_BODY() 19 | 20 | private: 21 | /** Enable running different server worker types to split the simulation. */ 22 | UPROPERTY(EditAnywhere, Config, Category = "Multi-Worker") 23 | bool bEnableMultiWorker; 24 | 25 | public: 26 | UPROPERTY(EditAnywhere, Category = "Multi-Worker", meta = (EditCondition = "bEnableMultiWorker")) 27 | TSubclassOf MultiWorkerSettingsClass; 28 | 29 | // This function is used to expose the private bool property to SpatialStatics. 30 | // You should call USpatialStatics::IsMultiWorkerEnabled to properly check whether multi-worker is enabled. 31 | bool IsMultiWorkerEnabledInWorldSettings() const 32 | { 33 | return bEnableMultiWorker && *MultiWorkerSettingsClass != nullptr; 34 | } 35 | }; 36 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Interop/Connection/WorkerConnectionCoordinator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "HAL/Event.h" 6 | 7 | struct FEventDeleter 8 | { 9 | void operator()(FEvent* Event) const 10 | { 11 | FPlatformProcess::ReturnSynchEventToPool(Event); 12 | } 13 | }; 14 | 15 | /** 16 | * The reason this exists is because FEvent::Wait(Time) is not equivilant for 17 | * FPlatformProcess::Sleep and has overhead which impacts latency. 18 | */ 19 | class WorkerConnectionCoordinator 20 | { 21 | TUniquePtr Event; 22 | int32 WaitTimeMs; 23 | public: 24 | WorkerConnectionCoordinator(bool bCanWake, int32 InWaitMs) 25 | : Event(bCanWake ? FGenericPlatformProcess::GetSynchEventFromPool() : nullptr) 26 | , WaitTimeMs(InWaitMs) 27 | { 28 | 29 | } 30 | ~WorkerConnectionCoordinator() = default; 31 | 32 | void Wait() 33 | { 34 | if (Event.IsValid()) 35 | { 36 | Event->Wait(WaitTimeMs); 37 | } 38 | else 39 | { 40 | FPlatformProcess::Sleep(WaitTimeMs*0.001f); 41 | } 42 | } 43 | 44 | void Wake() 45 | { 46 | if (Event.IsValid()) 47 | { 48 | Event->Trigger(); 49 | } 50 | } 51 | }; 52 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Interop/SpatialOutputDevice.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Misc/OutputDevice.h" 7 | 8 | #include 9 | 10 | class USpatialWorkerConnection; 11 | 12 | class SPATIALGDK_API FSpatialOutputDevice : public FOutputDevice 13 | { 14 | public: 15 | FSpatialOutputDevice(USpatialWorkerConnection* InConnection, FName LoggerName, int32 InPIEIndex); 16 | ~FSpatialOutputDevice(); 17 | 18 | void AddRedirectCategory(const FName& Category); 19 | void RemoveRedirectCategory(const FName& Category); 20 | void SetVerbosityFilterLevel(ELogVerbosity::Type Verbosity); 21 | void Serialize(const TCHAR* InData, ELogVerbosity::Type Verbosity, const FName& Category) override; 22 | 23 | static Worker_LogLevel ConvertLogLevelToSpatial(ELogVerbosity::Type Verbosity); 24 | 25 | protected: 26 | ELogVerbosity::Type FilterLevel; 27 | TSet CategoriesToRedirect; 28 | USpatialWorkerConnection* Connection; 29 | FName LoggerName; 30 | 31 | int32 PIEIndex; 32 | bool bLogToSpatial; 33 | }; 34 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Interop/SpatialSnapshotManager.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Utils/SchemaUtils.h" 6 | 7 | #include 8 | #include 9 | 10 | #include "CoreMinimal.h" 11 | 12 | class UGlobalStateManager; 13 | class USpatialReceiver; 14 | class USpatialWorkerConnection; 15 | 16 | DECLARE_LOG_CATEGORY_EXTERN(LogSnapshotManager, Log, All) 17 | 18 | DECLARE_DELEGATE(PostWorldWipeDelegate); 19 | 20 | class SPATIALGDK_API SpatialSnapshotManager 21 | { 22 | public: 23 | SpatialSnapshotManager(); 24 | 25 | void Init(USpatialWorkerConnection* InConnection, UGlobalStateManager* InGlobalStateManager, USpatialReceiver* InReceiver); 26 | 27 | void WorldWipe(const PostWorldWipeDelegate& Delegate); 28 | void LoadSnapshot(const FString& SnapshotName); 29 | 30 | private: 31 | static void DeleteEntities(const Worker_EntityQueryResponseOp& Op, TWeakObjectPtr Connection); 32 | 33 | TWeakObjectPtr Connection; 34 | TWeakObjectPtr GlobalStateManager; 35 | TWeakObjectPtr Receiver; 36 | }; 37 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Interop/SpatialWorkerFlags.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include 6 | #include "SpatialWorkerFlags.generated.h" 7 | 8 | DECLARE_DYNAMIC_DELEGATE_TwoParams(FOnWorkerFlagsUpdatedBP, const FString&, FlagName, const FString&, FlagValue); 9 | DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnWorkerFlagsUpdated, const FString&, FlagName, const FString&, FlagValue); 10 | 11 | UCLASS() 12 | class SPATIALGDK_API USpatialWorkerFlags : public UObject 13 | { 14 | GENERATED_BODY() 15 | 16 | public: 17 | /** Gets value of a worker flag. Must be connected to SpatialOS to properly work. 18 | * @param InFlagName - Name of worker flag 19 | * @param OutFlagValue - Value of worker flag 20 | * @return - If worker flag was found. 21 | */ 22 | bool GetWorkerFlag(const FString& InFlagName, FString& OutFlagValue) const; 23 | 24 | UFUNCTION(BlueprintCallable, Category = "SpatialOS") 25 | void BindToOnWorkerFlagsUpdated(const FOnWorkerFlagsUpdatedBP& InDelegate); 26 | 27 | UFUNCTION(BlueprintCallable, Category = "SpatialOS") 28 | void UnbindFromOnWorkerFlagsUpdated(const FOnWorkerFlagsUpdatedBP& InDelegate); 29 | 30 | void ApplyWorkerFlagUpdate(const Worker_FlagUpdateOp& Op); 31 | 32 | private: 33 | 34 | FOnWorkerFlagsUpdated OnWorkerFlagsUpdated; 35 | 36 | TMap WorkerFlags; 37 | }; 38 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/LoadBalancing/WorkerRegion.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Components/StaticMeshComponent.h" 6 | #include "GameFramework/Actor.h" 7 | #include "Math/Box2D.h" 8 | #include "Math/Color.h" 9 | 10 | #include "WorkerRegion.generated.h" 11 | 12 | UCLASS(NotPlaceable, NotBlueprintable) 13 | class SPATIALGDK_API AWorkerRegion : public AActor 14 | { 15 | GENERATED_BODY() 16 | 17 | public: 18 | AWorkerRegion(const FObjectInitializer& ObjectInitializer); 19 | 20 | void Init(UMaterial* Material, const FColor& Color, const FBox2D& Extents, const float VerticalScale); 21 | 22 | UPROPERTY() 23 | UStaticMeshComponent *Mesh; 24 | 25 | UPROPERTY() 26 | UMaterialInstanceDynamic *MaterialInstance; 27 | 28 | private: 29 | void SetOpacity(const float Opacity); 30 | void SetHeight(const float Height); 31 | void SetPositionAndScale(const FBox2D& Extents, const float VerticalScale); 32 | void SetColor(const FColor& Color); 33 | }; 34 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Schema/ClientEndpoint.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Schema/Component.h" 6 | #include "SpatialConstants.h" 7 | #include "Utils/RPCRingBuffer.h" 8 | 9 | #include 10 | #include 11 | 12 | namespace SpatialGDK 13 | { 14 | 15 | struct ClientEndpoint : Component 16 | { 17 | static const Worker_ComponentId ComponentId = SpatialConstants::CLIENT_ENDPOINT_COMPONENT_ID; 18 | 19 | ClientEndpoint(const Worker_ComponentData& Data); 20 | 21 | void ApplyComponentUpdate(const Worker_ComponentUpdate& Update) override; 22 | 23 | RPCRingBuffer ReliableRPCBuffer; 24 | RPCRingBuffer UnreliableRPCBuffer; 25 | uint64 ReliableRPCAck = 0; 26 | uint64 UnreliableRPCAck = 0; 27 | 28 | private: 29 | void ReadFromSchema(Schema_Object* SchemaObject); 30 | }; 31 | 32 | } // namespace SpatialGDK 33 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Schema/Component.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include 6 | #include "CoreMinimal.h" 7 | 8 | namespace SpatialGDK 9 | { 10 | 11 | struct Component 12 | { 13 | virtual ~Component() {} 14 | virtual void ApplyComponentUpdate(const Worker_ComponentUpdate& Update) {} 15 | }; 16 | 17 | } // namespace SpatialGDK 18 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Schema/DynamicComponent.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Schema/Component.h" 6 | #include "SpatialView/ComponentData.h" 7 | 8 | namespace SpatialGDK 9 | { 10 | 11 | // Represents any Unreal rep component 12 | struct DynamicComponent : Component 13 | { 14 | explicit DynamicComponent(const Worker_ComponentData& InComponentData) 15 | : Data(ComponentData::CreateCopy(InComponentData.schema_type, InComponentData.component_id)) 16 | { 17 | } 18 | 19 | ComponentData Data; 20 | }; 21 | 22 | } // namespace SpatialGDK 23 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Schema/Heartbeat.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Schema/Component.h" 6 | #include "SpatialConstants.h" 7 | #include "Utils/SchemaUtils.h" 8 | 9 | #include 10 | #include 11 | 12 | namespace SpatialGDK 13 | { 14 | 15 | struct Heartbeat : Component 16 | { 17 | static const Worker_ComponentId ComponentId = SpatialConstants::HEARTBEAT_COMPONENT_ID; 18 | 19 | Heartbeat() = default; 20 | Heartbeat(const Worker_ComponentData& Data) 21 | { 22 | } 23 | 24 | FORCEINLINE Worker_ComponentData CreateHeartbeatData() 25 | { 26 | Worker_ComponentData Data = {}; 27 | Data.component_id = ComponentId; 28 | Data.schema_type = Schema_CreateComponentData(); 29 | Schema_Object* ComponentObject = Schema_GetComponentDataFields(Data.schema_type); 30 | 31 | Schema_AddBool(ComponentObject, SpatialConstants::HEARTBEAT_CLIENT_HAS_QUIT_ID, false); 32 | 33 | return Data; 34 | } 35 | }; 36 | 37 | } // namespace SpatialGDK 38 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Schema/MulticastRPCs.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Schema/Component.h" 6 | #include "SpatialConstants.h" 7 | #include "Utils/RPCRingBuffer.h" 8 | 9 | #include 10 | #include 11 | 12 | namespace SpatialGDK 13 | { 14 | 15 | struct MulticastRPCs : Component 16 | { 17 | static const Worker_ComponentId ComponentId = SpatialConstants::MULTICAST_RPCS_COMPONENT_ID; 18 | 19 | MulticastRPCs(const Worker_ComponentData& Data); 20 | 21 | void ApplyComponentUpdate(const Worker_ComponentUpdate& Update) override; 22 | 23 | RPCRingBuffer MulticastRPCBuffer; 24 | uint32 InitiallyPresentMulticastRPCsCount = 0; 25 | 26 | private: 27 | void ReadFromSchema(Schema_Object* SchemaObject); 28 | }; 29 | 30 | } // namespace SpatialGDK 31 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Schema/ServerEndpoint.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Schema/Component.h" 6 | #include "SpatialConstants.h" 7 | #include "Utils/RPCRingBuffer.h" 8 | 9 | #include 10 | #include 11 | 12 | namespace SpatialGDK 13 | { 14 | 15 | struct ServerEndpoint : Component 16 | { 17 | static const Worker_ComponentId ComponentId = SpatialConstants::SERVER_ENDPOINT_COMPONENT_ID; 18 | 19 | ServerEndpoint(const Worker_ComponentData& Data); 20 | 21 | void ApplyComponentUpdate(const Worker_ComponentUpdate& Update) override; 22 | 23 | RPCRingBuffer ReliableRPCBuffer; 24 | RPCRingBuffer UnreliableRPCBuffer; 25 | uint64 ReliableRPCAck = 0; 26 | uint64 UnreliableRPCAck = 0; 27 | 28 | private: 29 | void ReadFromSchema(Schema_Object* SchemaObject); 30 | }; 31 | 32 | } // namespace SpatialGDK 33 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Schema/Tombstone.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Schema/Component.h" 6 | #include "SpatialConstants.h" 7 | 8 | #include 9 | #include 10 | 11 | namespace SpatialGDK 12 | { 13 | 14 | struct Tombstone : Component 15 | { 16 | static const Worker_ComponentId ComponentId = SpatialConstants::TOMBSTONE_COMPONENT_ID; 17 | 18 | Tombstone() = default; 19 | 20 | FORCEINLINE Worker_ComponentData CreateData() 21 | { 22 | Worker_ComponentData Data = {}; 23 | Data.component_id = ComponentId; 24 | Data.schema_type = Schema_CreateComponentData(); 25 | 26 | return Data; 27 | } 28 | }; 29 | 30 | } // namespace SpatialGDK 31 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/SimulatedPlayers/SimPlayerBPFunctionLibrary.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Kismet/BlueprintFunctionLibrary.h" 6 | 7 | #include "SimPlayerBPFunctionLibrary.generated.h" 8 | 9 | UCLASS() 10 | class SPATIALGDK_API USimPlayerBPFunctionLibrary : public UBlueprintFunctionLibrary 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | /** 16 | * Get whether this client is simulated. 17 | * This will return true for clients launched inside simulated player deployments, 18 | * or simulated clients launched from the Editor. 19 | */ 20 | UFUNCTION(BlueprintPure, Category="SpatialOS|SimulatedPlayer", meta = (WorldContext = WorldContextObject)) 21 | static bool IsSimulatedPlayer(const UObject* WorldContextObject); 22 | }; 23 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/SpatialGDKConsoleCommands.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | #pragma once 3 | 4 | #include "SpatialCommonTypes.h" 5 | 6 | DECLARE_LOG_CATEGORY_EXTERN(LogSpatialGDKConsoleCommands, Log, All); 7 | 8 | class UWorld; 9 | 10 | namespace SpatialGDKConsoleCommands 11 | { 12 | void ConsoleCommand_ConnectToLocator(const TArray& Args, UWorld* World); 13 | } 14 | // namespace 15 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/SpatialGDKModule.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Modules/ModuleManager.h" 7 | 8 | #include "Utils/EngineVersionCheck.h" 9 | 10 | #include "SpatialGDKLoader.h" 11 | 12 | DECLARE_LOG_CATEGORY_EXTERN(LogSpatialGDKModule, Log, All); 13 | 14 | class SPATIALGDK_API FSpatialGDKModule : public IModuleInterface 15 | { 16 | public: 17 | void StartupModule() override; 18 | void ShutdownModule() override; 19 | 20 | private: 21 | FSpatialGDKLoader Loader; 22 | }; 23 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/SpatialView/ConnectionHandler/AbstractConnectionHandler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "SpatialView/MessagesToSend.h" 6 | #include "SpatialView/OpList/OpList.h" 7 | #include "Templates/UniquePtr.h" 8 | #include 9 | 10 | namespace SpatialGDK 11 | { 12 | 13 | class AbstractConnectionHandler 14 | { 15 | public: 16 | virtual ~AbstractConnectionHandler() = default; 17 | 18 | // Should be called to indicate a new tick has started. 19 | // Ensures all external messages, up to this, point have been received. 20 | virtual void Advance() = 0; 21 | 22 | // The number of OpList instances queued. 23 | virtual uint32 GetOpListCount() = 0; 24 | 25 | // Gets the next queued OpList. If there is no OpList queued then an empty one is returned. 26 | virtual OpList GetNextOpList() = 0; 27 | 28 | // Consumes messages and sends them to the deployment. 29 | virtual void SendMessages(TUniquePtr Messages) = 0; 30 | 31 | // Return the unique ID for the worker. 32 | virtual const FString& GetWorkerId() const = 0; 33 | 34 | // Returns the attributes for the worker. 35 | virtual const TArray& GetWorkerAttributes() const = 0; 36 | }; 37 | 38 | } // namespace SpatialGDK 39 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/SpatialView/ConnectionHandler/SpatialOSConnectionHandler.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "SpatialView/ConnectionHandler/AbstractConnectionHandler.h" 6 | #include "SpatialView/OpList/OpList.h" 7 | #include "SpatialView/OpList/WorkerConnectionOpList.h" 8 | 9 | namespace SpatialGDK 10 | { 11 | 12 | class SpatialOSConnectionHandler : public AbstractConnectionHandler 13 | { 14 | public: 15 | explicit SpatialOSConnectionHandler(Worker_Connection* Connection); 16 | 17 | virtual void Advance() override; 18 | virtual uint32 GetOpListCount() override; 19 | virtual OpList GetNextOpList() override; 20 | virtual void SendMessages(TUniquePtr Messages) override; 21 | virtual const FString& GetWorkerId() const override; 22 | virtual const TArray& GetWorkerAttributes() const override; 23 | 24 | private: 25 | struct ConnectionDeleter 26 | { 27 | void operator()(Worker_Connection* Connection) const noexcept; 28 | }; 29 | 30 | TUniquePtr Connection; 31 | TMap InternalToUserRequestId; 32 | FString WorkerId; 33 | TArray WorkerAttributes; 34 | }; 35 | 36 | } // namespace SpatialGDK 37 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/SpatialView/EntityComponentId.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | 3 | #include "Templates/TypeHash.h" 4 | #include 5 | 6 | namespace SpatialGDK 7 | { 8 | 9 | struct EntityComponentId 10 | { 11 | Worker_EntityId EntityId; 12 | Worker_ComponentId ComponentId; 13 | 14 | friend bool operator==(const EntityComponentId& Lhs, const EntityComponentId& Rhs) 15 | { 16 | return Lhs.EntityId == Rhs.EntityId && Lhs.ComponentId == Rhs.ComponentId; 17 | } 18 | 19 | friend uint32 GetTypeHash(EntityComponentId Value) 20 | { 21 | return HashCombine(::GetTypeHash(static_cast(Value.EntityId)), ::GetTypeHash(static_cast(Value.ComponentId))); 22 | } 23 | }; 24 | 25 | } // namespace SpatialGDK 26 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/SpatialView/EntityComponentRecord.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "SpatialView/EntityComponentId.h" 6 | #include "SpatialView/EntityComponentUpdateRecord.h" 7 | #include "Containers/Array.h" 8 | 9 | namespace SpatialGDK 10 | { 11 | 12 | // Can be recorded as at most one of 13 | // added 14 | // removed 15 | // updated 16 | // Corollary of this is that if the component is recorded as added, that events received in the same tick will be dropped. 17 | class EntityComponentRecord 18 | { 19 | public: 20 | void AddComponent(Worker_EntityId EntityId, ComponentData Data); 21 | void RemoveComponent(Worker_EntityId EntityId, Worker_ComponentId ComponentId); 22 | void AddComponentAsUpdate(Worker_EntityId EntityId, ComponentData Data); 23 | void AddUpdate(Worker_EntityId EntityId, ComponentUpdate Update); 24 | 25 | void Clear(); 26 | 27 | const TArray& GetComponentsAdded() const; 28 | const TArray& GetComponentsRemoved() const; 29 | 30 | const TArray& GetUpdates() const; 31 | const TArray& GetCompleteUpdates() const; 32 | 33 | private: 34 | TArray ComponentsAdded; 35 | TArray ComponentsRemoved; 36 | EntityComponentUpdateRecord UpdateRecord; 37 | }; 38 | 39 | } // namespace SpatialGDK 40 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/SpatialView/EntityPresenceRecord.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Containers/Array.h" 6 | #include 7 | 8 | namespace SpatialGDK 9 | { 10 | 11 | // An entity can be recorded as at most one of 12 | // added 13 | // removed 14 | class EntityPresenceRecord 15 | { 16 | public: 17 | void AddEntity(Worker_EntityId EntityId); 18 | void RemoveEntity(Worker_EntityId EntityId); 19 | 20 | void Clear(); 21 | 22 | const TArray& GetEntitiesAdded() const; 23 | const TArray& GetEntitiesRemoved() const; 24 | 25 | private: 26 | TArray EntitiesAdded; 27 | TArray EntitiesRemoved; 28 | }; 29 | 30 | } // namespace SpatialGDK 31 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/SpatialView/EntityQuery.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include 6 | #include 7 | 8 | namespace SpatialGDK 9 | { 10 | 11 | // A wrapper around a Worker_EntityQuery that allows it to be stored and moved. 12 | class EntityQuery 13 | { 14 | public: 15 | explicit EntityQuery(const Worker_EntityQuery& Query); 16 | 17 | ~EntityQuery() = default; 18 | 19 | // Moveable, not copyable. 20 | EntityQuery(const EntityQuery&) = delete; 21 | EntityQuery(EntityQuery&&) = default; 22 | EntityQuery& operator=(const EntityQuery&) = delete; 23 | EntityQuery& operator=(EntityQuery&&) = default; 24 | 25 | // Returns the stored entity query. 26 | // The value is only valid until the EntityQuery object is moved or goes out of scope. 27 | Worker_EntityQuery GetWorkerQuery() const; 28 | 29 | private: 30 | // Returns the total number of Worker_Constraint objects in the tree. 31 | static int32 GetNestedConstraintCount(const Worker_Constraint& Constraint); 32 | // Recursively re-points the constraint to its children and stores those children in the array. 33 | // `Constraint` should refer to the same query that Constraints[Index] was copied from. 34 | void StoreChildConstraints(const Worker_Constraint& Constraint, int32 Index); 35 | 36 | TArray SnapshotComponentIds; 37 | TArray Constraints; // Stable pointer storage. 38 | uint8 ResultType; 39 | }; 40 | 41 | } // namespace SpatialGDK 42 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/SpatialView/MessagesToSend.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Interop/Connection/OutgoingMessages.h" 6 | #include "SpatialView/OutgoingComponentMessage.h" 7 | #include "SpatialView/OutgoingMessages.h" 8 | #include "Containers/Array.h" 9 | 10 | namespace SpatialGDK 11 | { 12 | 13 | struct MessagesToSend 14 | { 15 | TArray ComponentMessages; 16 | TArray ReserveEntityIdsRequests; 17 | TArray CreateEntityRequests; 18 | TArray DeleteEntityRequests; 19 | TArray EntityQueryRequests; 20 | TArray EntityCommandRequests; 21 | TArray EntityCommandResponses; 22 | TArray EntityCommandFailures; 23 | // todo should this be the metrics type from the cpp-gdk repo. 24 | TArray Metrics; 25 | TArray Logs; 26 | }; 27 | 28 | } // namespace SpatialGDK 29 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/SpatialView/OpList/EntityComponentOpList.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "SpatialView/ComponentData.h" 6 | #include "SpatialView/ComponentUpdate.h" 7 | #include "SpatialView/OpList/OpList.h" 8 | #include "Containers/Array.h" 9 | #include "Templates/UniquePtr.h" 10 | 11 | namespace SpatialGDK 12 | { 13 | 14 | // Data for a set of ops representing 15 | struct EntityComponentOpListData : OpListData 16 | { 17 | TArray Ops; 18 | TArray DataStorage; 19 | TArray UpdateStorage; 20 | }; 21 | 22 | class EntityComponentOpListBuilder 23 | { 24 | public: 25 | EntityComponentOpListBuilder(); 26 | 27 | EntityComponentOpListBuilder& AddComponent(Worker_EntityId EntityId, ComponentData Data); 28 | EntityComponentOpListBuilder& UpdateComponent(Worker_EntityId EntityId, ComponentUpdate Update); 29 | EntityComponentOpListBuilder& RemoveComponent(Worker_EntityId EntityId, Worker_ComponentId ComponentId); 30 | EntityComponentOpListBuilder& SetAuthority(Worker_EntityId EntityId, Worker_ComponentId ComponentId, Worker_Authority Authority); 31 | 32 | OpList CreateOpList() &&; 33 | 34 | private: 35 | TUniquePtr OpListData; 36 | }; 37 | 38 | } // namespace SpatialGDK 39 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/SpatialView/OpList/OpList.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Templates/UniquePtr.h" 6 | #include 7 | 8 | namespace SpatialGDK 9 | { 10 | 11 | struct OpListData { 12 | virtual ~OpListData() = default; 13 | }; 14 | 15 | struct OpList 16 | { 17 | Worker_Op* Ops; 18 | uint32 Count; 19 | TUniquePtr Storage; 20 | }; 21 | 22 | } // namespace SpatialGDK 23 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/SpatialView/OpList/SplitOpList.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | #include "OpList.h" 5 | #include "Templates/SharedPointer.h" 6 | 7 | namespace SpatialGDK 8 | { 9 | 10 | struct SplitOpListData : OpListData 11 | { 12 | TSharedPtr Data; 13 | 14 | explicit SplitOpListData(TSharedPtr SplitData) 15 | : Data(MoveTemp(SplitData)) 16 | { 17 | } 18 | }; 19 | 20 | struct SplitOpListPair 21 | { 22 | SplitOpListPair(OpList OriginalOpList, uint32 InitialOpListCount) 23 | { 24 | check(InitialOpListCount <= OriginalOpList.Count); 25 | // Transfer ownership to a shared pointer. 26 | TSharedPtr SplitData(OriginalOpList.Storage.Release()); 27 | Head = {OriginalOpList.Ops, InitialOpListCount, MakeUnique(SplitData)}; 28 | Tail = {OriginalOpList.Ops + InitialOpListCount, OriginalOpList.Count - InitialOpListCount, MakeUnique(MoveTemp(SplitData))}; 29 | } 30 | 31 | OpList Head; 32 | OpList Tail; 33 | }; 34 | 35 | } // namespace SpatialGDK 36 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/SpatialView/OpList/ViewDeltaLegacyOpList.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "SpatialView/OpList/OpList.h" 6 | #include "SpatialView/ViewDelta.h" 7 | #include "Containers/Array.h" 8 | 9 | namespace SpatialGDK 10 | { 11 | 12 | struct ViewDeltaLegacyOpListData: OpListData 13 | { 14 | TArray Ops; 15 | // Used to store UTF8 disconnect string. 16 | ViewDelta Delta; 17 | TUniquePtr DisconnectReason; 18 | }; 19 | 20 | /** Creates an OpList from a ViewDelta. */ 21 | OpList GetOpListFromViewDelta(ViewDelta Delta); 22 | } // namespace SpatialGDK 23 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/SpatialView/OpList/WorkerConnectionOpList.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "SpatialView/OpList/OpList.h" 6 | #include "Templates/UniquePtr.h" 7 | #include 8 | 9 | namespace SpatialGDK 10 | { 11 | 12 | struct WorkerConnectionOpListData : OpListData 13 | { 14 | struct Deleter 15 | { 16 | void operator()(Worker_OpList* OpListToDelete) const noexcept 17 | { 18 | if (OpListToDelete != nullptr) 19 | { 20 | Worker_OpList_Destroy(OpListToDelete); 21 | } 22 | } 23 | }; 24 | 25 | TUniquePtr OpList; 26 | 27 | explicit WorkerConnectionOpListData(Worker_OpList* OpList) : OpList(OpList) 28 | { 29 | } 30 | }; 31 | 32 | inline OpList GetOpListFromConnection(Worker_Connection* Connection) 33 | { 34 | Worker_OpList* Ops = Worker_Connection_GetOpList(Connection, 0); 35 | return {Ops->ops, Ops->op_count, MakeUnique(Ops)}; 36 | } 37 | 38 | } // namespace SpatialGDK 39 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Tests/TestActor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "GameFramework/Actor.h" 7 | 8 | #include "TestActor.generated.h" 9 | 10 | UCLASS() 11 | class ATestActor : public AActor 12 | { 13 | GENERATED_BODY() 14 | 15 | ATestActor() 16 | { 17 | SetReplicates(true); 18 | } 19 | 20 | public: 21 | UFUNCTION(Server, Reliable) 22 | void TestServerRPC(); 23 | void TestServerRPC_Implementation() {}; 24 | }; 25 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Tests/TestDefinitions.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Misc/AutomationTest.h" 6 | 7 | #define GDK_TEST(ModuleName, ComponentName, TestName) \ 8 | IMPLEMENT_SIMPLE_AUTOMATION_TEST(TestName, "SpatialGDK."#ModuleName"."#ComponentName"."#TestName, EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::EngineFilter) \ 9 | bool TestName::RunTest(const FString& Parameters) 10 | 11 | #define GDK_COMPLEX_TEST(ModuleName, ComponentName, TestName) \ 12 | IMPLEMENT_COMPLEX_AUTOMATION_TEST(TestName, "SpatialGDK."#ModuleName"."#ComponentName"."#TestName, EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::EngineFilter) 13 | 14 | #define GDK_SLOW_TEST(ModuleName, ComponentName, TestName) \ 15 | IMPLEMENT_SIMPLE_AUTOMATION_TEST(TestName, "SpatialGDKSlow."#ModuleName"."#ComponentName"."#TestName, EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::EngineFilter) \ 16 | bool TestName::RunTest(const FString& Parameters) 17 | 18 | #define GDK_SLOW_COMPLEX_TEST(ModuleName, ComponentName, TestName) \ 19 | IMPLEMENT_COMPLEX_AUTOMATION_TEST(TestName, "SpatialGDKSlow."#ModuleName"."#ComponentName"."#TestName, EAutomationTestFlags::ApplicationContextMask | EAutomationTestFlags::EngineFilter) 20 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Tests/TestingComponentViewHelpers.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | 7 | #include "Interop/SpatialStaticComponentView.h" 8 | 9 | #include 10 | 11 | struct SPATIALGDK_API TestingComponentViewHelpers 12 | { 13 | // Can be used add components to a component view for a given entity. 14 | static void AddEntityComponentToStaticComponentView(USpatialStaticComponentView& StaticComponentView, 15 | const Worker_EntityId EntityId, 16 | const Worker_ComponentId ComponentId, 17 | Schema_ComponentData* ComponentData, 18 | const Worker_Authority Authority); 19 | 20 | static void AddEntityComponentToStaticComponentView(USpatialStaticComponentView& StaticComponentView, 21 | const Worker_EntityId EntityId, 22 | const Worker_ComponentId ComponentId, 23 | const Worker_Authority Authority); 24 | }; 25 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Tests/TestingSchemaHelpers.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | 7 | #include "SpatialCommonTypes.h" 8 | 9 | #include 10 | 11 | struct SPATIALGDK_API TestingSchemaHelpers 12 | { 13 | // Can be used to create a Schema_Object to be passed to VirtualWorkerTranslator. 14 | static Schema_Object* CreateTranslationComponentDataFields(); 15 | // Can be used to add a mapping between virtual work id and physical worker name. 16 | static void AddTranslationComponentDataMapping(Schema_Object* ComponentDataFields, VirtualWorkerId VWId, const PhysicalWorkerName& WorkerName); 17 | }; 18 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Utils/EngineVersionCheck.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Launch/Resources/SpatialVersion.h" 6 | 7 | // GDK Version to be updated with SPATIAL_ENGINE_VERSION 8 | // when breaking changes are made to the engine that requires 9 | // changes to the GDK to remain compatible 10 | #define SPATIAL_GDK_VERSION 25 11 | 12 | // Check if GDK is compatible with the current version of Unreal Engine 13 | // SPATIAL_ENGINE_VERSION is incremented in engine when breaking changes 14 | // are made that make previous versions of the GDK incompatible 15 | static_assert(SPATIAL_ENGINE_VERSION == SPATIAL_GDK_VERSION, "GDK Version is incompatible with the Engine Version. Check both the GDK and Engine are up to date"); 16 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Utils/GDKPropertyMacros.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "UObject/UnrealType.h" 6 | #include "Runtime/Launch/Resources/Version.h" 7 | 8 | #if ENGINE_MINOR_VERSION <= 24 9 | #define GDK_PROPERTY(Type) U##Type 10 | #define GDK_CASTFIELD Cast 11 | #else 12 | #define GDK_PROPERTY(Type) F##Type 13 | #define GDK_CASTFIELD CastField 14 | #endif 15 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Utils/InspectionColors.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "SpatialCommonTypes.h" 6 | #include "Math/Color.h" 7 | 8 | // Mimicking Inspector V2 coloring from platform/js/console/src/inspector-v2/styles/colors.ts 9 | 10 | namespace SpatialGDK 11 | { 12 | // Argument expected in the form: UnrealWorker1a2s3d4f... 13 | FColor GetColorForWorkerName(const PhysicalWorkerName& WorkerName); 14 | } 15 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Utils/LayerInfo.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "LoadBalancing/GridBasedLBStrategy.h" 6 | 7 | #include "CoreMinimal.h" 8 | 9 | #include "LayerInfo.generated.h" 10 | 11 | class UAbstractLBStrategy; 12 | class UAbstractLockingPolicy; 13 | 14 | USTRUCT() 15 | struct FLayerInfo 16 | { 17 | GENERATED_BODY() 18 | 19 | FLayerInfo() 20 | : Name(TEXT("New Layer")) 21 | , ActorClasses({}) 22 | , LoadBalanceStrategy(USingleWorkerStrategy::StaticClass()) 23 | { 24 | } 25 | 26 | FLayerInfo(FName InName, TSet> InActorClasses, UClass* InLoadBalanceStrategy) 27 | : Name(InName) 28 | , ActorClasses(InActorClasses) 29 | , LoadBalanceStrategy(InLoadBalanceStrategy) {} 30 | 31 | UPROPERTY(EditAnywhere, Category = "Load Balancing") 32 | FName Name; 33 | 34 | // Using TSoftClassPtr here to prevent eagerly loading all classes. 35 | /** The Actor classes contained within this group. Children of these classes will also be included. */ 36 | UPROPERTY(EditAnywhere, Category = "Load Balancing") 37 | TSet> ActorClasses; 38 | 39 | UPROPERTY(EditAnywhere, Category = "Load Balancing") 40 | TSubclassOf LoadBalanceStrategy; 41 | }; 42 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Utils/OpUtils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "SpatialView/OpList/OpList.h" 6 | 7 | #include "CoreMinimal.h" 8 | 9 | #include 10 | 11 | namespace SpatialGDK 12 | { 13 | 14 | Worker_Op* FindFirstOpOfType(const TArray& InOpLists, const Worker_OpType OpType); 15 | void AppendAllOpsOfType(const TArray& InOpLists, const Worker_OpType OpType, TArray& FoundOps); 16 | Worker_Op* FindFirstOpOfTypeForComponent(const TArray& InOpLists, const Worker_OpType OpType, const Worker_ComponentId ComponentId); 17 | Worker_ComponentId GetComponentId(const Worker_Op* Op); 18 | 19 | } // namespace SpatialGDK 20 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Utils/RepDataUtils.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Containers/Array.h" 6 | #include "HAL/Platform.h" 7 | #include "Net/RepLayout.h" 8 | 9 | // Storage for a changelist created by the replication system when replicating from the server. 10 | struct FRepChangeState 11 | { 12 | const TArray RepChanged; // changed replicated properties 13 | FRepLayout& RepLayout; 14 | }; 15 | 16 | using FHandoverChangeState = TArray; // changed handover properties 17 | using FInterestChangeState = TArray; // changed interest properties 18 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Utils/SnapshotGenerationTemplate.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include 6 | #include "SnapshotGenerationTemplate.generated.h" 7 | 8 | UCLASS(abstract) 9 | class SPATIALGDK_API USnapshotGenerationTemplate : public UObject 10 | { 11 | GENERATED_BODY() 12 | 13 | public: 14 | USnapshotGenerationTemplate() = default; 15 | ~USnapshotGenerationTemplate() = default; 16 | 17 | /** 18 | * Write to the snapshot generation output stream 19 | * @param OutputStream the output stream for the snapshot being created. 20 | * @param NextEntityId the next available entity ID in the snapshot, this reference should be incremented appropriately. 21 | * @return bool the success of writing to the snapshot output stream, this is returned to the overall snapshot generation. 22 | */ 23 | virtual bool WriteToSnapshotOutput(Worker_SnapshotOutputStream* OutputStream, Worker_EntityId& NextEntityId) PURE_VIRTUAL(USnapshotGenerationTemplate::WriteToSnapshotOutput, return false;); 24 | }; 25 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/Public/Utils/SpatialLatencyPayload.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Containers/Array.h" 7 | #include "Hash/CityHash.h" 8 | #include "SpatialCommonTypes.h" 9 | 10 | #include "SpatialLatencyPayload.generated.h" 11 | 12 | USTRUCT(BlueprintType) 13 | struct SPATIALGDK_API FSpatialLatencyPayload 14 | { 15 | GENERATED_BODY() 16 | 17 | FSpatialLatencyPayload() {} 18 | 19 | FSpatialLatencyPayload(TArray&& TraceBytes, TArray&& SpanBytes, TraceKey InKey) 20 | : TraceId(MoveTemp(TraceBytes)) 21 | , SpanId(MoveTemp(SpanBytes)) 22 | , Key(InKey) 23 | {} 24 | 25 | UPROPERTY() 26 | TArray TraceId; 27 | 28 | UPROPERTY() 29 | TArray SpanId; 30 | 31 | UPROPERTY(NotReplicated) 32 | int32 Key = InvalidTraceKey; 33 | 34 | // Required for TMap hash 35 | bool operator == (const FSpatialLatencyPayload& Other) const 36 | { 37 | return TraceId == Other.TraceId && SpanId == Other.SpanId; 38 | } 39 | 40 | friend uint32 GetTypeHash(const FSpatialLatencyPayload& Obj) 41 | { 42 | return CityHash32((const char*)Obj.TraceId.GetData(), Obj.TraceId.Num()) ^ CityHash32((const char*)Obj.SpanId.GetData(), Obj.SpanId.Num()); 43 | } 44 | }; 45 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDK/SpatialGDK_APL.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 22 | 23 | 24 | 26 | 27 | 28 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditor/Private/SchemaGenerator/SchemaGenerator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "TypeStructure.h" 6 | #include "Utils/SchemaDatabase.h" 7 | 8 | using ComponentIdPerType = Worker_ComponentId[ESchemaComponentType::SCHEMA_Count]; 9 | 10 | DECLARE_LOG_CATEGORY_EXTERN(LogSchemaGenerator, Log, All); 11 | 12 | class FCodeWriter; 13 | struct FComponentIdGenerator; 14 | 15 | extern TArray SchemaGeneratedClasses; 16 | extern TMap ActorClassPathToSchema; 17 | extern TMap SubobjectClassPathToSchema; 18 | extern TMap LevelPathToComponentId; 19 | extern TMap> SchemaComponentTypeToComponents; 20 | extern TMap NetCullDistanceToComponentId; 21 | 22 | // Generates schema for an Actor 23 | void GenerateActorSchema(FComponentIdGenerator& IdGenerator, UClass* Class, TSharedPtr TypeInfo, FString SchemaPath); 24 | // Generates schema for a Subobject class - the schema type and the dynamic schema components 25 | void GenerateSubobjectSchema(FComponentIdGenerator& IdGenerator, UClass* Class, TSharedPtr TypeInfo, FString SchemaPath); 26 | 27 | // Generates schema for RPC endpoints. 28 | void GenerateRPCEndpointsSchema(FString SchemaPath); 29 | 30 | void AddComponentId(const Worker_ComponentId ComponentId, ComponentIdPerType& SchemaComponents, const ESchemaComponentType ComponentType); 31 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditor/Private/SchemaGenerator/Utils/ComponentIdGenerator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | struct FComponentIdGenerator 6 | { 7 | const uint32 RESERVED_COMPONENT_ID_START = 19000; 8 | const uint32 RESERVED_COMPONENT_ID_END = 19999; 9 | 10 | FComponentIdGenerator(uint32 InNextId) 11 | : NextId(InNextId) 12 | { 13 | ValidateNextId(); 14 | } 15 | 16 | uint32 Next() 17 | { 18 | uint32 Result = NextId++; 19 | ValidateNextId(); 20 | return Result; 21 | } 22 | 23 | uint32 Peek() const 24 | { 25 | return NextId; 26 | } 27 | 28 | private: 29 | 30 | void ValidateNextId() 31 | { 32 | if (RESERVED_COMPONENT_ID_START <= NextId && NextId <= RESERVED_COMPONENT_ID_END) 33 | { 34 | NextId = RESERVED_COMPONENT_ID_END + 1; 35 | } 36 | } 37 | 38 | uint32 NextId; 39 | }; 40 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditor/Public/CloudDeploymentConfiguration.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Containers/UnrealString.h" 6 | 7 | /** 8 | * This struct is used to save all the fields needed to build, upload, and start a cloud deployment. 9 | * This lets the user continue to modify the settings without affecting the deployment that is being prepared. 10 | */ 11 | struct SPATIALGDKEDITOR_API FCloudDeploymentConfiguration 12 | { 13 | void InitFromSettings(); 14 | 15 | FString AssemblyName; 16 | FString RuntimeVersion; 17 | FString PrimaryDeploymentName; 18 | FString PrimaryLaunchConfigPath; 19 | FString SnapshotPath; 20 | FString PrimaryRegionCode; 21 | FString MainDeploymentCluster; 22 | FString DeploymentTags; 23 | 24 | bool bSimulatedPlayersEnabled = false; 25 | FString SimulatedPlayerDeploymentName; 26 | FString SimulatedPlayerLaunchConfigPath; 27 | FString SimulatedPlayerRegionCode; 28 | FString SimulatedPlayerCluster; 29 | uint32 NumberOfSimulatedPlayers = 0; 30 | 31 | bool bBuildAndUploadAssembly = false; 32 | bool bGenerateSchema = false; 33 | bool bGenerateSnapshot = false; 34 | FString BuildConfiguration; 35 | bool bBuildClientWorker = false; 36 | bool bForceAssemblyOverwrite = false; 37 | 38 | FString BuildServerExtraArgs; 39 | FString BuildClientExtraArgs; 40 | FString BuildSimulatedPlayerExtraArgs; 41 | 42 | bool bUseChinaPlatform = false; 43 | }; 44 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKDefaultLaunchConfigGenerator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Logging/LogMacros.h" 6 | 7 | #include "SpatialGDKSettings.h" 8 | #include "SpatialGDKEditorSettings.h" 9 | 10 | DECLARE_LOG_CATEGORY_EXTERN(LogSpatialGDKDefaultLaunchConfigGenerator, Log, All); 11 | 12 | class UAbstractRuntimeLoadBalancingStrategy; 13 | struct FSpatialLaunchConfigDescription; 14 | 15 | uint32 SPATIALGDKEDITOR_API GetWorkerCountFromWorldSettings(const UWorld& World); 16 | 17 | bool SPATIALGDKEDITOR_API FillWorkerConfigurationFromCurrentMap(FWorkerTypeLaunchSection& OutWorker, FIntPoint& OutWorldDimensions); 18 | 19 | bool SPATIALGDKEDITOR_API GenerateLaunchConfig(const FString& LaunchConfigPath, const FSpatialLaunchConfigDescription* InLaunchConfigDescription, const FWorkerTypeLaunchSection& InWorker); 20 | 21 | bool SPATIALGDKEDITOR_API ValidateGeneratedLaunchConfig(const FSpatialLaunchConfigDescription& LaunchConfigDesc, const FWorkerTypeLaunchSection& InWorker); 22 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKDefaultWorkerJsonGenerator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Logging/LogMacros.h" 6 | 7 | DECLARE_LOG_CATEGORY_EXTERN(LogSpatialGDKDefaultWorkerJsonGenerator, Log, All); 8 | 9 | SPATIALGDKEDITOR_API bool GenerateAllDefaultWorkerJsons(bool& bOutRedeployRequired); 10 | SPATIALGDKEDITOR_API bool GenerateDefaultWorkerJson(const FString& WorkerJsonName, const FString& WorkerTypeName, bool& bOutRedeployRequired); 11 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKDevAuthTokenGenerator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Templates/Atomic.h" 7 | #include "Widgets/Notifications/SNotificationList.h" 8 | 9 | DECLARE_LOG_CATEGORY_EXTERN(LogSpatialGDKDevAuthTokenGenerator, Log, All); 10 | 11 | class SPATIALGDKEDITOR_API FSpatialGDKDevAuthTokenGenerator : public TSharedFromThis 12 | { 13 | public: 14 | FSpatialGDKDevAuthTokenGenerator(); 15 | 16 | void AsyncGenerateDevAuthToken(); 17 | 18 | private: 19 | void ShowTaskStartedNotification(const FString& NotificationText); 20 | void ShowTaskEndedNotification(const FString& NotificationText, SNotificationItem::ECompletionState CompletionState); 21 | 22 | void EndTask(bool bSuccess); 23 | void DoGenerateDevAuthTokenTasks(); 24 | 25 | private: 26 | TAtomic bIsGenerating; 27 | TWeakPtr TaskNotificationPtr; 28 | }; 29 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKEditorCloudLauncher.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Logging/LogMacros.h" 6 | 7 | DECLARE_LOG_CATEGORY_EXTERN(LogSpatialGDKEditorCloudLauncher, Log, All); 8 | 9 | struct FCloudDeploymentConfiguration; 10 | 11 | SPATIALGDKEDITOR_API bool SpatialGDKCloudLaunch(const FCloudDeploymentConfiguration& Configuration); 12 | 13 | SPATIALGDKEDITOR_API bool SpatialGDKCloudStop(); 14 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKEditorLayoutDetails.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "IDetailCustomization.h" 7 | 8 | class IErrorReportingWidget; 9 | 10 | class FSpatialGDKEditorLayoutDetails : public IDetailCustomization 11 | { 12 | public: 13 | static TSharedRef MakeInstance(); 14 | virtual void CustomizeDetails(IDetailLayoutBuilder& DetailBuilder) override; 15 | 16 | private: 17 | void ForceRefreshLayout(); 18 | 19 | private: 20 | IDetailLayoutBuilder* CurrentLayout = nullptr; 21 | TSharedPtr ProjectNameInputErrorReporting; 22 | 23 | /** Delegate to commit project name */ 24 | void OnProjectNameCommitted(const FText& InText, ETextCommit::Type InCommitType); 25 | }; 26 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKEditorSnapshotGenerator.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Logging/LogMacros.h" 6 | 7 | DECLARE_LOG_CATEGORY_EXTERN(LogSpatialGDKSnapshot, Log, All); 8 | 9 | SPATIALGDKEDITOR_API bool SpatialGDKGenerateSnapshot(class UWorld* World, FString SnapshotPath); 10 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditor/Public/SpatialLaunchConfigCustomization.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "IPropertyTypeCustomization.h" 7 | 8 | class FSpatialLaunchConfigCustomization : public IPropertyTypeCustomization 9 | { 10 | public: 11 | 12 | static TSharedRef MakeInstance(); 13 | 14 | /** IPropertyTypeCustomization interface */ 15 | virtual void CustomizeHeader(TSharedRef StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override; 16 | virtual void CustomizeChildren(TSharedRef StructPropertyHandle, class IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override; 17 | }; 18 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditor/Public/SpatialRuntimeVersionCustomization.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "IPropertyTypeCustomization.h" 7 | 8 | class FSpatialRuntimeVersionCustomization :public IPropertyTypeCustomization 9 | { 10 | public: 11 | static TSharedRef MakeInstance(); 12 | 13 | /** IPropertyTypeCustomization interface */ 14 | virtual void CustomizeHeader(TSharedRef StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override; 15 | virtual void CustomizeChildren(TSharedRef StructPropertyHandle, class IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override; 16 | }; 17 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditor/Public/Utils/LaunchConfigurationEditor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "SpatialGDKEditorSettings.h" 7 | 8 | #include "LaunchConfigurationEditor.generated.h" 9 | 10 | class ULaunchConfigurationEditor; 11 | class SWindow; 12 | 13 | DECLARE_DELEGATE_OneParam(FOnSpatialOSLaunchConfigurationSaved, const FString&) 14 | 15 | UCLASS(Transient, CollapseCategories) 16 | class SPATIALGDKEDITOR_API ULaunchConfigurationEditor : public UObject 17 | { 18 | GENERATED_BODY() 19 | public: 20 | FOnSpatialOSLaunchConfigurationSaved OnConfigurationSaved; 21 | 22 | UPROPERTY(EditAnywhere, Category = "Launch Configuration") 23 | FSpatialLaunchConfigDescription LaunchConfiguration; 24 | 25 | typedef void(*OnLaunchConfigurationSaved)(const FString&); 26 | 27 | static void OpenModalWindow(TSharedPtr InParentWindow, OnLaunchConfigurationSaved InSaved = nullptr); 28 | protected: 29 | void PostInitProperties() override; 30 | 31 | UFUNCTION(Exec) 32 | void SaveConfiguration(); 33 | }; 34 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditor/Public/Utils/TransientUObjectEditor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "UObject/Object.h" 7 | 8 | #include "TransientUObjectEditor.generated.h" 9 | 10 | DECLARE_DELEGATE(FOnTransientUObjectEditorClosed) 11 | 12 | class SWindow; 13 | 14 | // Utility class to create Editor tools exposing a UObject Field and automatically adding Exec UFUNCTION as buttons. 15 | UCLASS(Blueprintable, Abstract) 16 | class SPATIALGDKEDITOR_API UTransientUObjectEditor : public UObject 17 | { 18 | GENERATED_BODY() 19 | public: 20 | 21 | template 22 | static T* LaunchTransientUObjectEditor(const FText& EditorName, TSharedPtr ParentWindow) 23 | { 24 | return Cast(LaunchTransientUObjectEditor(EditorName, T::StaticClass(), ParentWindow)); 25 | } 26 | 27 | private: 28 | static UTransientUObjectEditor* LaunchTransientUObjectEditor(const FText& EditorName, UClass* ObjectClass, TSharedPtr ParentWindow); 29 | }; 30 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditor/Public/WorkerTypeCustomization.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "IPropertyTypeCustomization.h" 7 | 8 | class FWorkerTypeCustomization : public IPropertyTypeCustomization 9 | { 10 | public: 11 | 12 | static TSharedRef MakeInstance(); 13 | 14 | /** IPropertyTypeCustomization interface */ 15 | virtual void CustomizeHeader(TSharedRef StructPropertyHandle, class FDetailWidgetRow& HeaderRow, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override; 16 | virtual void CustomizeChildren(TSharedRef StructPropertyHandle, class IDetailChildrenBuilder& StructBuilder, IPropertyTypeCustomizationUtils& StructCustomizationUtils) override; 17 | 18 | private: 19 | static void OnGetStrings(TArray>& OutComboBoxStrings, TArray>& OutToolTips, TArray& OutRestrictedItems); 20 | static FString OnGetValue(TSharedPtr WorkerTypeNameHandle); 21 | static void OnValueSelected(const FString& SelectedValue, TSharedPtr WorkerTypeNameHandle); 22 | }; 23 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditor/SpatialGDKEditor.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | using UnrealBuildTool; 4 | 5 | public class SpatialGDKEditor : ModuleRules 6 | { 7 | public SpatialGDKEditor(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | bLegacyPublicIncludePaths = false; 10 | PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; 11 | #pragma warning disable 0618 12 | bFasterWithoutUnity = true; // Deprecated in 4.24, replace with bUseUnity = false; once we drop support for 4.23 13 | if (Target.Version.MinorVersion == 24) // Due to a bug in 4.24, bFasterWithoutUnity is inversed, fixed in master, so should hopefully roll into the next release, remove this once it does 14 | { 15 | bFasterWithoutUnity = false; 16 | } 17 | #pragma warning restore 0618 18 | 19 | PrivateDependencyModuleNames.AddRange( 20 | new string[] { 21 | "Core", 22 | "CoreUObject", 23 | "EditorStyle", 24 | "Engine", 25 | "EngineSettings", 26 | "IOSRuntimeSettings", 27 | "LauncherServices", 28 | "Json", 29 | "PropertyEditor", 30 | "Slate", 31 | "SlateCore", 32 | "SpatialGDK", 33 | "SpatialGDKServices", 34 | "UATHelper", 35 | "UnrealEd", 36 | "DesktopPlatform" 37 | }); 38 | 39 | PrivateIncludePaths.AddRange( 40 | new string[] 41 | { 42 | "SpatialGDKEditor/Private", 43 | }); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditorCommandlet/Private/Commandlets/GenerateSchemaAndSnapshotsCommandlet.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "GenerateSchemaCommandlet.h" 6 | 7 | #include "GenerateSchemaAndSnapshotsCommandlet.generated.h" 8 | 9 | class FSpatialGDKEditor; 10 | 11 | UCLASS() 12 | class UGenerateSchemaAndSnapshotsCommandlet : public UGenerateSchemaCommandlet 13 | { 14 | GENERATED_BODY() 15 | 16 | public: 17 | UGenerateSchemaAndSnapshotsCommandlet(); 18 | 19 | public: 20 | virtual int32 Main(const FString& Params) override; 21 | 22 | private: 23 | const FString MapPathsParamName = TEXT("MapPaths"); // Commandline Argument Name used to declare the paths to generate schema/snapshots against 24 | const FString AssetPathGameDirName = TEXT("/Game"); // Root asset path directory name that maps will ultimately be found in 25 | 26 | TArray GeneratedMapPaths; 27 | 28 | private: 29 | bool GenerateSnapshotForPath(FSpatialGDKEditor& InSpatialGDKEditor, const FString& InPath); 30 | bool GenerateSnapshotForMap(FSpatialGDKEditor& InSpatialGDKEditor, const FString& InMapName); 31 | 32 | bool GenerateSchema(FSpatialGDKEditor& InSpatialGDKEditor); 33 | bool GenerateSnapshotForLoadedMap(FSpatialGDKEditor& InSpatialGDKEditor, const FString& InMapName); 34 | }; 35 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditorCommandlet/Private/Commandlets/GenerateSchemaCommandlet.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Commandlets/Commandlet.h" 6 | 7 | #include "GenerateSchemaCommandlet.generated.h" 8 | 9 | UCLASS() 10 | class UGenerateSchemaCommandlet : public UCommandlet 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | UGenerateSchemaCommandlet(); 16 | 17 | public: 18 | virtual int32 Main(const FString& Params) override; 19 | 20 | protected: 21 | virtual bool HandleOptions(const TArray& Switches); 22 | }; 23 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditorCommandlet/Private/Commandlets/GenerateSnapshotCommandlet.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Commandlets/Commandlet.h" 6 | 7 | #include "GenerateSnapshotCommandlet.generated.h" 8 | 9 | UCLASS() 10 | class UGenerateSnapshotCommandlet : public UCommandlet 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | UGenerateSnapshotCommandlet(); 16 | 17 | public: 18 | virtual int32 Main(const FString& Params) override; 19 | 20 | private: 21 | bool GenerateSnapshots(); 22 | bool GenerateSnapshotForMap(FString WorldPath); 23 | TArray GetAllMapPaths(FString InMapsPath); 24 | }; 25 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditorCommandlet/Private/SpatialGDKEditorCommandletModule.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "SpatialGDKEditorCommandletModule.h" 4 | 5 | #define LOCTEXT_NAMESPACE "FSpatialGDKEditorCommandletModule" 6 | 7 | DEFINE_LOG_CATEGORY(LogSpatialGDKEditorCommandlet); 8 | 9 | IMPLEMENT_MODULE(FSpatialGDKEditorCommandletModule, SpatialGDKEditorCommandlet); 10 | 11 | void FSpatialGDKEditorCommandletModule::StartupModule() 12 | { 13 | } 14 | void FSpatialGDKEditorCommandletModule::ShutdownModule() 15 | { 16 | } 17 | 18 | #undef LOCTEXT_NAMESPACE 19 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditorCommandlet/Private/SpatialGDKEditorCommandletPrivate.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Logging/LogMacros.h" 6 | 7 | DECLARE_LOG_CATEGORY_EXTERN(LogSpatialGDKEditorCommandlet, Log, All); 8 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditorCommandlet/Public/SpatialGDKEditorCommandletModule.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "SpatialGDKEditorCommandletPrivate.h" 6 | 7 | #include "Modules/ModuleInterface.h" 8 | #include "Modules/ModuleManager.h" 9 | 10 | class FSpatialGDKEditorCommandletModule : public IModuleInterface 11 | { 12 | public: 13 | virtual void StartupModule() override; 14 | virtual void ShutdownModule() override; 15 | 16 | virtual bool SupportsDynamicReloading() override 17 | { 18 | return true; 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditorCommandlet/SpatialGDKEditorCommandlet.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | using UnrealBuildTool; 4 | 5 | public class SpatialGDKEditorCommandlet : ModuleRules 6 | { 7 | public SpatialGDKEditorCommandlet(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | bLegacyPublicIncludePaths = false; 10 | PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; 11 | #pragma warning disable 0618 12 | bFasterWithoutUnity = true; // Deprecated in 4.24, replace with bUseUnity = false; once we drop support for 4.23 13 | if (Target.Version.MinorVersion == 24) // Due to a bug in 4.24, bFasterWithoutUnity is inversed, fixed in master, so should hopefully roll into the next release, remove this once it does 14 | { 15 | bFasterWithoutUnity = false; 16 | } 17 | #pragma warning restore 0618 18 | 19 | PrivateDependencyModuleNames.AddRange( 20 | new string[] { 21 | "Core", 22 | "CoreUObject", 23 | "Engine", 24 | "EngineSettings", 25 | "SpatialGDK", 26 | "SpatialGDKEditor", 27 | "SpatialGDKServices", 28 | "UnrealEd", 29 | }); 30 | 31 | PrivateIncludePaths.AddRange( 32 | new string[] 33 | { 34 | "SpatialGDKEditorCommandlet/Private", 35 | "SpatialGDKEditorCommandlet/Private/Commandlets" 36 | }); 37 | } 38 | } 39 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKEditorToolbar/Public/SpatialGDKEditorToolbarStyle.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Styling/SlateStyle.h" 7 | 8 | class FSlateStyleSet; 9 | 10 | class FSpatialGDKEditorToolbarStyle 11 | { 12 | public: 13 | static void Initialize(); 14 | static void Shutdown(); 15 | static void ReloadTextures(); 16 | static const ISlateStyle& Get(); 17 | static FName GetStyleSetName(); 18 | 19 | private: 20 | static TSharedRef Create(); 21 | static TSharedPtr StyleInstance; 22 | }; 23 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/Private/SpatialFunctionalTestAutoDestroyComponent.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | 4 | #include "SpatialFunctionalTestAutoDestroyComponent.h" 5 | 6 | USpatialFunctionalTestAutoDestroyComponent::USpatialFunctionalTestAutoDestroyComponent() 7 | : Super() 8 | { 9 | #if ENGINE_MINOR_VERSION <= 23 10 | bReplicates = true; 11 | #else 12 | SetIsReplicatedByDefault(true); 13 | #endif 14 | } 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/Private/SpatialFunctionalTestBlueprintLibrary.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "SpatialFunctionalTestBlueprintLibrary.h" 4 | 5 | FSpatialFunctionalTestStepDefinition USpatialFunctionalTestBlueprintLibrary::MakeStepDefinition(const FString& StepName, const FStepIsReadyDelegate& IsReadyEvent, const FStepStartDelegate& StartEvent, const FStepTickDelegate& TickEvent, const float StepTimeLimit) 6 | { 7 | FSpatialFunctionalTestStepDefinition StepDefinition; 8 | StepDefinition.StepName = StepName; 9 | StepDefinition.IsReadyEvent = IsReadyEvent; 10 | StepDefinition.StartEvent = StartEvent; 11 | StepDefinition.TickEvent = TickEvent; 12 | StepDefinition.TimeLimit = StepTimeLimit; 13 | return StepDefinition; 14 | } 15 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/Private/SpatialFunctionalTestGridLBStrategy.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | 4 | #include "SpatialFunctionalTestGridLBStrategy.h" 5 | #include "GameFramework/Actor.h" 6 | #include "SpatialFunctionalTestWorkerDelegationComponent.h" 7 | 8 | USpatialFunctionalTestGridLBStrategy::USpatialFunctionalTestGridLBStrategy() 9 | : Super() 10 | { 11 | Rows = 2; 12 | Cols = 2; 13 | } 14 | 15 | bool USpatialFunctionalTestGridLBStrategy::ShouldHaveAuthority(const AActor& Actor) const 16 | { 17 | USpatialFunctionalTestWorkerDelegationComponent* DelegationComponent = Actor.FindComponentByClass(); 18 | 19 | if (DelegationComponent != nullptr) 20 | { 21 | return GetLocalVirtualWorkerId() == DelegationComponent->WorkerId; 22 | } 23 | return Super::ShouldHaveAuthority(Actor); 24 | } 25 | 26 | VirtualWorkerId USpatialFunctionalTestGridLBStrategy::WhoShouldHaveAuthority(const AActor& Actor) const 27 | { 28 | USpatialFunctionalTestWorkerDelegationComponent* DelegationComponent = Actor.FindComponentByClass(); 29 | 30 | if (DelegationComponent != nullptr) 31 | { 32 | return DelegationComponent->WorkerId; 33 | } 34 | return Super::WhoShouldHaveAuthority(Actor); 35 | } 36 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/Private/SpatialFunctionalTestWorkerDelegationComponent.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "SpatialFunctionalTestWorkerDelegationComponent.h" 4 | #include "Net/UnrealNetwork.h" 5 | 6 | USpatialFunctionalTestWorkerDelegationComponent::USpatialFunctionalTestWorkerDelegationComponent() 7 | : Super() 8 | { 9 | #if ENGINE_MINOR_VERSION <= 23 10 | bReplicates = true; 11 | #else 12 | SetIsReplicatedByDefault(true); 13 | #endif 14 | } 15 | 16 | void USpatialFunctionalTestWorkerDelegationComponent::GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const 17 | { 18 | Super::GetLifetimeReplicatedProps(OutLifetimeProps); 19 | 20 | DOREPLIFETIME(USpatialFunctionalTestWorkerDelegationComponent, WorkerId); 21 | DOREPLIFETIME(USpatialFunctionalTestWorkerDelegationComponent, bIsPersistent); 22 | } 23 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/Private/SpatialGDKFunctionalTestsModule.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "SpatialGDKFunctionalTestsModule.h" 4 | 5 | #include "SpatialGDKFunctionalTestsPrivate.h" 6 | 7 | #define LOCTEXT_NAMESPACE "FSpatialGDKFunctionalTestsModule" 8 | 9 | DEFINE_LOG_CATEGORY(LogSpatialGDKFunctionalTests); 10 | 11 | IMPLEMENT_MODULE(FSpatialGDKFunctionalTestsModule, SpatialGDKFunctionalTests); 12 | 13 | void FSpatialGDKFunctionalTestsModule::StartupModule() 14 | { 15 | } 16 | 17 | void FSpatialGDKFunctionalTestsModule::ShutdownModule() 18 | { 19 | } 20 | 21 | #undef LOCTEXT_NAMESPACE 22 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/Private/SpatialGDKFunctionalTestsPrivate.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Logging/LogMacros.h" 6 | 7 | DECLARE_LOG_CATEGORY_EXTERN(LogSpatialGDKFunctionalTests, Log, All); 8 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/Private/Test1x2GridStrategy.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | 4 | #include "Test1x2GridStrategy.h" 5 | 6 | UTest1x2GridStrategy::UTest1x2GridStrategy() 7 | { 8 | Cols = 2; 9 | InterestBorder = 10000.0f; 10 | } 11 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/Public/SpatialFunctionalTestAutoDestroyComponent.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Components/ActorComponent.h" 7 | #include "SpatialFunctionalTestAutoDestroyComponent.generated.h" 8 | 9 | 10 | /* 11 | * Empty component to be added to actors so that they can be automatically destroyed when the tests finish 12 | */ 13 | UCLASS( NotBlueprintable, ClassGroup=SpatialFunctionalTest ) 14 | class SPATIALGDKFUNCTIONALTESTS_API USpatialFunctionalTestAutoDestroyComponent : public USceneComponent 15 | { 16 | GENERATED_BODY() 17 | 18 | public: 19 | USpatialFunctionalTestAutoDestroyComponent(); 20 | }; 21 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/Public/SpatialFunctionalTestBlueprintLibrary.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Kismet/BlueprintFunctionLibrary.h" 7 | #include "SpatialFunctionalTestStep.h" 8 | #include "SpatialFunctionalTestBlueprintLibrary.generated.h" 9 | 10 | 11 | UCLASS(meta = (ScriptName = "SpatialFunctionalTestLibrary")) 12 | class SPATIALGDKFUNCTIONALTESTS_API USpatialFunctionalTestBlueprintLibrary : public UBlueprintFunctionLibrary 13 | { 14 | GENERATED_BODY() 15 | 16 | public: 17 | 18 | UFUNCTION(BlueprintPure, Category = "Spatial Functional Test", meta = (AutoCreateRefTerm = "IsReadyEvent,StartEvent,TickEvent", NativeMakeFunc)) 19 | static FSpatialFunctionalTestStepDefinition MakeStepDefinition(const FString& StepName, const FStepIsReadyDelegate& IsReadyEvent, const FStepStartDelegate& StartEvent, const FStepTickDelegate& TickEvent, const float StepTimeLimit); 20 | }; 21 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/Public/SpatialFunctionalTestFlowControllerSpawner.h: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #include "Math/Transform.h" 3 | #include "Templates/SubclassOf.h" 4 | 5 | class APlayerController; 6 | class ASpatialFunctionalTestFlowController; 7 | class ASpatialFunctionalTest; 8 | class UWorld; 9 | 10 | class SpatialFunctionalTestFlowControllerSpawner 11 | { 12 | public: 13 | //default constructor has to exist for generated code, shouldn't be used in user code 14 | SpatialFunctionalTestFlowControllerSpawner(); 15 | SpatialFunctionalTestFlowControllerSpawner(ASpatialFunctionalTest* ControllerOwningTest, TSubclassOf FlowControllerClassToSpawn); 16 | 17 | void ModifyFlowControllerClassToSpawn(TSubclassOf FlowControllerClassToSpawn); 18 | 19 | ASpatialFunctionalTestFlowController* SpawnServerFlowController(); 20 | ASpatialFunctionalTestFlowController* SpawnClientFlowController(APlayerController* OwningClient); 21 | 22 | void AssignClientFlowControllerId(ASpatialFunctionalTestFlowController* ClientFlowController); 23 | 24 | private: 25 | ASpatialFunctionalTest* OwningTest; 26 | TSubclassOf FlowControllerClass; 27 | uint8 NextClientControllerId; 28 | 29 | uint8 OwningServerIntanceId(UWorld* World) const; 30 | void LockFlowControllerDelegations(ASpatialFunctionalTestFlowController* FlowController) const; 31 | }; 32 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/Public/SpatialFunctionalTestGridLBStrategy.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "LoadBalancing/GridBasedLBStrategy.h" 7 | #include "SpatialFunctionalTestLBDelegationInterface.h" 8 | #include "SpatialFunctionalTestGridLBStrategy.generated.h" 9 | 10 | /** 11 | * A 2 by 2 (rows by columns) load balancing strategy for testing zoning features. 12 | * You should use this Grid LBS instead of the UGridBasedLBStrategy because it allows you to 13 | * do runtime delegations of Actors to specific Server Workers. 14 | */ 15 | UCLASS() 16 | class SPATIALGDKFUNCTIONALTESTS_API USpatialFunctionalTestGridLBStrategy : public UGridBasedLBStrategy, public ISpatialFunctionalTestLBDelegationInterface 17 | { 18 | GENERATED_BODY() 19 | 20 | public: 21 | USpatialFunctionalTestGridLBStrategy(); 22 | 23 | virtual bool ShouldHaveAuthority(const AActor& Actor) const override; 24 | virtual VirtualWorkerId WhoShouldHaveAuthority(const AActor& Actor) const override; 25 | }; 26 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/Public/SpatialFunctionalTestLBDelegationInterface.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "SpatialCommonTypes.h" 7 | #include "SpatialFunctionalTestLBDelegationInterface.generated.h" 8 | 9 | /** 10 | * Interface that can be added to Spatial's Load Balancing Strategies to allow you to 11 | * delegate Actors to specific Server Workers at runtime. 12 | * To guarantee that this delegation system works even when Server Workers don't have 13 | * complete World area of interest, we add USpatialFunctionalTestDelegationComponent 14 | * to Actors. 15 | */ 16 | UINTERFACE(MinimalAPI, Blueprintable) 17 | class USpatialFunctionalTestLBDelegationInterface : public UInterface 18 | { 19 | GENERATED_BODY() 20 | }; 21 | 22 | class ISpatialFunctionalTestLBDelegationInterface 23 | { 24 | GENERATED_BODY() 25 | 26 | public: 27 | // Adds or changes the current Actor Delegation to WorkerId 28 | bool AddActorDelegation(AActor* Actor, VirtualWorkerId WorkerId, bool bPersistOnTestFinished = false); 29 | 30 | // Removes an Actor Delegation, which means that it will fallback to the Load Balancing Strategy 31 | bool RemoveActorDelegation(AActor* Actor); 32 | 33 | // If there's an Actor Delegation it will return True, and WorkerId and bIsPersistent will be set accordingly 34 | bool HasActorDelegation(AActor* Actor, VirtualWorkerId& WorkerId, bool& bIsPersistent); 35 | 36 | void RemoveAllActorDelegations(UWorld* World, bool bRemovePersistent = false); 37 | }; 38 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/Public/SpatialFunctionalTestWorkerDelegationComponent.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "SpatialCommonTypes.h" 7 | #include "SpatialFunctionalTestWorkerDelegationComponent.generated.h" 8 | 9 | /* 10 | * Actor Component for Functional Testing purposes only that allows you to delegate its Actor to a specific Server Worker. 11 | * Note that currently this functionality only works in single layer Load Balancing Strategies, and your Default Load 12 | * Balancing Strategy needs to implement ISpatialFunctionalTestLBDelegationInterface. 13 | */ 14 | UCLASS(BlueprintType) 15 | class SPATIALGDKFUNCTIONALTESTS_API USpatialFunctionalTestWorkerDelegationComponent : public UActorComponent 16 | { 17 | GENERATED_BODY() 18 | 19 | public: 20 | USpatialFunctionalTestWorkerDelegationComponent(); 21 | 22 | virtual void GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const override; 23 | 24 | UPROPERTY(Replicated, VisibleAnywhere, BlueprintReadOnly, Category="Default") 25 | int WorkerId = 0; 26 | 27 | UPROPERTY(Replicated, VisibleAnywhere, BlueprintReadOnly, Category="Default") 28 | bool bIsPersistent = false; 29 | }; 30 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/Public/SpatialGDKFunctionalTestsModule.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Modules/ModuleInterface.h" 6 | #include "Modules/ModuleManager.h" 7 | 8 | class SPATIALGDKFUNCTIONALTESTS_API FSpatialGDKFunctionalTestsModule : public IModuleInterface 9 | { 10 | public: 11 | virtual void StartupModule() override; 12 | virtual void ShutdownModule() override; 13 | 14 | virtual bool SupportsDynamicReloading() override 15 | { 16 | return true; 17 | } 18 | }; 19 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/Public/Test1x2GridStrategy.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "LoadBalancing/GridBasedLBStrategy.h" 7 | #include "Test1x2GridStrategy.generated.h" 8 | 9 | /** 10 | * A 1 by 2 (rows by columns) load balancing strategy for testing zoning features. 11 | * Has a 10000 unit interest border, so almost everything should be in view. 12 | */ 13 | UCLASS() 14 | class SPATIALGDKFUNCTIONALTESTS_API UTest1x2GridStrategy : public UGridBasedLBStrategy 15 | { 16 | GENERATED_BODY() 17 | 18 | public: 19 | UTest1x2GridStrategy(); 20 | }; 21 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/CrossServerAndClientOrchestrationTest/CrossServerAndClientOrchestrationFlowController.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | 4 | #include "CrossServerAndClientOrchestrationFlowController.h" 5 | 6 | #include "CrossServerAndClientOrchestrationTest.h" 7 | 8 | void ACrossServerAndClientOrchestrationFlowController::ServerClientReadValueAck_Implementation() 9 | { 10 | ACrossServerAndClientOrchestrationTest* Test = Cast(OwningTest); 11 | Test->CrossServerSetTestValue(ESpatialFunctionalTestWorkerType::Client, WorkerDefinition.Id); 12 | } 13 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/CrossServerAndClientOrchestrationTest/CrossServerAndClientOrchestrationFlowController.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "SpatialFunctionalTestFlowController.h" 7 | #include "CrossServerAndClientOrchestrationFlowController.generated.h" 8 | 9 | /** 10 | * 11 | */ 12 | UCLASS() 13 | class SPATIALGDKFUNCTIONALTESTS_API ACrossServerAndClientOrchestrationFlowController : public ASpatialFunctionalTestFlowController 14 | { 15 | GENERATED_BODY() 16 | 17 | public: 18 | UFUNCTION(Server, Reliable) 19 | void ServerClientReadValueAck(); 20 | }; 21 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/CrossServerAndClientOrchestrationTest/CrossServerAndClientOrchestrationTest.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "SpatialFunctionalTest.h" 7 | #include "CrossServerAndClientOrchestrationTest.generated.h" 8 | 9 | /** 10 | * 11 | */ 12 | UCLASS() 13 | class SPATIALGDKFUNCTIONALTESTS_API ACrossServerAndClientOrchestrationTest : public ASpatialFunctionalTest 14 | { 15 | GENERATED_BODY() 16 | 17 | public: 18 | ACrossServerAndClientOrchestrationTest(); 19 | 20 | virtual void BeginPlay() override; 21 | 22 | UPROPERTY(Replicated) 23 | TArray ServerWorkerSetValues; 24 | UPROPERTY(Replicated) 25 | TArray ClientWorkerSetValues; 26 | 27 | UFUNCTION(CrossServer, Reliable) 28 | void CrossServerSetTestValue(ESpatialFunctionalTestWorkerType ControllerType, uint8 ChangedInstance); 29 | 30 | virtual void GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const; 31 | 32 | private: 33 | void Assert_ServerStepIsRunningInExpectedEnvironment(int InstanceToRunIn, ASpatialFunctionalTestFlowController* FlowController); 34 | void Assert_ClientStepIsRunningInExpectedEnvironment(int InstanceToRunIn, ASpatialFunctionalTestFlowController* FlowController); 35 | bool CheckAllValuesHaveBeenSetAndCanBeLocallyRead(); 36 | }; 37 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/DormancyAndTombstoneTest/DormancyAndTombstoneTest.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "SpatialFunctionalTest.h" 7 | #include "DormancyAndTombstoneTest.generated.h" 8 | 9 | UCLASS() 10 | class SPATIALGDKFUNCTIONALTESTS_API ADormancyAndTombstoneTest : public ASpatialFunctionalTest 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | ADormancyAndTombstoneTest(); 16 | 17 | virtual void BeginPlay() override; 18 | }; 19 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/DormancyAndTombstoneTest/DormancyTestActor.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "DormancyTestActor.h" 4 | 5 | #include "Engine/Classes/Components/StaticMeshComponent.h" 6 | #include "Engine/Classes/Materials/Material.h" 7 | #include "Net/UnrealNetwork.h" 8 | 9 | ADormancyTestActor::ADormancyTestActor() 10 | { 11 | bReplicates = true; 12 | TestIntProp = 0; 13 | 14 | GetStaticMeshComponent()->SetStaticMesh(LoadObject(nullptr, TEXT("StaticMesh'/Engine/BasicShapes/Sphere.Sphere'"))); 15 | GetStaticMeshComponent()->SetMaterial(0, LoadObject(nullptr, TEXT("Material'/Engine/BasicShapes/BasicShapeMaterial.BasicShapeMaterial'"))); 16 | 17 | NetDormancy = DORM_Initial; // By default dormant initially, as we have no way to correctly set this at runtime. 18 | #if ENGINE_MINOR_VERSION < 24 19 | bHidden = true; 20 | #else 21 | SetHidden(true); 22 | #endif 23 | } 24 | 25 | 26 | void ADormancyTestActor::GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const 27 | { 28 | Super::GetLifetimeReplicatedProps(OutLifetimeProps); 29 | 30 | DOREPLIFETIME(ADormancyTestActor, TestIntProp); 31 | } 32 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/DormancyAndTombstoneTest/DormancyTestActor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Engine/StaticMeshActor.h" 7 | #include "DormancyTestActor.generated.h" 8 | 9 | /** 10 | * A Helper actor for the dormancy tests. 11 | * Has a TestIntProp to see if it replicates when it should/shouldn't. 12 | */ 13 | UCLASS() 14 | class SPATIALGDKFUNCTIONALTESTS_API ADormancyTestActor : public AStaticMeshActor 15 | { 16 | GENERATED_BODY() 17 | 18 | public: 19 | ADormancyTestActor(); 20 | 21 | void GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const override; 22 | 23 | UPROPERTY(Replicated) 24 | int TestIntProp; 25 | }; 26 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/RegisterAutoDestroyActorsTest/RegisterAutoDestroyActorsTest.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "SpatialFunctionalTest.h" 7 | #include "RegisterAutoDestroyActorsTest.generated.h" 8 | 9 | /** 10 | * These Tests are meant to test the functionality of RegisterAutoDestroyActor in Test environments. 11 | * Keep in mind that for it to run correctly you need to run both part 1 and 2, and in that order, 12 | * since the auto destruction happens at the end of the test, so you need the next test to check 13 | * that it is working. This test should work both with and without load-balancing, as long as 14 | * the servers have global interest area (limitation at this time). 15 | */ 16 | UCLASS() 17 | class SPATIALGDKFUNCTIONALTESTS_API ARegisterAutoDestroyActorsTestPart1 : public ASpatialFunctionalTest 18 | { 19 | GENERATED_BODY() 20 | 21 | ARegisterAutoDestroyActorsTestPart1(); 22 | 23 | virtual void BeginPlay() override; 24 | }; 25 | 26 | UCLASS() 27 | class SPATIALGDKFUNCTIONALTESTS_API ARegisterAutoDestroyActorsTestPart2 : public ASpatialFunctionalTest 28 | { 29 | GENERATED_BODY() 30 | 31 | ARegisterAutoDestroyActorsTestPart2(); 32 | 33 | virtual void BeginPlay() override; 34 | 35 | }; 36 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/SpatialTestCharacterMovement/CharacterMovementTestGameMode.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | 4 | #include "CharacterMovementTestGameMode.h" 5 | #include "TestMovementCharacter.h" 6 | 7 | ACharacterMovementTestGameMode::ACharacterMovementTestGameMode(const FObjectInitializer& ObjectInitializer) 8 | : Super(ObjectInitializer) 9 | { 10 | DefaultPawnClass = ATestMovementCharacter::StaticClass(); 11 | } 12 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/SpatialTestCharacterMovement/CharacterMovementTestGameMode.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "GameFramework/GameModeBase.h" 7 | #include "CharacterMovementTestGameMode.generated.h" 8 | 9 | /** 10 | * GameMode used for the SpatialTestCharacterMovementMap 11 | */ 12 | UCLASS() 13 | class ACharacterMovementTestGameMode : public AGameModeBase 14 | { 15 | GENERATED_UCLASS_BODY() 16 | }; 17 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/SpatialTestCharacterMovement/SpatialTestCharacterMovement.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "SpatialFunctionalTest.h" 7 | #include "SpatialTestCharacterMovement.generated.h" 8 | 9 | UCLASS() 10 | class ASpatialTestCharacterMovement : public ASpatialFunctionalTest 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | ASpatialTestCharacterMovement(); 16 | 17 | virtual void BeginPlay() override; 18 | 19 | bool bCharacterReachedDestination; 20 | 21 | UFUNCTION() 22 | void OnOverlapBegin(AActor* OverlappedActor, AActor* OtherActor); 23 | }; 24 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/SpatialTestCharacterMovement/TestMovementCharacter.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "GameFramework/Character.h" 7 | #include "TestMovementCharacter.generated.h" 8 | 9 | UCLASS() 10 | class ATestMovementCharacter : public ACharacter 11 | { 12 | GENERATED_BODY() 13 | 14 | private: 15 | UPROPERTY() 16 | UStaticMeshComponent* SphereComponent; 17 | 18 | UPROPERTY() 19 | class UCameraComponent* CameraComponent; 20 | 21 | public: 22 | ATestMovementCharacter(); 23 | 24 | UFUNCTION(Client, Reliable) 25 | void UpdateCameraLocationAndRotation(FVector Location, FRotator NewRotation); 26 | }; 27 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/SpatialTestPossession/SpatialTestPossession.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "SpatialFunctionalTest.h" 7 | #include "SpatialTestPossession.generated.h" 8 | 9 | UCLASS() 10 | class SPATIALGDKFUNCTIONALTESTS_API ASpatialTestPossession : public ASpatialFunctionalTest 11 | { 12 | GENERATED_BODY() 13 | public: 14 | ASpatialTestPossession(); 15 | 16 | virtual void BeginPlay() override; 17 | 18 | // To save original Pawns and possess them back at the end 19 | TArray> OriginalPawns; 20 | }; 21 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/SpatialTestPossession/SpatialTestRepossession.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "SpatialFunctionalTest.h" 7 | #include "SpatialTestRepossession.generated.h" 8 | 9 | class ATestPossessionPawn; 10 | 11 | UCLASS() 12 | class SPATIALGDKFUNCTIONALTESTS_API ASpatialTestRepossession : public ASpatialFunctionalTest 13 | { 14 | GENERATED_BODY() 15 | public: 16 | ASpatialTestRepossession(); 17 | 18 | virtual void BeginPlay() override; 19 | 20 | void GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const override; 21 | 22 | UPROPERTY(Replicated) 23 | TArray Controllers; 24 | UPROPERTY(Replicated) 25 | TArray TestPawns; 26 | 27 | // To possess original pawns 28 | TArray> OriginalPawns; 29 | }; 30 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/SpatialTestPossession/TestPossessionPawn.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "Engine/World.h" 7 | #include "TestPossessionPawn.generated.h" 8 | 9 | class UCameraComponent; 10 | 11 | UCLASS() 12 | class ATestPossessionPawn : public APawn 13 | { 14 | GENERATED_BODY() 15 | private: 16 | UPROPERTY() 17 | UStaticMeshComponent* SphereComponent; 18 | 19 | UPROPERTY(VisibleAnywhere, Category = "Spatial Functional Test") 20 | UCameraComponent* CameraComponent; 21 | public: 22 | ATestPossessionPawn(); 23 | }; 24 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/TestActors/ReplicatedTestActorBase.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | 4 | #include "ReplicatedTestActorBase.h" 5 | #include "Components/StaticMeshComponent.h" 6 | #include "Materials/Material.h" 7 | 8 | AReplicatedTestActorBase::AReplicatedTestActorBase() 9 | { 10 | bReplicates = true; 11 | 12 | CubeComponent = CreateDefaultSubobject(TEXT("CubeComponent")); 13 | CubeComponent->SetStaticMesh(LoadObject(nullptr, TEXT("StaticMesh'/Engine/BasicShapes/Cube.Cube'"))); 14 | CubeComponent->SetMaterial(0, LoadObject(nullptr, TEXT("Material'/Engine/BasicShapes/BasicShapeMaterial.BasicShapeMaterial'"))); 15 | CubeComponent->SetVisibility(true); 16 | 17 | RootComponent = CubeComponent; 18 | } 19 | 20 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/TestActors/ReplicatedTestActorBase.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "GameFramework/Actor.h" 7 | #include "ReplicatedTestActorBase.generated.h" 8 | 9 | /** 10 | * A replicated Actor with a Cube Mesh, used as a base for Actors used in tests. 11 | */ 12 | UCLASS() 13 | class AReplicatedTestActorBase : public AActor 14 | { 15 | GENERATED_BODY() 16 | 17 | public: 18 | AReplicatedTestActorBase(); 19 | 20 | UPROPERTY() 21 | UStaticMeshComponent* CubeComponent; 22 | }; 23 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/UNR-3066/OwnerOnlyPropertyReplication.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "OwnerOnlyTestPawn.h" 7 | #include "SpatialFunctionalTest.h" 8 | #include "OwnerOnlyPropertyReplication.generated.h" 9 | 10 | UCLASS() 11 | class SPATIALGDKFUNCTIONALTESTS_API AOwnerOnlyPropertyReplication : public ASpatialFunctionalTest 12 | { 13 | GENERATED_BODY() 14 | 15 | public: 16 | AOwnerOnlyPropertyReplication(); 17 | 18 | virtual void BeginPlay() override; 19 | 20 | void GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const override; 21 | 22 | private: 23 | UPROPERTY(Replicated) 24 | AOwnerOnlyTestPawn* Pawn = nullptr; 25 | 26 | float StepTimer = 0.0f; 27 | 28 | TArray> OriginalPawns; 29 | }; 30 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/UNR-3066/OwnerOnlyTestPawn.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "OwnerOnlyTestPawn.h" 4 | #include "Net/UnrealNetwork.h" 5 | 6 | void AOwnerOnlyTestPawn::GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const 7 | { 8 | Super::GetLifetimeReplicatedProps(OutLifetimeProps); 9 | 10 | DOREPLIFETIME_CONDITION(AOwnerOnlyTestPawn, TestInt, COND_OwnerOnly); 11 | } 12 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/UNR-3066/OwnerOnlyTestPawn.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "GameFramework/Pawn.h" 7 | #include "OwnerOnlyTestPawn.generated.h" 8 | 9 | UCLASS() 10 | class AOwnerOnlyTestPawn : public APawn 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | void GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const override; 16 | 17 | UPROPERTY(Replicated) 18 | int32 TestInt = 0; 19 | }; 20 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/UNR-3157/RPCInInterfaceActor.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "RPCInInterfaceActor.h" 4 | 5 | ARPCInInterfaceActor::ARPCInInterfaceActor() 6 | { 7 | PrimaryActorTick.bCanEverTick = false; 8 | bAlwaysRelevant = true; 9 | } 10 | 11 | void ARPCInInterfaceActor::RPCInInterface_Implementation() 12 | { 13 | bRPCReceived = true; 14 | } 15 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/UNR-3157/RPCInInterfaceActor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "GameFramework/Actor.h" 7 | #include "RPCTestInterface.h" 8 | #include "RPCInInterfaceActor.generated.h" 9 | 10 | UCLASS(Blueprintable) 11 | class SPATIALGDKFUNCTIONALTESTS_API ARPCInInterfaceActor : public AActor, public IRPCTestInterface 12 | { 13 | GENERATED_BODY() 14 | 15 | public: 16 | ARPCInInterfaceActor(); 17 | 18 | bool bRPCReceived = false; 19 | 20 | UFUNCTION(Client, Reliable) 21 | virtual void RPCInInterface() override; 22 | 23 | protected: 24 | virtual void RPCInInterface_Implementation() override; 25 | }; 26 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/UNR-3157/RPCInInterfaceTest.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "RPCInInterfaceActor.h" 7 | #include "SpatialFunctionalTest.h" 8 | #include "RPCInInterfaceTest.generated.h" 9 | 10 | UCLASS() 11 | class SPATIALGDKFUNCTIONALTESTS_API ARPCInInterfaceTest : public ASpatialFunctionalTest 12 | { 13 | GENERATED_BODY() 14 | 15 | public: 16 | ARPCInInterfaceTest(); 17 | 18 | virtual void BeginPlay() override; 19 | 20 | void GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const override; 21 | 22 | private: 23 | float StepTimer = 0.0f; 24 | 25 | UPROPERTY(Replicated) 26 | ARPCInInterfaceActor* TestActor = nullptr; 27 | }; 28 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/UNR-3157/RPCTestInterface.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "UObject/Interface.h" 6 | #include "Engine/Classes/Engine/EngineTypes.h" 7 | #include "RPCTestInterface.generated.h" 8 | 9 | UINTERFACE(Blueprintable) 10 | class URPCTestInterface : public UInterface 11 | { 12 | GENERATED_BODY() 13 | }; 14 | 15 | class IRPCTestInterface 16 | { 17 | GENERATED_BODY() 18 | 19 | public: 20 | UFUNCTION(Client, Reliable) 21 | virtual void RPCInInterface(); 22 | }; 23 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/UNR-3761/SpatialTestNetReference/CubeWithReferences.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | 4 | #include "CubeWithReferences.h" 5 | #include "Net/UnrealNetwork.h" 6 | 7 | ACubeWithReferences::ACubeWithReferences() 8 | { 9 | bNetLoadOnClient = false; 10 | bNetLoadOnNonAuthServer = true; 11 | } 12 | 13 | int ACubeWithReferences::CountValidNeighbours() 14 | { 15 | int ValidNeighbours = 0; 16 | 17 | if (IsValid(Neighbour1)) 18 | { 19 | ValidNeighbours++; 20 | } 21 | 22 | if (IsValid(Neighbour2)) 23 | { 24 | ValidNeighbours++; 25 | } 26 | 27 | return ValidNeighbours; 28 | } 29 | 30 | void ACubeWithReferences::GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const 31 | { 32 | Super::GetLifetimeReplicatedProps(OutLifetimeProps); 33 | 34 | DOREPLIFETIME(ACubeWithReferences, Neighbour1); 35 | DOREPLIFETIME(ACubeWithReferences, Neighbour2); 36 | } 37 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/UNR-3761/SpatialTestNetReference/CubeWithReferences.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "SpatialGDKFunctionalTests/SpatialGDK/TestActors/ReplicatedTestActorBase.h" 7 | #include "CubeWithReferences.generated.h" 8 | 9 | UCLASS() 10 | class ACubeWithReferences : public AReplicatedTestActorBase 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | ACubeWithReferences(); 16 | 17 | int CountValidNeighbours(); 18 | 19 | void GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const override; 20 | 21 | UPROPERTY(Replicated) 22 | ACubeWithReferences* Neighbour1; 23 | 24 | UPROPERTY(Replicated) 25 | ACubeWithReferences* Neighbour2; 26 | }; 27 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/UNR-3761/SpatialTestNetReference/SpatialTestNetReference.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "SpatialFunctionalTest.h" 7 | #include "SpatialTestNetReference.generated.h" 8 | 9 | UCLASS() 10 | class SPATIALGDKFUNCTIONALTESTS_API ASpatialTestNetReference : public ASpatialFunctionalTest 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | ASpatialTestNetReference(); 16 | 17 | virtual void FinishTest(EFunctionalTestResult TestResult, const FString& Message) override; 18 | 19 | virtual void BeginPlay() override; 20 | 21 | // Array used to store the locations in which the character will perform the references check and the number of cubes that should be visible at that location 22 | TArray> TestLocations; 23 | 24 | // Helper array used to store the relative locations of the camera, so that it can see all cubes from every test location, used for visual debugging 25 | TArray CameraRelativeLocations; 26 | 27 | // Helper rotator used to store the relative rotation of the camera so that it can see all cubes from every test location, used for visual debugging 28 | FRotator CameraRelativeRotation; 29 | 30 | TPair OriginalPawn; 31 | 32 | float PreviousPositionUpdateFrequency; 33 | }; 34 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/UNR-3761/SpatialTestReplicatedStartupActor/ReplicatedStartupActorGameMode.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | 4 | #include "ReplicatedStartupActorGameMode.h" 5 | #include "ReplicatedStartupActorPlayerController.h" 6 | 7 | AReplicatedStartupActorGameMode::AReplicatedStartupActorGameMode(const FObjectInitializer& ObjectInitializer) 8 | : Super(ObjectInitializer) 9 | { 10 | PlayerControllerClass = AReplicatedStartupActorPlayerController::StaticClass(); 11 | } 12 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/UNR-3761/SpatialTestReplicatedStartupActor/ReplicatedStartupActorGameMode.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "GameFramework/GameModeBase.h" 7 | #include "ReplicatedStartupActorGameMode.generated.h" 8 | 9 | UCLASS() 10 | class AReplicatedStartupActorGameMode : public AGameModeBase 11 | { 12 | GENERATED_UCLASS_BODY() 13 | }; 14 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/UNR-3761/SpatialTestReplicatedStartupActor/ReplicatedStartupActorPlayerController.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | 4 | #include "ReplicatedStartupActorPlayerController.h" 5 | #include "SpatialTestReplicatedStartupActor.h" 6 | 7 | void AReplicatedStartupActorPlayerController::ClientToServerRPC_Implementation(ASpatialTestReplicatedStartupActor* Test, AActor* ReplicatedActor) 8 | { 9 | if (IsValid(ReplicatedActor)) 10 | { 11 | Test->bIsValidReference = true; 12 | } 13 | } 14 | 15 | void AReplicatedStartupActorPlayerController::ResetBoolean_Implementation(ASpatialTestReplicatedStartupActor* Test) 16 | { 17 | Test->bIsValidReference = false; 18 | } 19 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/UNR-3761/SpatialTestReplicatedStartupActor/ReplicatedStartupActorPlayerController.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "GameFramework/PlayerController.h" 7 | #include "ReplicatedStartupActorPlayerController.generated.h" 8 | 9 | class ASpatialTestReplicatedStartupActor; 10 | UCLASS() 11 | class AReplicatedStartupActorPlayerController : public APlayerController 12 | { 13 | GENERATED_BODY() 14 | 15 | public: 16 | UFUNCTION(Server, Reliable) 17 | void ClientToServerRPC(ASpatialTestReplicatedStartupActor* Test, AActor* ReplicatedActor); 18 | 19 | UFUNCTION(Server, Reliable) 20 | void ResetBoolean(ASpatialTestReplicatedStartupActor* Test); 21 | }; 22 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDK/UNR-3761/SpatialTestReplicatedStartupActor/SpatialTestReplicatedStartupActor.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "SpatialFunctionalTest.h" 7 | #include "SpatialTestReplicatedStartupActor.generated.h" 8 | 9 | UCLASS() 10 | class SPATIALGDKFUNCTIONALTESTS_API ASpatialTestReplicatedStartupActor : public ASpatialFunctionalTest 11 | { 12 | GENERATED_BODY() 13 | 14 | public: 15 | ASpatialTestReplicatedStartupActor(); 16 | 17 | virtual void BeginPlay() override; 18 | 19 | void GetLifetimeReplicatedProps(TArray& OutLifetimeProps) const override; 20 | 21 | UPROPERTY(Replicated) 22 | bool bIsValidReference; 23 | 24 | AActor* ReplicatedActor; 25 | }; 26 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKFunctionalTests/SpatialGDKFunctionalTests.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | using UnrealBuildTool; 4 | 5 | public class SpatialGDKFunctionalTests : ModuleRules 6 | { 7 | public SpatialGDKFunctionalTests(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | bLegacyPublicIncludePaths = false; 10 | PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; 11 | #pragma warning disable 0618 12 | bFasterWithoutUnity = true; // Deprecated in 4.24, replace with bUseUnity = false; once we drop support for 4.23 13 | if (Target.Version.MinorVersion == 24) // Due to a bug in 4.24, bFasterWithoutUnity is inversed, fixed in master, so should hopefully roll into the next release, remove this once it does 14 | { 15 | bFasterWithoutUnity = false; 16 | } 17 | #pragma warning restore 0618 18 | 19 | PrivateDependencyModuleNames.AddRange( 20 | new string[] { 21 | "SpatialGDK", 22 | "Core", 23 | "CoreUObject", 24 | "Engine", 25 | "FunctionalTesting" 26 | }); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKServices/Private/SpatialGDKServicesPrivate.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Logging/LogMacros.h" 6 | 7 | DECLARE_LOG_CATEGORY_EXTERN(LogSpatialGDKServices, Log, All); 8 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKServices/Public/LocalReceptionistProxyServerManager.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | 7 | DECLARE_LOG_CATEGORY_EXTERN(LogLocalReceptionistProxyServerManager, Log, All); 8 | 9 | class FLocalReceptionistProxyServerManager 10 | { 11 | public: 12 | FLocalReceptionistProxyServerManager(); 13 | 14 | bool CheckIfPortIsBound(int32 Port, FString& OutPID, FString& OutLogMessages); 15 | bool LocalReceptionistProxyServerPreRunChecks(int32 ReceptionistPort); 16 | 17 | void SPATIALGDKSERVICES_API Init(int32 ReceptionistPort); 18 | bool SPATIALGDKSERVICES_API TryStartReceptionistProxyServer(bool bIsRunningInChina, const FString& CloudDeploymentName, const FString& ListeningAddress, int32 ReceptionistPort); 19 | bool SPATIALGDKSERVICES_API TryStopReceptionistProxyServer(); 20 | 21 | private: 22 | static TSharedPtr ParsePIDFile(); 23 | static void SavePIDInJson(const FString& PID); 24 | static bool GetPreviousReceptionistProxyPID(FString& OutPID); 25 | static void DeletePIDFile(); 26 | 27 | FProcHandle ProxyServerProcHandle; 28 | FString RunningCloudDeploymentName; 29 | int32 RunningProxyReceptionistPort; 30 | FString RunningProxyListeningAddress; 31 | 32 | bool bProxyIsRunning = false; 33 | }; 34 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKServices/SpatialGDKServices.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | using UnrealBuildTool; 4 | 5 | public class SpatialGDKServices : ModuleRules 6 | { 7 | public SpatialGDKServices(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | bLegacyPublicIncludePaths = false; 10 | PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; 11 | #pragma warning disable 0618 12 | bFasterWithoutUnity = true; // Deprecated in 4.24, replace with bUseUnity = false; once we drop support for 4.23 13 | if (Target.Version.MinorVersion == 24) // Due to a bug in 4.24, bFasterWithoutUnity is inversed, fixed in master, so should hopefully roll into the next release, remove this once it does 14 | { 15 | bFasterWithoutUnity = false; 16 | } 17 | #pragma warning restore 0618 18 | 19 | PrivateDependencyModuleNames.AddRange( 20 | new string[] { 21 | "EditorStyle", 22 | "Engine", 23 | "OutputLog", 24 | "Slate", 25 | "SlateCore", 26 | "Core", 27 | "CoreUObject", 28 | "EngineSettings", 29 | "Json", 30 | "JsonUtilities", 31 | "UnrealEd", 32 | "Sockets" 33 | } 34 | ); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/Private/SpatialGDKTestsModule.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "SpatialGDKTestsModule.h" 4 | 5 | #include "SpatialGDKTestsPrivate.h" 6 | 7 | #define LOCTEXT_NAMESPACE "FSpatialGDKTestsModule" 8 | 9 | DEFINE_LOG_CATEGORY(LogSpatialGDKTests); 10 | 11 | IMPLEMENT_MODULE(FSpatialGDKTestsModule, SpatialGDKTests); 12 | 13 | void InitializeSpatialFlagEarlyValues(); 14 | 15 | void FSpatialGDKTestsModule::StartupModule() 16 | { 17 | InitializeSpatialFlagEarlyValues(); 18 | } 19 | 20 | void FSpatialGDKTestsModule::ShutdownModule() 21 | { 22 | } 23 | 24 | #undef LOCTEXT_NAMESPACE 25 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/Private/SpatialGDKTestsPrivate.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Logging/LogMacros.h" 6 | 7 | DECLARE_LOG_CATEGORY_EXTERN(LogSpatialGDKTests, Log, All); 8 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/Public/SpatialGDKTestsModule.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "LocalDeploymentManager.h" 6 | #include "Modules/ModuleInterface.h" 7 | #include "Modules/ModuleManager.h" 8 | 9 | class SPATIALGDKTESTS_API FSpatialGDKTestsModule : public IModuleInterface 10 | { 11 | public: 12 | virtual void StartupModule() override; 13 | virtual void ShutdownModule() override; 14 | 15 | virtual bool SupportsDynamicReloading() override 16 | { 17 | return true; 18 | } 19 | }; 20 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDK/Interop/SpatialWorkerFlags/WorkerFlagsTestSpyObject.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "WorkerFlagsTestSpyObject.h" 4 | 5 | void UWorkerFlagsTestSpyObject::SetFlagUpdated(const FString& FlagName, const FString& FlagValue) 6 | { 7 | TimesUpdated++; 8 | 9 | return; 10 | } 11 | 12 | int UWorkerFlagsTestSpyObject::GetTimesFlagUpdated() const 13 | { 14 | return TimesUpdated; 15 | } 16 | 17 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDK/Interop/SpatialWorkerFlags/WorkerFlagsTestSpyObject.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | #pragma once 3 | 4 | #include "Interop/SpatialWorkerFlags.h" 5 | 6 | #include "WorkerFlagsTestSpyObject.generated.h" 7 | 8 | 9 | UCLASS() 10 | class UWorkerFlagsTestSpyObject : public UObject 11 | { 12 | GENERATED_BODY() 13 | public: 14 | 15 | UFUNCTION() 16 | void SetFlagUpdated(const FString& FlagName, const FString& FlagValue); 17 | 18 | int GetTimesFlagUpdated() const; 19 | 20 | private: 21 | 22 | int TimesUpdated = 0; 23 | }; 24 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDK/LoadBalancing/AbstractLBStrategy/LBStrategyStub.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "LoadBalancing/AbstractLBStrategy.h" 6 | #include "SpatialCommonTypes.h" 7 | 8 | #include "LBStrategyStub.generated.h" 9 | 10 | /** 11 | * This class is for testing purposes only. 12 | */ 13 | UCLASS(HideDropdown) 14 | class SPATIALGDKTESTS_API ULBStrategyStub : public UAbstractLBStrategy 15 | { 16 | GENERATED_BODY() 17 | 18 | public: 19 | VirtualWorkerId GetVirtualWorkerId() const 20 | { 21 | return LocalVirtualWorkerId; 22 | } 23 | }; 24 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDK/LoadBalancing/GridBasedLBStrategy/TestGridBasedLBStrategy.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "TestGridBasedLBStrategy.h" 4 | 5 | UGridBasedLBStrategy* UTestGridBasedLBStrategy::Create(uint32 InRows, uint32 InCols, float WorldWidth, float WorldHeight, float InterestBorder) 6 | { 7 | UTestGridBasedLBStrategy* Strat = NewObject(); 8 | 9 | Strat->Rows = InRows; 10 | Strat->Cols = InCols; 11 | 12 | Strat->WorldWidth = WorldWidth; 13 | Strat->WorldHeight = WorldHeight; 14 | 15 | Strat->InterestBorder = InterestBorder; 16 | 17 | return Strat; 18 | } 19 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDK/LoadBalancing/GridBasedLBStrategy/TestGridBasedLBStrategy.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "CoreMinimal.h" 6 | #include "LoadBalancing/GridBasedLBStrategy.h" 7 | #include "TestGridBasedLBStrategy.generated.h" 8 | 9 | /** 10 | * This class is for testing purposes only. 11 | */ 12 | UCLASS(HideDropdown, NotBlueprintable) 13 | class SPATIALGDKTESTS_API UTestGridBasedLBStrategy : public UGridBasedLBStrategy 14 | { 15 | GENERATED_BODY() 16 | 17 | public: 18 | 19 | static UGridBasedLBStrategy* Create(uint32 Rows, uint32 Cols, float WorldWidth, float WorldHeight, float InterestBorder = 0.0f); 20 | }; 21 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDK/LoadBalancing/LayeredLBStrategy/TestLayeredLBStrategy.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "LoadBalancing/GridBasedLBStrategy.h" 6 | 7 | #include "CoreMinimal.h" 8 | #include "GameFramework/DefaultPawn.h" 9 | 10 | #include "TestLayeredLBStrategy.generated.h" 11 | 12 | /** 13 | * This class is for testing purposes only. 14 | */ 15 | UCLASS(HideDropdown, NotBlueprintable) 16 | class SPATIALGDKTESTS_API UTwoByFourLBGridStrategy : public UGridBasedLBStrategy 17 | { 18 | GENERATED_BODY() 19 | 20 | public: 21 | UTwoByFourLBGridStrategy(): Super() 22 | { 23 | Rows = 2; 24 | Cols = 4; 25 | } 26 | }; 27 | 28 | /** 29 | * Same as a Default pawn but for testing 30 | */ 31 | UCLASS(NotPlaceable) 32 | class SPATIALGDKTESTS_API ALayer1Pawn : public ADefaultPawn 33 | { 34 | GENERATED_BODY() 35 | }; 36 | 37 | 38 | /** 39 | * Same as a Default pawn but for testing 40 | */ 41 | UCLASS(NotPlaceable) 42 | class SPATIALGDKTESTS_API ALayer2Pawn : public ADefaultPawn 43 | { 44 | GENERATED_BODY() 45 | }; 46 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDK/Schema/UnrealObjectRef/UnrealObjectRefTests.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "CoreMinimal.h" 4 | 5 | #include "Tests/TestDefinitions.h" 6 | #include "Tests/AutomationCommon.h" 7 | #include "Schema/UnrealObjectRef.h" 8 | #include "UObject/SoftObjectPtr.h" 9 | 10 | #define UNREALOBJECTREF_TEST(TestName) \ 11 | GDK_TEST(Core, FUnrealObjectRef, TestName) 12 | 13 | UNREALOBJECTREF_TEST(GIVEN_a_softpointer_WHEN_making_an_object_ref_from_it_THEN_we_can_recover_it) 14 | { 15 | FString PackagePath = "/Game/TestAsset/DummyAsset"; 16 | FString ObjectName = "DummyObject"; 17 | FSoftObjectPath SoftPath(PackagePath + "." + ObjectName); 18 | FSoftObjectPtr DummySoftReference(SoftPath); 19 | 20 | FUnrealObjectRef SoftObjectRef = FUnrealObjectRef::FromSoftObjectPath(DummySoftReference.ToSoftObjectPath()); 21 | 22 | TestTrue("Got a stably named reference", SoftObjectRef.Path.IsSet() && SoftObjectRef.Path.IsSet()); 23 | 24 | FSoftObjectPtr OutPtr; 25 | OutPtr = FUnrealObjectRef::ToSoftObjectPath(SoftObjectRef); 26 | 27 | TestTrue("Can serialize a SoftObjectPointer", DummySoftReference == OutPtr); 28 | 29 | return true; 30 | } 31 | 32 | // TODO : [UNR-2691] Add tests involving the PackageMapClient, with entity Id and actual assets to generate the path to/from (needs a NetDriver right now). 33 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDK/Utils/RPCContainer/ObjectDummy.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "ObjectDummy.h" 4 | 5 | FRPCErrorInfo UObjectDummy::ProcessRPC(const FPendingRPCParams& Params) 6 | { 7 | return FRPCErrorInfo{ nullptr, nullptr, ERPCResult::Success }; 8 | } 9 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDK/Utils/RPCContainer/ObjectDummy.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Utils/RPCContainer.h" 6 | 7 | #include "CoreMinimal.h" 8 | 9 | #include "ObjectDummy.generated.h" 10 | 11 | UCLASS() 12 | class UObjectDummy : public UObject 13 | { 14 | GENERATED_BODY() 15 | public: 16 | FRPCErrorInfo ProcessRPC(const FPendingRPCParams& Params); 17 | }; 18 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDK/Utils/RPCContainer/ObjectSpy.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "ObjectSpy.h" 4 | 5 | // If this assertion fails, then TypeToArray and ArrayToType 6 | // functions have to be updated correspondingly 7 | static_assert(sizeof(ERPCType) == sizeof(uint8), ""); 8 | 9 | TArray SpyUtils::RPCTypeToByteArray(ERPCType Type) 10 | { 11 | uint8 ConvertedType = static_cast(Type); 12 | return TArray(&ConvertedType, sizeof(ConvertedType)); 13 | } 14 | 15 | ERPCType SpyUtils::ByteArrayToRPCType(const TArray& Array) 16 | { 17 | return ERPCType(Array[0]); 18 | } 19 | 20 | FRPCErrorInfo UObjectSpy::ProcessRPC(const FPendingRPCParams& Params) 21 | { 22 | ERPCType Type = SpyUtils::ByteArrayToRPCType(Params.Payload.PayloadData); 23 | ProcessedRPCIndices.FindOrAdd(Type).Push(Params.Payload.Index); 24 | return FRPCErrorInfo{ nullptr, nullptr, ERPCResult::Success }; 25 | } 26 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDK/Utils/RPCContainer/ObjectSpy.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Utils/RPCContainer.h" 6 | 7 | #include "CoreMinimal.h" 8 | 9 | #include "ObjectSpy.generated.h" 10 | 11 | namespace SpyUtils 12 | { 13 | TArray RPCTypeToByteArray(ERPCType Type); 14 | ERPCType ByteArrayToRPCType(const TArray& Array); 15 | } // namespace SpyUtils 16 | 17 | UCLASS() 18 | class UObjectSpy : public UObject 19 | { 20 | GENERATED_BODY() 21 | public: 22 | FRPCErrorInfo ProcessRPC(const FPendingRPCParams& Params); 23 | 24 | TMap> ProcessedRPCIndices; 25 | }; 26 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDK/Utils/RPCContainer/ObjectStub.cpp: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #include "ObjectStub.h" 4 | 5 | FRPCErrorInfo UObjectStub::ProcessRPC(const FPendingRPCParams& Params) 6 | { 7 | return FRPCErrorInfo{ nullptr, nullptr, ERPCResult::UnresolvedParameters }; 8 | } 9 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDK/Utils/RPCContainer/ObjectStub.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Utils/RPCContainer.h" 6 | 7 | #include "CoreMinimal.h" 8 | 9 | #include "ObjectStub.generated.h" 10 | 11 | UCLASS() 12 | class UObjectStub : public UObject 13 | { 14 | GENERATED_BODY() 15 | public: 16 | FRPCErrorInfo ProcessRPC(const FPendingRPCParams& Params); 17 | }; 18 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDKEditor/SpatialGDKEditorSchemaGenerator/ExpectedSchema/NonSpatialTypeActor.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | // Note that this file has been generated automatically 3 | package unreal.generated.nonspatialtypeactor; 4 | 5 | import "unreal/gdk/core_types.schema"; 6 | 7 | component NonSpatialTypeActor { 8 | id = {{id}}; 9 | bool bhidden = 1; 10 | bool breplicatemovement = 2; 11 | bool btearoff = 3; 12 | bool bcanbedamaged = 4; 13 | uint32 remoterole = 5; 14 | bytes replicatedmovement = 6; 15 | UnrealObjectRef attachmentreplication_attachparent = 7; 16 | bytes attachmentreplication_locationoffset = 8; 17 | bytes attachmentreplication_relativescale3d = 9; 18 | bytes attachmentreplication_rotationoffset = 10; 19 | string attachmentreplication_attachsocket = 11; 20 | UnrealObjectRef attachmentreplication_attachcomponent = 12; 21 | UnrealObjectRef owner = 13; 22 | uint32 role = 14; 23 | UnrealObjectRef instigator = 15; 24 | } 25 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDKEditor/SpatialGDKEditorSchemaGenerator/ExpectedSchema/SpatialTypeActor.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | // Note that this file has been generated automatically 3 | package unreal.generated.spatialtypeactor; 4 | 5 | import "unreal/gdk/core_types.schema"; 6 | 7 | component SpatialTypeActor { 8 | id = {{id}}; 9 | bool bhidden = 1; 10 | bool breplicatemovement = 2; 11 | bool btearoff = 3; 12 | bool bcanbedamaged = 4; 13 | uint32 remoterole = 5; 14 | bytes replicatedmovement = 6; 15 | UnrealObjectRef attachmentreplication_attachparent = 7; 16 | bytes attachmentreplication_locationoffset = 8; 17 | bytes attachmentreplication_relativescale3d = 9; 18 | bytes attachmentreplication_rotationoffset = 10; 19 | string attachmentreplication_attachsocket = 11; 20 | UnrealObjectRef attachmentreplication_attachcomponent = 12; 21 | UnrealObjectRef owner = 13; 22 | uint32 role = 14; 23 | UnrealObjectRef instigator = 15; 24 | } 25 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDKEditor/SpatialGDKEditorSchemaGenerator/ExpectedSchema/SpatialTypeActorComponent.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | // Note that this file has been generated automatically 3 | package unreal.generated; 4 | 5 | type SpatialTypeActorComponent { 6 | bool breplicates = 1; 7 | bool bisactive = 2; 8 | } 9 | 10 | component SpatialTypeActorComponentDynamic1 { 11 | id = 10000; 12 | data SpatialTypeActorComponent; 13 | } 14 | 15 | component SpatialTypeActorComponentDynamic2 { 16 | id = 10001; 17 | data SpatialTypeActorComponent; 18 | } 19 | 20 | component SpatialTypeActorComponentDynamic3 { 21 | id = 10002; 22 | data SpatialTypeActorComponent; 23 | } 24 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDKEditor/SpatialGDKEditorSchemaGenerator/ExpectedSchema/SpatialTypeActorWithActorComponent.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | // Note that this file has been generated automatically 3 | package unreal.generated.spatialtypeactorwithactorcomponent; 4 | 5 | import "unreal/gdk/core_types.schema"; 6 | 7 | component SpatialTypeActorWithActorComponent { 8 | id = {{id}}; 9 | bool bhidden = 1; 10 | bool breplicatemovement = 2; 11 | bool btearoff = 3; 12 | bool bcanbedamaged = 4; 13 | uint32 remoterole = 5; 14 | bytes replicatedmovement = 6; 15 | UnrealObjectRef attachmentreplication_attachparent = 7; 16 | bytes attachmentreplication_locationoffset = 8; 17 | bytes attachmentreplication_relativescale3d = 9; 18 | bytes attachmentreplication_rotationoffset = 10; 19 | string attachmentreplication_attachsocket = 11; 20 | UnrealObjectRef attachmentreplication_attachcomponent = 12; 21 | UnrealObjectRef owner = 13; 22 | uint32 role = 14; 23 | UnrealObjectRef instigator = 15; 24 | UnrealObjectRef spatialactorcomponent = 16; 25 | } 26 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDKEditor/SpatialGDKEditorSchemaGenerator/ExpectedSchema/SpatialTypeActorWithMultipleActorComponents.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | // Note that this file has been generated automatically 3 | package unreal.generated.spatialtypeactorwithmultipleactorcomponents; 4 | 5 | import "unreal/gdk/core_types.schema"; 6 | 7 | component SpatialTypeActorWithMultipleActorComponents { 8 | id = {{id}}; 9 | bool bhidden = 1; 10 | bool breplicatemovement = 2; 11 | bool btearoff = 3; 12 | bool bcanbedamaged = 4; 13 | uint32 remoterole = 5; 14 | bytes replicatedmovement = 6; 15 | UnrealObjectRef attachmentreplication_attachparent = 7; 16 | bytes attachmentreplication_locationoffset = 8; 17 | bytes attachmentreplication_relativescale3d = 9; 18 | bytes attachmentreplication_rotationoffset = 10; 19 | string attachmentreplication_attachsocket = 11; 20 | UnrealObjectRef attachmentreplication_attachcomponent = 12; 21 | UnrealObjectRef owner = 13; 22 | uint32 role = 14; 23 | UnrealObjectRef instigator = 15; 24 | UnrealObjectRef firstspatialactorcomponent = 16; 25 | UnrealObjectRef secondspatialactorcomponent = 17; 26 | } 27 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDKEditor/SpatialGDKEditorSchemaGenerator/ExpectedSchema/SpatialTypeActorWithMultipleObjectComponents.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | // Note that this file has been generated automatically 3 | package unreal.generated.spatialtypeactorwithmultipleobjectcomponents; 4 | 5 | import "unreal/gdk/core_types.schema"; 6 | 7 | component SpatialTypeActorWithMultipleObjectComponents { 8 | id = {{id}}; 9 | bool bhidden = 1; 10 | bool breplicatemovement = 2; 11 | bool btearoff = 3; 12 | bool bcanbedamaged = 4; 13 | uint32 remoterole = 5; 14 | bytes replicatedmovement = 6; 15 | UnrealObjectRef attachmentreplication_attachparent = 7; 16 | bytes attachmentreplication_locationoffset = 8; 17 | bytes attachmentreplication_relativescale3d = 9; 18 | bytes attachmentreplication_rotationoffset = 10; 19 | string attachmentreplication_attachsocket = 11; 20 | UnrealObjectRef attachmentreplication_attachcomponent = 12; 21 | UnrealObjectRef owner = 13; 22 | uint32 role = 14; 23 | UnrealObjectRef instigator = 15; 24 | UnrealObjectRef firstspatialobjectcomponent = 16; 25 | UnrealObjectRef secondspatialobjectcomponent = 17; 26 | } 27 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDKEditor/SpatialGDKEditorSchemaGenerator/ExpectedSchema_425/NonSpatialTypeActor.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | // Note that this file has been generated automatically 3 | package unreal.generated.nonspatialtypeactor; 4 | 5 | import "unreal/gdk/core_types.schema"; 6 | 7 | component NonSpatialTypeActor { 8 | id = {{id}}; 9 | bool breplicatemovement = 1; 10 | bool bhidden = 2; 11 | bool btearoff = 3; 12 | bool bcanbedamaged = 4; 13 | uint32 remoterole = 5; 14 | bytes replicatedmovement = 6; 15 | UnrealObjectRef attachmentreplication_attachparent = 7; 16 | bytes attachmentreplication_locationoffset = 8; 17 | bytes attachmentreplication_relativescale3d = 9; 18 | bytes attachmentreplication_rotationoffset = 10; 19 | string attachmentreplication_attachsocket = 11; 20 | UnrealObjectRef attachmentreplication_attachcomponent = 12; 21 | UnrealObjectRef owner = 13; 22 | uint32 role = 14; 23 | UnrealObjectRef instigator = 15; 24 | } 25 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDKEditor/SpatialGDKEditorSchemaGenerator/ExpectedSchema_425/SpatialTypeActor.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | // Note that this file has been generated automatically 3 | package unreal.generated.spatialtypeactor; 4 | 5 | import "unreal/gdk/core_types.schema"; 6 | 7 | component SpatialTypeActor { 8 | id = {{id}}; 9 | bool breplicatemovement = 1; 10 | bool bhidden = 2; 11 | bool btearoff = 3; 12 | bool bcanbedamaged = 4; 13 | uint32 remoterole = 5; 14 | bytes replicatedmovement = 6; 15 | UnrealObjectRef attachmentreplication_attachparent = 7; 16 | bytes attachmentreplication_locationoffset = 8; 17 | bytes attachmentreplication_relativescale3d = 9; 18 | bytes attachmentreplication_rotationoffset = 10; 19 | string attachmentreplication_attachsocket = 11; 20 | UnrealObjectRef attachmentreplication_attachcomponent = 12; 21 | UnrealObjectRef owner = 13; 22 | uint32 role = 14; 23 | UnrealObjectRef instigator = 15; 24 | } 25 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDKEditor/SpatialGDKEditorSchemaGenerator/ExpectedSchema_425/SpatialTypeActorComponent.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | // Note that this file has been generated automatically 3 | package unreal.generated; 4 | 5 | type SpatialTypeActorComponent { 6 | bool breplicates = 1; 7 | bool bisactive = 2; 8 | } 9 | 10 | component SpatialTypeActorComponentDynamic1 { 11 | id = 10000; 12 | data SpatialTypeActorComponent; 13 | } 14 | 15 | component SpatialTypeActorComponentDynamic2 { 16 | id = 10001; 17 | data SpatialTypeActorComponent; 18 | } 19 | 20 | component SpatialTypeActorComponentDynamic3 { 21 | id = 10002; 22 | data SpatialTypeActorComponent; 23 | } 24 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDKEditor/SpatialGDKEditorSchemaGenerator/ExpectedSchema_425/SpatialTypeActorWithActorComponent.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | // Note that this file has been generated automatically 3 | package unreal.generated.spatialtypeactorwithactorcomponent; 4 | 5 | import "unreal/gdk/core_types.schema"; 6 | 7 | component SpatialTypeActorWithActorComponent { 8 | id = {{id}}; 9 | bool breplicatemovement = 1; 10 | bool bhidden = 2; 11 | bool btearoff = 3; 12 | bool bcanbedamaged = 4; 13 | uint32 remoterole = 5; 14 | bytes replicatedmovement = 6; 15 | UnrealObjectRef attachmentreplication_attachparent = 7; 16 | bytes attachmentreplication_locationoffset = 8; 17 | bytes attachmentreplication_relativescale3d = 9; 18 | bytes attachmentreplication_rotationoffset = 10; 19 | string attachmentreplication_attachsocket = 11; 20 | UnrealObjectRef attachmentreplication_attachcomponent = 12; 21 | UnrealObjectRef owner = 13; 22 | uint32 role = 14; 23 | UnrealObjectRef instigator = 15; 24 | UnrealObjectRef spatialactorcomponent = 16; 25 | } 26 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDKEditor/SpatialGDKEditorSchemaGenerator/ExpectedSchema_425/SpatialTypeActorWithMultipleActorComponents.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | // Note that this file has been generated automatically 3 | package unreal.generated.spatialtypeactorwithmultipleactorcomponents; 4 | 5 | import "unreal/gdk/core_types.schema"; 6 | 7 | component SpatialTypeActorWithMultipleActorComponents { 8 | id = {{id}}; 9 | bool breplicatemovement = 1; 10 | bool bhidden = 2; 11 | bool btearoff = 3; 12 | bool bcanbedamaged = 4; 13 | uint32 remoterole = 5; 14 | bytes replicatedmovement = 6; 15 | UnrealObjectRef attachmentreplication_attachparent = 7; 16 | bytes attachmentreplication_locationoffset = 8; 17 | bytes attachmentreplication_relativescale3d = 9; 18 | bytes attachmentreplication_rotationoffset = 10; 19 | string attachmentreplication_attachsocket = 11; 20 | UnrealObjectRef attachmentreplication_attachcomponent = 12; 21 | UnrealObjectRef owner = 13; 22 | uint32 role = 14; 23 | UnrealObjectRef instigator = 15; 24 | UnrealObjectRef firstspatialactorcomponent = 16; 25 | UnrealObjectRef secondspatialactorcomponent = 17; 26 | } 27 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDKEditor/SpatialGDKEditorSchemaGenerator/ExpectedSchema_425/SpatialTypeActorWithMultipleObjectComponents.schema: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | // Note that this file has been generated automatically 3 | package unreal.generated.spatialtypeactorwithmultipleobjectcomponents; 4 | 5 | import "unreal/gdk/core_types.schema"; 6 | 7 | component SpatialTypeActorWithMultipleObjectComponents { 8 | id = {{id}}; 9 | bool breplicatemovement = 1; 10 | bool bhidden = 2; 11 | bool btearoff = 3; 12 | bool bcanbedamaged = 4; 13 | uint32 remoterole = 5; 14 | bytes replicatedmovement = 6; 15 | UnrealObjectRef attachmentreplication_attachparent = 7; 16 | bytes attachmentreplication_locationoffset = 8; 17 | bytes attachmentreplication_relativescale3d = 9; 18 | bytes attachmentreplication_rotationoffset = 10; 19 | string attachmentreplication_attachsocket = 11; 20 | UnrealObjectRef attachmentreplication_attachcomponent = 12; 21 | UnrealObjectRef owner = 13; 22 | uint32 role = 14; 23 | UnrealObjectRef instigator = 15; 24 | UnrealObjectRef firstspatialobjectcomponent = 16; 25 | UnrealObjectRef secondspatialobjectcomponent = 17; 26 | } 27 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDKServices/LocalDeploymentManager/LocalDeploymentManagerUtilities.h: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | #pragma once 4 | 5 | #include "Tests/TestDefinitions.h" 6 | 7 | #include "CoreMinimal.h" 8 | 9 | // TODO: UNR-1964 - Move EDeploymentState enum to LocalDeploymentManager 10 | enum class EDeploymentState { IsRunning, IsNotRunning }; 11 | 12 | DEFINE_LATENT_AUTOMATION_COMMAND(FStartDeployment); 13 | DEFINE_LATENT_AUTOMATION_COMMAND(FStopDeployment); 14 | DEFINE_LATENT_AUTOMATION_COMMAND_TWO_PARAMETER(FWaitForDeployment, FAutomationTestBase*, Test, EDeploymentState, ExpectedDeploymentState); 15 | DEFINE_LATENT_AUTOMATION_COMMAND_TWO_PARAMETER(FCheckDeploymentState, FAutomationTestBase*, Test, EDeploymentState, ExpectedDeploymentState); 16 | -------------------------------------------------------------------------------- /SpatialGDK/Source/SpatialGDKTests/SpatialGDKTests.Build.cs: -------------------------------------------------------------------------------- 1 | // Copyright (c) Improbable Worlds Ltd, All Rights Reserved 2 | 3 | using UnrealBuildTool; 4 | 5 | public class SpatialGDKTests : ModuleRules 6 | { 7 | public SpatialGDKTests(ReadOnlyTargetRules Target) : base(Target) 8 | { 9 | bLegacyPublicIncludePaths = false; 10 | PCHUsage = PCHUsageMode.UseExplicitOrSharedPCHs; 11 | #pragma warning disable 0618 12 | bFasterWithoutUnity = true; // Deprecated in 4.24, replace with bUseUnity = false; once we drop support for 4.23 13 | if (Target.Version.MinorVersion == 24) // Due to a bug in 4.24, bFasterWithoutUnity is inversed, fixed in master, so should hopefully roll into the next release, remove this once it does 14 | { 15 | bFasterWithoutUnity = false; 16 | } 17 | #pragma warning restore 0618 18 | 19 | PrivateDependencyModuleNames.AddRange( 20 | new string[] { 21 | "SpatialGDK", 22 | "SpatialGDKEditor", 23 | "SpatialGDKServices", 24 | "Core", 25 | "CoreUObject", 26 | "Engine", 27 | "EngineSettings", 28 | "UnrealEd", 29 | "Json", 30 | "JsonUtilities" 31 | }); 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /ci/README.md: -------------------------------------------------------------------------------- 1 | See the ["CI Setup" wiki page](https://improbableio.atlassian.net/wiki/spaces/GBU/pages/563282518/CI+Setup) for info on our CI. 2 | -------------------------------------------------------------------------------- /ci/ReleaseTool.Tests/ReleaseTool.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | netcoreapp2.1 5 | 6 | false 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /ci/ReleaseTool/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Runtime.CompilerServices; 2 | 3 | [assembly: InternalsVisibleTo("ReleaseTool.Tests")] 4 | -------------------------------------------------------------------------------- /ci/ReleaseTool/EntryPoint.cs: -------------------------------------------------------------------------------- 1 | using CommandLine; 2 | using NLog; 3 | 4 | namespace ReleaseTool 5 | { 6 | internal static class EntryPoint 7 | { 8 | private static int Main(string[] args) 9 | { 10 | ConfigureLogger(); 11 | 12 | return Parser.Default.ParseArguments(args) 13 | .MapResult( 14 | (PrepCommand.Options options) => new PrepCommand(options).Run(), 15 | (ReleaseCommand.Options options) => new ReleaseCommand(options).Run(), 16 | errors => 1); 17 | } 18 | 19 | private static void ConfigureLogger() 20 | { 21 | var config = new NLog.Config.LoggingConfiguration(); 22 | 23 | var logfile = new NLog.Targets.FileTarget("logfile") 24 | { 25 | FileName = "release-tool.log" 26 | }; 27 | var logconsole = new NLog.Targets.ConsoleTarget("logconsole"); 28 | 29 | config.AddRule(LogLevel.Info, LogLevel.Fatal, logconsole); 30 | config.AddRule(LogLevel.Debug, LogLevel.Fatal, logfile); 31 | 32 | LogManager.Configuration = config; 33 | } 34 | } 35 | } 36 | -------------------------------------------------------------------------------- /ci/ReleaseTool/ReleaseTool.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | Exe 4 | netcoreapp2.1 5 | 6 | ReleaseTool.EntryPoint 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /ci/ReleaseTool/WorkingDirectoryScope.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace ReleaseTool 4 | { 5 | public class WorkingDirectoryScope : IDisposable 6 | { 7 | private readonly string oldWorkingDirectory; 8 | 9 | public WorkingDirectoryScope(string newWorkingDirectory) 10 | { 11 | oldWorkingDirectory = Environment.CurrentDirectory; 12 | Environment.CurrentDirectory = newWorkingDirectory; 13 | } 14 | 15 | public void Dispose() 16 | { 17 | Environment.CurrentDirectory = oldWorkingDirectory; 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /ci/Tools.sln: -------------------------------------------------------------------------------- 1 | Microsoft Visual Studio Solution File, Format Version 12.00 2 | # Visual Studio Version 16 3 | VisualStudioVersion = 16.0.30011.22 4 | MinimumVisualStudioVersion = 10.0.40219.1 5 | Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ReleaseTool", "ReleaseTool\ReleaseTool.csproj", "{7C42D241-8F30-4C0E-A0F8-178306E9F617}" 6 | EndProject 7 | Global 8 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 9 | Debug|Any CPU = Debug|Any CPU 10 | Release|Any CPU = Release|Any CPU 11 | EndGlobalSection 12 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 13 | {7C42D241-8F30-4C0E-A0F8-178306E9F617}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 14 | {7C42D241-8F30-4C0E-A0F8-178306E9F617}.Debug|Any CPU.Build.0 = Debug|Any CPU 15 | {7C42D241-8F30-4C0E-A0F8-178306E9F617}.Release|Any CPU.ActiveCfg = Release|Any CPU 16 | {7C42D241-8F30-4C0E-A0F8-178306E9F617}.Release|Any CPU.Build.0 = Release|Any CPU 17 | EndGlobalSection 18 | GlobalSection(SolutionProperties) = preSolution 19 | HideSolutionNode = FALSE 20 | EndGlobalSection 21 | GlobalSection(ExtensibilityGlobals) = postSolution 22 | SolutionGuid = {D2487644-D63B-4B59-842F-5BAF4F2C2C06} 23 | EndGlobalSection 24 | EndGlobal 25 | -------------------------------------------------------------------------------- /ci/cleanup.ps1: -------------------------------------------------------------------------------- 1 | param ( 2 | [string] $unreal_path = "$((Get-Item `"$($PSScriptRoot)`").parent.parent.FullName)\UnrealEngine", ## This should ultimately resolve to "C:\b\\UnrealEngine". 3 | [string] $project_name = "NetworkTestProject" 4 | ) 5 | 6 | $project_absolute_path = "$((Get-Item `"$($PSScriptRoot)`").parent.parent.FullName)\$project_name" ## This should ultimately resolve to "C:\b\\NetworkTestProject". 7 | 8 | . "$PSScriptRoot\common.ps1" 9 | $ErrorActionPreference = 'Continue' 10 | 11 | # Workaround for UNR-2156 and UNR-2076, where spatiald / runtime processes sometimes never close, or where runtimes are orphaned 12 | # Clean up any spatiald and java (i.e. runtime) processes that may not have been shut down 13 | Stop-Runtime 14 | 15 | # Clean up the symlinks 16 | if (Test-Path "$unreal_path") { 17 | (Get-Item "$unreal_path").Delete() 18 | } 19 | 20 | $gdk_in_test_repo = "$project_absolute_path\Game\Plugins\UnrealGDK" 21 | if (Test-Path "$gdk_in_test_repo") { 22 | (Get-Item "$gdk_in_test_repo").Delete() 23 | } 24 | 25 | # Clean up testing project 26 | if (Test-Path $project_absolute_path) { 27 | Write-Output "Removing existing project" 28 | Remove-Item $project_absolute_path -Recurse -Force 29 | if (-Not $?) { 30 | Throw "Failed to remove existing project at $($project_absolute_path)." 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ci/cleanup.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | pushd "$(dirname "$0")" 4 | 5 | UNREAL_PATH="${1:-"$(pwd)/../../UnrealEngine"}" 6 | BUILD_PROJECT="${2:-GDKTestGyms}" 7 | 8 | PROJECT_ABSOLUTE_PATH="$(pwd)/../../${BUILD_PROJECT}" 9 | GDK_IN_TEST_REPO="${PROJECT_ABSOLUTE_PATH}/Game/Plugins/UnrealGDK" 10 | 11 | # Workaround for UNR-2156 and UNR-2076, where spatiald / runtime processes sometimes never close, or where runtimes are orphaned 12 | # Clean up any spatiald and java (i.e. runtime) processes that may not have been shut down 13 | spatial service stop 14 | pkill -9 -f java 15 | 16 | rm -rf ${UNREAL_PATH} 17 | rm -rf ${GDK_IN_TEST_REPO} 18 | rm -rf ${PROJECT_ABSOLUTE_PATH} 19 | popd 20 | -------------------------------------------------------------------------------- /ci/common-release.sh: -------------------------------------------------------------------------------- 1 | function cleanUp() { 2 | rm -rf ${SECRETS_DIR} 3 | } 4 | 5 | function setupReleaseTool() { 6 | echo "--- Setting up release tool :gear:" 7 | # Create temporary directory for secrets and set a trap to cleanup on exit. 8 | export SECRETS_DIR=$(mktemp -d) 9 | trap cleanUp EXIT 10 | 11 | imp-ci secrets read \ 12 | --environment=production \ 13 | --buildkite-org=improbable \ 14 | --secret-type=github-personal-access-token \ 15 | --secret-name=gdk-for-unreal-bot-github-personal-access-token \ 16 | --field="token" \ 17 | --write-to="${SECRETS_DIR}/github_token" 18 | 19 | imp-ci secrets read \ 20 | --environment=production \ 21 | --buildkite-org=improbable \ 22 | --secret-type=ssh-key \ 23 | --secret-name=gdk-for-unreal-bot-ssh-key \ 24 | --field="privateKey" \ 25 | --write-to="${SECRETS_DIR}/id_rsa" 26 | 27 | docker build \ 28 | --tag local:gdk-release-tool \ 29 | --file ./ci/docker/release-tool.Dockerfile \ 30 | . 31 | } 32 | -------------------------------------------------------------------------------- /ci/common.ps1: -------------------------------------------------------------------------------- 1 | [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 2 | 3 | function Write-Log() { 4 | param( 5 | [string] $msg, 6 | [Parameter(Mandatory = $False)] [bool] $expand = $False 7 | ) 8 | if ($expand) { 9 | Write-Output "+++ $($msg)" 10 | } 11 | else { 12 | Write-Output "--- $($msg)" 13 | } 14 | } 15 | 16 | function Start-Event() { 17 | param( 18 | [string] $event_name, 19 | [string] $event_parent 20 | ) 21 | 22 | # Start this tracing span. 23 | Start-Process -NoNewWindow "imp-ci" -ArgumentList @(` 24 | "events", "new", ` 25 | "--name", "$($event_name)", ` 26 | "--child-of", "$($event_parent)" 27 | ) | Out-Null 28 | 29 | Write-Log "$($event_name)" 30 | } 31 | 32 | function Finish-Event() { 33 | param( 34 | [string] $event_name, 35 | [string] $event_parent 36 | ) 37 | 38 | # Emit the end marker for this tracing span. 39 | Start-Process -NoNewWindow "imp-ci" -ArgumentList @(` 40 | "events", "new", ` 41 | "--name", "$($event_name)", ` 42 | "--child-of", "$($event_parent)" 43 | ) | Out-Null 44 | } 45 | 46 | function Stop-Runtime() { 47 | & spatial "service" "stop" 48 | Stop-Process -Name "java" -Force -ErrorAction SilentlyContinue 49 | } 50 | 51 | $ErrorActionPreference = 'Stop' 52 | -------------------------------------------------------------------------------- /ci/docker/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e -u -o pipefail 4 | 5 | if [[ -n "${DEBUG-}" ]]; then 6 | set -x 7 | fi 8 | 9 | USER_ID=${LOCAL_USER_ID:-999} 10 | 11 | useradd --shell /bin/bash -u "${USER_ID}" -o -c "" -m user 12 | export HOME=/home/user 13 | 14 | # Change ownership of directories to the "user" user. 15 | chown -R user:user "${HOME}" 16 | chown -R user:user "$(pwd)" 17 | chown -R user:user "/var/ssh" 18 | chown -R user:user "/var/github" 19 | chown -R user:user "/var/logs" 20 | 21 | gosu user git config --global user.name "UnrealGDK Bot" 22 | gosu user git config --global user.email "gdk-for-unreal-bot@improbable.io" 23 | gosu user git config --global core.sshCommand "ssh -i /var/ssh/id_rsa" 24 | 25 | mkdir -p /${HOME}/.ssh 26 | touch /${HOME}/.ssh/known_hosts 27 | ssh-keyscan github.com >> /${HOME}/.ssh/known_hosts 28 | 29 | gosu user dotnet ReleaseTool.dll "$@" -------------------------------------------------------------------------------- /ci/docker/release-tool.Dockerfile: -------------------------------------------------------------------------------- 1 | FROM microsoft/dotnet:2.2-sdk as build 2 | 3 | # Copy everything and build 4 | WORKDIR /app 5 | COPY ./ci ./ 6 | RUN dotnet publish -c Release -o out 7 | 8 | # Build runtime image 9 | FROM mcr.microsoft.com/dotnet/core/runtime:2.2 10 | WORKDIR /app 11 | COPY --from=build /app/*/out ./ 12 | 13 | # Setup GIT 14 | RUN apt-get update && \ 15 | apt-get upgrade -y && \ 16 | apt-get install -y git && \ 17 | curl -LSs -o /usr/local/bin/gosu -SL "https://github.com/tianon/gosu/releases/download/1.4/gosu-$(dpkg --print-architecture)" && \ 18 | chmod +x /usr/local/bin/gosu 19 | 20 | # Create a volume to mount our SSH key into and configure git to use it. 21 | VOLUME /var/ssh 22 | # Volume to mount our Github token into. 23 | VOLUME /var/github 24 | # Volume to output logs & Buildkite metadata to 25 | VOLUME /var/logs 26 | 27 | COPY ./ci/docker/entrypoint.sh ./ 28 | 29 | RUN ["chmod", "+x", "./entrypoint.sh"] 30 | 31 | ENTRYPOINT ["./entrypoint.sh"] -------------------------------------------------------------------------------- /ci/generate-unrealengine-premerge-trigger.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ### This script should only be run on Improbable's internal build machines. 4 | ### If you don't work at Improbable, this may be interesting as a guide to what software versions we use for our 5 | ### automation, but not much more than that. 6 | 7 | # exit immediately on failure, or if an undefined variable is used 8 | set -eu 9 | 10 | # This assigns the gdk-version key that was set in .buildkite\release.steps.yaml to the variable GDK-VERSION 11 | GDK_VERSION="$(buildkite-agent meta-data get gdk-version)" 12 | 13 | # This assigns the engine-version key that was set in .buildkite\release.steps.yaml to the variable ENGINE-VERSION 14 | ENGINE_VERSIONS="$(buildkite-agent meta-data get engine-source-branches)" 15 | 16 | echo "steps:" 17 | triggerTest () { 18 | local REPO_NAME="${1}" 19 | local TEST_NAME="${2}" 20 | local BRANCH_TO_TEST="${3}" 21 | local ENVIRONMENT_VARIABLES=( "${@:4}" ) 22 | 23 | echo " - trigger: "${REPO_NAME}-${TEST_NAME}"" 24 | echo " label: "Run ${REPO_NAME}-${TEST_NAME} at HEAD OF ${BRANCH_TO_TEST}"" 25 | echo " async: true" 26 | echo " build:" 27 | echo " branch: "${BRANCH_TO_TEST}"" 28 | echo " commit: "HEAD"" 29 | } 30 | 31 | ### unrealengine-premerge 32 | while IFS= read -r ENGINE_VERSION; do 33 | triggerTest "unrealengine" \ 34 | "premerge" \ 35 | "${ENGINE_VERSION}-${GDK_VERSION}-rc" 36 | done <<< "${ENGINE_VERSIONS}" 37 | -------------------------------------------------------------------------------- /ci/setup-gdk.ps1: -------------------------------------------------------------------------------- 1 | # Expects gdk_home, which is not the GDK location in the engine 2 | # This script is used directly as part of the UnrealGDKExampleProject CI, so providing default values may be strictly necessary 3 | param ( 4 | [string] $gdk_path = "$gdk_home", 5 | [string] $msbuild_path = "$((Get-Item 'Env:programfiles(x86)').Value)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Current\Bin\MSBuild.exe", ## Location of MSBuild.exe on the build agent, as it only has the build tools, not the full visual studio 6 | [switch] $includeTraceLibs 7 | ) 8 | 9 | Push-Location $gdk_path 10 | if (-Not (Test-Path env:NO_PAUSE)) { # seems like this is set somewhere previously in CI, but just to make sure 11 | $env:NO_PAUSE = 1 12 | } 13 | $env:MSBUILD_EXE = "`"$msbuild_path`"" 14 | if($includeTraceLibs) { 15 | cmd /c SetupIncTraceLibs.bat --mobile 16 | } else { 17 | cmd /c Setup.bat --mobile 18 | } 19 | Pop-Location 20 | -------------------------------------------------------------------------------- /ci/unreal-engine.version: -------------------------------------------------------------------------------- 1 | UnrealEngine-12dfe67f9f1bee648e3515b8577892bc0c29f95b 2 | UnrealEngine-0d01cd0d96afb53e7e46bee883e5995e71941555 3 | -------------------------------------------------------------------------------- /ci/upload-test-metrics.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -euo pipefail 3 | 4 | # Fetch the test summary artifacts uploaded earlier 5 | mkdir "./test_summaries" 6 | buildkite-agent artifact download "*test_summary*.json" "./test_summaries" 7 | 8 | # Define target upload location 9 | PROJECT="holocentroid-aimful-6523579" 10 | DATASET="UnrealGDK" 11 | TABLE="ci_metrics" 12 | 13 | # Make sure that the gcp secret is always removed 14 | GCP_SECRET="$(mktemp)" 15 | function cleanup { 16 | rm -rf "${GCP_SECRET}" 17 | } 18 | trap cleanup EXIT 19 | 20 | # Fetch Google credentials so that we can upload the metrics to the GCS bucket. 21 | imp-ci secrets read --environment=production --buildkite-org=improbable \ 22 | --secret-type=gce-key-pair --secret-name=qa-unreal-gce-service-account \ 23 | --write-to=${GCP_SECRET} 24 | gcloud auth activate-service-account --key-file "${GCP_SECRET}" 25 | 26 | # Upload metrics 27 | for json_file in ./test_summaries/*.json; do 28 | cat "${json_file}" | bq --project_id "${PROJECT}" --dataset_id "${DATASET}" insert "${TABLE}" 29 | done 30 | --------------------------------------------------------------------------------