From 91c7984c222e062e02322e8be5fb3d53bc7ed867 Mon Sep 17 00:00:00 2001 From: Oliver Balaam Date: Thu, 5 Dec 2019 11:00:47 +0000 Subject: [PATCH 01/30] 0.6.3 (#1561) * Feature/UNR-2132 additional endpoint support patch 4.20 (#1531) * Adding API endpoints for China. .NET upgraded to 4.6.1 to link to new Platform SDK * Adding API endpoints for China. .NET upgraded to 4.6.1 to link to new Platform SDK * Added release note * Update CHANGELOG.md Co-Authored-By: Oliver Balaam * FIxes from review * Update SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs Co-Authored-By: Michael Samiec * Update SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs Co-Authored-By: Michael Samiec * Update SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs Co-Authored-By: Michael Samiec * Updating spatial version * Modifying Setup.bat to respect china endpoints Adding endpoint settings to LocalDeploymentManager * Changing china flag to capital * Fixed URL based on the console * Update Setup.bat Fixing whitespace * Apply suggestions from code review + Formatting suggestions Co-Authored-By: improbable-valentyn <32096431+improbable-valentyn@users.noreply.github.com> Co-Authored-By: Joshua Huburn <31517089+joshuahuburn@users.noreply.github.com> * Update DeploymentLauncher.cs Whitespace fix * Some items from the review * Changed comparison to case-insensitive and using --china to supply argument instead * Adding --China to shell script also * Update CHANGELOG.md Added some more info China flags * Apply suggestions from code review Tabs->spaces Co-Authored-By: improbable-valentyn <32096431+improbable-valentyn@users.noreply.github.com> * + Command-line args changed to lowercase + Changed tabs->spaces + Sorted DeploymentManager includes * + Command-line args changed to lowercase + Changed tabs->spaces + Sorted DeploymentManager includes * Fix spaces * Fixed formatting * Updated spot version * Update worker SDK ports (#1549) * Feature/update platform endpoint (#1553) * Update worker SDK ports * Updating platform endpoint * Update CHANGELOG.md (#1560) * Fix the third StopDeployments argument (#1563) * Fix the third StopDeployments argument * Update SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs * Update Version and VersionName in SpatialGDK.uplugin (#1562) * Update Version and VersionName in SpatialGDK.uplugin * Update SpatialGDK.uplugin --- CHANGELOG.md | 10 ++++ Setup.bat | 23 +++++---- Setup.sh | 22 ++++---- .../DeploymentLauncher/DeploymentLauncher.cs | 51 ++++++++++++------- SpatialGDK/Extras/spot.version | 2 +- .../Connection/SpatialWorkerConnection.cpp | 3 +- .../SpatialGDK/Public/SpatialConstants.h | 2 +- .../Private/SpatialGDKEditorCloudLauncher.cpp | 5 +- .../Private/SpatialGDKEditorSettings.cpp | 1 + .../Public/SpatialGDKEditorSettings.h | 18 ++++++- .../Private/SpatialGDKEditorToolbar.cpp | 1 + .../Private/LocalDeploymentManager.cpp | 28 ++++++++-- .../Public/LocalDeploymentManager.h | 3 ++ SpatialGDK/SpatialGDK.uplugin | 2 +- 14 files changed, 122 insertions(+), 49 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7360a54cf4..1ca8bd57fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased-`x.y.z`] - 2019-xx-xx +## [`0.6.3`] - 2019-12-05 +### Bug fixes: +- The C++ Worker SDK now communicates on port 443 instead of 444. This change is intended to protect your cloud deployments from DDoS attacks. + +### Internal: +Features listed in the internal section are not ready to use but, in the spirit of open development, we detail every change we make to the GDK. +- The GDK is now compatible with the `CN` launch region. When Improbable's online services are fully working in China, they will work with this version of the GDK. You will be able to create SpatialOS Deployments in China by specifying the `CN` region in the Deployment Launcher. +- `Setup.bat` and `Setup.sh` both accept the `--china` flag, which will be required in order to run SpatialOS CLI commands in the `CN` region. +- **SpatialOS GDK for Unreal** > **Editor Settings** now contains a **Region Settings** section. You will be required to set **Region where services are located** to `CN` in order to create SpatialOS Deployments in China. + ## [`0.6.2`] - 2019-10-10 - The GDK no longer relies on an ordering of entity and interest queries that is not guaranteed by the SpatialOS runtime. diff --git a/Setup.bat b/Setup.bat index d17758a503..6a36693695 100644 --- a/Setup.bat +++ b/Setup.bat @@ -57,7 +57,10 @@ call :MarkStartOfBlock "Setup variables" set SCHEMA_COPY_DIR=%~dp0..\..\..\spatial\schema\unreal\gdk set SCHEMA_STD_COPY_DIR=%~dp0..\..\..\spatial\build\dependencies\schema\standard_library set SPATIAL_DIR=%~dp0..\..\..\spatial - + set DOMAIN_ENVIRONMENT_VAR= + for %%A in (%*) do ( + if "%%A"=="--china" set DOMAIN_ENVIRONMENT_VAR=--domain spatialoschina.com --environment cn-production + ) call :MarkEndOfBlock "Setup variables" call :MarkStartOfBlock "Clean folders" @@ -86,15 +89,15 @@ call :MarkStartOfBlock "Create folders" call :MarkEndOfBlock "Create folders" call :MarkStartOfBlock "Retrieve dependencies" - spatial package retrieve tools schema_compiler-x86_64-win32 %PINNED_CORE_SDK_VERSION% "%CORE_SDK_DIR%\tools\schema_compiler-x86_64-win32.zip" - spatial package retrieve schema standard_library %PINNED_CORE_SDK_VERSION% "%CORE_SDK_DIR%\schema\standard_library.zip" - spatial package retrieve worker_sdk c-dynamic-x86-msvc_md-win32 %PINNED_CORE_SDK_VERSION% "%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86-msvc_md-win32.zip" - spatial package retrieve worker_sdk c-dynamic-x86_64-msvc_md-win32 %PINNED_CORE_SDK_VERSION% "%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86_64-msvc_md-win32.zip" - spatial package retrieve worker_sdk c-dynamic-x86_64-gcc_libstdcpp-linux %PINNED_CORE_SDK_VERSION% "%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86_64-gcc_libstdcpp-linux.zip" - spatial package retrieve worker_sdk c-static-fullylinked-arm-clang_libcpp-ios %PINNED_CORE_SDK_VERSION% "%CORE_SDK_DIR%\worker_sdk\c-static-fullylinked-arm-clang_libcpp-ios.zip" - spatial package retrieve worker_sdk core-dynamic-x86_64-linux %PINNED_CORE_SDK_VERSION% "%CORE_SDK_DIR%\worker_sdk\core-dynamic-x86_64-linux.zip" - spatial package retrieve worker_sdk csharp %PINNED_CORE_SDK_VERSION% "%CORE_SDK_DIR%\worker_sdk\csharp.zip" - spatial package retrieve spot spot-win64 %PINNED_SPOT_VERSION% "%BINARIES_DIR%\Programs\spot.exe" + spatial package retrieve tools schema_compiler-x86_64-win32 %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\tools\schema_compiler-x86_64-win32.zip" + spatial package retrieve schema standard_library %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\schema\standard_library.zip" + spatial package retrieve worker_sdk c-dynamic-x86-msvc_md-win32 %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86-msvc_md-win32.zip" + spatial package retrieve worker_sdk c-dynamic-x86_64-msvc_md-win32 %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86_64-msvc_md-win32.zip" + spatial package retrieve worker_sdk c-dynamic-x86_64-gcc_libstdcpp-linux %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86_64-gcc_libstdcpp-linux.zip" + spatial package retrieve worker_sdk c-static-fullylinked-arm-clang_libcpp-ios %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\c-static-fullylinked-arm-clang_libcpp-ios.zip" + spatial package retrieve worker_sdk core-dynamic-x86_64-linux %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\core-dynamic-x86_64-linux.zip" + spatial package retrieve worker_sdk csharp %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\csharp.zip" + spatial package retrieve spot spot-win64 %PINNED_SPOT_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%BINARIES_DIR%\Programs\spot.exe" call :MarkEndOfBlock "Retrieve dependencies" call :MarkStartOfBlock "Unpack dependencies" diff --git a/Setup.sh b/Setup.sh index 46b30c4e9b..bd57b15e8f 100755 --- a/Setup.sh +++ b/Setup.sh @@ -67,6 +67,10 @@ markStartOfBlock "Setup variables" BINARIES_DIR="$(dirname "$0")/SpatialGDK/Binaries/ThirdParty/Improbable" SCHEMA_COPY_DIR="$(dirname "$0")/../../../spatial/schema/unreal/gdk" SCHEMA_STD_COPY_DIR="$(dirname "$0")/../../../spatial/build/dependencies/schema/standard_library" + DOMAIN_ENVIRONMENT_VAR= + if [[ "$*" == "--china" ]]; then + DOMAIN_ENVIRONMENT_VAR=--domain spatialoschina.com --environment cn-production + fi markEndOfBlock "Setup variables" markStartOfBlock "Clean folders" @@ -86,15 +90,15 @@ markStartOfBlock "Create folders" markEndOfBlock "Create folders" markStartOfBlock "Retrieve dependencies" - spatial package retrieve tools schema_compiler-x86_64-win32 $PINNED_CORE_SDK_VERSION $CORE_SDK_DIR/tools/schema_compiler-x86_64-win32.zip - spatial package retrieve schema standard_library $PINNED_CORE_SDK_VERSION $CORE_SDK_DIR/schema/standard_library.zip - spatial package retrieve worker_sdk c-dynamic-x86-msvc_md-win32 $PINNED_CORE_SDK_VERSION $CORE_SDK_DIR/worker_sdk/c-dynamic-x86-msvc_md-win32.zip - spatial package retrieve worker_sdk c-dynamic-x86_64-msvc_md-win32 $PINNED_CORE_SDK_VERSION $CORE_SDK_DIR/worker_sdk/c-dynamic-x86_64-msvc_md-win32.zip - spatial package retrieve worker_sdk c-dynamic-x86_64-gcc_libstdcpp-linux $PINNED_CORE_SDK_VERSION $CORE_SDK_DIR/worker_sdk/c-dynamic-x86_64-gcc_libstdcpp-linux.zip - spatial package retrieve worker_sdk c-dynamic-x86_64-clang_libcpp-macos $PINNED_CORE_SDK_VERSION $CORE_SDK_DIR/worker_sdk/c-dynamic-x86_64-clang_libcpp-macos.zip - spatial package retrieve worker_sdk c-static-fullylinked-arm-clang_libcpp-ios $PINNED_CORE_SDK_VERSION $CORE_SDK_DIR/worker_sdk/c-static-fullylinked-arm-clang_libcpp-ios.zip - spatial package retrieve worker_sdk core-dynamic-x86_64-linux $PINNED_CORE_SDK_VERSION $CORE_SDK_DIR/worker_sdk/core-dynamic-x86_64-linux.zip - spatial package retrieve worker_sdk csharp $PINNED_CORE_SDK_VERSION $CORE_SDK_DIR/worker_sdk/csharp.zip + spatial package retrieve tools schema_compiler-x86_64-win32 $PINNED_CORE_SDK_VERSION $DOMAIN_ENVIRONMENT_VAR $CORE_SDK_DIR/tools/schema_compiler-x86_64-win32.zip + spatial package retrieve schema standard_library $PINNED_CORE_SDK_VERSION $DOMAIN_ENVIRONMENT_VAR $CORE_SDK_DIR/schema/standard_library.zip + spatial package retrieve worker_sdk c-dynamic-x86-msvc_md-win32 $PINNED_CORE_SDK_VERSION $DOMAIN_ENVIRONMENT_VAR $CORE_SDK_DIR/worker_sdk/c-dynamic-x86-msvc_md-win32.zip + spatial package retrieve worker_sdk c-dynamic-x86_64-msvc_md-win32 $PINNED_CORE_SDK_VERSION $DOMAIN_ENVIRONMENT_VAR $CORE_SDK_DIR/worker_sdk/c-dynamic-x86_64-msvc_md-win32.zip + spatial package retrieve worker_sdk c-dynamic-x86_64-gcc_libstdcpp-linux $PINNED_CORE_SDK_VERSION $DOMAIN_ENVIRONMENT_VAR $CORE_SDK_DIR/worker_sdk/c-dynamic-x86_64-gcc_libstdcpp-linux.zip + spatial package retrieve worker_sdk c-dynamic-x86_64-clang_libcpp-macos $PINNED_CORE_SDK_VERSION $DOMAIN_ENVIRONMENT_VAR $CORE_SDK_DIR/worker_sdk/c-dynamic-x86_64-clang_libcpp-macos.zip + spatial package retrieve worker_sdk c-static-fullylinked-arm-clang_libcpp-ios $PINNED_CORE_SDK_VERSION $DOMAIN_ENVIRONMENT_VAR $CORE_SDK_DIR/worker_sdk/c-static-fullylinked-arm-clang_libcpp-ios.zip + spatial package retrieve worker_sdk core-dynamic-x86_64-linux $PINNED_CORE_SDK_VERSION $DOMAIN_ENVIRONMENT_VAR $CORE_SDK_DIR/worker_sdk/core-dynamic-x86_64-linux.zip + spatial package retrieve worker_sdk csharp $PINNED_CORE_SDK_VERSION $DOMAIN_ENVIRONMENT_VAR $CORE_SDK_DIR/worker_sdk/csharp.zip markEndOfBlock "Retrieve dependencies" markStartOfBlock "Unpack dependencies" diff --git a/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs b/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs index d85ef32607..2f977527cc 100644 --- a/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs +++ b/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs @@ -1,17 +1,18 @@ // Copyright (c) Improbable Worlds Ltd, All Rights Reserved -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Security.Cryptography; using Google.LongRunning; using Google.Protobuf.WellKnownTypes; using Improbable.SpatialOS.Deployment.V1Alpha1; +using Improbable.SpatialOS.Platform.Common; using Improbable.SpatialOS.PlayerAuth.V2Alpha1; using Improbable.SpatialOS.Snapshot.V1Alpha1; using Newtonsoft.Json.Linq; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Security.Cryptography; +using System; namespace Improbable { @@ -22,6 +23,9 @@ internal class DeploymentLauncher private const string CoordinatorWorkerName = "SimulatedPlayerCoordinator"; + private const string CHINA_ENDPOINT_URL = "platform.api.spatialoschina.com"; + private const int CHINA_ENDPOINT_PORT = 443; + private static string UploadSnapshot(SnapshotServiceClient client, string snapshotPath, string projectName, string deploymentName) { @@ -77,6 +81,15 @@ private static string UploadSnapshot(SnapshotServiceClient client, string snapsh return confirmUploadResponse.Snapshot.Id; } + + private static PlatformApiEndpoint GetApiEndpoint(string region) + { + if (region == "CN") + { + return new PlatformApiEndpoint(CHINA_ENDPOINT_URL, CHINA_ENDPOINT_PORT); + } + return null; // Use default + } private static int CreateDeployment(string[] args) { @@ -109,7 +122,7 @@ private static int CreateDeployment(string[] args) try { - var deploymentServiceClient = DeploymentServiceClient.Create(); + var deploymentServiceClient = DeploymentServiceClient.Create(GetApiEndpoint(mainDeploymentRegion)); if (DeploymentExists(deploymentServiceClient, projectName, mainDeploymentName)) { @@ -220,7 +233,7 @@ private static void StopDeploymentByName(DeploymentServiceClient deploymentServi private static Operation CreateMainDeploymentAsync(DeploymentServiceClient deploymentServiceClient, bool launchSimPlayerDeployment, string projectName, string assemblyName, string mainDeploymentName, string mainDeploymentJsonPath, string mainDeploymentSnapshotPath, string regionCode) { - var snapshotServiceClient = SnapshotServiceClient.Create(); + var snapshotServiceClient = SnapshotServiceClient.Create(GetApiEndpoint(regionCode)); // Upload snapshots. var mainSnapshotId = UploadSnapshot(snapshotServiceClient, mainDeploymentSnapshotPath, projectName, @@ -268,7 +281,7 @@ private static Operation CreateMainDeploym private static Operation CreateSimPlayerDeploymentAsync(DeploymentServiceClient deploymentServiceClient, string projectName, string assemblyName, string mainDeploymentName, string simDeploymentName, string simDeploymentJsonPath, string regionCode, int simNumPlayers) { - var playerAuthServiceClient = PlayerAuthServiceClient.Create(); + var playerAuthServiceClient = PlayerAuthServiceClient.Create(GetApiEndpoint(regionCode)); // Create development authentication token used by the simulated players. var dat = playerAuthServiceClient.CreateDevelopmentAuthenticationToken( @@ -356,13 +369,14 @@ private static Operation CreateSimPlayerDe private static int StopDeployments(string[] args) { var projectName = args[1]; + var regionCode = args[2]; - var deploymentServiceClient = DeploymentServiceClient.Create(); + var deploymentServiceClient = DeploymentServiceClient.Create(GetApiEndpoint(regionCode)); - if (args.Length == 3) + if (args.Length == 4) { // Stop only the specified deployment. - var deploymentId = args[2]; + var deploymentId = args[3]; StopDeploymentById(deploymentServiceClient, projectName, deploymentId); return 0; @@ -407,8 +421,9 @@ private static void StopDeploymentById(DeploymentServiceClient client, string pr private static int ListDeployments(string[] args) { var projectName = args[1]; + var regionCode = args[2]; - var deploymentServiceClient = DeploymentServiceClient.Create(); + var deploymentServiceClient = DeploymentServiceClient.Create(GetApiEndpoint(regionCode)); var activeDeployments = ListLaunchedActiveDeployments(deploymentServiceClient, projectName); foreach (var deployment in activeDeployments) @@ -462,11 +477,11 @@ private static void ShowUsage() { Console.WriteLine("Usage:"); Console.WriteLine("DeploymentLauncher create [ ]"); - Console.WriteLine($" Starts a cloud deployment, with optionally a simulated player deployment. The deployments can be started in different regions ('EU', 'US' and 'AP')."); - Console.WriteLine("DeploymentLauncher stop [deployment-id]"); + Console.WriteLine($" Starts a cloud deployment, with optionally a simulated player deployment. The deployments can be started in different regions ('EU', 'US', 'AP' and 'CN')."); + Console.WriteLine("DeploymentLauncher stop [deployment-id]"); Console.WriteLine(" Stops the specified deployment within the project."); Console.WriteLine(" If no deployment id argument is specified, all active deployments started by the deployment launcher in the project will be stopped."); - Console.WriteLine("DeploymentLauncher list "); + Console.WriteLine("DeploymentLauncher list "); Console.WriteLine(" Lists all active deployments within the specified project that are started by the deployment launcher."); } @@ -474,8 +489,8 @@ private static int Main(string[] args) { if (args.Length == 0 || args[0] == "create" && (args.Length != 11 && args.Length != 7) || - args[0] == "stop" && (args.Length != 2 && args.Length != 3) || - args[0] == "list" && args.Length != 2) + args[0] == "stop" && (args.Length != 3 && args.Length != 4) || + args[0] == "list" && args.Length != 3) { ShowUsage(); return 1; diff --git a/SpatialGDK/Extras/spot.version b/SpatialGDK/Extras/spot.version index 5729794af5..41e6f4ad6b 100644 --- a/SpatialGDK/Extras/spot.version +++ b/SpatialGDK/Extras/spot.version @@ -1 +1 @@ -20190626.145947.9ed060f1af \ No newline at end of file +20191029.144741.87a7d78768 \ No newline at end of file diff --git a/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp b/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp index 6ff57ffc17..94b94bbfb1 100644 --- a/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp +++ b/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp @@ -246,8 +246,7 @@ void USpatialWorkerConnection::ConnectToLocator() LocatorParams.player_identity.player_identity_token = PlayerIdentityTokenCStr.Get(); LocatorParams.player_identity.login_token = LoginTokenCStr.Get(); - // Connect to the locator on the default port(0 will choose the default) - WorkerLocator = Worker_Alpha_Locator_Create(TCHAR_TO_UTF8(*LocatorConfig.LocatorHost), 0, &LocatorParams); + WorkerLocator = Worker_Alpha_Locator_Create(TCHAR_TO_UTF8(*LocatorConfig.LocatorHost), SpatialConstants::LOCATOR_PORT, &LocatorParams); // TODO UNR-1271: Move creation of connection parameters into a function somehow Worker_ConnectionParameters ConnectionParams = Worker_DefaultConnectionParameters(); diff --git a/SpatialGDK/Source/SpatialGDK/Public/SpatialConstants.h b/SpatialGDK/Source/SpatialGDK/Public/SpatialConstants.h index 70fe07934e..711fa02f34 100644 --- a/SpatialGDK/Source/SpatialGDK/Public/SpatialConstants.h +++ b/SpatialGDK/Source/SpatialGDK/Public/SpatialConstants.h @@ -199,7 +199,7 @@ namespace SpatialConstants const FString SPATIALOS_METRICS_DYNAMIC_FPS = TEXT("Dynamic.FPS"); const FString LOCATOR_HOST = TEXT("locator.improbable.io"); - const uint16 LOCATOR_PORT = 444; + const uint16 LOCATOR_PORT = 443; const FString DEVELOPMENT_AUTH_PLAYER_ID = TEXT("Player Id"); } diff --git a/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorCloudLauncher.cpp b/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorCloudLauncher.cpp index 87ab7fc1b6..c4c4433c24 100644 --- a/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorCloudLauncher.cpp +++ b/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorCloudLauncher.cpp @@ -50,7 +50,10 @@ bool SpatialGDKCloudStop() const USpatialGDKEditorSettings* SpatialGDKSettings = GetDefault(); const FString CmdExecutable = TEXT("cmd.exe"); - const FString LauncherCmdArguments = TEXT("/c DeploymentLauncher.exe stop"); + const FString LauncherCmdArguments = FString::Printf( + TEXT("/c DeploymentLauncher.exe stop %s"), + *SpatialGDKSettings->GetPrimaryRegionCode().ToString() + ); FProcHandle DeploymentLauncherProcHandle = FPlatformProcess::CreateProc( *CmdExecutable, *LauncherCmdArguments, true, false, false, nullptr, 0, diff --git a/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorSettings.cpp b/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorSettings.cpp index 53a7708456..47e45cf161 100644 --- a/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorSettings.cpp +++ b/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorSettings.cpp @@ -26,6 +26,7 @@ USpatialGDKEditorSettings::USpatialGDKEditorSettings(const FObjectInitializer& O , PrimaryDeploymentRegionCode(ERegionCode::US) , SimulatedPlayerLaunchConfigPath(FSpatialGDKServicesModule::GetSpatialGDKPluginDirectory(TEXT("SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/WorkerCoordinator/SpatialConfig/cloud_launch_sim_player_deployment.json"))) , SimulatedPlayerDeploymentRegionCode(ERegionCode::US) + , ServicesRegion(EServicesRegion::Default) { SpatialOSLaunchConfig.FilePath = GetSpatialOSLaunchConfig(); SpatialOSSnapshotFile = GetSpatialOSSnapshotFile(); diff --git a/SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKEditorSettings.h b/SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKEditorSettings.h index 35de44d74e..91ced1bf26 100644 --- a/SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKEditorSettings.h +++ b/SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKEditorSettings.h @@ -207,6 +207,17 @@ namespace ERegionCode US = 1, EU, AP, + CN + }; +} + +UENUM() +namespace EServicesRegion +{ + enum Type + { + Default, + CN }; } @@ -297,7 +308,10 @@ class SPATIALGDKEDITOR_API USpatialGDKEditorSettings : public UObject UPROPERTY(EditAnywhere, config, Category = "Simulated Players", meta = (EditCondition = "bSimulatedPlayersIsEnabled", ConfigRestartRequired = false, DisplayName = "Number of simulated players")) uint32 NumberOfSimulatedPlayers; - + + UPROPERTY(EditAnywhere, Config, Category = "Region settings", meta = (ConfigRestartRequired = true, DisplayName = "Region where services are located")) + TEnumAsByte ServicesRegion; + static bool IsAssemblyNameValid(const FString& Name); static bool IsProjectNameValid(const FString& Name); static bool IsDeploymentNameValid(const FString& Name); @@ -452,4 +466,6 @@ class SPATIALGDKEDITOR_API USpatialGDKEditorSettings : public UObject } bool IsDeploymentConfigurationValid() const; + + FORCEINLINE bool IsRunningInChina() const { return ServicesRegion == EServicesRegion::CN; } }; diff --git a/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp b/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp index d982ff5f42..7aad6273ee 100644 --- a/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp +++ b/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp @@ -73,6 +73,7 @@ void FSpatialGDKEditorToolbarModule::StartupModule() FSpatialGDKServicesModule& GDKServices = FModuleManager::GetModuleChecked("SpatialGDKServices"); LocalDeploymentManager = GDKServices.GetLocalDeploymentManager(); LocalDeploymentManager->SetAutoDeploy(GetDefault()->bAutoStartLocalDeployment); + LocalDeploymentManager->SetInChina(GetDefault()->IsRunningInChina()); // Bind the play button delegate to starting a local spatial deployment. if (!UEditorEngine::TryStartSpatialDeployment.IsBound() && GetDefault()->bAutoStartLocalDeployment) diff --git a/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp b/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp index 52b4d642f9..b78bedae90 100644 --- a/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp +++ b/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp @@ -20,7 +20,20 @@ DEFINE_LOG_CATEGORY(LogSpatialDeploymentManager); static const FString SpatialExe(TEXT("spatial.exe")); -static const FString SpatialServiceVersion(TEXT("20190716.094149.1b6d448edd")); +static const FString SpatialServiceVersion(TEXT("20191128.003423.475a3c1edb")); + +namespace +{ + FString GetDomainEnvironmentStr(bool bIsInChina) + { + FString DomainEnvironmentStr; + if (bIsInChina) + { + DomainEnvironmentStr = TEXT("--domain=spatialoschina.com --environment=cn-production"); + } + return DomainEnvironmentStr; + } +} // anonymous namespace FLocalDeploymentManager::FLocalDeploymentManager() : bLocalDeploymentRunning(false) @@ -57,6 +70,11 @@ FLocalDeploymentManager::FLocalDeploymentManager() #endif } +void FLocalDeploymentManager::SetInChina(bool bChinaEnabled) +{ + bIsInChina = bChinaEnabled; +} + const FString FLocalDeploymentManager::GetSpotExe() { return FSpatialGDKServicesModule::GetSpatialGDKPluginDirectory(TEXT("SpatialGDK/Binaries/ThirdParty/Improbable/Programs/spot.exe")); @@ -122,7 +140,7 @@ void FLocalDeploymentManager::WorkerBuildConfigAsync() { AsyncTask(ENamedThreads::AnyBackgroundThreadNormalTask, [this] { - FString BuildConfigArgs = TEXT("worker build build-config"); + FString BuildConfigArgs = FString::Printf(TEXT("worker build build-config %s"), *GetDomainEnvironmentStr(bIsInChina)); FString WorkerBuildConfigResult; int32 ExitCode; ExecuteAndReadOutput(SpatialExe, BuildConfigArgs, FSpatialGDKServicesModule::GetSpatialOSDirectory(), WorkerBuildConfigResult, ExitCode); @@ -368,7 +386,7 @@ bool FLocalDeploymentManager::TryStartSpatialService() bStartingSpatialService = true; - FString SpatialServiceStartArgs = FString::Printf(TEXT("service start --version=%s"), *SpatialServiceVersion); + FString SpatialServiceStartArgs = FString::Printf(TEXT("service start --version=%s %s"), *SpatialServiceVersion, *GetDomainEnvironmentStr(bIsInChina)); FString ServiceStartResult; int32 ExitCode; ExecuteAndReadOutput(SpatialExe, SpatialServiceStartArgs, FSpatialGDKServicesModule::GetSpatialOSDirectory(), ServiceStartResult, ExitCode); @@ -400,7 +418,7 @@ bool FLocalDeploymentManager::TryStopSpatialService() { bStoppingSpatialService = true; - FString SpatialServiceStartArgs = TEXT("service stop"); + FString SpatialServiceStartArgs = FString::Printf(TEXT("service stop %s"), *GetDomainEnvironmentStr(bIsInChina)); FString ServiceStopResult; int32 ExitCode; ExecuteAndReadOutput(SpatialExe, SpatialServiceStartArgs, FSpatialGDKServicesModule::GetSpatialOSDirectory(), ServiceStopResult, ExitCode); @@ -490,7 +508,7 @@ bool FLocalDeploymentManager::GetLocalDeploymentStatus() bool FLocalDeploymentManager::GetServiceStatus() { - FString SpatialServiceStatusArgs = TEXT("service status"); + FString SpatialServiceStatusArgs = FString::Printf(TEXT("service status %s"), *GetDomainEnvironmentStr(bIsInChina)); FString ServiceStatusResult; int32 ExitCode; ExecuteAndReadOutput(SpatialExe, SpatialServiceStatusArgs, FSpatialGDKServicesModule::GetSpatialOSDirectory(), ServiceStatusResult, ExitCode); diff --git a/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h b/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h index 936838b2da..96fb82cd90 100644 --- a/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h +++ b/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h @@ -17,6 +17,8 @@ class FLocalDeploymentManager public: FLocalDeploymentManager(); + void SPATIALGDKSERVICES_API SetInChina(bool IsInChina); + void SPATIALGDKSERVICES_API RefreshServiceStatus(); bool SPATIALGDKSERVICES_API TryStartLocalDeployment(FString LaunchConfig, FString LaunchArgs); @@ -83,4 +85,5 @@ class FLocalDeploymentManager bool bRedeployRequired = false; bool bAutoDeploy = false; + bool bIsInChina = false; }; diff --git a/SpatialGDK/SpatialGDK.uplugin b/SpatialGDK/SpatialGDK.uplugin index b513e17a11..4730b0d32f 100644 --- a/SpatialGDK/SpatialGDK.uplugin +++ b/SpatialGDK/SpatialGDK.uplugin @@ -1,7 +1,7 @@ { "FileVersion": 3, "Version": 3, - "VersionName": "0.6.0", + "VersionName": "0.6.3", "FriendlyName": "SpatialOS GDK for Unreal", "Description": "The SpatialOS Game Development Kit (GDK) for Unreal Engine allows you to host your game and combine multiple dedicated server instances across one seamless game world whilst using the Unreal Engine networking API.", "Category": "SpatialOS", From 7e4e16e56cab68bbe90861113d9a17f13d8001c6 Mon Sep 17 00:00:00 2001 From: Oliver Balaam Date: Fri, 6 Dec 2019 14:39:45 +0000 Subject: [PATCH 02/30] Update CHANGELOG.md (#1577) --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ca8bd57fe..4827eb3b6c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,7 +8,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [`0.6.3`] - 2019-12-05 ### Bug fixes: -- The C++ Worker SDK now communicates on port 443 instead of 444. This change is intended to protect your cloud deployments from DDoS attacks. +- The C Worker SDK now communicates on port 443 instead of 444. This change is intended to protect your cloud deployments from DDoS attacks. ### Internal: Features listed in the internal section are not ready to use but, in the spirit of open development, we detail every change we make to the GDK. From d028e3009280e10f56b8d04ced26309ff3097ee6 Mon Sep 17 00:00:00 2001 From: Oliver Balaam Date: Fri, 13 Dec 2019 13:41:13 +0000 Subject: [PATCH 03/30] 0.6.4 (#1604) * Fix * Release Note (#1603) * Update SpatialGDK.uplugin (#1607) * Update CHANGELOG.md (#1606) --- CHANGELOG.md | 4 ++++ .../Private/SpatialGDKEditorToolbar.cpp | 2 +- SpatialGDK/SpatialGDK.uplugin | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4827eb3b6c..870fac7fae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased-`x.y.z`] - 2019-xx-xx +## [`0.6.4`] - 2019-12-13 +### Bug fixes: +- The Inspector button in the SpatialOS GDK for Unreal toolbar now opens the correct URL. + ## [`0.6.3`] - 2019-12-05 ### Bug fixes: - The C Worker SDK now communicates on port 443 instead of 444. This change is intended to protect your cloud deployments from DDoS attacks. diff --git a/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp b/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp index 7aad6273ee..8d0f2db98d 100644 --- a/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp +++ b/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp @@ -614,7 +614,7 @@ void FSpatialGDKEditorToolbarModule::StopSpatialDeploymentButtonClicked() void FSpatialGDKEditorToolbarModule::LaunchInspectorWebpageButtonClicked() { FString WebError; - FPlatformProcess::LaunchURL(TEXT("http://localhost:21000/inspector"), TEXT(""), &WebError); + FPlatformProcess::LaunchURL(TEXT("http://localhost:31000/inspector"), TEXT(""), &WebError); if (!WebError.IsEmpty()) { FNotificationInfo Info(FText::FromString(WebError)); diff --git a/SpatialGDK/SpatialGDK.uplugin b/SpatialGDK/SpatialGDK.uplugin index 4730b0d32f..5c694e0068 100644 --- a/SpatialGDK/SpatialGDK.uplugin +++ b/SpatialGDK/SpatialGDK.uplugin @@ -1,7 +1,7 @@ { "FileVersion": 3, "Version": 3, - "VersionName": "0.6.3", + "VersionName": "0.6.4", "FriendlyName": "SpatialOS GDK for Unreal", "Description": "The SpatialOS Game Development Kit (GDK) for Unreal Engine allows you to host your game and combine multiple dedicated server instances across one seamless game world whilst using the Unreal Engine networking API.", "Category": "SpatialOS", From 3f99d6d65d2523b8d7be2a9e34c30beba9f937be Mon Sep 17 00:00:00 2001 From: Miron Zelina Date: Fri, 24 Jan 2020 15:17:51 +0000 Subject: [PATCH 04/30] [UNR-2738] Fix dynamic subobject references not being set correctly (#1716) If creating a subobject and setting a replicated reference to it in approximately the same tick, the reference would be set to null forever. This fixes the issue by resolving the dynamic subobject earlier in replication. * Try to resolve dynamic object refs earlier * Move TryResolveNewDynamicSubobjectAndGetClassInfo into SpatialPackageMap * Add error log if trying to resolve an object twice * Do not try to resolve dynamic subobjects twice * Remove debugging logs * Return correct return type * Make UnrealObjectRef resolution nicer to read * Add change to changelog * Apply suggestions from code review * Apply two missed suggestions * Remove unneccessary includes and forward declarations * Add a const when I can * Change check for ActorComponent to check for all possible subobjects * Update SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialSender.cpp Co-Authored-By: improbable-valentyn <32096431+improbable-valentyn@users.noreply.github.com> * Update SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialPackageMapClient.cpp Co-Authored-By: improbable-valentyn <32096431+improbable-valentyn@users.noreply.github.com> * Error gracefully when Object is nullptr Co-authored-by: improbable-valentyn <32096431+improbable-valentyn@users.noreply.github.com> --- CHANGELOG.md | 5 ++- .../EngineClasses/SpatialActorChannel.cpp | 32 +------------------ .../EngineClasses/SpatialPackageMapClient.cpp | 30 +++++++++++++++++ .../Interop/SpatialClassInfoManager.cpp | 28 ++++++++++++++++ .../Private/Interop/SpatialSender.cpp | 2 +- .../EngineClasses/SpatialActorChannel.h | 1 - .../EngineClasses/SpatialPackageMapClient.h | 6 ++-- .../Public/Interop/SpatialClassInfoManager.h | 3 ++ .../Public/Schema/UnrealObjectRef.cpp | 15 +++++++-- 9 files changed, 82 insertions(+), 40 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index e5c68c5c98..ab88a55d65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,13 +6,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased-`x.y.z`] - 20xx-xx-xx -## [`0.8.1-preview`] - 2020-01-07 +## [`0.8.1-preview`] - 2020-xx-xx ### Adapted from 0.6.5 ### Internal: Features listed in the internal section are not ready to use but, in the spirit of open development, we detail every change we make to the GDK. - **SpatialOS GDK for Unreal** > **Editor Settings** > **Region Settings** has been moved to **SpatialOS GDK for Unreal** > **Runtime Settings** > **Region Settings**. - Local deployments can now be launched in China, when the **Region where services are located** is set to `CN`. +### Bug fixes: +- Replicated references to newly created dynamic subobjects will now be resolved correctly. + ## [`0.8.0-preview`] - 2019-12-17 ### Breaking Changes: diff --git a/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialActorChannel.cpp b/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialActorChannel.cpp index 99ff02234d..2431123923 100644 --- a/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialActorChannel.cpp +++ b/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialActorChannel.cpp @@ -577,7 +577,7 @@ void USpatialActorChannel::DynamicallyAttachSubobject(UObject* Object) } else { - Info = TryResolveNewDynamicSubobjectAndGetClassInfo(Object); + Info = NetDriver->PackageMap->TryResolveNewDynamicSubobjectAndGetClassInfo(Object); if (Info == nullptr) { @@ -621,36 +621,6 @@ bool USpatialActorChannel::IsListening() const return false; } -const FClassInfo* USpatialActorChannel::TryResolveNewDynamicSubobjectAndGetClassInfo(UObject* Object) -{ - const FClassInfo* Info = nullptr; - - const FClassInfo& SubobjectInfo = NetDriver->ClassInfoManager->GetOrCreateClassInfoByClass(Object->GetClass()); - - // Find the first ClassInfo relating to a dynamic subobject - // which has not been used on this entity. - for (const auto& DynamicSubobjectInfo : SubobjectInfo.DynamicSubobjectInfo) - { - if (!NetDriver->PackageMap->GetObjectFromUnrealObjectRef(FUnrealObjectRef(EntityId, DynamicSubobjectInfo->SchemaComponents[SCHEMA_Data])).IsValid()) - { - Info = &DynamicSubobjectInfo.Get(); - break; - } - } - - // If all ClassInfos are used up, we error. - if (Info == nullptr) - { - UE_LOG(LogSpatialActorChannel, Error, TEXT("Too many dynamic subobjects of type %s attached to Actor %s! Please increase" - " the max number of dynamically attached subobjects per class in the SpatialOS runtime settings."), *Object->GetClass()->GetName(), *Actor->GetName()); - return Info; - } - - NetDriver->PackageMap->ResolveSubobject(Object, FUnrealObjectRef(EntityId, Info->SchemaComponents[SCHEMA_Data])); - - return Info; -} - bool USpatialActorChannel::ReplicateSubobject(UObject* Object, const FReplicationFlags& RepFlags) { SCOPE_CYCLE_COUNTER(STAT_SpatialActorChannelReplicateSubobject); diff --git a/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialPackageMapClient.cpp b/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialPackageMapClient.cpp index c2024a67bc..5bf68f30ae 100644 --- a/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialPackageMapClient.cpp +++ b/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialPackageMapClient.cpp @@ -295,6 +295,36 @@ bool USpatialPackageMapClient::SerializeObject(FArchive& Ar, UClass* InClass, UO return true; } +const FClassInfo* USpatialPackageMapClient::TryResolveNewDynamicSubobjectAndGetClassInfo(UObject* Object) +{ + AActor* Actor = Object ? Object->GetTypedOuter() : nullptr; + Worker_EntityId EntityId = GetEntityIdFromObject(Actor); + + if (EntityId != SpatialConstants::INVALID_ENTITY_ID) + { + FUnrealObjectRef Ref = GetUnrealObjectRefFromObject(Object); + if (Ref.IsValid()) + { + UE_LOG(LogSpatialPackageMap, Error, TEXT("Trying to resolve a dynamic subobject twice! Object %s, Actor %s, EntityId %d."), *GetNameSafe(Object), *GetNameSafe(Actor), EntityId); + return nullptr; + } + + const FClassInfo* Info = Cast(GuidCache->Driver)->ClassInfoManager->GetClassInfoForNewSubobject(Object, EntityId, this); + + // If we don't get the info, an error is logged in the above function, that we have exceeded the maximum number of dynamic subobjects on the entity + if (Info != nullptr) + { + ResolveSubobject(Object, FUnrealObjectRef(EntityId, Info->SchemaComponents[SCHEMA_Data])); + } + + return Info; + } + + UE_LOG(LogSpatialPackageMap, Error, TEXT("While trying to resolve a new dynamic subobject %s, the parent actor %s was not resolved."), *GetNameSafe(Object), *GetNameSafe(Actor)); + + return nullptr; +} + FSpatialNetGUIDCache::FSpatialNetGUIDCache(USpatialNetDriver* InDriver) : FNetGUIDCache(InDriver) { diff --git a/SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialClassInfoManager.cpp b/SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialClassInfoManager.cpp index d8faadb1b8..e305204d84 100644 --- a/SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialClassInfoManager.cpp +++ b/SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialClassInfoManager.cpp @@ -467,6 +467,34 @@ bool USpatialClassInfoManager::IsSublevelComponent(Worker_ComponentId ComponentI return SchemaDatabase->LevelComponentIds.Contains(ComponentId); } +const FClassInfo* USpatialClassInfoManager::GetClassInfoForNewSubobject(const UObject * Object, Worker_EntityId EntityId, USpatialPackageMapClient* PackageMapClient) +{ + const FClassInfo* Info = nullptr; + + const FClassInfo& SubobjectInfo = GetOrCreateClassInfoByClass(Object->GetClass()); + + // Find the first ClassInfo relating to a dynamic subobject + // which has not been used on this entity. + for (const auto& DynamicSubobjectInfo : SubobjectInfo.DynamicSubobjectInfo) + { + if (!PackageMapClient->GetObjectFromUnrealObjectRef(FUnrealObjectRef(EntityId, DynamicSubobjectInfo->SchemaComponents[SCHEMA_Data])).IsValid()) + { + Info = &DynamicSubobjectInfo.Get(); + break; + } + } + + // If all ClassInfos are used up, we error. + if (Info == nullptr) + { + const AActor* Actor = Cast(PackageMapClient->GetObjectFromEntityId(EntityId)); + UE_LOG(LogSpatialPackageMap, Error, TEXT("Too many dynamic subobjects of type %s attached to Actor %s! Please increase" + " the max number of dynamically attached subobjects per class in the SpatialOS runtime settings."), *Object->GetClass()->GetName(), *GetNameSafe(Actor)); + } + + return Info; +} + void USpatialClassInfoManager::QuitGame() { #if WITH_EDITOR diff --git a/SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialSender.cpp b/SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialSender.cpp index 5822d9f74d..22a1d46e0e 100644 --- a/SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialSender.cpp +++ b/SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialSender.cpp @@ -285,7 +285,7 @@ Worker_RequestId USpatialSender::CreateEntity(USpatialActorChannel* Channel) // If this object is not in the PackageMap, it has been dynamically created. if (!PackageMap->GetUnrealObjectRefFromObject(Subobject).IsValid()) { - const FClassInfo* SubobjectInfo = Channel->TryResolveNewDynamicSubobjectAndGetClassInfo(Subobject); + const FClassInfo* SubobjectInfo = PackageMap->TryResolveNewDynamicSubobjectAndGetClassInfo(Subobject); if (SubobjectInfo == nullptr) { diff --git a/SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialActorChannel.h b/SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialActorChannel.h index e9e0e23b9f..c4f414243b 100644 --- a/SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialActorChannel.h +++ b/SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialActorChannel.h @@ -159,7 +159,6 @@ class SPATIALGDK_API USpatialActorChannel : public UActorChannel FORCEINLINE bool GetInterestDirty() const { return bInterestDirty; } bool IsListening() const; - const FClassInfo* TryResolveNewDynamicSubobjectAndGetClassInfo(UObject* Object); protected: // Begin UChannel interface diff --git a/SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialPackageMapClient.h b/SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialPackageMapClient.h index b60bed7dd8..70b1265c28 100644 --- a/SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialPackageMapClient.h +++ b/SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialPackageMapClient.h @@ -14,7 +14,6 @@ DECLARE_LOG_CATEGORY_EXTERN(LogSpatialPackageMap, Log, All); -class USpatialClassInfoManager; class USpatialNetDriver; class UEntityPool; class FTimerManager; @@ -62,10 +61,9 @@ class SPATIALGDK_API USpatialPackageMapClient : public UPackageMapClient virtual bool SerializeObject(FArchive& Ar, UClass* InClass, UObject*& Obj, FNetworkGUID *OutNetGUID = NULL) override; -private: - UPROPERTY() - USpatialClassInfoManager* ClassInfoManager; + const FClassInfo* TryResolveNewDynamicSubobjectAndGetClassInfo(UObject* Object); +private: UPROPERTY() UEntityPool* EntityPool; diff --git a/SpatialGDK/Source/SpatialGDK/Public/Interop/SpatialClassInfoManager.h b/SpatialGDK/Source/SpatialGDK/Public/Interop/SpatialClassInfoManager.h index 4053eb13db..2351eb975c 100644 --- a/SpatialGDK/Source/SpatialGDK/Public/Interop/SpatialClassInfoManager.h +++ b/SpatialGDK/Source/SpatialGDK/Public/Interop/SpatialClassInfoManager.h @@ -116,6 +116,9 @@ class SPATIALGDK_API USpatialClassInfoManager : public UObject uint32 GetComponentIdFromLevelPath(const FString& LevelPath); bool IsSublevelComponent(Worker_ComponentId ComponentId); + // Tries to find ClassInfo corresponding to an unused dynamic subobject on the given entity + const FClassInfo* GetClassInfoForNewSubobject(const UObject* Object, Worker_EntityId EntityId, USpatialPackageMapClient* PackageMapClient); + UPROPERTY() USchemaDatabase* SchemaDatabase; diff --git a/SpatialGDK/Source/SpatialGDK/Public/Schema/UnrealObjectRef.cpp b/SpatialGDK/Source/SpatialGDK/Public/Schema/UnrealObjectRef.cpp index 7bcd7e1545..aa6436805c 100644 --- a/SpatialGDK/Source/SpatialGDK/Public/Schema/UnrealObjectRef.cpp +++ b/SpatialGDK/Source/SpatialGDK/Public/Schema/UnrealObjectRef.cpp @@ -122,8 +122,19 @@ FUnrealObjectRef FUnrealObjectRef::FromObjectPtr(UObject* ObjectValue, USpatialP } } - // Unresolved object. - UE_LOG(LogUnrealObjectRef, Verbose, TEXT("FUnrealObjectRef::FromObjectPtr: ObjectValue is unresolved! %s"), *ObjectValue->GetName()); + // Check if the object is a newly referenced dynamic subobject, in which case we can create the object ref if we have the entity id of the parent actor. + if (!ObjectValue->IsA()) + { + PackageMap->TryResolveNewDynamicSubobjectAndGetClassInfo(ObjectValue); + ObjectRef = PackageMap->GetUnrealObjectRefFromObject(ObjectValue); // This should now be valid, as we resolve the object in the line before + if (ObjectRef.IsValid()) + { + return ObjectRef; + } + } + + // Unresolved object. + UE_LOG(LogUnrealObjectRef, Warning, TEXT("FUnrealObjectRef::FromObjectPtr: ObjectValue is unresolved! %s"), *ObjectValue->GetName()); ObjectRef = FUnrealObjectRef::NULL_OBJECT_REF; } } From 75482efd90fc873402217cca032fce480fac8ca5 Mon Sep 17 00:00:00 2001 From: Oliver Balaam Date: Mon, 27 Jan 2020 11:40:59 +0000 Subject: [PATCH 05/30] Update spatiald version (#1703) * Update spot.version * Update CHANGELOG.md * reinstate spot version, update spatialD version * Update CHANGELOG.md --- CHANGELOG.md | 7 ++++++- .../SpatialGDKServices/Private/LocalDeploymentManager.cpp | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ab88a55d65..f234ff8508 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,7 +4,12 @@ All notable changes to the SpatialOS Game Development Kit for Unreal will be doc The format of this Changelog is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [Unreleased-`x.y.z`] - 20xx-xx-xx +## [Unreleased-`x.y.z`] - 2020-xx-xx +### Features: +- Updated the version of the local API service used by the UnrealGDK. + +### Bug fixes: +- Fixed a bug that caused the local API service to memory leak. ## [`0.8.1-preview`] - 2020-xx-xx ### Adapted from 0.6.5 diff --git a/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp b/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp index 9b12fb37a7..9824e52aff 100644 --- a/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp +++ b/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp @@ -23,7 +23,7 @@ DEFINE_LOG_CATEGORY(LogSpatialDeploymentManager); #define LOCTEXT_NAMESPACE "FLocalDeploymentManager" -static const FString SpatialServiceVersion(TEXT("20191128.003423.475a3c1edb")); +static const FString SpatialServiceVersion(TEXT("20200120.115350.8d6b779c82")); namespace { From b321b822ea7d5b079a3e3002d76aaf360a99948c Mon Sep 17 00:00:00 2001 From: improbable-valentyn <32096431+improbable-valentyn@users.noreply.github.com> Date: Wed, 5 Feb 2020 17:14:07 +0000 Subject: [PATCH 06/30] [UNR-2735] Correctly report errors when cloud deployment fails to launch (#1772) * Correctly report errors when cloud deployment fails to launch * Add release note * Apply suggestions from code review --- CHANGELOG.md | 1 + .../DeploymentLauncher/DeploymentLauncher.cs | 1 + .../Private/SpatialGDKEditorCloudLauncher.cpp | 8 ++++++++ 3 files changed, 10 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index f234ff8508..54c8867c4a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ Features listed in the internal section are not ready to use but, in the spirit ### Bug fixes: - Replicated references to newly created dynamic subobjects will now be resolved correctly. +- Cloud deployment flow will now correctly report errors when a deployment fails to launch due to a missing assembly. ## [`0.8.0-preview`] - 2019-12-17 diff --git a/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs b/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs index 2f977527cc..93864ec6e0 100644 --- a/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs +++ b/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs @@ -189,6 +189,7 @@ private static int CreateDeployment(string[] args) { Console.WriteLine( $"Unable to launch the deployment(s). This is likely because the project '{projectName}' or assembly '{assemblyName}' doesn't exist."); + return 1; } else { diff --git a/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorCloudLauncher.cpp b/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorCloudLauncher.cpp index a147fce9c6..8de15eb7d1 100644 --- a/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorCloudLauncher.cpp +++ b/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorCloudLauncher.cpp @@ -48,6 +48,10 @@ bool SpatialGDKCloudLaunch() if (OutCode != 0) { UE_LOG(LogSpatialGDKEditorCloudLauncher, Error, TEXT("Cloud Launch failed with code %d: %s"), OutCode, *OutString); + if (!OutErr.IsEmpty()) + { + UE_LOG(LogSpatialGDKEditorCloudLauncher, Error, TEXT("%s"), *OutErr); + } bSuccess = false; } @@ -76,6 +80,10 @@ bool SpatialGDKCloudStop() if (OutCode != 0) { UE_LOG(LogSpatialGDKEditorCloudLauncher, Error, TEXT("Cloud Launch failed with code %d: %s"), OutCode, *OutString); + if (!OutErr.IsEmpty()) + { + UE_LOG(LogSpatialGDKEditorCloudLauncher, Error, TEXT("%s"), *OutErr); + } bSuccess = false; } From 25bdf6c7e86c26a4f51de0d5d2b0f627010d2fa7 Mon Sep 17 00:00:00 2001 From: improbable-valentyn <32096431+improbable-valentyn@users.noreply.github.com> Date: Thu, 6 Feb 2020 10:57:46 +0000 Subject: [PATCH 07/30] Update CHANGELOG (#1773) --- CHANGELOG.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 54c8867c4a..5501fae29c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,6 @@ The format of this Changelog is based on [Keep a Changelog](https://keepachangel and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased-`x.y.z`] - 2020-xx-xx -### Features: -- Updated the version of the local API service used by the UnrealGDK. - -### Bug fixes: -- Fixed a bug that caused the local API service to memory leak. ## [`0.8.1-preview`] - 2020-xx-xx ### Adapted from 0.6.5 @@ -18,8 +13,12 @@ Features listed in the internal section are not ready to use but, in the spirit - **SpatialOS GDK for Unreal** > **Editor Settings** > **Region Settings** has been moved to **SpatialOS GDK for Unreal** > **Runtime Settings** > **Region Settings**. - Local deployments can now be launched in China, when the **Region where services are located** is set to `CN`. +### Features: +- Updated the version of the local API service used by the UnrealGDK. + ### Bug fixes: - Replicated references to newly created dynamic subobjects will now be resolved correctly. +- Fixed a bug that caused the local API service to memory leak. - Cloud deployment flow will now correctly report errors when a deployment fails to launch due to a missing assembly. ## [`0.8.0-preview`] - 2019-12-17 From becb4a025b5af241ea9c204a7a6b4db46ab5cb63 Mon Sep 17 00:00:00 2001 From: MatthewSandfordImprobable Date: Fri, 7 Feb 2020 14:04:42 +0000 Subject: [PATCH 08/30] 0.8.1 China fixes (#1778) * Adding refresh token work around and adding header to snapshot upload. * Running spatial auth whenever you launch a cloud or local deployment. This fixes a china blocker. # Conflicts: # SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKSimulatedPlayerDeployment.cpp # SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp * Adding a delegate to TryStartLocalDeployment to be called at the end of the function. Removing --domain from unreal gdk spatial cli calls. # Conflicts: # Setup.bat # SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp # SpatialGDK/Source/SpatialGDKTests/SpatialGDKServices/LocalDeploymentManager/LocalDeploymentManagerUtilities.cpp * Setup.sh changes. * Modifying toast messages for clarity. * Applying some feedback from PR pointing at 0.6.5 * Removing line from setup.bat and small formatting change. --- RequireSetup | 2 +- Setup.bat | 2 +- Setup.sh | 2 +- .../DeploymentLauncher/DeploymentLauncher.cs | 32 +++-- .../Private/SpatialGDKEditorToolbar.cpp | 23 ++-- .../SpatialGDKSimulatedPlayerDeployment.cpp | 56 +++++--- .../SpatialGDKSimulatedPlayerDeployment.h | 4 + .../Private/LocalDeploymentManager.cpp | 122 +++++++++++------- .../Private/SpatialCommandUtils.cpp | 23 ++++ .../Public/LocalDeploymentManager.h | 8 +- .../Public/SpatialCommandUtils.h | 14 ++ .../LocalDeploymentManagerTest.cpp | 2 +- 12 files changed, 206 insertions(+), 84 deletions(-) create mode 100644 SpatialGDK/Source/SpatialGDKServices/Private/SpatialCommandUtils.cpp create mode 100644 SpatialGDK/Source/SpatialGDKServices/Public/SpatialCommandUtils.h diff --git a/RequireSetup b/RequireSetup index a9edb1328a..5578f83247 100644 --- a/RequireSetup +++ b/RequireSetup @@ -1,4 +1,4 @@ Increment the below number whenever it is required to run Setup.bat as part of a new commit. Our git hooks will detect this file has been updated and automatically run Setup.bat on pull. -38 +39 diff --git a/Setup.bat b/Setup.bat index 72f4f8fcd2..1a24223a54 100644 --- a/Setup.bat +++ b/Setup.bat @@ -59,7 +59,7 @@ call :MarkStartOfBlock "Setup variables" set SPATIAL_DIR=%~dp0..\..\..\spatial set DOMAIN_ENVIRONMENT_VAR= for %%A in (%*) do ( - if "%%A"=="--china" set DOMAIN_ENVIRONMENT_VAR=--domain spatialoschina.com --environment cn-production + if "%%A"=="--china" set DOMAIN_ENVIRONMENT_VAR=--environment cn-production ) call :MarkEndOfBlock "Setup variables" diff --git a/Setup.sh b/Setup.sh index f5c4358c9d..ffcaa50ec4 100755 --- a/Setup.sh +++ b/Setup.sh @@ -19,7 +19,7 @@ SCHEMA_COPY_DIR="$(pwd)/../../../spatial/schema/unreal/gdk" SCHEMA_STD_COPY_DIR="$(pwd)/../../../spatial/build/dependencies/schema/standard_library" SPATIAL_DIR="$(pwd)/../../../spatial" if [[ "${1:-}" == "--china" ]]; then - DOMAIN_ENVIRONMENT_VAR="--domain spatialoschina.com --environment cn-production" + DOMAIN_ENVIRONMENT_VAR="--environment cn-production" fi echo "Setup the git hooks" diff --git a/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs b/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs index 93864ec6e0..7209a85762 100644 --- a/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs +++ b/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs @@ -26,8 +26,14 @@ internal class DeploymentLauncher private const string CHINA_ENDPOINT_URL = "platform.api.spatialoschina.com"; private const int CHINA_ENDPOINT_PORT = 443; + private static readonly string ChinaRefreshToken = File.ReadAllText(Path.Combine(Environment.ExpandEnvironmentVariables("%LOCALAPPDATA%"), ".improbable/oauth2/oauth2_refresh_token_cn-production")); + + private static readonly PlatformRefreshTokenCredential ChinaCredentials = new PlatformRefreshTokenCredential(ChinaRefreshToken, + "https://auth.spatialoschina.com/auth/v1/authcode", + "https://auth.spatialoschina.com/auth/v1/token"); + private static string UploadSnapshot(SnapshotServiceClient client, string snapshotPath, string projectName, - string deploymentName) + string deploymentName, string region) { Console.WriteLine($"Uploading {snapshotPath} to project {projectName}"); @@ -61,7 +67,12 @@ private static string UploadSnapshot(SnapshotServiceClient client, string snapsh var httpRequest = WebRequest.Create(uploadSnapshotResponse.UploadUrl) as HttpWebRequest; httpRequest.Method = "PUT"; httpRequest.ContentLength = snapshotToUpload.Size; - httpRequest.Headers.Set("Content-MD5", snapshotToUpload.Checksum); + httpRequest.Headers.Add("Content-MD5", snapshotToUpload.Checksum); + + if (region == "CN") + { + httpRequest.Headers.Add("x-amz-server-side-encryption", "AES256"); + } using (var dataStream = httpRequest.GetRequestStream()) { @@ -91,6 +102,11 @@ private static PlatformApiEndpoint GetApiEndpoint(string region) return null; // Use default } + private static PlatformRefreshTokenCredential GetPlatformRefreshTokenCredential(string region) + { + return region == "CN" ? ChinaCredentials : null; + } + private static int CreateDeployment(string[] args) { bool launchSimPlayerDeployment = args.Length == 11; @@ -122,7 +138,7 @@ private static int CreateDeployment(string[] args) try { - var deploymentServiceClient = DeploymentServiceClient.Create(GetApiEndpoint(mainDeploymentRegion)); + var deploymentServiceClient = DeploymentServiceClient.Create(GetApiEndpoint(mainDeploymentRegion), GetPlatformRefreshTokenCredential(mainDeploymentRegion)); if (DeploymentExists(deploymentServiceClient, projectName, mainDeploymentName)) { @@ -234,11 +250,11 @@ private static void StopDeploymentByName(DeploymentServiceClient deploymentServi private static Operation CreateMainDeploymentAsync(DeploymentServiceClient deploymentServiceClient, bool launchSimPlayerDeployment, string projectName, string assemblyName, string mainDeploymentName, string mainDeploymentJsonPath, string mainDeploymentSnapshotPath, string regionCode) { - var snapshotServiceClient = SnapshotServiceClient.Create(GetApiEndpoint(regionCode)); + var snapshotServiceClient = SnapshotServiceClient.Create(GetApiEndpoint(regionCode), GetPlatformRefreshTokenCredential(regionCode)); // Upload snapshots. var mainSnapshotId = UploadSnapshot(snapshotServiceClient, mainDeploymentSnapshotPath, projectName, - mainDeploymentName); + mainDeploymentName, regionCode); if (mainSnapshotId.Length == 0) { @@ -282,7 +298,7 @@ private static Operation CreateMainDeploym private static Operation CreateSimPlayerDeploymentAsync(DeploymentServiceClient deploymentServiceClient, string projectName, string assemblyName, string mainDeploymentName, string simDeploymentName, string simDeploymentJsonPath, string regionCode, int simNumPlayers) { - var playerAuthServiceClient = PlayerAuthServiceClient.Create(GetApiEndpoint(regionCode)); + var playerAuthServiceClient = PlayerAuthServiceClient.Create(GetApiEndpoint(regionCode), GetPlatformRefreshTokenCredential(regionCode)); // Create development authentication token used by the simulated players. var dat = playerAuthServiceClient.CreateDevelopmentAuthenticationToken( @@ -372,7 +388,7 @@ private static int StopDeployments(string[] args) var projectName = args[1]; var regionCode = args[2]; - var deploymentServiceClient = DeploymentServiceClient.Create(GetApiEndpoint(regionCode)); + var deploymentServiceClient = DeploymentServiceClient.Create(GetApiEndpoint(regionCode), GetPlatformRefreshTokenCredential(regionCode)); if (args.Length == 4) { @@ -424,7 +440,7 @@ private static int ListDeployments(string[] args) var projectName = args[1]; var regionCode = args[2]; - var deploymentServiceClient = DeploymentServiceClient.Create(GetApiEndpoint(regionCode)); + var deploymentServiceClient = DeploymentServiceClient.Create(GetApiEndpoint(regionCode), GetPlatformRefreshTokenCredential(regionCode)); var activeDeployments = ListLaunchedActiveDeployments(deploymentServiceClient, projectName); foreach (var deployment in activeDeployments) diff --git a/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp b/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp index 7da1dab406..ee39e865fb 100644 --- a/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp +++ b/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp @@ -624,17 +624,20 @@ void FSpatialGDKEditorToolbarModule::VerifyAndStartDeployment() return; } - OnShowTaskStartNotification(TEXT("Starting local deployment...")); - const bool bLocalDeploymentStarted = LocalDeploymentManager->TryStartLocalDeployment(LaunchConfig, LaunchFlags, SnapshotName, GetOptionalExposedRuntimeIP()); - - if (bLocalDeploymentStarted) + FLocalDeploymentManager::LocalDeploymentCallback CallBack = [this](bool bSuccess) { - OnShowSuccessNotification(TEXT("Local deployment started!")); - } - else - { - OnShowFailedNotification(TEXT("Local deployment failed to start")); - } + if (bSuccess) + { + OnShowSuccessNotification(TEXT("Local deployment started!")); + } + else + { + OnShowFailedNotification(TEXT("Local deployment failed to start")); + } + }; + + OnShowTaskStartNotification(TEXT("Starting local deployment...")); + LocalDeploymentManager->TryStartLocalDeployment(LaunchConfig, LaunchFlags, SnapshotName, GetOptionalExposedRuntimeIP(), CallBack); }); } diff --git a/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKSimulatedPlayerDeployment.cpp b/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKSimulatedPlayerDeployment.cpp index 49ed2cb211..4542dc55bc 100644 --- a/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKSimulatedPlayerDeployment.cpp +++ b/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKSimulatedPlayerDeployment.cpp @@ -2,16 +2,20 @@ #include "SpatialGDKSimulatedPlayerDeployment.h" +#include "Async/Async.h" #include "DesktopPlatformModule.h" #include "EditorDirectories.h" #include "EditorStyleSet.h" #include "Framework/Application/SlateApplication.h" #include "Framework/MultiBox/MultiBoxBuilder.h" #include "Framework/Notifications/NotificationManager.h" -#include "Templates/SharedPointer.h" +#include "Runtime/Launch/Resources/Version.h" +#include "SpatialCommandUtils.h" +#include "SpatialGDKSettings.h" #include "SpatialGDKEditorSettings.h" #include "SpatialGDKEditorToolbar.h" #include "SpatialGDKServicesModule.h" +#include "Templates/SharedPointer.h" #include "Textures/SlateIcon.h" #include "Widgets/Input/SButton.h" #include "Widgets/Input/SComboButton.h" @@ -28,6 +32,8 @@ #include "Internationalization/Regex.h" +DEFINE_LOG_CATEGORY(LogSpatialGDKSimulatedPlayerDeployment); + void SSpatialGDKSimulatedPlayerDeployment::Construct(const FArguments& InArgs) { const USpatialGDKEditorSettings* SpatialGDKSettings = GetDefault(); @@ -502,14 +508,16 @@ FReply SSpatialGDKSimulatedPlayerDeployment::OnLaunchClicked() return FReply::Handled(); } - if (TSharedPtr SpatialGDKEditorSharedPtr = SpatialGDKEditorPtr.Pin()) + if (ToolbarPtr) { - if (ToolbarPtr) - { - ToolbarPtr->OnShowTaskStartNotification(TEXT("Starting cloud deployment...")); - } + ToolbarPtr->OnShowTaskStartNotification(TEXT("Starting cloud deployment...")); + } - SpatialGDKEditorSharedPtr->LaunchCloudDeployment( + auto LaunchCloudDeployment = [this, ToolbarPtr]() + { + if (TSharedPtr SpatialGDKEditorSharedPtr = SpatialGDKEditorPtr.Pin()) + { + SpatialGDKEditorSharedPtr->LaunchCloudDeployment( FSimpleDelegate::CreateLambda([]() { if (FSpatialGDKEditorToolbarModule* ToolbarPtr = FModuleManager::GetModulePtr("SpatialGDKEditorToolbar")) @@ -522,19 +530,37 @@ FReply SSpatialGDKSimulatedPlayerDeployment::OnLaunchClicked() { if (FSpatialGDKEditorToolbarModule* ToolbarPtr = FModuleManager::GetModulePtr("SpatialGDKEditorToolbar")) { - ToolbarPtr->OnShowFailedNotification("Failed to launch cloud deployment."); + ToolbarPtr->OnShowFailedNotification("Failed to launch cloud deployment. See output logs for details."); } })); - return FReply::Handled(); - } + return; + } - FNotificationInfo Info(FText::FromString(TEXT("Couldn't launch the deployment."))); - Info.bUseSuccessFailIcons = true; - Info.ExpireDuration = 3.0f; + FNotificationInfo Info(FText::FromString(TEXT("Couldn't launch the deployment."))); + Info.bUseSuccessFailIcons = true; + Info.ExpireDuration = 3.0f; - TSharedPtr NotificationItem = FSlateNotificationManager::Get().AddNotification(Info); - NotificationItem->SetCompletionState(SNotificationItem::CS_Fail); + TSharedPtr NotificationItem = FSlateNotificationManager::Get().AddNotification(Info); + NotificationItem->SetCompletionState(SNotificationItem::CS_Fail); + }; + +#if ENGINE_MINOR_VERSION <= 22 + AttemptSpatialAuthResult = Async(EAsyncExecution::Thread, []() { return SpatialCommandUtils::AttemptSpatialAuth(GetDefault()->IsRunningInChina()); }, +#else + AttemptSpatialAuthResult = Async(EAsyncExecution::Thread, []() { return SpatialCommandUtils::AttemptSpatialAuth(GetDefault()->IsRunningInChina()); }, +#endif + [this, LaunchCloudDeployment, ToolbarPtr]() + { + if (AttemptSpatialAuthResult.IsReady() && AttemptSpatialAuthResult.Get() == true) + { + LaunchCloudDeployment(); + } + else + { + ToolbarPtr->OnShowTaskStartNotification(TEXT("Spatial auth failed attempting to launch cloud deployment.")); + } + }); return FReply::Handled(); } diff --git a/SpatialGDK/Source/SpatialGDKEditorToolbar/Public/SpatialGDKSimulatedPlayerDeployment.h b/SpatialGDK/Source/SpatialGDKEditorToolbar/Public/SpatialGDKSimulatedPlayerDeployment.h index 1abfea0f6b..290587e39e 100644 --- a/SpatialGDK/Source/SpatialGDKEditorToolbar/Public/SpatialGDKSimulatedPlayerDeployment.h +++ b/SpatialGDK/Source/SpatialGDKEditorToolbar/Public/SpatialGDKSimulatedPlayerDeployment.h @@ -13,6 +13,8 @@ #include "Widgets/Layout/SBorder.h" #include "Widgets/SCompoundWidget.h" +DECLARE_LOG_CATEGORY_EXTERN(LogSpatialGDKSimulatedPlayerDeployment, Log, All); + class SWindow; enum class ECheckBoxState : uint8; @@ -40,6 +42,8 @@ class SSpatialGDKSimulatedPlayerDeployment : public SCompoundWidget /** Pointer to the SpatialGDK editor */ TWeakPtr SpatialGDKEditorPtr; + TFuture AttemptSpatialAuthResult; + /** Delegate to commit assembly name */ void OnDeploymentAssemblyCommited(const FText& InText, ETextCommit::Type InCommitType); diff --git a/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp b/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp index 9824e52aff..c021315e47 100644 --- a/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp +++ b/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp @@ -14,9 +14,10 @@ #include "IPAddress.h" #include "Json/Public/Dom/JsonObject.h" #include "Misc/MessageDialog.h" -#include "SpatialGDKServicesModule.h" -#include "SocketSubsystem.h" #include "Sockets.h" +#include "SocketSubsystem.h" +#include "SpatialCommandUtils.h" +#include "SpatialGDKServicesModule.h" #include "UObject/CoreNet.h" DEFINE_LOG_CATEGORY(LogSpatialDeploymentManager); @@ -32,7 +33,7 @@ namespace FString DomainEnvironmentStr; if (bIsInChina) { - DomainEnvironmentStr = TEXT("--domain=spatialoschina.com --environment=cn-production"); + DomainEnvironmentStr = TEXT("--environment=cn-production"); } return DomainEnvironmentStr; } @@ -285,49 +286,8 @@ bool FLocalDeploymentManager::LocalDeploymentPreRunChecks() return bSuccess; } -bool FLocalDeploymentManager::TryStartLocalDeployment(FString LaunchConfig, FString LaunchArgs, FString SnapshotName, FString RuntimeIPToExpose) +bool FLocalDeploymentManager::FinishLocalDeployment(FString LaunchConfig, FString LaunchArgs, FString SnapshotName, FString RuntimeIPToExpose) { - bRedeployRequired = false; - - if (bStoppingDeployment) - { - UE_LOG(LogSpatialDeploymentManager, Verbose, TEXT("Local deployment is in the process of stopping. New deployment will start when previous one has stopped.")); - while (bStoppingDeployment) - { - FPlatformProcess::Sleep(0.1f); - } - } - - if (bLocalDeploymentRunning) - { - UE_LOG(LogSpatialDeploymentManager, Verbose, TEXT("Tried to start a local deployment but one is already running.")); - return false; - } - - if (!LocalDeploymentPreRunChecks()) - { - UE_LOG(LogSpatialDeploymentManager, Error, TEXT("Tried to start a local deployment but a required port is already bound by another process.")); - return false; - } - - LocalRunningDeploymentID.Empty(); - - bStartingDeployment = true; - - // Stop the currently running service if the runtime IP is to be exposed, but is different from the one specified - if (ExposedRuntimeIP != RuntimeIPToExpose) - { - UE_LOG(LogSpatialDeploymentManager, Verbose, TEXT("Settings for exposing runtime IP have changed since service startup. Restarting service to reflect changes.")); - TryStopSpatialService(); - } - - // If the service is not running then start it. - if (!bSpatialServiceRunning) - { - TryStartSpatialService(RuntimeIPToExpose); - } - - SnapshotName.RemoveFromEnd(TEXT(".snapshot")); FString SpotCreateArgs = FString::Printf(TEXT("alpha deployment create --launch-config=\"%s\" --name=localdeployment --project-name=%s --json --starting-snapshot-id=\"%s\" %s"), *LaunchConfig, *FSpatialGDKServicesModule::GetProjectName(), *SnapshotName, *LaunchArgs); FDateTime SpotCreateStart = FDateTime::Now(); @@ -387,7 +347,77 @@ bool FLocalDeploymentManager::TryStartLocalDeployment(FString LaunchConfig, FStr UE_LOG(LogSpatialDeploymentManager, Error, TEXT("'status' does not exist in Json result from 'spot create': %s"), *SpotCreateResult); } - return bSuccess; + return true; +} + +void FLocalDeploymentManager::TryStartLocalDeployment(FString LaunchConfig, FString LaunchArgs, FString SnapshotName, FString RuntimeIPToExpose, const LocalDeploymentCallback& CallBack) +{ + bRedeployRequired = false; + + if (bStoppingDeployment) + { + UE_LOG(LogSpatialDeploymentManager, Verbose, TEXT("Local deployment is in the process of stopping. New deployment will start when previous one has stopped.")); + while (bStoppingDeployment) + { + FPlatformProcess::Sleep(0.1f); + } + } + + if (bLocalDeploymentRunning) + { + UE_LOG(LogSpatialDeploymentManager, Verbose, TEXT("Tried to start a local deployment but one is already running.")); + CallBack(false); + return; + } + + if (!LocalDeploymentPreRunChecks()) + { + UE_LOG(LogSpatialDeploymentManager, Error, TEXT("Tried to start a local deployment but a required port is already bound by another process.")); + CallBack(false); + return; + } + + LocalRunningDeploymentID.Empty(); + + bStartingDeployment = true; + + // Stop the currently running service if the runtime IP is to be exposed, but is different from the one specified + if (ExposedRuntimeIP != RuntimeIPToExpose) + { + UE_LOG(LogSpatialDeploymentManager, Verbose, TEXT("Settings for exposing runtime IP have changed since service startup. Restarting service to reflect changes.")); + TryStopSpatialService(); + } + + // If the service is not running then start it. + if (!bSpatialServiceRunning) + { + TryStartSpatialService(RuntimeIPToExpose); + } + + SnapshotName.RemoveFromEnd(TEXT(".snapshot")); + + +#if ENGINE_MINOR_VERSION <= 22 + AttemptSpatialAuthResult = Async(EAsyncExecution::Thread, [this]() { return SpatialCommandUtils::AttemptSpatialAuth(bIsInChina); }, +#else + AttemptSpatialAuthResult = Async(EAsyncExecution::Thread, [this]() { return SpatialCommandUtils::AttemptSpatialAuth(bIsInChina); }, +#endif + [this, LaunchConfig, LaunchArgs, SnapshotName, RuntimeIPToExpose, CallBack]() + { + bool bSuccess = AttemptSpatialAuthResult.IsReady() && AttemptSpatialAuthResult.Get() == true; + if (bSuccess) + { + FinishLocalDeployment(LaunchConfig, LaunchArgs, SnapshotName, RuntimeIPToExpose); + } + else + { + UE_LOG(LogSpatialDeploymentManager, Error, TEXT("Spatial auth failed attempting to launch local deployment.")); + } + + CallBack(bSuccess); + }); + + return; } bool FLocalDeploymentManager::TryStopLocalDeployment() diff --git a/SpatialGDK/Source/SpatialGDKServices/Private/SpatialCommandUtils.cpp b/SpatialGDK/Source/SpatialGDKServices/Private/SpatialCommandUtils.cpp new file mode 100644 index 0000000000..3c76ba68e1 --- /dev/null +++ b/SpatialGDK/Source/SpatialGDKServices/Private/SpatialCommandUtils.cpp @@ -0,0 +1,23 @@ +// Copyright (c) Improbable Worlds Ltd, All Rights Reserved + +#include "SpatialCommandUtils.h" + +DEFINE_LOG_CATEGORY(LogSpatialCommandUtils); + +bool SpatialCommandUtils::AttemptSpatialAuth(bool IsRunningInChina) +{ + FString SpatialInfoArgs = IsRunningInChina ? TEXT("auth login --environment=cn-production") : TEXT("auth login"); + FString SpatialInfoResult; + FString StdErr; + int32 ExitCode; + + FPlatformProcess::ExecProcess(*FString(TEXT("spatial")), *SpatialInfoArgs, &ExitCode, &SpatialInfoResult, &StdErr); + + bool bSuccess = ExitCode == 0; + if (!bSuccess) + { + UE_LOG(LogSpatialCommandUtils, Warning, TEXT("Spatial auth login failed. Error Code: %d, Error Message: %s"), ExitCode, *SpatialInfoResult); + } + + return bSuccess; +} diff --git a/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h b/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h index f6babe15a9..fc1a3685a9 100644 --- a/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h +++ b/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h @@ -27,7 +27,9 @@ class FLocalDeploymentManager bool KillProcessBlockingPort(int32 Port); bool LocalDeploymentPreRunChecks(); - bool SPATIALGDKSERVICES_API TryStartLocalDeployment(FString LaunchConfig, FString LaunchArgs, FString SnapshotName, FString RuntimeIPToExpose); + using LocalDeploymentCallback = TFunction; + + void SPATIALGDKSERVICES_API TryStartLocalDeployment(FString LaunchConfig, FString LaunchArgs, FString SnapshotName, FString RuntimeIPToExpose, const LocalDeploymentCallback& CallBack); bool SPATIALGDKSERVICES_API TryStopLocalDeployment(); bool SPATIALGDKSERVICES_API TryStartSpatialService(FString RuntimeIPToExpose); @@ -65,6 +67,10 @@ class FLocalDeploymentManager void StartUpWorkerConfigDirectoryWatcher(); void OnWorkerConfigDirectoryChanged(const TArray& FileChanges); + bool FinishLocalDeployment(FString LaunchConfig, FString LaunchArgs, FString SnapshotName, FString RuntimeIPToExpose); + + TFuture AttemptSpatialAuthResult; + static const int32 ExitCodeSuccess = 0; static const int32 ExitCodeNotRunning = 4; static const int32 RequiredRuntimePort = 5301; diff --git a/SpatialGDK/Source/SpatialGDKServices/Public/SpatialCommandUtils.h b/SpatialGDK/Source/SpatialGDKServices/Public/SpatialCommandUtils.h new file mode 100644 index 0000000000..d82dee5f67 --- /dev/null +++ b/SpatialGDK/Source/SpatialGDKServices/Public/SpatialCommandUtils.h @@ -0,0 +1,14 @@ +// Copyright (c) Improbable Worlds Ltd, All Rights Reserved + +#pragma once + +#include "CoreMinimal.h" + +DECLARE_LOG_CATEGORY_EXTERN(LogSpatialCommandUtils, Log, All); + +class SpatialCommandUtils +{ +public: + + SPATIALGDKSERVICES_API static bool AttemptSpatialAuth(bool IsRunningInChina); +}; diff --git a/SpatialGDK/Source/SpatialGDKTests/SpatialGDKServices/LocalDeploymentManager/LocalDeploymentManagerTest.cpp b/SpatialGDK/Source/SpatialGDKTests/SpatialGDKServices/LocalDeploymentManager/LocalDeploymentManagerTest.cpp index be010d08e0..2375b7714b 100644 --- a/SpatialGDK/Source/SpatialGDKTests/SpatialGDKServices/LocalDeploymentManager/LocalDeploymentManagerTest.cpp +++ b/SpatialGDK/Source/SpatialGDKTests/SpatialGDKServices/LocalDeploymentManager/LocalDeploymentManagerTest.cpp @@ -91,7 +91,7 @@ bool FStartDeployment::Update() return; } - LocalDeploymentManager->TryStartLocalDeployment(LaunchConfig, LaunchFlags, SnapshotName, TEXT("")); + LocalDeploymentManager->TryStartLocalDeployment(LaunchConfig, LaunchFlags, SnapshotName, TEXT(""), FLocalDeploymentManager::LocalDeploymentCallback()); }); } From 838a36962c73fda6f034a734d7bd12da237f426d Mon Sep 17 00:00:00 2001 From: improbable-valentyn <32096431+improbable-valentyn@users.noreply.github.com> Date: Wed, 12 Feb 2020 15:29:51 +0000 Subject: [PATCH 09/30] Move the initialization for Spatial connection into a separate function (#1793) --- .../Private/EngineClasses/SpatialGameInstance.cpp | 7 ++++++- .../SpatialGDK/Public/EngineClasses/SpatialGameInstance.h | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialGameInstance.cpp b/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialGameInstance.cpp index 92be2fb800..80427e81b7 100644 --- a/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialGameInstance.cpp +++ b/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialGameInstance.cpp @@ -95,7 +95,7 @@ FGameInstancePIEResult USpatialGameInstance::StartPlayInEditorGameInstance(ULoca } #endif -void USpatialGameInstance::StartGameInstance() +void USpatialGameInstance::TryConnectToSpatial() { if (HasSpatialNetDriver()) { @@ -121,6 +121,11 @@ void USpatialGameInstance::StartGameInstance() } } } +} + +void USpatialGameInstance::StartGameInstance() +{ + TryConnectToSpatial(); Super::StartGameInstance(); } diff --git a/SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialGameInstance.h b/SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialGameInstance.h index b4ee5a815a..8c794a1665 100644 --- a/SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialGameInstance.h +++ b/SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialGameInstance.h @@ -23,6 +23,9 @@ class SPATIALGDK_API USpatialGameInstance : public UGameInstance #if WITH_EDITOR virtual FGameInstancePIEResult StartPlayInEditorGameInstance(ULocalPlayer* LocalPlayer, const FGameInstancePIEParameters& Params) override; #endif + // Initializes the Spatial connection if Spatial networking is enabled, otherwise does nothing. + void TryConnectToSpatial(); + virtual void StartGameInstance() override; //~ Begin UObject Interface From df7d629ddca176f67a2af50f748845ad31d20307 Mon Sep 17 00:00:00 2001 From: MatthewSandfordImprobable Date: Thu, 13 Feb 2020 11:17:33 +0000 Subject: [PATCH 10/30] Updating changelog for SpatialOutput window open by default. (#1797) --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5501fae29c..ee18d25534 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ Features listed in the internal section are not ready to use but, in the spirit ### Features: - Updated the version of the local API service used by the UnrealGDK. +- The Spatial output log will now be open by default. ### Bug fixes: - Replicated references to newly created dynamic subobjects will now be resolved correctly. From e826a6e37c61e6cf630bb7c50b42079b1db8ffb1 Mon Sep 17 00:00:00 2001 From: Miron Zelina Date: Wed, 19 Feb 2020 13:23:19 +0000 Subject: [PATCH 11/30] [UNR-2887] Fix: Dynamic subobjects attached near actor creation would not be able to replicate their properties (#1806) Previously, if trying to create and attach a dynamic subobject to an actor near its creation point, the fields of the dynamic component would not replicate properly after initial creation. The reason for this was that we were not setting component write ACLs properly for these subobjects. This was due to the change made earlier, to resolve dynamic components earlier, which caused the code trying to check if the subobject is dynamically attached to think it was not dynamically attached, since it has already been resolved. This is fixed by decoupling the writing of ACLs from the resolution of the dynamic object in `SpatialSender::CreateEntity`. Also a drive-by fix for $lld spam in logs. Also a drive-by fix for authority queuing not checking which component we got authority over and potentially firing component updates for objects we did not have authority over. * Initial fix by modifying write ACLs anytime we create a component * Replace RemoveCurrent with RemoveAtSwap * Change back to iterator, as we need to preserve order of component updates --- .../Private/Interop/SpatialReceiver.cpp | 4 +-- .../Private/Interop/SpatialSender.cpp | 32 ++++++++++++------- .../SpatialGDK/Public/Interop/SpatialSender.h | 2 +- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialReceiver.cpp b/SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialReceiver.cpp index 6de1f03db3..238ef4d15f 100644 --- a/SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialReceiver.cpp +++ b/SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialReceiver.cpp @@ -358,7 +358,7 @@ void USpatialReceiver::HandleActorAuthority(const Worker_AuthorityChangeOp& Op) // TODO UNR-955 - Remove this once batch reservation of EntityIds are in. if (Op.authority == WORKER_AUTHORITY_AUTHORITATIVE) { - Sender->ProcessUpdatesQueuedUntilAuthority(Op.entity_id); + Sender->ProcessUpdatesQueuedUntilAuthority(Op.entity_id, Op.component_id); } // If we became authoritative over the position component. set our role to be ROLE_Authority @@ -538,7 +538,7 @@ void USpatialReceiver::ReceiveActor(Worker_EntityId EntityId) if (AActor* EntityActor = Cast(PackageMap->GetObjectFromEntityId(EntityId))) { UE_LOG(LogSpatialReceiver, Log, TEXT("Entity for actor %s has been checked out on the worker which spawned it or is a singleton linked on this worker. " - "Entity id: $lld"), *EntityActor->GetName(), EntityId); + "Entity id: %lld"), *EntityActor->GetName(), EntityId); // Assume SimulatedProxy until we've been delegated Authority bool bAuthority = StaticComponentView->GetAuthority(EntityId, Position::ComponentId) == WORKER_AUTHORITY_AUTHORITATIVE; diff --git a/SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialSender.cpp b/SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialSender.cpp index 22a1d46e0e..9a1c4253aa 100644 --- a/SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialSender.cpp +++ b/SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialSender.cpp @@ -292,14 +292,6 @@ Worker_RequestId USpatialSender::CreateEntity(USpatialActorChannel* Channel) // This is a failure but there is already a log inside TryResolveNewDynamicSubbojectAndGetClassInfo continue; } - - ForAllSchemaComponentTypes([&](ESchemaComponentType Type) - { - if (SubobjectInfo->SchemaComponents[Type] != SpatialConstants::INVALID_COMPONENT_ID) - { - ComponentWriteAcl.Add(SubobjectInfo->SchemaComponents[Type], AuthoritativeWorkerRequirementSet); - } - }); } const FClassInfo& SubobjectInfo = ClassInfoManager->GetOrCreateClassInfoByObject(Subobject); @@ -307,6 +299,14 @@ Worker_RequestId USpatialSender::CreateEntity(USpatialActorChannel* Channel) FRepChangeState SubobjectRepChanges = Channel->CreateInitialRepChangeState(Subobject); FHandoverChangeState SubobjectHandoverChanges = Channel->CreateInitialHandoverChangeState(SubobjectInfo); + ForAllSchemaComponentTypes([&](ESchemaComponentType Type) + { + if (SubobjectInfo.SchemaComponents[Type] != SpatialConstants::INVALID_COMPONENT_ID) + { + ComponentWriteAcl.Add(SubobjectInfo.SchemaComponents[Type], AuthoritativeWorkerRequirementSet); + } + }); + TArray ActorSubobjectDatas = DataFactory.CreateComponentDatas(Subobject, SubobjectInfo, SubobjectRepChanges, SubobjectHandoverChanges); ComponentDatas.Append(ActorSubobjectDatas); } @@ -539,15 +539,23 @@ void USpatialSender::SendComponentUpdates(UObject* Object, const FClassInfo& Inf } // Apply (and clean up) any updates queued, due to being sent previously when they didn't have authority. -void USpatialSender::ProcessUpdatesQueuedUntilAuthority(Worker_EntityId EntityId) +void USpatialSender::ProcessUpdatesQueuedUntilAuthority(Worker_EntityId EntityId, Worker_ComponentId ComponentId) { if (TArray* UpdatesQueuedUntilAuthority = UpdatesQueuedUntilAuthorityMap.Find(EntityId)) { - for (Worker_ComponentUpdate& Update : *UpdatesQueuedUntilAuthority) + for (auto It = UpdatesQueuedUntilAuthority->CreateIterator(); It; It++) + { + if (ComponentId == It->component_id) + { + Connection->SendComponentUpdate(EntityId, &(*It)); + It.RemoveCurrent(); + } + } + + if (UpdatesQueuedUntilAuthority->Num() == 0) { - Connection->SendComponentUpdate(EntityId, &Update); + UpdatesQueuedUntilAuthorityMap.Remove(EntityId); } - UpdatesQueuedUntilAuthorityMap.Remove(EntityId); } } diff --git a/SpatialGDK/Source/SpatialGDK/Public/Interop/SpatialSender.h b/SpatialGDK/Source/SpatialGDK/Public/Interop/SpatialSender.h index d76f7d7a15..32d52f20ce 100644 --- a/SpatialGDK/Source/SpatialGDK/Public/Interop/SpatialSender.h +++ b/SpatialGDK/Source/SpatialGDK/Public/Interop/SpatialSender.h @@ -102,7 +102,7 @@ class SPATIALGDK_API USpatialSender : public UObject void UpdateInterestComponent(AActor* Actor); void ProcessOrQueueOutgoingRPC(const FUnrealObjectRef& InTargetObjectRef, SpatialGDK::RPCPayload&& InPayload); - void ProcessUpdatesQueuedUntilAuthority(Worker_EntityId EntityId); + void ProcessUpdatesQueuedUntilAuthority(Worker_EntityId EntityId, Worker_ComponentId ComponentId); void FlushPackedRPCs(); From 193732ceec653f9dbc056eaf90ffc7f7137cc88a Mon Sep 17 00:00:00 2001 From: Oliver Balaam Date: Wed, 26 Feb 2020 17:05:21 +0000 Subject: [PATCH 12/30] Update CHANGELOG.md, increment the VersionName and Version. (#1840) * Update CHANGELOG.md * incremene Version and VersionName --- CHANGELOG.md | 10 +++++----- SpatialGDK/SpatialGDK.uplugin | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ee18d25534..bff8c4afd5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,19 +8,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [`0.8.1-preview`] - 2020-xx-xx ### Adapted from 0.6.5 -### Internal: +### Features: Features listed in the internal section are not ready to use but, in the spirit of open development, we detail every change we make to the GDK. - **SpatialOS GDK for Unreal** > **Editor Settings** > **Region Settings** has been moved to **SpatialOS GDK for Unreal** > **Runtime Settings** > **Region Settings**. - Local deployments can now be launched in China, when the **Region where services are located** is set to `CN`. - -### Features: - Updated the version of the local API service used by the UnrealGDK. - The Spatial output log will now be open by default. ### Bug fixes: - Replicated references to newly created dynamic subobjects will now be resolved correctly. - Fixed a bug that caused the local API service to memory leak. -- Cloud deployment flow will now correctly report errors when a deployment fails to launch due to a missing assembly. +- Errors are now correctly reported when you try to launch a cloud deployment without an assembly. ## [`0.8.0-preview`] - 2019-12-17 @@ -30,9 +28,11 @@ Features listed in the internal section are not ready to use but, in the spirit 1. `git checkout 4.23-SpatialOSUnrealGDK-preview` 1. `git pull` 1. Download and install the `-v15 clang-8.0.1-based` toolchain from this [Unreal Engine Documentation page](https://docs.unrealengine.com/en-US/Platforms/Linux/GettingStarted/index.html). +1. Navigate to the root of GDK repo and run `Setup.bat`. 1. Run `Setup.bat`, which is located in the root directory of the `UnrealEngine` repository. 1. Run `GenerateProjectFiles.bat`, which is in the same root directory. -For more information, check the [Keep your GDK up to date](https://docs.improbable.io/unreal/preview/content/upgrading) SpatialOS documentation. + +For more information, check the [Keep your GDK up to date](https://documentation.improbable.io/gdk-for-unreal/docs/keep-your-gdk-up-to-date) SpatialOS documentation. ### Features: diff --git a/SpatialGDK/SpatialGDK.uplugin b/SpatialGDK/SpatialGDK.uplugin index dbb48894b2..2ec2574b5d 100644 --- a/SpatialGDK/SpatialGDK.uplugin +++ b/SpatialGDK/SpatialGDK.uplugin @@ -1,7 +1,7 @@ { "FileVersion": 3, - "Version": 5, - "VersionName": "0.8.0", + "Version": 6, + "VersionName": "0.8.1", "FriendlyName": "SpatialOS GDK for Unreal", "Description": "The SpatialOS Game Development Kit (GDK) for Unreal Engine allows you to host your game and combine multiple dedicated server instances across one seamless game world whilst using the Unreal Engine networking API.", "Category": "SpatialOS", From 53e6fc402aaf5c9a0666b3305b8607f383203cbc Mon Sep 17 00:00:00 2001 From: MatthewSandfordImprobable Date: Thu, 27 Feb 2020 15:09:41 +0000 Subject: [PATCH 13/30] [UNR-2950][MS] Fix when generating schema after changing GDK version (#1826) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [UNR-2203] Spatial virtual worker translator refactor (#1471) * [UNR-2203][MS] Adding LoadBalanceEnforcer, load balancing flag and worker attribute that allows for editing entity ACL components. * [UNR-2203][MS] Tidy. Also found a bug in SpatialSender. * Missed in merge. * [UNR-2203][MS] Tidy tidy. * [UNR-2203][MS] Combining with LBStrategy. * [UNR-2203][MS] Tidy. Mostly adding VirtualWorkerId. * [UNR-2203][MS] Adding a setting for chaniging the LB strategy. * [UNR-2203] Removing files that shouldn't be there. * [UNR-2203][MS] Removing spatial debugging asset. * [UNR-2203][MS] Renaming function. * [UNR-2203][MS] Feedback from Matt. * [UNR-2203][MS] Matt feedback * [UNR-2203][MS] Matt feedback * [UNR-2203][MS] Merge stuff and adding static functions on AuthorityIntent. * [UNR-2203][MS] Resolving merge details. * [UNR-2203][MS] Michael feedback. * [UNR-2203][MS] More Michael feedback. * [UNR-2203][MS] Removing commented out code. * [UNR-2203][MS] Sami feedback. * [UNR-2203][MS] Feedback * [UNR-2203][MS] Michael feedback. * UNR-2364 Crash in ProcessRPCs (#1491) * ProcessRPCs called recursively is now ignored * Downgraded the new Warning to Log * Updated CHANGELOG.md * Reduce log severity when deleting an actor with no channel (#1492) Reduce log severity when deleting an actor with no channel When a startup actor is deleted as its entity comes into view with a Tombstone component, it won't have an ActorChannel created yet. * Bugfix/unr 1698 fix host url override (#1430) * constrain problem to PIE clients * improve pie detection * logging * fix by recognizing first connection * change connection type determination * remove debug logging * revert unintentional changes * [UNR-1698][MS] Modifying code writen by Vlad Barvinko. * [UNR-1698][MS] Adding release notes. * [UNR-1285][MS] PR feedback. * [UNR-1698][MS] Neatening some bits on the spatial connection flow. An attempt to use the command line arguments will be made on first connection. Adding a hack to allow a client to re-connect as if it were connecting for the first time. * [UNR-1698][MS] Updating CHANGELOG. Adding a console command to allow for more felxable testing of connecting to locators. * [UNR-1698][MS] Feedback * [UNR-1698][MS] Josh feedback * [UNR-1698][MS] Michael changes. * [UNR-1698][MS] Fixing a bug when making feedback changes. Tidying up a the case where you try to reconnect using command line args but don't have valid command line args. * UNR-2363 Use accessors to get Spatial Networking flag from settings (#1488) * Change accessing the bSpatialNetworking flag to use accessors and add a test to check the early availability of the correct flag value regarding overrides. * Disable tests while investigating why it fails on CI * Make copyright headers consistent (#1497) * Bugfix/servers retain interest in always relevant actors (#1495) * Server workers maintain interest on always relevant actors * Release msg * Update CHANGELOG.md Co-Authored-By: improbable-valentyn <32096431+improbable-valentyn@users.noreply.github.com> * Feature/unr 2302 unreal gdk ci testing with spatial (#1463) * reintroduce tests * test GIVEN conditions * fix GIVEN conditions * store log as arifact * add debug printing * fix debugging * remove debug printing * first implementation of project cloning * improve project cloning * fix missing comma * fix git clone command * fix cloning * fix symlinks * better logging * fix comma * add bracket * build project * change build * fix argument passing * alternative build * alternative build * alternative build * alternative build * change build * alternative build * alternative build * generate snapshots and schema * add snapshot * add missing comma * temp fix for directory lock * find file locker * better process killing * print processes for debug * better logging * kill spatiald better * better process killing * fix typo * properly kill spatiald * move symlinking * add debug logging * improve deleting * revert deleting * proper Plugins directory * better deleting * fix symlink deleting * fix argument passing * remove irrelevant TODOs * clean up project * use specific map * remove irrelevant TODOs * fix project deletion * fix variable name * remove temporary workaround * change repo to gym * fix argument name * rename variables * move project to build root * fix argument passing * better logging * generate snapshot for al maps * properly call commandlet * only generate snapshot for testing map * fix project symlink * test with fake commandlet * revert commandlet name and remove unnecessary directory creation logic * test pre-run check * add debug logging * fix logging * disable fastbuild * remove logging * reactivate fastbuild * fix map name * add proper ps1 junction * update ABSLOG comment * wrap executables in quotes to allow spaces * Update buildkite queues * revert unintentional queue changes * Update SpatialGDK/Source/SpatialGDKTests/SpatialGDKServices/LocalDeploymentManager/LocalDeploymentManagerTest.cpp Co-Authored-By: Michael Samiec * make pointer constant * clean up deployment manager code * fix logging directory * test with ThirdPersonShooter * move to testgymsg * allow test repo branch overriding * fix merge * improve argument passing * make project clone more efficient * rename file for consistency * clean up logging * pin spatial CLI version * v4-2019-11-11-bk3891-f17bd2c787d2fe1c New agent image allows building UE 4.23 projects * run all tests * fix spatial updating * improve argument passing * refactor code * v4-2019-11-11-bk3891-f17bd2c787d2fe1c This new agent image allows building projects with UE 4.23 * fix image version * fix path * remove unintentionally added file * give local deployment manager more time to start * improve naming * change step name and fix sed * clarify that file is a template * Clear queued RPCs on entity/actor deletion (#1490) * Clear queued RPCs on entity destroyed * Update changelog * Move drop RPCs to SpatialActorChannel::Cleanup * Move Sender clear RPCs to USpatialActorChannel::CleanUp * UNR-1945 SpatialGDK Example Tests (#1467) * Initial commit * Removed unused code * Removed Mock example objects. Minor reorganisation in in SpatialGDKExampleTest.cpp * Removed unused line * Update SpatialGDK/Source/SpatialGDKTests/Examples/SpatialGDKExampleTest.cpp * Added TestFixture example * Added Testing guidelines as SpatialGDKTestGuidelines.h * Small updates of Guidelines * Updated Guidelines * Added an example for cmd tests * Addressing feedback * Added a better description of TEST macro * Modified guidelines * Updated Guidelines for Latent Commands * Fixed compilation. Renamed slow->background * Fixed the build after merge * Added latent command naming rule to Guidelines * Added Test Coverage section to Guidelines * Updated Guidelines according to dllexport decision * Changed raw ptr to TUniquePtr for IFileHandle * Added one more TestTrue for invalid input, alphabetized headers * Update SpatialGDK/Source/SpatialGDKTests/Examples/SpatialGDKTestGuidelines.h Co-Authored-By: Michael Samiec * Update SpatialGDK/Source/SpatialGDKTests/Examples/SpatialGDKTestGuidelines.h Co-Authored-By: Michael Samiec * Update SpatialGDK/Source/SpatialGDKTests/Examples/SpatialGDKTestGuidelines.h Co-Authored-By: Michael Samiec * Removed a FileHandle unique ptr * Updated Guidelines * Added init/cleanup for ComputationResult * Use UniquePtr instead of raw ptr * Update SpatialGDK/Source/SpatialGDKTests/Examples/SpatialGDKExampleTest.cpp Co-Authored-By: Sami Husain * Removed UniquePtr, use SharedPtr instead * UNR 2363 Fix LocalDeploymentManager to stop using bSpatialNetworking to disable himself. (#1496) * Re-enable test * Stop the local deployment manager from writing to the bSpatialNetworking flag when it want to disable itself * Split big test into individual ones with a common fixture * make gdk setup self-contained (#1503) * GCS-1500 - Add support to DeploymentLauncher to parse a .pb.json launch config. (#1453) * Add support to DeploymentManager to parse a .pb.json launch config. * Update CHANGELOG.md. * Increment RequireSetup. * UNR-2189 - Bugfix cloud launch config default (#1444) * deploy window now defaults to valid cloud config * update changelog * cloud config now defaults to an empty string * warn if manual_worker_connection is set on a cloud deploy * update changelog * small style changes * Update SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKEditor.h Co-Authored-By: Michael Samiec * Changed to use a message dialog * Updated includes * Review comments * Moved IsManualWorkerConnectionSet to IsDeploymentConfigurationValid * Cleanup * Cleanup * Changed to static * Reload class by component id if it has been unloaded (WIP) (#1508) * Reload class by component id if it has been unloaded * Revert "Reload class by component id if it has been unloaded" This reverts commit 00715a0d1a24a0322e8aba2d677fbd2cf64dd4e8. * Revert "Revert "Reload class by component id if it has been unloaded"" This reverts commit c54f27c2b0157037f12b24715a2a9ef115ef8c62. * Updating changelog for dynamic component reload crash. * Updating changlog as requested by Valentyn. * Feature/unr 1998 adding network profiler calls (#1424) Added network profile hooks to support the ue4 network profiler with spatial. * UNR-2181 - Add option to DeploymentLauncher to deploy only sim player deployment (#1452) * Add option to DeploymentLauncher to deploy only sim player deployments without the target deployment. That allows us to use a separate assembly for the target and the sim deployments, and launch the independently. * Move RPC types into separate enum, remove old reliable RPC checking (#1515) * Move RPC types into their own enum * Remove outdated ordered RPC checking * Bugfix: Fixed up regex to handle log categories without imporba… (#1512) * Fixed up regex to handle log categories without imporbable. prefix * Revert deployment launcher change * UNR 1132 Correct handling of unresolved reference in structs (#1509) * Fix unresolved ref inside structs handling * Make UPackageSpatialMapClient return whether we have an unresolved object * Remove unnecessary ConfigRestartRequired = false from settings (#1519) * Update fastbuild readme (#1522) * Update README.md * Update SpatialGDK/Extras/fastbuild/README.md Co-Authored-By: Joshua Huburn <31517089+joshuahuburn@users.noreply.github.com> * forgot quotes * Update SpatialGDK/Extras/fastbuild/README.md Co-Authored-By: Jared Dixey-Hefty * Feature/unr 2034 spatial debugger (#1505) * Add raw textures * Allow SpatialGDK to contain Content * Add delegates for OnEntityAdded/Removed * Add ability to retrieve current list of known entity ids * Add first pass SpatialDebugger * Sort actors once per tick by range to PlayerPawn * Pass console commands to SpatialDebugger * add icon textures * Reference SpatialDebuggerClass from SpatialGDKSettings * Add blueprint-side BP_SpatialDebugger * - Fix bug with lock icon - Remove stacking for now - Cleanup spacing in the header * Variable horizontal offsets for icons/text depending on which ones are enabled * - Remove some magic numbers - Expose WorldSpaceActorTagOffset via UPROPERTY * - Rename constant to match it's now more restricted usage * Moving away from member initializer list toward more modern initialization style. Also, UObjects are zero'd by default, so we only need to set deltas from that * supertick * bunch more little fixes * Switch to using FSoftClassPath for SpatialDebuggerClassPath as a default can then be provided * Don't render tags that project to 0,0 * Set defaults up correctly so we aren't rendering data that isn't available yet * final cleanup pass * Naming consistency for the delegates in SpatialReceiver * Add comment to make it clear what this method is for * Linux should compile too * Add placeholder changelog entry * Add box icon * Reference new box texture asset * Add box texture and address review feedback * Address review feedback * Enable SchemaGen for types in non-Game (ex. Plugin) folders * Addressing PR feedback * Final fixes for SpatialDebugger before merge * Update changelog comment * Fix bad merge * Fixes required after syncing Master * const * Disable by default * Add overrides for handover, server interest, and load balancing (#1523) * Add overrides for handover, server interest, and load balancing * Feature/sim player scripts changelog (#1530) * [UNR-2425][MS] Adding note to the change log to inform customers of the new scrips that will exist inside the UnrealExampleProject. # Conflicts: # CHANGELOG.md * Formatting change * Update name of one of the sim player scripts. * [UNR-2425][MS] Ollie Feedback. * Update CHANGELOG.md * UNR-2287 Server travel (#1455) * change static component view to live on worker connection, not net driver * only kill unreal objects when wiping world * added reset gsm function, reset gsm on server travel * added missing reset gsm call * partially completed sessionID task * replace isServer, change when onConnect callback is called * [UNR-2287][MS] Small tidy. Changing some members to private as they have "important" setters. Also correcing an error in GlobalStateManager.cpp. Adding "session_id" to DeploymentMap component in global_state_manager.schema. * [UNR-2287][MS] Small fix. * [UNR-2287][MS] Global state manager now sits on the worker connection as it should persist after the net driver is destroyed. SessionId is sent to the client through the URL. This sessionId is checked against the GSMs sessionId once we have loaded the map. Removed code to do with snapshat loading on server travel. * [UNR-2287][MS] Allow request to spawn player if it is the first time we are connecting to a worker. * [UNR-2287][MS] Code tidy. * [UNR-2287][MS] Adding to the changelog. * [UNR-2287][MS] Update to formatting. * [UNR-2287][MS] Tidy up. * [UNR-2287][MS] Tidy. * [UNR-2287][MS] Tiny formatting change. * [UNR-2287][MS] Sahil feedback. * [UNR-2287][MS] Josh server travel feedback. * [UNR-2287][MS] Fixing crash when closing editor in non single process mode. * [UNR-2287][MS] Feedback from Michael. * [UNR-2287][MS] Adding comments to clear up use on net driver as reqeusted by Michael. * [UNR-2287][MS] Josh feedback. * [UNR-2287][MS] Janky Janky fix for crash that was occuring on second PIE session. A NetDriver was not being destroyed thus its FSpatialOutputDevice was not being destroyed. This in turn means that a FSpatialOutputDevice exists with a pointer to an older SpatialWorkerConnection which is invalid. No idea why this actually fixes the issue. * [UNR-2287][MS] Correcting log mistake. * [UNR-2287][MS] Josh feedback. * [UNR-2287][MS] Josh feedback * [UNR-2287][MS] Michaels feedback. * [UNR-2287][MS] Michael feedback. * [UNR-2287][MS] Better name for GSM SessionId * [UNR-2287][MS] Josh feedback! * [UNR-2287][MS] Josh feedback * [UNR-2287][MS] Josh feedback * [UNR-2287][MS] Michael feedback. * Build issue? * Build fix? * UNR-1905 - Improve slack hooks (#1501) Recently unit tests have been introduced to the GDK CI. This PR introduces a Slack notification that will be sent for each build on master, detailing which tested engine versions passed or failed testing. This functionality is implemented via Buildkite artifacts. During each testing run of an engine version, a slack JSON message is uploaded as an artifact. A new step in the pipeline runs after all testing steps have been completed, downloads all of the uploaded JSON message attachments, and merges these into a single Slack notification. * Zoning glue: This uses the Strategy, Translator, and Enforcer t… (#1513) This makes the previously available components work together. Now when the system runs, the Translator will create/read the virtual worker to physcial worker mapping, then when we call ReplicateActor, the Strategy will be queried for the appropriate authority for the actor, and the Enforcer will write the appropriate ACL. * implement tracking and fix slack message (#1537) This PR adds automatic tracking of some GDK test-related metrics. These metrics are uploaded to BigQuery and are displayed in a DataStudio dashboard. * fix environment variable Fixes Slack message for nightly builds. * Added %s token to debug strings in GlobalStateManager to display actor class name in log (#1541) * Added %s token to debug strings to display actor class name in log * Added line to CHANGELOG.md * Added check (#1543) * Fix reporting of number of tests Fixes test metrics that are uploaded to BigQuery. * Bugfix/unr 2501 tombstone check to log (#1548) * Convert assert to verbose log, as the assert condition can be valid when called through SpatialReciever::HandleActorAuthority * Update changelog.md * Add spec for linking SpatialMetrics API (#1550) * Adjust formatting and namespace scope for SpatialConstants (#1552) * Adjust formatting and namespace scope for SpatialConstants * Move ESchemaComponentType out of the namespace * Feature/unr 2396 add trace lib measurements (#1528) Added trace library and usage API * UNR-2129 Reduce code coupling (#1546) * Removed SpatialNetDriver from the Translator * SpatialLoadBalanceEnforcer is no longer a UObject. It's now stored as a SharedPtr in NetDriver and a WeakPtr in Receiver * Made SnapshotManager a non-UObject, changed it to SharedPtr in NetDriver * Fixed the build * Made UActorGroupManager to not be a UObject * Made USpatialDispatcher to not be a UObject * Some renaming for non-UObject classes * Removed NetDriver from SnapshotManager, added validity checks * Added missing checks * Fixed a bug with validity check * Moved the declaration of PostWorldWipeDelegate out of SpatialNetDriver * Fixed a SpatialVirtualWorkerTranslator test * Fixed a potential bug with BindLambda by not passing this * Update SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialReceiver.cpp Co-Authored-By: Michael Samiec * Moved check out of the loop * Alphabetized class declarations in SpatialNetDriver.h * Changed SharedPtrs to UniquePtrs * Added nullptr checks in Init functions * Moved PostWorldWipeDelegate declaration to SnapshotManager. Removed unnecessary declarations * Renamed ActorGroupManager.h/.cpp to SpatialActorGroupManager.h/.cpp. Renamed SnapshotManager.h/.cpp to SpatialSnapshotManager.h/.cpp * Removed LoadBalancer validity check (#1568) * Enabling SpatialOS toolbar on Mac (#1507) * adding spot download to Setup.sh * whitelisting mac for toolbar and gdk services * enabling schema compiler on mac * making spatial and spot available on mac * removing windows checks * PR feedback * some renaming * removing anonymous namespace * PR feedback * added changelog and ticket number * Provide help for rebuilding engine artifacts if download failed (#1574) * Allows RunSchemaCompiler to output any format (#1440) Allow the RunSchemaCompiler function to compile additional schema formats based on CL args. * Enabling pushing iOS command line arguments to builds (#1521) * adding iOS runtime settings to Build.cs * adding new menu item to update mobile client * PR feedback * PR feedback * making sure it works on windows * Feature/0.7.1 preview merge to master (#1579) * Update CHANGELOG.md (#1458) * 0.7.1 (#1575) * Update CHANGELOG.md (#1458) (#1565) * Merged 0.6.3 into 0.7.1-rc and manually resolved conflicts (#1566) * Merged 0.6.3 into 0.7.1 and manually resolved conflicts * Update SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp Co-Authored-By: Danny Birch <57946331+improbable-danny@users.noreply.github.com> * Update SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp Co-Authored-By: improbable-valentyn <32096431+improbable-valentyn@users.noreply.github.com> * Update SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp Co-Authored-By: Danny Birch <57946331+improbable-danny@users.noreply.github.com> * Apply suggestions from code review * Update CHANGELOG.md (#1576) * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp * Update DeploymentLauncher.cs Manually merged in sim deployments endpoint * Fixed region order * Fixes from PR * Feature/unr 2494 expose additional connection config settings (#1567) * Add connection config settings, increment spatial version to 14.2.1 * Reworked connection config * Add comments and changelog * Reworked inline to struct * Settings rename * Add domain env var to setup.sh (#1583) * UNR-2507 - LoadObjects when bNetLoadOnClient is false and object is deleted. (#1571) * Also try loading objects if we can't find them and they have a stable ref * Updated changelog * Check for bNetStartup and update comments * Update CHANGELOG.md Co-Authored-By: Michael Samiec * UNR-2129 Removed NetDriver from WorkerConnection (#1580) * Removed NetDriver from WorkerConnection * Addressed PR feedback * Update SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialNetDriver.cpp Co-Authored-By: Michael Samiec * Added a WITH_EDITOR if macro to fix the build (#1584) * UNR-2318 stop spatial service which runs in different project (#1573) * check bSpatialServiceInProjectDirectory flag to find a service running from the wrong dir * Bugfix/log spelling fix (#1593) * Corrected "succesfully" to "sucessfully" * Added changelog note * Default to 4.23 version (#1594) * Default to 4.23 version * [UNR-2553][MS] Fix for droppped URL options. (#1597) * [UNR-2553][MS] Fix for droppped URL options. * [UNR-2553][MS] Adding helpful comment. * UNR-1995 Workflow improvement for local deployments where a schema build previously failed (#1517) Workflow change to stop deployments starting after an invalid schema build * Before sorting actors based on distance to the player, remove any wea… (#1598) * Before sorting actors based on distance to the player, remove any weak pointers that no longer point to valid actors * Fix crash in SpatialDebugger caused by dereference of invalid weak pointer * Addressing PR feedback * UNR-2318: Use text which was provided by tech editors (#1600) * UNR-2129 Removing unused code (#1596) * Removed NetDriver's friends and hid some members * Removed unused IsSingletonEntity function from SpatialActorChannel * [UNR-2129] Decouple net driver and Spatial metrics (#1590) * Remove coupling between spatial metrics and net driver * GV-101 - Expand CI build configurations (GDK) (#1559) Previously only two build configurations were used in CI. With these changes, the GDK is built for a much wider range of configurations. * Refactored an overzealous warning message and a drive by fix to acl processing. (#1588) * [WIP] Add ring buffer settings (#1520) * Add ring buffer settings * Make default ring buffer size and size map private * Generate RPC endpoint schema (#1527) * Add ring buffer settings * Make default ring buffer size and size map private * Mark event-based RPC components as legacy * Few adjustments to schema gen tests, move expected schema into separate files * Schema gen for RPC endpoints * Move local functions into anonymous namespace * Address PR suggestions * Fix bad merge * Fix bad merge * Increment requiresetup * ServerTravel cleaning: Fix race condition and removing log. (#1569) * Fixing two issues. There was a race where the server had loaded the map, the GSM had been created but the server did not have authority over the SpatialConstants::STARTUP_ACTOR_MANAGER_COMPONENT_ID component on the GSM. This lead to a failed check() in SetCanBeginPlay. Also adding the !GlobalStateManager->IsReadyToCallBeginPlay() check. This is just in case we load the map after we gain authority over the component on the GSM. When we gain autority the GSM has will have already called SetCanBeginPlay(true) so we shouldn't do this again. Also removing th log as I don't think it is helpful. The flow of not doing the GlobalStateManager->SetCanBeginPlay(true) logic is perfectly valid. Essentially we only want to go down this path on server travel. * [UNR-2515][MS] Changing function name on GSM so that it makes sense when used in more scenarios. * UNR-2503 SpatialDebugger colourings (#1581) * spatial debugger colourings Co-Authored-By: Sami Husain Co-Authored-By: aleximprobable * Review: Worker translator typedefs (#1605) * Replace worker name typedef with alias-declaration and use consistently * IWYU, CoreMinimal first, remove double space * Use alias in declaration, too * Add more missing includes * Update release process email list (#1595) * UNR-2352 Pop & locking actors (#1599) * Added the abstract locking policy. * Added the reference counted locking policy and tests. * Added the locking policy to the settings and the net driver. * Actor channel now checks for the authority intent as well as authority. Co-Authored-By: Sami Husain * UNR-2129 Removed the Sender from the Enforcer (#1570) * Removed Sender from Enforcer. Added static construct function. Removed pointer checks, since the object must be valid by default now * Removed static constructor * Process all queued ACL Assignemnts before returning * Fixed bad merge * Made some functions const * Made StaticComponentView const in the Enforcer * Fixed the build * Made more StaticComponentView's functions const * Update SpatialGDK/Source/SpatialGDK/Public/Interop/SpatialStaticComponentView.h Co-Authored-By: Michael Samiec * Applied PR suggestion * Removed unnecessary includes * Update SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialLoadBalanceEnforcer.h Co-Authored-By: Michael Samiec * Addressing PR feedback * Updated includes * Update premerge.steps.yaml (#1616) * dont-create-locking-policy-on-client (#1614) this happened accidentally in a rebase * Update ReferenceCountedLockingPolicy.cpp (#1618) This was blocking Evi's build compiling. It succeeded on my machine + CI, could be an issue with precompiled headers. * UNR-2129 SpatialWorkerCleanup (#1610) * Moved the StaticComponetView and the GlobalStateManager to the SpatialGameInstance * Update SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialNetDriver.cpp Co-Authored-By: Michael Samiec * Added handling of connection error * Addressing PR feedback * Fixed the build * Addressing PR feedback * GSM and StaticComponentView are now created as part of USpatialGameInstance::Init * Added nullptr checks * Update SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialNetDriver.cpp Co-Authored-By: Sahil Dhanju * Moved GSM and StaticComponentView to private in GameInstance, added getters * Only explicitly set external ip to true if not connecting to local host (#1608) * Only explicitly set external ip to true if not connecting to local host * Update CHANGELOG.md * update Linux queue to recent version (#1624) update linux queue to -v4-2019-12-12-bk5225-daecba805768d787 * Bugfix UNR-1259 fix worker flags not per worker (#1585) * Change SpatailaWorkerFlag Class to UObject, Create SpatialWorkerFlag per NetConnection and pass SpatialWorker reference in Dispatcher. * Add GetWorkerFlag BlueprintCallable function in SpatialStatic class * Add Unit Tests for SpatilaWorkerFlags Class * Make GetspatialWorker const function, Remove unacessary include * Change of delegate declaration and minor fixes * Remove const from Get worker flag, Sort includes * Update SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialWorkerFlags.cpp Co-Authored-By: Daniel Hall * Update SpatialGDK/Source/SpatialGDK/Private/Utils/SpatialStatics.cpp Co-Authored-By: aleximprobable * Update SpatialGDK/Source/SpatialGDK/Private/Utils/SpatialStatics.cpp Co-Authored-By: Daniel Hall * Update SpatialGDK/Source/SpatialGDK/Public/Utils/SpatialStatics.h Co-Authored-By: Tencho Tenev * Update SpatialGDK/Source/SpatialGDKTests/SpatialGDK/Interop/SpatialWorkerFlags/SpatialWorkerFlagsTest.cpp Co-Authored-By: Samuel Silvester * Update SpatialGDK/Source/SpatialGDKTests/SpatialGDK/Interop/SpatialWorkerFlags/SpatialWorkerFlagsTest.cpp Co-Authored-By: Samuel Silvester * Update SpatialGDK/Source/SpatialGDKTests/SpatialGDK/Interop/SpatialWorkerFlags/SpatialWorkerFlagsTest.cpp Co-Authored-By: Samuel Silvester * Update SpatialGDK/Source/SpatialGDKTests/SpatialGDK/Interop/SpatialWorkerFlags/SpatialWorkerFlagsTest.cpp Co-Authored-By: Samuel Silvester * Minor Fixes, change DummyObj to SpyObject and refactor class * Update SpatialGDK/Source/SpatialGDKTests/SpatialGDK/Interop/SpatialWorkerFlags/SpatialWorkerFlagsTest.cpp Co-Authored-By: Sami Husain * MinorFixes * Removed public GetOnWorkerFlagsUpdated Delegate * Switch defaults to 14.3.0 (#1631) * Missed tcp fixes (#1635) * RPC Service (Ring buffers) (#1554) * Add ring buffer settings * Make default ring buffer size and size map private * Mark event-based RPC components as legacy * Few adjustments to schema gen tests, move expected schema into separate files * Schema gen for RPC endpoints * Move local functions into anonymous namespace * Address PR suggestions * RPC Service (WIP) * Add RPC components, utils functions * Seems like it should work, but doesn't * Seems to work * Fix bad merge * Fix bad merge * Reworked RingBufferDescriptor into several smaller functions and a smaller descriptor * Fix cross-server RPCs, change check to error status * Added logs for some cases * Handle initial multicast RPCs, address PR comments * Adjust condition * Address PR comments * Fix last seen multicast after crossing boundary * Tests for RPCService (#1602) * [UNR-2509][MS] Initial tests for RPCService. Todo - add working compare functions for RPCPayloads and schema objects. Todo - checks initially_present is set when pushing rpcs with no entity in the component view. * [UNR-2509][MS] Feedback and extra test. * [UNR-2509][MS] Fixing comparison functions. All tests passing! * [UNR-2509][MS] Cleaning. * [UNR-2509][MS] Cleaning. * [UNR-2509][MS] Cleaning. * [UNR-2509][MS] Matt Young feedback. * [UNR-2509][MS] Moving RPCServiceTest.cpp to Private/Tests. - Removing SPATIALGDK_API from various classes/functions. - moving TestDefinitions to Public/Tests. * [UNR-2509][MS] Sami feedback. * [UNR-2509][MS] Matt Yound feedback. * [UNR-2509][MS] Feedback. * Adjustments for RPC Tests (#1629) * Use the right call to WriteToSchemaObject * Check for RPCService being valid * Remove redundant include * Increment RequireSetup Co-authored-by: Sami Husain Co-authored-by: MatthewSandfordImprobable * Bugfix/unr 2607 SpatialDebugger crashfix (#1636) * Fix crash dereferencing null VirtualWorkerTranslator when using the SpatialDebugger with GDK-space load balancing disabled * Update changelog.md * bugfix the bugfix * Rename origin to prevent name clash warning (#1637) * [UNR-2434][MS] Removing logic from schema generator for spatial type look up (#1591) * [UNR-2434][MS] Removing logic from schema generator that used to look up the parent tree to find the correct spatial flags. This logic is now done as part of UClass::Serialize. * [UNR-2434][MS] Removing logic from schema generator that used to look up the parent tree to find the correct spatial flags. This logic is now done as part of UClass::Serialize. * Switch schema database path to editor version (#1638) * Switch schema database path to editor version * Changelog * Fix TestDefinitions.h includes and misc include fixes to the exmaples tests. (#1640) * Add additional perf counters (#1634) * UNR-2586: provide parameters for tests path and networking backend (#1621) * provide parameters for tests path and networking backend * make the spatial networking a default one * don't generate snapshot if running on unreal networking * remove useless include * [UNR-2190] Async load new classes on checkout (#1642) * Async load new classes when checking out entities * Handle multiple entities trying to load same class, adjust queued ops * Turn async loading off by default * Add release note * Adjust comment * Address PR comments * Bool formatting * SpatialDebugger spawns debug worker regions on clients for grid based… (#1628) * SpatialDebugger spawns debug worker regions on clients for grid based lb strats * Only calculate worker regions on singleton authoritative worker * Delete spamming log when spatial debugger enabled without load balancing * Fixed worker region uasset to be 4.22 * [UNR 2583] Handle asynchronous loading for stably named assets (#1649) * Record pending loading packages, and poll them each frame to resolve properties. * [UNR-2583] Serialize unresolved SoftObjectPointers (#1641) * Read and write soft object references * Add entity factory (#1662) * Extracts & encapsulates Actor->Entity logic As part of Snapshot Migration we go through most of the same process that the SpatialSender does when initially creating an Entity; we take an Actor (well, actually its Channel) and enumerate the Spatial Components that represent that Actor as an Entity. The Sender follows this up by sending a CreateEntity request while the Migrator takes the resulting Components and "fast-forwards" data from the old Components (from the existing Entity that we read out of the Snapshot) onto them when possible and where appropriate. This change just pulls the logic for actually creating a list of Components from an Actor out into its own encapsulated thing that can be invoked without needing to route through the SpatialSender; right now everything is still shoved into one function but I think breaking it down into a number of smaller, more easily parseable functions that are invoked internally would be a low-hanging next step. * Update EntityFactory.cpp Fix `[Client|Server]RPCEndpoint.h` to point to the legacy versions. * Update CHANGELOG.md * Update EntityFactory.cpp Fix tweaked constant names & server/client rpc endpoint class names * Update EntityFactory.cpp Pull in up-to-date code from SpatialSender * Update EntityFactory.h (#1663) * Update EntityFactory.h * Update EntityFactory.cpp * Update SpatialSender.cpp * Update EntityFactory.h Add missing semicolon * Add entity factory explicit constructor arguments (#1667) * Update EntityFactory.h * Update EntityFactory.cpp * Update SpatialSender.cpp * Add additional index from schema functions (#1661) * Adds IndexFromSchema functions for various classes As part of the Snapshot Migration work, we need to extract existing SchemaObject values from SchemaObjects representing the data on a component. While many of the Unreal-facing classes that represent SchemaObjects do have IndexFromSchema functions (which facilitates extracting collections from SchemaObjects) defined, the ones addressed in this PR did not. The Migrator doesn't reason about cardinality of a field in Schema, since the Singular and Optional field cases are simply degenerate Arrays (with 1 and 0 or 1 elements, respectively). As such, it assumes everything can be treated as an array and maintains a thin compatability wrapper that allows us to use IndexFromSchema functions to extract an arbitrary number of _correctly-typed_ objects from a SchemaObject; this is important as we may need to apply a transform (e.g., updating component Ids to accomodate schema changes) to the object before writing it back to the new snapshot. * Add missing GetRotatorFromSchema * Update CHANGELOG.md * Update SpatialGDK/Source/SpatialGDK/Public/Utils/SchemaUtils.h Line spacing fix Co-Authored-By: Joshua Huburn <31517089+joshuahuburn@users.noreply.github.com> Co-authored-by: Joshua Huburn <31517089+joshuahuburn@users.noreply.github.com> * Fixup incomplete include path (#1668) * Native latency tracing support + updating build paths so the WorkerSD… (#1644) Tracing lib now supports native tracing by passing around a payload blob * Add sensible heartbeat options when running in editor (#1643) * Add sensible heartbeat options when running in editor * Update changelog * Added runtime setting for WITH_EDITOR timeout Co-authored-by: improbable-valentyn <32096431+improbable-valentyn@users.noreply.github.com> * [UNR-2645][MS] Removing PostRepNotifies call (#1658) * Update SpatialGDKEditorSettings.h (#1676) * UNR-2595 - SpatialWorkerConnection tests (#1620) * SpatialWorkerConnection tests * Made 2 proper WorkerConnection tests * UnrealWorker is now used for testing instead of AutomationWorker (to be investigated, why that's the issue). Added entity id reservation test. * Fixed AutomationWorker type issues * Added some more tests, removed commented code * Removing a failing test * Addressing feedback * Add TitleProperty to Launch->ServerWorkers (#1540) Co-authored-by: Michael Samiec * Fix includes for Engine plugin build (#1683) * [UNR-2275] Track references to replicated objects in order to restore them when they move out and in relevance. (#1551) * Track mapped object refs * Fix component constraint using correct constraint variable (#1681) * Fix component constraint using correct constraint variable * Add changelog * Fix crash when attempting to add map element back in whilst map size changes (#1686) * [UNR-2563][MS] Adding spatial auth into the deployment process. (#1664) * [UNR-2563][MS] Adding spatial auth into the deployment process. Adding a quick fix for understanding why deployments fail to launch. * [UNR-2563][MS] Updating changelog.md and fixing an issue. * [UNR-2563][MS] Running the auth login on a different thread to stop the editor hanging. * [UNR-2563][MS] Neat little changes. * Move the Load Balancing Translation mapping from the GSM to its… (#1654) * Move the Translation Mapping from the GSM to its own entity. * Made the mapping transient on the translation entity, and cleaned up the isReady logic to allow for PiE restarts. * Fix worker region collision (#1689) * Empty channel's reference map in USpatialNetDriver::RemoveActor (#1694) * Added more detailed stat tracking in component update (#1695) * Latency tracing of properties (native + spatial) (#1673) Property tracing for native Unreal and Spatial * Bugfix/unr 2171 mismatched schema warnings (#1592) Schema hash can now be validated against the server to ensure both client and server are running with the same schema asset * Bugfix/gsc 1513 fixing get actor spatial position for spectator mode (#1699) * Fixed retrun value from GetActorSpatialLocation for players in spectator mode * Updated comment documentation * [nojira][MS] Sorting SchemaDatabase (#1696) * [nojira][MS] Changes darewise wanted to make that seem legit. * Adding a changelog to sorting of SchemaDatabase. * Feedback * Feedback. * dedupe bucket (#1685) * flatten * manually tested working * comment * correct comment * less dumb map usage * const const * extract checkout constraint functionality * unit tests for deduping * PR comments * Cleanup * Tim comments * nit * UNR-2579 Locking tests (#1679) * abstract package map & translator with mocks * static component view mock * add more locking tests * UNR-2702 Added a readiness check for EntityPool (#1674) * Added a readiness check * Added validity check in ResolveEntityActor * Added some more checks * Destroying the Channel and the Actor, if can't resolve the entity * [UNR-2485] Add integration/end-to-end/networking tests to CI (#1684) Uses the new repository for the integration/end-to-end testing framework, and runs these tests in CI. * UNR-2485: update ci scripts for the networking tests * add test project root to avoid conflict * provide report dir parameter to tests run script * try to use ssh instead of https * fix url * add directory to a cleanup script * add parameters to run specific tests directory * remove assignment * replace with class * fix class definition * fix cleanup step * try to run networking test first * run native netwroking tests * Start a local deployment if running with spatial * Fix dangling comma in list, make addition to list clearer * Fix spatial override * Change boolean value to 1, because I can't parse for some reason * Parse run_with_spatial as bool * fix type * fix override type * Add temporary logging * Fix debugging pipe * Add cruder debugging * Add sleep before checking log * Build worker configs before launching local deployment * Remove wrong whitespace * Update unreal-engine.version * Remove debugging, stop spatial only if it started * Try only running one project * run net tests with and without spatialos * remove comma * Add log for debugging * Add timeout for running tests * Remove trailing comma * Remove debugging log * Remove unnecessary sleep * Add nicer handling of test timeout, with logs * Add better checking for spatial service * Separate test result directories * Add stopping and starting of deployments when running automated tests * Check deployment status before starting deployment * Update unreal-engine.version * Update setup-build-test-gdk.ps1 * Make the tests faster, and hopefully report to slack * Make slack report nicer * Rename long tests to slow tests * Compacting test runs to make them faster, more unreliable * Remove trailing comma... * Report more logs when failing to run tests * Increase timeout * Switch EngineNetTest branch to master * Try to keep connections from getting garbage collected * Revert "Try to keep connections from getting garbage collected" This reverts commit 43e3d477900e838af60915eb09882bc5a6f145fe. * Use root Object array to keep objects around * Increase timeout for running tests * Rename Test Result directories to reflect range of tests * Include more information for dashboard display * Apply some more consistent formatting to ps files * Switch order or GAutomationTesting and spatial networking * Rename test_project_root to test_project_name * Add comment about timeout duration for running tests * Style fixes, move reused strings to variables * More style fixes * Update ci/setup-build-test-gdk.ps1 Co-Authored-By: Joshua Huburn <31517089+joshuahuburn@users.noreply.github.com> Co-authored-by: Victor Buldakov Co-authored-by: Joshua Huburn <31517089+joshuahuburn@users.noreply.github.com> * UNR-2386: Move load balance settings to ASpatialWorldSettings (#1690) * Extract CreateAndInitializeLoadBalancer * Move load balance settings to SpatialWorldSettings * Change batch position update default to false (#1704) * Change default to false * Update CHANGELOG.md * Replace GetAuthority calls in the code with HasAuthority (#1659) * Make StaticComponentView::GetAuthority private and convert calls to use HasAuthority. Minor soft handover cleanup driveby. * Fix contributing docs link (#1712) * Moved a couple of functions from SpatialNetDriver to SpatialWorkerConnection (#1713) * Fix problem where PIE sessions sometimes fail to start due to missing schema for SpatialDebugger blueprint (#1697) * Separate Translator into Translator and TranslationManager (#1709) Take the code for generation of the translation mapping and put it in the SpatialVirtualWorkerTranslationManager. * [UNR-2729][MS] Removing unnecessary interest component updates and refactor to InterestFactory (#1707) * [UNR-2729][MS] Removing the recursing of actor children when updating actor interest. We now only update the players controller. * [UNR-2729][MS] Small refactor to InterestFactory. Now sits on the Netdriver. * My own review feedback * Better naming * Changing variable names to InterstFactory and the type to SpatailInterestFactory. Some other feedback. Adding in stat capture. * Revert "Changing variable names to InterstFactory and the type to SpatailInterestFactory." This reverts commit ac0c4c529b42a17b5ab8f08ba4972e440bcb8023. * Revert "Better naming" This reverts commit 34fe713203cde1eddba460277d58c3252b9e370b. * Revert "Better naming" This reverts commit 34fe713203cde1eddba460277d58c3252b9e370b. * [UNR-2729][MS] Adding stat tracking. * Missed revert. * Revert componentfactory.cpp * Feature/unr 2565 spatial debugging component (#1698) Added a component on Unreal entities which holds information used by the SpatialDebugger. Right now, this only contains load balancing information, but could be expanded in the future to expose other SpatialOS concepts. * Change FindChecked call by code that would not crash in release (#1720) * granular result types for non-auth entities (#1714) * optimistic schema database types * map of component type sets * schema generation doesn't crash * found them! * nice function * comments * re-add the bad qbi * add feature flag * silly bug * flip feature flag back * changelog * rename flag * move release note to bottom * PR comments * small thing * log bug * colon space * more comments * final PR comments hopefully * flip flag back * comments * check no entry * disable interest overrides (#1727) * add new flag * disable dynamic interest * correct comments * correct components * changelog * offline comments * Add warning messages (#1700) * Add warning messages * Apply suggestions from code review Co-Authored-By: Laura <36853437+ElleEss@users.noreply.github.com> * Update SetupIncTraceLibs.bat Co-authored-by: Laura <36853437+ElleEss@users.noreply.github.com> * Update SpatialGDK/Source/SpatialGDK/Private/Interop/SpatialClassInfoManager.cpp Co-Authored-By: Miron Zelina * Set ROLE_SimulatedProxy when setting a different authority intent (#1719) * Update spatiald version (#1701) * Update spot.version https://improbable.slack.com/archives/C0KP2A1UM/p1579532135001600 * Update CHANGELOG.md * reinstate spot version, update spatialD version * Update CHANGELOG.md * UNR-2741 - Added stat in LatencyTracer (#1735) * Initial commit * Added more stat * Feature/unr 2751 tracer gameplay events (#1706) Gameplay tracing events with ability to stash for use later * [UNR-2696] Resolve pending operations after applying component data (#1723) * Resolve pending operations after applying component data * Add release note * Adding dev auth flow into SpatialNetDriver (#1734) * adding dev auth config and constants * updating connection flow in SpatialNetDriver * enabling dev auth flow in SpatialWorkerConnection * making locator host optional * fixing up merge conflicts * added a todo comment * Initial tagging and reference of NCD interest (#1639) * Initial tagging and reference of NCD interest * Queries with multiple frequencies created * Merge conflict * Compile fix * Fix queries * Ignore NCD components * Handle use net owner relevancy flag using NCD components (#1671) * Resolve merge conflicts * Reworked with previous interest factory refactor * Reworked default queries * Refactor * Add distance/freq struct * Add utility functions * Merge fixups * PR feedback * PR feedback * PR feedback * Refactor client checkout caching * Revert change * Fix frequency distance pair duplication bug * Utility function refactor * Update changelog * Add warning for fractional NCD values Co-authored-by: Nicolas Colombe * Change slow test to use latent commands (#1738) * Change test to use latent commands, in order to avoid blocking the editor's UI * Bugfix/unr 2795 schema hash fail cooks (#1740) Fix for schema descriptor hashing in cook builds * Some work on adding Android support (#1682) * whitelist Android * using Unreal's move function * updating setup scripts * adding Android into the UnrealGDK build step * refactoring android build * updating worker sdk and adding mobile flag * adding macos check back in * changelog and updating requiresetup * getting rid of too many newlines * Fixed bad add (#1743) * [UNR-2781][MS] Recursing Player Controller Child UActorInterestComponents for Querys. (#1726) * [UNR-2781][MS] When creating the interest component for an actor, recursing the children of the actor if the actor is a player controller and add all all child queries. * Feedback. * Adding check * Spelling mistake. * Feedback from Michael * Feature/unr 2804 ghost rpcs (#1742) * remove dependency on acl * added actual flag rather than just setting * less interest, flag flip for test * flip flag back for merge * beginning fo refactor * bob the narcisstic terrible builder * works * include owner only components * my own nits * pr comments * missed nit * interest all the way down * consts for matt * actual fix * PR comments * cargo cult programming * inentityid * missed one * modify queries directly * Making simulated player flow simpler (#1737) * making sim player connection flow simpler * code review * indenting this time for real * changelog * updating RequireSetup to ensure the projects gets rebuilt * removed Authentication.cs from csproj * Feature/unr 2734 translation manager testing (#1721) * Mocked SpatialOSWorkerInterface * Added interface and mock for dispatching functionality of SpatialReceiver * Cleaned up and documented the mocks. Added more tests for the translation manager * Add missing generate call (#1749) * Feature/unr 2762 latency tracking improvements (#1718) Embedding the latency keys in more of a transparent way. Plus entity creation tracking if add is the first update * Extend translator unit tests (#1746) * Extend translator unit tests * Unbreak master, my bad lol (#1750) * Feature/unr 2808 self interest server (#1747) * always add true constraint to servers * honest warning * build result types for server * new setting * use result type for general server query * Add server result types for auth entities * fix for something probably * add command line override * add heart * release note * put the heart in the wrong place * merge flags * [UNR-2753][MS] General cleaning around auth config flow (#1739) * adding dev auth config and constants * updating connection flow in SpatialNetDriver * enabling dev auth flow in SpatialWorkerConnection * making locator host optional * fixing up merge conflicts * added a todo comment * Possible changes we want to make to clean up Connection configs. * Removing virtualness of connection configs. * Removing config file changes * Removing more subtle changes to connection configs. * Spelling error. * Spelling mistake in spelling mistake fix. * Noticed that we should also set the locator host of the dev auth flow in SetupConnectionConfigFromURL. We might want to do this using the URL later. * Feedback. * Changing the DevAuth flow to only concern itself with the DevAuthConfig. * Adding Jira ticket. * Small fix. * Michael nit Co-authored-by: jessicafalk <31853332+jessicafalk@users.noreply.github.com> * Ability to delete initially dormant startup actors (#1748) * Create a tombstone entity when destroying an initially dormant startup actor. * Drive by fixes. * [UNR-2753][MS] Moving DAT settings to editor settings. (#1744) * [UNR-2753][MS] Moving DAT settings to editor settings. * [UNR-2753][MS] Adding changelog note * Feature/UNR-2589 latency tracking (#1717) These changes add a static function to the existing latency tracing code that allows to easily set the prefixes of trace names. This facilitates the use of the new latency tracing scenario, aa users are expected to specify a trace prefix (because all traces are uploaded to the same project by default). This PR also makes sure that the trace library is fetched and built when the GDK is downloaded during CI. * Make the Dev Auth Config more configurable (#1741) * configure player id, display name and metadata via command line * adding check for locatorhost * code review * Default unattended mode in commandlets (#1753) * Locking gas ability activations (#1730) * GAS ability activations lock the owner Actor until completion * Unit tests for expanded locking policy function interface Co-authored-by: Tilman Schmidt * adding url options for dev auth flow (#1756) * MBL-23 Setup.sh does not work on mac system. (#1751) * MBL-23 Fix an issue that `Engine/Plugins/UnrealGDK/Setup.sh` does't work on MAC system. ====================================== Error log: conditional binary operator expected. That is caused by `-v` only support bash 4.2 and above. Modify it to `-n` to check for non-null/non-zero string variable here. * Execute different logic according to input parameters. * MBL-18 Add RegisterOnLoginTokensCb function in USpatialWorkerConnection. (#1711) * MBL-18 Add RegisterOnLoginTokensCb function in USpatialWorkerConnection. Caller can register a callback function in and execute some custom logic. In this case caller can list available deployment in UI. * Fixed component name output (#1757) * Add more setting logging (#1755) * Adding a Generate Dev Auth Token Button (#1752) * adding a button to generate the dev auth token * add changelog * PR feedback * adding message dialog * UNR-2794 SpatialWorkerConnection on Game Thread (#1736) * Initial commit * Added flag to run SpatialWorkerConnection on the main thread * Added proper checks * Moved `QueueLatestOpList` to the beginning of `USpatialNetDriver::TickFlush`, `ProcessOutgoingMessages` to the end of `USpatialNetDriver::TickFlush` * Added CMD support for `SpatialWorkerConnectionOnGameThread` option * Hid `bRunSpatialWorkerConnectionOnGameThread`, added `Override` prefix for CMD option * Add spatial output * Update SpatialGDK/Source/SpatialGDK/Private/SpatialGDKSettings.cpp Co-authored-by: Michael Samiec * Remove simulated player zip from runner on startup (#1758) * Remove simulated player zip from runner on startup * Update RequireSetup * Bugfix/fix worker startup race (#1763) * Create log directory directly * Remove unused log folder * Add trailing slash * [UNR-2714] Force RPC ringbuffer when zoning is enabled (#1759) * Add accessor for RPCRingBuffer setting * Gray out RPCSetting when Load balancing is enabled. * Added missing checks for creating tombstone entiteis. (#1769) * [UNR-2736] Don't construct shadow data every time when receiving update (#1767) * Don't construct shadow data every time when receiving update * Bump engine version * No need to empty an empty buffer * Update EngineVersionCheck.h * Have a more explicit error message when pulling load balancing strategy from world settings (#1766) * Fix issue with dangling pointer when channel is cleaned up during a component update (#1777) * Remove unnecessary wrappers from static view storage (#1779) * MBL-13 Remove hard coded locator url in example project. (#1780) * MBL-13 Remove hard coded locator url in example project. * Restructure ReuqestDeploymentLoginTokens logic and export the function to outside so caller can call this API regularly. * Dup functionality from DataChannel::ReplicateActor (#1770) * Dup functionality from DataChannel::ReplicateActor * Update comment * Fix 422 Co-authored-by: improbable-valentyn <32096431+improbable-valentyn@users.noreply.github.com> * Bugfix: SpatialPingComponent on non-auth servers (#1705) SpatialPingComponent should not start pings on non-auth servers. Co-authored-by: improbable-valentyn <32096431+improbable-valentyn@users.noreply.github.com> * [UNR-2689][MS] Spatial output log will pop up at the end of PIE sessi… (#1765) * [UNR-2689][MS] Spatial output log will pop up at the end of PIE session. A setting can be changed to disable this. * Update to changelog * Feedback. * Revert "Feedback." This reverts commit 7596b788601d8a4cbcb042ead3c383bfee9bf928. * Revert "[UNR-2689][MS] Spatial output log will pop up at the end of PIE session. A setting can be changed to disable this." This reverts commit 1c8fda92078aaa1bb68ad1f274b57cc082b977f2. * Update change log * Updating change log * correct components (#1764) * cleanup * fix zoning bug * assumptions all the way down * fix zoning + ring buffers + result types bug * nicer bugfix * out of u and me * add error and return if the check is passed * reorder * ensure * not really a precondition anymore * expose colors to blueprints (#1787) * expose colors to blueprints * undo unnecessary change * Feature/unr 2012 fix registering singletons crash (#1781) * Driveby fix for missing includes. * Use path names in stead of class pointers as a key for singletons. Remove singeltons from the list when actors are destroyed. * Move use of the singleton channel map to the gsm entirely. * Added an error message for deleting singletons on a server. * Spawn actor entities with component authority based on lb strat if zo… (#1783) * Spawn actor entities with component authority based on lb strat if zoning enabled * Adding a mobile settings section (#1771) * adding mobile settings * removing old way of pushing command line args to iOS device * update SpatialGDKEditor.Build.cs * adding buttons to push mobile settings to device * PR feedback * making sure that paths with spaces also work.. * updating changelog * a few more error checks * code review * adding comment about json api * UNR-322 : Add more profiling coverage (#1784) * Added more detailed profiling scopes * Added more profiles * startup actor begin play authority respects lb strategy (#1768) * startup actor begin play respects lb strategy * [UNR-2818] Pin runtime version (#1782) Add Runtime version pinning to the GDK + settings to control this behaviour Add additional setting for cloud deployment runtime version, along with UI in the deployment panel. * Feature/unr 2815 split server to server to server (#1795) * schema change * split component * reverse silly testing things * release note * remove ready and all checks * accidnet * rename legacy->command * bug * remove unnecessary file * someone made another component * [UNR-2796] Enhance deployment startup report (#1774) Report which workers needs to be manually started * ring buffer split rpc (#1798) * reset again merge bad * fix test * pr commetns * strange parentheses * begrudgingly add back the force inlines * forceinline -> inline * Fixing the ms build script to work properly with vs2019 (#1800) Co-authored-by: Michael Samiec * fixing check in dev auth generation (#1805) * Worker connection on game thread fix (#1786) * Fix when running spatial worker connection on the game thread. * Correcting missing trace data. * Un commenting... Co-authored-by: Michael Samiec * [UNR-2372] Do not reset shadow data for the entire object on every update (#1788) We previously reset the entire object's shadow data in `USpatialActorChannel::PreReceiveSpatialUpdate`. This was mostly wasted effort. With this change, we only reset the shadow data for the updated property. This should keep parity with Unreal, as the worrisome scenario was this: 1) Let's say replicated X starts at 1 on both the server and client 2) Client changes X locally to 10 3) Server changes X locally to 10 4) Client receives replicated X from the server, but it's the same as the local value so a RepNotify wouldn't be fired on spatial It turns out, this RepNotify also won't fire on native, because native copies the current value of the property to the shadow data before receiving the property from the wire. * Try not resetting shadow data on receive * Adapt for 4.23 * Update repnotify condition to match native * Only copy if not resetting shadow data * Make code more readable * Remove extra newline * Missed replace * Replace incorrect check to initialize shadow data * Fix indentation * Bugfix/unr 2891 rpc calls not traced (#1791) Improved way we handle closing traces with the new begin->continue flow. Fixed a bug where traces were not being continued for RPCs * fix echo (#1811) * fix echo * grammatical consistency * technically not minimal * Disable secure connection by default (#1785) * Add setting for configuring TLS on the worker connection * Only enable secure connection for clients * Re-order initlisatioN * Add secure server connection settings * Use bConnectAsClient * Add const * MBL-32 Fix a crash issue that Unreal Editor will crash when click `Push SpatialOS settings to Android device`. (#1813) * MBL-32 Fix a crash issue that Unreal Editor will crash when click `Push SpatialOS settings to Android device`. ------------------------------ Convert variable between THCAR and UTF8 string. * Fix variable convert issues. * Augment 0.8.1-preview-rc merge with fixes Contains additional fixes as suggested by code review when merging the 0.8.1-preview-rc into master. * Remove overzealous assert (#1821) * Enable mobile support in worker_sdk when gdk is installed. (#1808) Pass parameters into Setup.bat from SetupIncTraceLibs.bat. * Add virtual worker IDs to spatial debugger (#1810) * Add virtual worker IDs to spatial debugger * Update GDK for OnOwnerUpdated args engine change (#1824) * [UNR-2950][MS] Fix when generating schema, we need to delete the old files. * Adding const * Cleaned up cmd line options (#1823) Cleaned up the cmd line option code and added additional arguments which will be useful for testing without needing to branch the project to edit settings * Remove redundant call (#1820) * Call Setup.bat from the correct directory (#1818) If the script is started from a directory different than its own, it fails because it can't find Setup.bat Co-authored-by: Michael Samiec * UNR-2926 Fix lock icon on spatial debugger (#1809) * Make locking icon work on spatial debugger * Updating based on feedback. * Untested but adding in the creation of the directory if it doesn't exist or has been deleted. * [UNR-2823] Basic ownership actor set locking (#1790) * Ownership-based actor set locking * Copy files in both full scan and iterative schema gen. * [UNR-2604][MS] Testing for load balancing strategy (#1815) * [UNR-2604][MS] First changes for load balance enforcer tests. * Adding more tests. * Moar tests! * Removing comments from rpc tests. * Header moving. * Adding constants for entity ids and virtual worker ids. * Adding an extra test testing queuing of the same entity multiple times. Also adding parts to "failure" tests that will check that after correcting the initial setup error the enforcer returns the appropriate acl requests. * rename and add comment as I got confused (#1832) * rename and add comment as I got confused * rest of refactor * better name * here * refactoring is more difficult * than expected * [UNR-2894][MS] Dev auth button functional in China (#1814) * [UNR-2894][MS] Dev auth generate button to work with china. * Feedback * Feedback * Updating to refresh * Moving copys back out of the if statement * Feedback Changing tests to use RefreshSchemaFiles. Removing DeleteGeneratedFile function. Allowing iterate schema gen to fail, the assumption being people will use full scan after an update. * [UNR-2221][MS] Docs and changelog update for InstallGDK script changes (#1834) * [UNR-2221][MS] Docs and changelog update. * Feedback * Update as files name changed. * Separate the Connection establishment from the Connection funct… (#1822) Add a new ConnectionManager which handles creating and establishing the WorkerConnection. * Fixing SimplayerDeployments (#1838) * Make RequestDeploymentLoginTokens public in SpatialConnectionMa… (#1841) * Make RequestDeploymentLoginTokens public in SpatialConnectionManager * Fix coordinates in GridBasedLBStrategy (#1831) * swap x and y to match world system * fix tests Co-authored-by: Oliver Balaam * Revert "Merge branch 'master' of https://github.com/spatialos/UnrealGDK into bugfix/UNR-2950" This reverts commit 936a81662abfd3c215482fc58d62ce86f4b024ec, reversing changes made to ee310b83b0a84b6da5c26a8395d5ada5d4798f91. * Modifying tests. Co-authored-by: aleximprobable Co-authored-by: Tim Gibson Co-authored-by: Nicolas Colombe Co-authored-by: improbable-valentyn Co-authored-by: Michael Samiec Co-authored-by: Vlad Co-authored-by: Shivam Mistry Co-authored-by: Jacques Lebrun Co-authored-by: Joe Stephenson Co-authored-by: dbsigurd Co-authored-by: Joshua Huburn <31517089+joshuahuburn@users.noreply.github.com> Co-authored-by: Ernest Oppetit Co-authored-by: Jared Dixey-Hefty Co-authored-by: cmsmithio Co-authored-by: Teri Drummond Co-authored-by: jessicafalk <31853332+jessicafalk@users.noreply.github.com> Co-authored-by: Tilman Schmidt Co-authored-by: JHuculak Co-authored-by: Danny Birch Co-authored-by: Victor Buldakov Co-authored-by: Sami Husain Co-authored-by: Ally Co-authored-by: Tencho Tenev Co-authored-by: Evmorfia Kalogiannidou Co-authored-by: Matt Young Co-authored-by: Jennifer Harkness Co-authored-by: Jacques Elliott Co-authored-by: Miron Zelina Co-authored-by: Laura <36853437+ElleEss@users.noreply.github.com> Co-authored-by: Oliver Balaam Co-authored-by: wangxin Co-authored-by: Jordan Vogel Co-authored-by: Jay Lauffer <49975160+jayprobable@users.noreply.github.com> --- .../SpatialGDKEditorSchemaGenerator.cpp | 38 ++++++------------- .../Private/SpatialGDKEditor.cpp | 3 +- .../Public/SpatialGDKEditorSchemaGenerator.h | 4 +- .../SpatialGDKEditorSchemaGeneratorTest.cpp | 14 ++++--- 4 files changed, 22 insertions(+), 37 deletions(-) diff --git a/SpatialGDK/Source/SpatialGDKEditor/Private/SchemaGenerator/SpatialGDKEditorSchemaGenerator.cpp b/SpatialGDK/Source/SpatialGDKEditor/Private/SchemaGenerator/SpatialGDKEditorSchemaGenerator.cpp index 7ea4631844..33b45daf42 100644 --- a/SpatialGDK/Source/SpatialGDKEditor/Private/SchemaGenerator/SpatialGDKEditorSchemaGenerator.cpp +++ b/SpatialGDK/Source/SpatialGDKEditor/Private/SchemaGenerator/SpatialGDKEditorSchemaGenerator.cpp @@ -528,50 +528,37 @@ void CopyWellKnownSchemaFiles(const FString& GDKSchemaCopyDir, const FString& Co IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile(); - if (!PlatformFile.DirectoryExists(*GDKSchemaCopyDir)) - { - if (!PlatformFile.CreateDirectoryTree(*GDKSchemaCopyDir)) - { - UE_LOG(LogSpatialGDKSchemaGenerator, Error, TEXT("Could not create gdk schema directory '%s'! Please make sure the parent directory is writeable."), *GDKSchemaCopyDir); - } - } - - if (!PlatformFile.DirectoryExists(*CoreSDKSchemaCopyDir)) - { - if (!PlatformFile.CreateDirectoryTree(*CoreSDKSchemaCopyDir)) - { - UE_LOG(LogSpatialGDKSchemaGenerator, Error, TEXT("Could not create standard library schema directory '%s'! Please make sure the parent directory is writeable."), *GDKSchemaCopyDir); - } - } - + RefreshSchemaFiles(*GDKSchemaCopyDir); if (!PlatformFile.CopyDirectoryTree(*GDKSchemaCopyDir, *GDKSchemaDir, true /*bOverwriteExisting*/)) { UE_LOG(LogSpatialGDKSchemaGenerator, Error, TEXT("Could not copy gdk schema to '%s'! Please make sure the directory is writeable."), *GDKSchemaCopyDir); } + RefreshSchemaFiles(*CoreSDKSchemaCopyDir); if (!PlatformFile.CopyDirectoryTree(*CoreSDKSchemaCopyDir, *CoreSDKSchemaDir, true /*bOverwriteExisting*/)) { UE_LOG(LogSpatialGDKSchemaGenerator, Error, TEXT("Could not copy standard library schema to '%s'! Please make sure the directory is writeable."), *CoreSDKSchemaCopyDir); } } -void DeleteGeneratedSchemaFiles(const FString& SchemaOutputPath) +bool RefreshSchemaFiles(const FString& SchemaOutputPath) { IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile(); if (PlatformFile.DirectoryExists(*SchemaOutputPath)) { if (!PlatformFile.DeleteDirectoryRecursively(*SchemaOutputPath)) { - UE_LOG(LogSpatialGDKSchemaGenerator, Error, TEXT("Could not clean the generated schema directory '%s'! Please make sure the directory and the files inside are writeable."), *SchemaOutputPath); + UE_LOG(LogSpatialGDKSchemaGenerator, Error, TEXT("Could not clean the schema directory '%s'! Please make sure the directory and the files inside are writeable."), *SchemaOutputPath); + return false; } } -} -void CreateGeneratedSchemaFolder() -{ - IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile(); - FString SchemaOutputPath = GetDefault()->GetGeneratedSchemaOutputFolder(); - PlatformFile.CreateDirectoryTree(*SchemaOutputPath); + if (!PlatformFile.CreateDirectoryTree(*SchemaOutputPath)) + { + UE_LOG(LogSpatialGDKSchemaGenerator, Error, TEXT("Could not create schema directory '%s'! Please make sure the parent directory is writeable."), *SchemaOutputPath); + return false; + } + return true; } void ResetSchemaGeneratorState() @@ -587,8 +574,7 @@ void ResetSchemaGeneratorState() void ResetSchemaGeneratorStateAndCleanupFolders() { ResetSchemaGeneratorState(); - DeleteGeneratedSchemaFiles(GetDefault()->GetGeneratedSchemaOutputFolder()); - CreateGeneratedSchemaFolder(); + RefreshSchemaFiles(GetDefault()->GetGeneratedSchemaOutputFolder()); } bool LoadGeneratorStateFromSchemaDatabase(const FString& FileName) diff --git a/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditor.cpp b/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditor.cpp index 934d8f033c..6365c56be4 100644 --- a/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditor.cpp +++ b/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditor.cpp @@ -101,8 +101,7 @@ bool FSpatialGDKEditor::GenerateSchema(bool bFullScan) FString GDKSchemaCopyDir = FPaths::Combine(FSpatialGDKServicesModule::GetSpatialOSDirectory(), TEXT("schema/unreal/gdk")); FString CoreSDKSchemaCopyDir = FPaths::Combine(FSpatialGDKServicesModule::GetSpatialOSDirectory(), TEXT("build/dependencies/schema/standard_library")); Schema::CopyWellKnownSchemaFiles(GDKSchemaCopyDir, CoreSDKSchemaCopyDir); - Schema::DeleteGeneratedSchemaFiles(GetDefault()->GetGeneratedSchemaOutputFolder()); - Schema::CreateGeneratedSchemaFolder(); + Schema::RefreshSchemaFiles(GetDefault()->GetGeneratedSchemaOutputFolder()); } Progress.EnterProgressFrame(bFullScan ? 10.f : 100.f); diff --git a/SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKEditorSchemaGenerator.h b/SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKEditorSchemaGenerator.h index bd08ba8676..b36cd3650a 100644 --- a/SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKEditorSchemaGenerator.h +++ b/SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKEditorSchemaGenerator.h @@ -38,9 +38,7 @@ namespace SpatialGDKEditor SPATIALGDKEDITOR_API bool GeneratedSchemaFolderExists(); - SPATIALGDKEDITOR_API void DeleteGeneratedSchemaFiles(const FString& SchemaOutputPath); - - SPATIALGDKEDITOR_API void CreateGeneratedSchemaFolder(); + SPATIALGDKEDITOR_API bool RefreshSchemaFiles(const FString& SchemaOutputPath); SPATIALGDKEDITOR_API void CopyWellKnownSchemaFiles(const FString& GDKSchemaCopyDir, const FString& CoreSDKSchemaCopyDir); diff --git a/SpatialGDK/Source/SpatialGDKTests/SpatialGDKEditor/SpatialGDKEditorSchemaGenerator/SpatialGDKEditorSchemaGeneratorTest.cpp b/SpatialGDK/Source/SpatialGDKTests/SpatialGDKEditor/SpatialGDKEditorSchemaGenerator/SpatialGDKEditorSchemaGeneratorTest.cpp index 546d6533e5..a58ee9382d 100644 --- a/SpatialGDK/Source/SpatialGDKTests/SpatialGDKEditor/SpatialGDKEditorSchemaGenerator/SpatialGDKEditorSchemaGeneratorTest.cpp +++ b/SpatialGDK/Source/SpatialGDKTests/SpatialGDKEditor/SpatialGDKEditorSchemaGenerator/SpatialGDKEditorSchemaGeneratorTest.cpp @@ -609,7 +609,7 @@ SCHEMA_GENERATOR_TEST(GIVEN_an_Actor_class_with_multiple_object_components_WHEN_ return true; } -SCHEMA_GENERATOR_TEST(GIVEN_multiple_schema_files_exist_WHEN_deleted_generated_files_THEN_no_schema_files_exist) +SCHEMA_GENERATOR_TEST(GIVEN_multiple_schema_files_exist_WHEN_refresh_generated_files_THEN_schema_files_exist) { SchemaTestFixture Fixture; @@ -623,25 +623,27 @@ SCHEMA_GENERATOR_TEST(GIVEN_multiple_schema_files_exist_WHEN_deleted_generated_f SpatialGDKEditor::Schema::SpatialGDKGenerateSchemaForClasses(Classes, SchemaOutputFolder); // WHEN - SpatialGDKEditor::Schema::DeleteGeneratedSchemaFiles(SchemaOutputFolder); + bool bRefreshSuccess = SpatialGDKEditor::Schema::RefreshSchemaFiles(SchemaOutputFolder); + TestTrue("RefreshSchema was successful", bRefreshSuccess); // THEN IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile(); - TestFalse("Schema directory does not exist", PlatformFile.DirectoryExists(*SchemaOutputFolder)); + TestTrue("Schema directory exists", PlatformFile.DirectoryExists(*SchemaOutputFolder)); return true; } -SCHEMA_GENERATOR_TEST(GIVEN_no_schema_files_exist_WHEN_deleted_generated_files_THEN_no_schema_files_exist) +SCHEMA_GENERATOR_TEST(GIVEN_no_schema_files_exist_WHEN_refresh_generated_files_THEN_schema_files_exist) { // GIVEN // WHEN - SpatialGDKEditor::Schema::DeleteGeneratedSchemaFiles(SchemaOutputFolder); + bool bRefreshSuccess = SpatialGDKEditor::Schema::RefreshSchemaFiles(SchemaOutputFolder); + TestTrue("RefreshSchema was successful", bRefreshSuccess); // THEN IPlatformFile& PlatformFile = FPlatformFileManager::Get().GetPlatformFile(); - TestFalse("Schema directory does not exist", PlatformFile.DirectoryExists(*SchemaOutputFolder)); + TestTrue("Schema directory now exists", PlatformFile.DirectoryExists(*SchemaOutputFolder)); return true; } From d362114e93e6e9145cd1d890ef432902e3541862 Mon Sep 17 00:00:00 2001 From: MatthewSandfordImprobable Date: Tue, 3 Mar 2020 14:26:19 +0000 Subject: [PATCH 14/30] Merge of MBL-13 and MBL-18 (#1849) * merge * MBL-18 Add RegisterOnLoginTokensCb function in USpatialWorkerConnection. (#1711) * MBL-18 Add RegisterOnLoginTokensCb function in USpatialWorkerConnection. Caller can register a callback function in and execute some custom logic. In this case caller can list available deployment in UI. # Conflicts: # SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp # SpatialGDK/Source/SpatialGDK/Public/Interop/Connection/SpatialWorkerConnection.h * Additional changes to make the code work in the release. * Revert "Additional changes to make the code work in the release." This reverts commit 2b9e055e37fc6775d3d7c36da4f8b6d7a6d2a20c. Co-authored-by: wangxin --- .../Connection/SpatialWorkerConnection.cpp | 42 +++++++++++++------ .../Connection/SpatialWorkerConnection.h | 11 +++++ 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp b/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp index 4a4d178fae..63839ae11e 100644 --- a/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp +++ b/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp @@ -112,11 +112,22 @@ void USpatialWorkerConnection::OnLoginTokens(void* UserData, const Worker_Alpha_ UE_LOG(LogSpatialWorkerConnection, Verbose, TEXT("Successfully received LoginTokens, Count: %d"), LoginTokens->login_token_count); USpatialWorkerConnection* Connection = static_cast(UserData); + Connection->ProcessLoginTokensResponse(LoginTokens); +} + +void USpatialWorkerConnection::ProcessLoginTokensResponse(const Worker_Alpha_LoginTokensResponse* LoginTokens) +{ + // If LoginTokenResCallback is callable and returns true, return early. + if (LoginTokenResCallback && LoginTokenResCallback(LoginTokens)) + { + return; + } + const FString& DeploymentToConnect = GetDefault()->DevelopmentDeploymentToConnect; // If not set, use the first deployment. It can change every query if you have multiple items available, because the order is not guaranteed. if (DeploymentToConnect.IsEmpty()) { - Connection->LocatorConfig.LoginToken = FString(LoginTokens->login_tokens[0].login_token); + LocatorConfig.LoginToken = FString(LoginTokens->login_tokens[0].login_token); } else { @@ -125,12 +136,27 @@ void USpatialWorkerConnection::OnLoginTokens(void* UserData, const Worker_Alpha_ FString DeploymentName = FString(LoginTokens->login_tokens[i].deployment_name); if (DeploymentToConnect.Compare(DeploymentName) == 0) { - Connection->LocatorConfig.LoginToken = FString(LoginTokens->login_tokens[i].login_token); + LocatorConfig.LoginToken = FString(LoginTokens->login_tokens[i].login_token); break; } } } - Connection->ConnectToLocator(); + ConnectToLocator(); +} + +void USpatialWorkerConnection::RequestDeploymentLoginTokens() +{ + Worker_Alpha_LoginTokensRequest LTParams{}; + FTCHARToUTF8 PlayerIdentityToken(*LocatorConfig.PlayerIdentityToken); + LTParams.player_identity_token = PlayerIdentityToken.Get(); + FTCHARToUTF8 WorkerType(*LocatorConfig.WorkerType); + LTParams.worker_type = WorkerType.Get(); + LTParams.use_insecure_connection = false; + + if (Worker_Alpha_LoginTokensResponseFuture* LTFuture = Worker_Alpha_CreateDevelopmentLoginTokensAsync(TCHAR_TO_UTF8(*LocatorConfig.LocatorHost), SpatialConstants::LOCATOR_PORT, <Params)) + { + Worker_Alpha_LoginTokensResponseFuture_Get(LTFuture, nullptr, this, &USpatialWorkerConnection::OnLoginTokens); + } } void USpatialWorkerConnection::OnPlayerIdentityToken(void* UserData, const Worker_Alpha_PlayerIdentityTokenResponse* PIToken) @@ -144,16 +170,8 @@ void USpatialWorkerConnection::OnPlayerIdentityToken(void* UserData, const Worke UE_LOG(LogSpatialWorkerConnection, Log, TEXT("Successfully received PIToken: %s"), UTF8_TO_TCHAR(PIToken->player_identity_token)); USpatialWorkerConnection* Connection = static_cast(UserData); Connection->LocatorConfig.PlayerIdentityToken = UTF8_TO_TCHAR(PIToken->player_identity_token); - Worker_Alpha_LoginTokensRequest LTParams{}; - LTParams.player_identity_token = PIToken->player_identity_token; - FTCHARToUTF8 WorkerType(*Connection->LocatorConfig.WorkerType); - LTParams.worker_type = WorkerType.Get(); - LTParams.use_insecure_connection = false; - if (Worker_Alpha_LoginTokensResponseFuture* LTFuture = Worker_Alpha_CreateDevelopmentLoginTokensAsync(TCHAR_TO_UTF8(*Connection->LocatorConfig.LocatorHost), SpatialConstants::LOCATOR_PORT, <Params)) - { - Worker_Alpha_LoginTokensResponseFuture_Get(LTFuture, nullptr, Connection, &USpatialWorkerConnection::OnLoginTokens); - } + Connection->RequestDeploymentLoginTokens(); } void USpatialWorkerConnection::StartDevelopmentAuth(FString DevAuthToken) diff --git a/SpatialGDK/Source/SpatialGDK/Public/Interop/Connection/SpatialWorkerConnection.h b/SpatialGDK/Source/SpatialGDK/Public/Interop/Connection/SpatialWorkerConnection.h index 3e3b8b28df..f238517ddc 100644 --- a/SpatialGDK/Source/SpatialGDK/Public/Interop/Connection/SpatialWorkerConnection.h +++ b/SpatialGDK/Source/SpatialGDK/Public/Interop/Connection/SpatialWorkerConnection.h @@ -38,6 +38,13 @@ class SPATIALGDK_API USpatialWorkerConnection : public UObject, public FRunnable virtual void FinishDestroy() override; void DestroyConnection(); + using LoginTokenResponseCallback = TFunction; + + /// Register a callback using this function. + /// It will be triggered when receiving login tokens using the development authentication flow inside SpatialWorkerConnection. + /// @param Callback - callback function. + void RegisterOnLoginTokensCallback(const LoginTokenResponseCallback& Callback) {LoginTokenResCallback = Callback;} + void Connect(bool bConnectAsClient); FORCEINLINE bool IsConnected() { return bIsConnected; } @@ -64,6 +71,8 @@ class SPATIALGDK_API USpatialWorkerConnection : public UObject, public FRunnable FReceptionistConfig ReceptionistConfig; FLocatorConfig LocatorConfig; + void RequestDeploymentLoginTokens(); + private: void ConnectToReceptionist(bool bConnectAsClient); void ConnectToLocator(); @@ -92,6 +101,7 @@ class SPATIALGDK_API USpatialWorkerConnection : public UObject, public FRunnable void StartDevelopmentAuth(FString DevAuthToken); static void OnPlayerIdentityToken(void* UserData, const Worker_Alpha_PlayerIdentityTokenResponse* PIToken); static void OnLoginTokens(void* UserData, const Worker_Alpha_LoginTokensResponse* LoginTokens); + void ProcessLoginTokensResponse(const Worker_Alpha_LoginTokensResponse* LoginTokens); template void QueueOutgoingMessage(ArgsType&&... Args); @@ -115,4 +125,5 @@ class SPATIALGDK_API USpatialWorkerConnection : public UObject, public FRunnable // RequestIds per worker connection start at 0 and incrementally go up each command sent. Worker_RequestId NextRequestId = 0; + LoginTokenResponseCallback LoginTokenResCallback; }; From 81c2c9a1c916097100cdaa62157e3c8eccde3295 Mon Sep 17 00:00:00 2001 From: MatthewSandfordImprobable Date: Wed, 4 Mar 2020 15:16:24 +0000 Subject: [PATCH 15/30] [CHINF-886][MS] Fixing a crash caused by the merge into release related to the jira issue. (#1864) * [CHINF-886][MS] Fixing a crash caused by the merge into release related to the jira issue. * Spelling mistake --- .../SpatialGDK/Private/EngineClasses/SpatialNetDriver.cpp | 6 +++++- .../Interop/Connection/SpatialWorkerConnection.cpp | 8 ++++---- .../Public/Interop/Connection/SpatialWorkerConnection.h | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialNetDriver.cpp b/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialNetDriver.cpp index eb11980e10..5c5a554568 100644 --- a/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialNetDriver.cpp +++ b/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialNetDriver.cpp @@ -251,7 +251,11 @@ void USpatialNetDriver::InitiateConnectionToSpatialOS(const FURL& URL) } } - Connection->Connect(bConnectAsClient); +#if WITH_EDITOR + Connection->Connect(bConnectAsClient, PlayInEditorID); +#else + Connection->Connect(bConnectAsClient, 0); +#endif } void USpatialNetDriver::OnConnectedToSpatialOS() diff --git a/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp b/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp index 63839ae11e..14f5d61565 100644 --- a/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp +++ b/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp @@ -68,7 +68,7 @@ void USpatialWorkerConnection::DestroyConnection() KeepRunning.AtomicSet(true); } -void USpatialWorkerConnection::Connect(bool bInitAsClient) +void USpatialWorkerConnection::Connect(bool bInitAsClient, uint32 PlayInEditorID) { if (bIsConnected) { @@ -88,7 +88,7 @@ void USpatialWorkerConnection::Connect(bool bInitAsClient) switch (GetConnectionType()) { case SpatialConnectionType::Receptionist: - ConnectToReceptionist(bInitAsClient); + ConnectToReceptionist(bInitAsClient, PlayInEditorID); break; case SpatialConnectionType::Locator: ConnectToLocator(); @@ -191,7 +191,7 @@ void USpatialWorkerConnection::StartDevelopmentAuth(FString DevAuthToken) } } -void USpatialWorkerConnection::ConnectToReceptionist(bool bConnectAsClient) +void USpatialWorkerConnection::ConnectToReceptionist(bool bConnectAsClient, uint32 PlayInEditorID) { if (ReceptionistConfig.WorkerType.IsEmpty()) { @@ -200,7 +200,7 @@ void USpatialWorkerConnection::ConnectToReceptionist(bool bConnectAsClient) } #if WITH_EDITOR - SpatialGDKServices::InitWorkers(bConnectAsClient, GetSpatialNetDriverChecked()->PlayInEditorID, ReceptionistConfig.WorkerId); + SpatialGDKServices::InitWorkers(bConnectAsClient, PlayInEditorID, ReceptionistConfig.WorkerId); #endif if (ReceptionistConfig.WorkerId.IsEmpty()) diff --git a/SpatialGDK/Source/SpatialGDK/Public/Interop/Connection/SpatialWorkerConnection.h b/SpatialGDK/Source/SpatialGDK/Public/Interop/Connection/SpatialWorkerConnection.h index f238517ddc..95e0308311 100644 --- a/SpatialGDK/Source/SpatialGDK/Public/Interop/Connection/SpatialWorkerConnection.h +++ b/SpatialGDK/Source/SpatialGDK/Public/Interop/Connection/SpatialWorkerConnection.h @@ -45,7 +45,7 @@ class SPATIALGDK_API USpatialWorkerConnection : public UObject, public FRunnable /// @param Callback - callback function. void RegisterOnLoginTokensCallback(const LoginTokenResponseCallback& Callback) {LoginTokenResCallback = Callback;} - void Connect(bool bConnectAsClient); + void Connect(bool bConnectAsClient, uint32 PlayInEditorID); FORCEINLINE bool IsConnected() { return bIsConnected; } @@ -74,7 +74,7 @@ class SPATIALGDK_API USpatialWorkerConnection : public UObject, public FRunnable void RequestDeploymentLoginTokens(); private: - void ConnectToReceptionist(bool bConnectAsClient); + void ConnectToReceptionist(bool bConnectAsClient, uint32 PlayInEditorID); void ConnectToLocator(); void FinishConnecting(Worker_ConnectionFuture* ConnectionFuture); From 32081f105394eac203c74666b7a9722893e66891 Mon Sep 17 00:00:00 2001 From: MatthewSandfordImprobable Date: Thu, 5 Mar 2020 11:36:45 +0000 Subject: [PATCH 16/30] Removing the netdriver from the spatial worker connection. (#1869) --- .../EngineClasses/SpatialNetDriver.cpp | 19 ++++++++++++--- .../Connection/SpatialWorkerConnection.cpp | 23 ++----------------- .../Public/EngineClasses/SpatialNetDriver.h | 3 +++ .../Connection/SpatialWorkerConnection.h | 8 +++++-- 4 files changed, 27 insertions(+), 26 deletions(-) diff --git a/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialNetDriver.cpp b/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialNetDriver.cpp index 5c5a554568..8b9a7dd5d6 100644 --- a/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialNetDriver.cpp +++ b/SpatialGDK/Source/SpatialGDK/Private/EngineClasses/SpatialNetDriver.cpp @@ -33,6 +33,7 @@ #include "SpatialGDKSettings.h" #include "Utils/ActorGroupManager.h" #include "Utils/EntityPool.h" +#include "Utils/ErrorCodeRemapping.h" #include "Utils/InterestFactory.h" #include "Utils/OpUtils.h" #include "Utils/SpatialMetrics.h" @@ -121,7 +122,7 @@ bool USpatialNetDriver::InitBase(bool bInitAsClient, FNetworkNotify* InNotify, c // Initialize ClassInfoManager here because it needs to load SchemaDatabase. // We shouldn't do that in CreateAndInitializeCoreClasses because it is called - // from OnConnectedToSpatialOS callback which could be executed with the async + // from OnConnectionToSpatialOSSucceeded callback which could be executed with the async // loading thread suspended (e.g. when resuming rendering thread), in which // case we'll crash upon trying to load SchemaDatabase. ClassInfoManager = NewObject(); @@ -216,6 +217,8 @@ void USpatialNetDriver::InitiateConnectionToSpatialOS(const FURL& URL) } Connection = GameInstance->GetSpatialWorkerConnection(); + Connection->OnConnectedCallback.BindUObject(this, &USpatialNetDriver::OnConnectionToSpatialOSSucceeded); + Connection->OnFailedToConnectCallback.BindUObject(this, &USpatialNetDriver::OnConnectionToSpatialOSFailed); if (URL.HasOption(TEXT("locator"))) { @@ -258,7 +261,7 @@ void USpatialNetDriver::InitiateConnectionToSpatialOS(const FURL& URL) #endif } -void USpatialNetDriver::OnConnectedToSpatialOS() +void USpatialNetDriver::OnConnectionToSpatialOSSucceeded() { // If we're the server, we will spawn the special Spatial connection that will route all updates to SpatialOS. // There may be more than one of these connections in the future for different replication conditions. @@ -282,6 +285,17 @@ void USpatialNetDriver::OnConnectedToSpatialOS() } } +void USpatialNetDriver::OnConnectionToSpatialOSFailed(uint8_t ConnectionStatusCode, const FString& ErrorMessage) +{ + if (const USpatialGameInstance* GameInstance = GetGameInstance()) + { + if (GEngine != nullptr && GameInstance->GetWorld() != nullptr) + { + GEngine->BroadcastNetworkFailure(GameInstance->GetWorld(), this, ENetworkFailure::FromDisconnectOpStatusCode(ConnectionStatusCode), *ErrorMessage); + } + } +} + void USpatialNetDriver::InitializeSpatialOutputDevice() { int32 PIEIndex = -1; // -1 is Unreal's default index when not using PIE @@ -621,7 +635,6 @@ void USpatialNetDriver::BeginDestroy() { Cast(LocalWorld->GetGameInstance())->DestroySpatialWorkerConnection(); } - Connection = nullptr; } } diff --git a/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp b/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp index 14f5d61565..bd52f7dad6 100644 --- a/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp +++ b/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp @@ -6,7 +6,6 @@ #endif #include "EngineClasses/SpatialGameInstance.h" -#include "EngineClasses/SpatialNetDriver.h" #include "Engine/World.h" #include "UnrealEngine.h" #include "Async/Async.h" @@ -14,7 +13,6 @@ #include "Engine/World.h" #include "Misc/Paths.h" -#include "EngineClasses/SpatialNetDriver.h" #include "SpatialGDKSettings.h" #include "Utils/ErrorCodeRemapping.h" @@ -464,22 +462,6 @@ void USpatialWorkerConnection::CacheWorkerAttributes() } } -USpatialNetDriver* USpatialWorkerConnection::GetSpatialNetDriverChecked() const -{ - UNetDriver* NetDriver = GameInstance->GetWorld()->GetNetDriver(); - - // On the client, the world might not be completely set up. - // in this case we can use the PendingNetGame to get the NetDriver - if (NetDriver == nullptr) - { - NetDriver = GameInstance->GetWorldContext()->PendingNetGame->GetNetDriver(); - } - - USpatialNetDriver* SpatialNetDriver = Cast(NetDriver); - checkf(SpatialNetDriver, TEXT("SpatialNetDriver was invalid while accessing SpatialNetDriver!")); - return SpatialNetDriver; -} - void USpatialWorkerConnection::OnConnectionSuccess() { bIsConnected = true; @@ -489,7 +471,7 @@ void USpatialWorkerConnection::OnConnectionSuccess() InitializeOpsProcessingThread(); } - GetSpatialNetDriverChecked()->OnConnectedToSpatialOS(); + OnConnectedCallback.ExecuteIfBound(); GameInstance->HandleOnConnected(); } @@ -507,8 +489,7 @@ void USpatialWorkerConnection::OnConnectionFailure() { uint8_t ConnectionStatusCode = Worker_Connection_GetConnectionStatusCode(WorkerConnection); const FString ErrorMessage(UTF8_TO_TCHAR(Worker_Connection_GetConnectionStatusDetailString(WorkerConnection))); - - GEngine->BroadcastNetworkFailure(GameInstance->GetWorld(), GetSpatialNetDriverChecked(), ENetworkFailure::FromDisconnectOpStatusCode(ConnectionStatusCode), *ErrorMessage); + OnFailedToConnectCallback.ExecuteIfBound(ConnectionStatusCode, ErrorMessage); } } diff --git a/SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialNetDriver.h b/SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialNetDriver.h index bc2bba88dd..9b60b5e143 100644 --- a/SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialNetDriver.h +++ b/SpatialGDK/Source/SpatialGDK/Public/EngineClasses/SpatialNetDriver.h @@ -77,6 +77,9 @@ class SPATIALGDK_API USpatialNetDriver : public UIpNetDriver virtual void OnOwnerUpdated(AActor* Actor); + void OnConnectionToSpatialOSSucceeded(); + void OnConnectionToSpatialOSFailed(uint8_t ConnectionStatusCode, const FString& ErrorMessage); + void OnConnectedToSpatialOS(); #if !UE_BUILD_SHIPPING diff --git a/SpatialGDK/Source/SpatialGDK/Public/Interop/Connection/SpatialWorkerConnection.h b/SpatialGDK/Source/SpatialGDK/Public/Interop/Connection/SpatialWorkerConnection.h index 95e0308311..6eaf805eea 100644 --- a/SpatialGDK/Source/SpatialGDK/Public/Interop/Connection/SpatialWorkerConnection.h +++ b/SpatialGDK/Source/SpatialGDK/Public/Interop/Connection/SpatialWorkerConnection.h @@ -71,6 +71,12 @@ class SPATIALGDK_API USpatialWorkerConnection : public UObject, public FRunnable FReceptionistConfig ReceptionistConfig; FLocatorConfig LocatorConfig; + DECLARE_DELEGATE(OnConnectionToSpatialOSSucceededDelegate) + OnConnectionToSpatialOSSucceededDelegate OnConnectedCallback; + + DECLARE_DELEGATE_TwoParams(OnConnectionToSpatialOSFailedDelegate, uint8_t, const FString&); + OnConnectionToSpatialOSFailedDelegate OnFailedToConnectCallback; + void RequestDeploymentLoginTokens(); private: @@ -86,8 +92,6 @@ class SPATIALGDK_API USpatialWorkerConnection : public UObject, public FRunnable void CacheWorkerAttributes(); - class USpatialNetDriver* GetSpatialNetDriverChecked() const; - // Begin FRunnable Interface virtual bool Init() override; virtual uint32 Run() override; From 6d94dfa101ff344120e3a8e6ac7dce99b5c37196 Mon Sep 17 00:00:00 2001 From: Oliver Balaam Date: Thu, 5 Mar 2020 13:04:04 +0000 Subject: [PATCH 17/30] Remove 0.6.5 from CHANGELOG (#1870) * Update CHANGELOG.md * Update CHANGELOG.md --- CHANGELOG.md | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bff8c4afd5..a0da912233 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,12 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased-`x.y.z`] - 2020-xx-xx -## [`0.8.1-preview`] - 2020-xx-xx -### Adapted from 0.6.5 +## [`0.8.1-preview`] - 2020-05-12 ### Features: -Features listed in the internal section are not ready to use but, in the spirit of open development, we detail every change we make to the GDK. - **SpatialOS GDK for Unreal** > **Editor Settings** > **Region Settings** has been moved to **SpatialOS GDK for Unreal** > **Runtime Settings** > **Region Settings**. -- Local deployments can now be launched in China, when the **Region where services are located** is set to `CN`. +- You can now choose which SpatialOS service region you want to use by adjusting the**Region where services are located** setting. You must use the service region that you're geographically located in. +- Deployments can now be launched in China, when the **Region where services are located** is set to `CN`. - Updated the version of the local API service used by the UnrealGDK. - The Spatial output log will now be open by default. @@ -131,12 +130,6 @@ Features listed in the internal section are not ready to use but, in the spirit - When replicating an actor, the owner's Spatial position will no longer be used if it isn't replicated. - Fixed a crash upon checking out an actor with a deleted static subobject. -## [`0.6.5`] - 2020-01-13 -### Internal: -Features listed in the internal section are not ready to use but, in the spirit of open development, we detail every change we make to the GDK. -- **SpatialOS GDK for Unreal** > **Editor Settings** > **Region Settings** has been moved to **SpatialOS GDK for Unreal** > **Runtime Settings** > **Region Settings**. -- Local deployments can now be launched in China, when the **Region where services are located** is set to `CN`. - ## [`0.6.4`] - 2019-12-13 ### Bug fixes: - The Inspector button in the SpatialOS GDK for Unreal toolbar now opens the correct URL. From 0d5155667f74eceaa25d6db0e981f602886d1ac8 Mon Sep 17 00:00:00 2001 From: MatthewSandfordImprobable Date: Thu, 5 Mar 2020 14:59:36 +0000 Subject: [PATCH 18/30] [UNR-2964][MS] Ensure spatial commands are run with correct environment arg. (#1846) * test * Feedback --- .../Private/SpatialGDKEditorToolbar.cpp | 3 +- .../Connection/EditorWorkerController.cpp | 6 +-- .../Private/LocalDeploymentManager.cpp | 32 ++++++--------- .../Private/SpatialCommandUtils.cpp | 40 +++++++++++++++++-- .../Private/SpatialGDKServicesModule.cpp | 5 ++- .../Public/LocalDeploymentManager.h | 3 ++ .../Public/SpatialCommandUtils.h | 8 +++- .../Public/SpatialGDKServicesModule.h | 2 +- .../LocalDeploymentManagerTest.cpp | 4 +- 9 files changed, 69 insertions(+), 34 deletions(-) diff --git a/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp b/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp index ee39e865fb..df14b5e1b3 100644 --- a/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp +++ b/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp @@ -75,8 +75,9 @@ void FSpatialGDKEditorToolbarModule::StartupModule() FSpatialGDKServicesModule& GDKServices = FModuleManager::GetModuleChecked("SpatialGDKServices"); LocalDeploymentManager = GDKServices.GetLocalDeploymentManager(); + LocalDeploymentManager->PreInit(GetDefault()->IsRunningInChina()); + LocalDeploymentManager->SetAutoDeploy(SpatialGDKEditorSettings->bAutoStartLocalDeployment); - LocalDeploymentManager->SetInChina(GetDefault()->IsRunningInChina()); // Bind the play button delegate to starting a local spatial deployment. if (!UEditorEngine::TryStartSpatialDeployment.IsBound() && SpatialGDKEditorSettings->bAutoStartLocalDeployment) diff --git a/SpatialGDK/Source/SpatialGDKServices/Private/Interop/Connection/EditorWorkerController.cpp b/SpatialGDK/Source/SpatialGDKServices/Private/Interop/Connection/EditorWorkerController.cpp index a0ae695e2d..9ff9845281 100644 --- a/SpatialGDK/Source/SpatialGDKServices/Private/Interop/Connection/EditorWorkerController.cpp +++ b/SpatialGDK/Source/SpatialGDKServices/Private/Interop/Connection/EditorWorkerController.cpp @@ -1,6 +1,7 @@ // Copyright (c) Improbable Worlds Ltd, All Rights Reserved #include "Interop/Connection/EditorWorkerController.h" +#include "SpatialCommandUtils.h" #include "SpatialGDKServicesPrivate.h" #include "Editor.h" @@ -73,9 +74,8 @@ struct EditorWorkerController "--existing_worker_id %s " "--replacing_worker_id %s"), *ServicePort, *OldWorker, *NewWorker); uint32 ProcessID = 0; - FProcHandle ProcHandle = FPlatformProcess::CreateProc( - *(CmdExecutable), *CmdArgs, false, true, true, &ProcessID, 2 /*PriorityModifier*/, - nullptr, nullptr, nullptr); + FProcHandle ProcHandle = SpatialCommandUtils::CreateSpatialProcess(CmdArgs, false, true, true, &ProcessID, 2 /*PriorityModifier*/, + nullptr, nullptr, nullptr, false); return ProcHandle; } diff --git a/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp b/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp index c021315e47..01fb87e4f6 100644 --- a/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp +++ b/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp @@ -26,19 +26,6 @@ DEFINE_LOG_CATEGORY(LogSpatialDeploymentManager); static const FString SpatialServiceVersion(TEXT("20200120.115350.8d6b779c82")); -namespace -{ - FString GetDomainEnvironmentStr(bool bIsInChina) - { - FString DomainEnvironmentStr; - if (bIsInChina) - { - DomainEnvironmentStr = TEXT("--environment=cn-production"); - } - return DomainEnvironmentStr; - } -} // anonymous namespace - FLocalDeploymentManager::FLocalDeploymentManager() : bLocalDeploymentRunning(false) , bSpatialServiceRunning(false) @@ -48,12 +35,16 @@ FLocalDeploymentManager::FLocalDeploymentManager() , bStartingSpatialService(false) , bStoppingSpatialService(false) { +} + +void FLocalDeploymentManager::PreInit(bool IsInChina) +{ #if PLATFORM_WINDOWS // Don't kick off background processes when running commandlets if (IsRunningCommandlet() == false) { // Check for the existence of Spatial and Spot. If they don't exist then don't start any background processes. Disable spatial networking if either is true. - if (!FSpatialGDKServicesModule::SpatialPreRunChecks()) + if (!FSpatialGDKServicesModule::SpatialPreRunChecks(IsInChina)) { UE_LOG(LogSpatialDeploymentManager, Warning, TEXT("Pre run checks for LocalDeploymentManager failed. Local deployments cannot be started. Spatial networking will be disabled.")); GetMutableDefault()->bSpatialNetworking = false; @@ -135,10 +126,10 @@ void FLocalDeploymentManager::WorkerBuildConfigAsync() { AsyncTask(ENamedThreads::AnyBackgroundThreadNormalTask, [this] { - FString BuildConfigArgs = FString::Printf(TEXT("worker build build-config %s"), *GetDomainEnvironmentStr(bIsInChina)); + FString BuildConfigArgs = FString::Printf(TEXT("worker build build-config")); FString WorkerBuildConfigResult; int32 ExitCode; - FSpatialGDKServicesModule::ExecuteAndReadOutput(FSpatialGDKServicesModule::GetSpatialExe(), BuildConfigArgs, FSpatialGDKServicesModule::GetSpatialOSDirectory(), WorkerBuildConfigResult, ExitCode); + SpatialCommandUtils::ExecuteSpatialCommandAndReadOutput(BuildConfigArgs, FSpatialGDKServicesModule::GetSpatialOSDirectory(), WorkerBuildConfigResult, ExitCode, bIsInChina); if (ExitCode == ExitCodeSuccess) { @@ -497,7 +488,7 @@ bool FLocalDeploymentManager::TryStartSpatialService(FString RuntimeIPToExpose) bStartingSpatialService = true; - FString SpatialServiceStartArgs = FString::Printf(TEXT("service start --version=%s %s"), *SpatialServiceVersion, *GetDomainEnvironmentStr(bIsInChina)); + FString SpatialServiceStartArgs = FString::Printf(TEXT("service start --version=%s"), *SpatialServiceVersion); // Pass exposed runtime IP if one has been specified if (!RuntimeIPToExpose.IsEmpty()) @@ -509,7 +500,8 @@ bool FLocalDeploymentManager::TryStartSpatialService(FString RuntimeIPToExpose) FString ServiceStartResult; int32 ExitCode; - FSpatialGDKServicesModule::ExecuteAndReadOutput(FSpatialGDKServicesModule::GetSpatialExe(), SpatialServiceStartArgs, FSpatialGDKServicesModule::GetSpatialOSDirectory(), ServiceStartResult, ExitCode); + + SpatialCommandUtils::ExecuteSpatialCommandAndReadOutput(SpatialServiceStartArgs, FSpatialGDKServicesModule::GetSpatialOSDirectory(), ServiceStartResult, ExitCode, bIsInChina); bStartingSpatialService = false; @@ -540,11 +532,11 @@ bool FLocalDeploymentManager::TryStopSpatialService() bStoppingSpatialService = true; - FString SpatialServiceStartArgs = FString::Printf(TEXT("service stop %s"), *GetDomainEnvironmentStr(bIsInChina)); + FString SpatialServiceStartArgs = FString::Printf(TEXT("service stop")); FString ServiceStopResult; int32 ExitCode; - FSpatialGDKServicesModule::ExecuteAndReadOutput(FSpatialGDKServicesModule::GetSpatialExe(), SpatialServiceStartArgs, FSpatialGDKServicesModule::GetSpatialOSDirectory(), ServiceStopResult, ExitCode); + SpatialCommandUtils::ExecuteSpatialCommandAndReadOutput(SpatialServiceStartArgs, FSpatialGDKServicesModule::GetSpatialOSDirectory(), ServiceStopResult, ExitCode, bIsInChina); bStoppingSpatialService = false; if (ExitCode == ExitCodeSuccess) diff --git a/SpatialGDK/Source/SpatialGDKServices/Private/SpatialCommandUtils.cpp b/SpatialGDK/Source/SpatialGDKServices/Private/SpatialCommandUtils.cpp index 3c76ba68e1..3d19bb350b 100644 --- a/SpatialGDK/Source/SpatialGDKServices/Private/SpatialCommandUtils.cpp +++ b/SpatialGDK/Source/SpatialGDKServices/Private/SpatialCommandUtils.cpp @@ -1,17 +1,49 @@ // Copyright (c) Improbable Worlds Ltd, All Rights Reserved #include "SpatialCommandUtils.h" +#include "SpatialGDKServicesModule.h" DEFINE_LOG_CATEGORY(LogSpatialCommandUtils); -bool SpatialCommandUtils::AttemptSpatialAuth(bool IsRunningInChina) +namespace +{ + FString ChinaEnvironmentArgument = TEXT(" --environment=cn-production"); +} // anonymous namespace + +void SpatialCommandUtils::ExecuteSpatialCommandAndReadOutput(FString Arguments, const FString& DirectoryToRun, FString& OutResult, int32& OutExitCode, bool bIsRunningInChina) +{ + if (bIsRunningInChina) + { + Arguments += ChinaEnvironmentArgument; + } + + FSpatialGDKServicesModule::ExecuteAndReadOutput(*FSpatialGDKServicesModule::GetSpatialExe(), Arguments, DirectoryToRun, OutResult, OutExitCode); +} + +void SpatialCommandUtils::ExecuteSpatialCommand(FString Arguments, int32* OutExitCode, FString* OutStdOut, FString* OutStdEr, bool bIsRunningInChina) +{ + if (bIsRunningInChina) + { + Arguments += ChinaEnvironmentArgument; + } + FPlatformProcess::ExecProcess(*FSpatialGDKServicesModule::GetSpatialExe(), *Arguments, OutExitCode, OutStdOut, OutStdEr); +} + +FProcHandle SpatialCommandUtils::CreateSpatialProcess(FString Arguments, bool bLaunchDetached, bool bLaunchHidden, bool bLaunchReallyHidden, uint32* OutProcessID, int32 PriorityModifier, const TCHAR* OptionalWorkingDirectory, void* PipeWriteChild, void * PipeReadChild, bool bIsRunningInChina) +{ + if (bIsRunningInChina) + { + Arguments += ChinaEnvironmentArgument; + } + return FPlatformProcess::CreateProc(*FSpatialGDKServicesModule::GetSpatialExe(), *Arguments, bLaunchDetached, bLaunchHidden, bLaunchReallyHidden, OutProcessID, PriorityModifier, OptionalWorkingDirectory, PipeWriteChild, PipeReadChild); +} + +bool SpatialCommandUtils::AttemptSpatialAuth(bool bIsRunningInChina) { - FString SpatialInfoArgs = IsRunningInChina ? TEXT("auth login --environment=cn-production") : TEXT("auth login"); FString SpatialInfoResult; FString StdErr; int32 ExitCode; - - FPlatformProcess::ExecProcess(*FString(TEXT("spatial")), *SpatialInfoArgs, &ExitCode, &SpatialInfoResult, &StdErr); + ExecuteSpatialCommand(TEXT("auth login"), &ExitCode, &SpatialInfoResult, &StdErr, bIsRunningInChina); bool bSuccess = ExitCode == 0; if (!bSuccess) diff --git a/SpatialGDK/Source/SpatialGDKServices/Private/SpatialGDKServicesModule.cpp b/SpatialGDK/Source/SpatialGDKServices/Private/SpatialGDKServicesModule.cpp index 4b8653bf63..cfb2943840 100644 --- a/SpatialGDK/Source/SpatialGDKServices/Private/SpatialGDKServicesModule.cpp +++ b/SpatialGDK/Source/SpatialGDKServices/Private/SpatialGDKServicesModule.cpp @@ -8,6 +8,7 @@ #include "Framework/Application/SlateApplication.h" #include "Framework/Docking/TabManager.h" #include "Misc/FileHelper.h" +#include "SpatialCommandUtils.h" #include "SSpatialOutputLog.h" #include "Serialization/JsonReader.h" #include "Serialization/JsonSerializer.h" @@ -88,11 +89,11 @@ const FString& FSpatialGDKServicesModule::GetSpatialExe() return SpatialExe; } -bool FSpatialGDKServicesModule::SpatialPreRunChecks() +bool FSpatialGDKServicesModule::SpatialPreRunChecks(bool bIsInChina) { FString SpatialExistenceCheckResult; int32 ExitCode; - ExecuteAndReadOutput(GetSpatialExe(), TEXT("version"), GetSpatialOSDirectory(), SpatialExistenceCheckResult, ExitCode); + SpatialCommandUtils::ExecuteSpatialCommandAndReadOutput(TEXT("version"), GetSpatialOSDirectory(), SpatialExistenceCheckResult, ExitCode, bIsInChina); if (ExitCode != 0) { diff --git a/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h b/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h index fc1a3685a9..9f9a56f628 100644 --- a/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h +++ b/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h @@ -17,6 +17,9 @@ class FLocalDeploymentManager public: FLocalDeploymentManager(); + // Needs to be ran after SetInChina is called. + void SPATIALGDKSERVICES_API PreInit(bool IsInChina); + void SPATIALGDKSERVICES_API Init(FString RuntimeIPToExpose); void SPATIALGDKSERVICES_API SetInChina(bool IsInChina); diff --git a/SpatialGDK/Source/SpatialGDKServices/Public/SpatialCommandUtils.h b/SpatialGDK/Source/SpatialGDKServices/Public/SpatialCommandUtils.h index d82dee5f67..906c912dc7 100644 --- a/SpatialGDK/Source/SpatialGDKServices/Public/SpatialCommandUtils.h +++ b/SpatialGDK/Source/SpatialGDKServices/Public/SpatialCommandUtils.h @@ -10,5 +10,11 @@ class SpatialCommandUtils { public: - SPATIALGDKSERVICES_API static bool AttemptSpatialAuth(bool IsRunningInChina); + SPATIALGDKSERVICES_API static void ExecuteSpatialCommandAndReadOutput(FString Arguments, const FString& DirectoryToRun, FString& OutResult, int32& ExitCode, bool bIsRunningInChina); + + SPATIALGDKSERVICES_API static void ExecuteSpatialCommand(FString Arguments, int32* OutReturnCode, FString* OutStdOut, FString* OutStdEr, bool bIsRunningInChina); + + SPATIALGDKSERVICES_API static FProcHandle CreateSpatialProcess(FString Arguments, bool bLaunchDetached, bool bLaunchHidden, bool bLaunchReallyHidden, uint32* OutProcessID, int32 PriorityModifier, const TCHAR* OptionalWorkingDirectory, void* PipeWriteChild, void * PipeReadChild, bool bIsRunningInChina); + + SPATIALGDKSERVICES_API static bool AttemptSpatialAuth(bool bIsRunningInChina); }; diff --git a/SpatialGDK/Source/SpatialGDKServices/Public/SpatialGDKServicesModule.h b/SpatialGDK/Source/SpatialGDKServices/Public/SpatialGDKServicesModule.h index 7c6de376a3..be46115107 100644 --- a/SpatialGDK/Source/SpatialGDKServices/Public/SpatialGDKServicesModule.h +++ b/SpatialGDK/Source/SpatialGDKServices/Public/SpatialGDKServicesModule.h @@ -24,7 +24,7 @@ class SPATIALGDKSERVICES_API FSpatialGDKServicesModule : public IModuleInterface static FString GetSpatialGDKPluginDirectory(const FString& AppendPath = TEXT("")); static const FString& GetSpotExe(); static const FString& GetSpatialExe(); - static bool SpatialPreRunChecks(); + static bool SpatialPreRunChecks(bool bIsInChina); FORCEINLINE static FString GetProjectName() { diff --git a/SpatialGDK/Source/SpatialGDKTests/SpatialGDKServices/LocalDeploymentManager/LocalDeploymentManagerTest.cpp b/SpatialGDK/Source/SpatialGDKTests/SpatialGDKServices/LocalDeploymentManager/LocalDeploymentManagerTest.cpp index 2375b7714b..a98cd8343f 100644 --- a/SpatialGDK/Source/SpatialGDKTests/SpatialGDKServices/LocalDeploymentManager/LocalDeploymentManagerTest.cpp +++ b/SpatialGDK/Source/SpatialGDKTests/SpatialGDKServices/LocalDeploymentManager/LocalDeploymentManagerTest.cpp @@ -3,6 +3,7 @@ #include "TestDefinitions.h" #include "LocalDeploymentManager.h" +#include "SpatialCommandUtils.h" #include "SpatialGDKDefaultLaunchConfigGenerator.h" #include "SpatialGDKDefaultWorkerJsonGenerator.h" #include "SpatialGDKEditorSettings.h" @@ -35,8 +36,7 @@ namespace FString BuildConfigArgs = TEXT("worker build build-config"); FString WorkerBuildConfigResult; int32 ExitCode; - const FString SpatialExe(TEXT("spatial.exe")); - FSpatialGDKServicesModule::ExecuteAndReadOutput(SpatialExe, BuildConfigArgs, FSpatialGDKServicesModule::GetSpatialOSDirectory(), WorkerBuildConfigResult, ExitCode); + SpatialCommandUtils::ExecuteSpatialCommandAndReadOutput(BuildConfigArgs, FSpatialGDKServicesModule::GetSpatialOSDirectory(), WorkerBuildConfigResult, ExitCode, false); const int32 ExitCodeSuccess = 0; return (ExitCode == ExitCodeSuccess); From 5d494649f835e2cf76b2bd669c0fe5b1744be901 Mon Sep 17 00:00:00 2001 From: MatthewSandfordImprobable Date: Fri, 6 Mar 2020 10:49:33 +0000 Subject: [PATCH 19/30] [UNR-3041][MS] Addin 14.3 into release (#1867) * [UNR-3041][MS] Addin 14.3 into GDK * Swapping compression to downstream. * Adding comments back --- CHANGELOG.md | 1 + RequireSetup | 2 +- SpatialGDK/Extras/core-sdk.version | 2 +- .../Interop/Connection/SpatialWorkerConnection.cpp | 14 ++++++-------- .../Public/Interop/Connection/ConnectionConfig.h | 6 +++--- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0da912233..7b105aff1a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Deployments can now be launched in China, when the **Region where services are located** is set to `CN`. - Updated the version of the local API service used by the UnrealGDK. - The Spatial output log will now be open by default. +- The GDK now uses SpatialOS 14.3.0. ### Bug fixes: - Replicated references to newly created dynamic subobjects will now be resolved correctly. diff --git a/RequireSetup b/RequireSetup index 5578f83247..6886684295 100644 --- a/RequireSetup +++ b/RequireSetup @@ -1,4 +1,4 @@ Increment the below number whenever it is required to run Setup.bat as part of a new commit. Our git hooks will detect this file has been updated and automatically run Setup.bat on pull. -39 +40 diff --git a/SpatialGDK/Extras/core-sdk.version b/SpatialGDK/Extras/core-sdk.version index 2f0f3c13e8..1cbb0aa64c 100644 --- a/SpatialGDK/Extras/core-sdk.version +++ b/SpatialGDK/Extras/core-sdk.version @@ -1 +1 @@ -14.1.0 \ No newline at end of file +14.3.0 \ No newline at end of file diff --git a/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp b/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp index bd52f7dad6..7e1629476b 100644 --- a/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp +++ b/SpatialGDK/Source/SpatialGDK/Private/Interop/Connection/SpatialWorkerConnection.cpp @@ -233,10 +233,9 @@ void USpatialWorkerConnection::ConnectToReceptionist(bool bConnectAsClient, uint ConnectionParams.network.tcp.multiplex_level = ReceptionistConfig.TcpMultiplexLevel; // We want the bridge to worker messages to be compressed; not the worker to bridge messages. - // TODO: UNR-2212 - Worker SDK 14.1.0 has a bug where upstream and downstream compression are swapped so we set the upstream settings to use compression. - Worker_Alpha_CompressionParameters EnableCompressionParams{}; - ConnectionParams.network.modular_udp.upstream_compression = &EnableCompressionParams; - ConnectionParams.network.modular_udp.downstream_compression = nullptr; + Worker_CompressionParameters EnableCompressionParams{}; + ConnectionParams.network.modular_kcp.upstream_compression = nullptr; + ConnectionParams.network.modular_kcp.downstream_compression = &EnableCompressionParams; ConnectionParams.enable_dynamic_components = true; // end TODO @@ -290,10 +289,9 @@ void USpatialWorkerConnection::ConnectToLocator() ConnectionParams.network.tcp.multiplex_level = LocatorConfig.TcpMultiplexLevel; // We want the bridge to worker messages to be compressed; not the worker to bridge messages. - // TODO: UNR-2212 - Worker SDK 14.1.0 has a bug where upstream and downstream compression are swapped so we set the upstream settings to use compression. - Worker_Alpha_CompressionParameters EnableCompressionParams{}; - ConnectionParams.network.modular_udp.upstream_compression = &EnableCompressionParams; - ConnectionParams.network.modular_udp.downstream_compression = nullptr; + Worker_CompressionParameters EnableCompressionParams{}; + ConnectionParams.network.modular_kcp.upstream_compression = nullptr; + ConnectionParams.network.modular_kcp.downstream_compression = &EnableCompressionParams; FString ProtocolLogDir = FPaths::ConvertRelativePathToFull(FPaths::ProjectLogDir()) + TEXT("protocol-log-"); ConnectionParams.protocol_logging.log_prefix = TCHAR_TO_UTF8(*ProtocolLogDir); diff --git a/SpatialGDK/Source/SpatialGDK/Public/Interop/Connection/ConnectionConfig.h b/SpatialGDK/Source/SpatialGDK/Public/Interop/Connection/ConnectionConfig.h index 4b31ca454e..8d17d19a6b 100644 --- a/SpatialGDK/Source/SpatialGDK/Public/Interop/Connection/ConnectionConfig.h +++ b/SpatialGDK/Source/SpatialGDK/Public/Interop/Connection/ConnectionConfig.h @@ -16,7 +16,7 @@ struct FConnectionConfig FConnectionConfig() : UseExternalIp(false) , EnableProtocolLoggingAtStartup(false) - , LinkProtocol(WORKER_NETWORK_CONNECTION_TYPE_MODULAR_UDP) + , LinkProtocol(WORKER_NETWORK_CONNECTION_TYPE_MODULAR_KCP) , TcpMultiplexLevel(2) // This is a "finger-in-the-air" number. { const TCHAR* CommandLine = FCommandLine::Get(); @@ -35,11 +35,11 @@ struct FConnectionConfig FParse::Value(CommandLine, TEXT("linkProtocol"), LinkProtocolString); if (LinkProtocolString == TEXT("Tcp")) { - LinkProtocol = WORKER_NETWORK_CONNECTION_TYPE_TCP; + LinkProtocol = WORKER_NETWORK_CONNECTION_TYPE_MODULAR_TCP; } else if (LinkProtocolString == TEXT("Kcp")) { - LinkProtocol = WORKER_NETWORK_CONNECTION_TYPE_MODULAR_UDP; + LinkProtocol = WORKER_NETWORK_CONNECTION_TYPE_MODULAR_KCP; } else if (!LinkProtocolString.IsEmpty()) { From 8625989df28790b59e9184c20ee7a26127e49abc Mon Sep 17 00:00:00 2001 From: improbable-valentyn Date: Fri, 6 Mar 2020 12:31:41 +0000 Subject: [PATCH 20/30] [UNR-2989] Fix the Start deployment button being greyed out after auth timeout (#1873) * Fix the Start deployment button being greyed out after auth timeout * Add release note * Reset the variable regardless of auth success * Update CHANGELOG.md Co-Authored-By: Oliver Balaam Co-authored-by: Oliver Balaam --- CHANGELOG.md | 1 + .../SpatialGDKServices/Private/LocalDeploymentManager.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b105aff1a..b432797326 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Replicated references to newly created dynamic subobjects will now be resolved correctly. - Fixed a bug that caused the local API service to memory leak. - Errors are now correctly reported when you try to launch a cloud deployment without an assembly. +- The Start deployment button will no longer become greyed out when a `spatial auth login` process times out. ## [`0.8.0-preview`] - 2019-12-17 diff --git a/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp b/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp index 01fb87e4f6..08df271f39 100644 --- a/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp +++ b/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp @@ -287,7 +287,6 @@ bool FLocalDeploymentManager::FinishLocalDeployment(FString LaunchConfig, FStrin FString StdErr; int32 ExitCode; FPlatformProcess::ExecProcess(*FSpatialGDKServicesModule::GetSpotExe(), *SpotCreateArgs, &ExitCode, &SpotCreateResult, &StdErr); - bStartingDeployment = false; if (ExitCode != ExitCodeSuccess) { @@ -404,6 +403,7 @@ void FLocalDeploymentManager::TryStartLocalDeployment(FString LaunchConfig, FStr { UE_LOG(LogSpatialDeploymentManager, Error, TEXT("Spatial auth failed attempting to launch local deployment.")); } + bStartingDeployment = false; CallBack(bSuccess); }); From f77109f12734a2780871a8dab53545701905c009 Mon Sep 17 00:00:00 2001 From: MatthewSandfordImprobable Date: Wed, 11 Mar 2020 11:31:46 +0000 Subject: [PATCH 21/30] [UNR-3064][MS] catching this exception and printing error. (#1885) --- .../DeploymentLauncher/DeploymentLauncher.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs b/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs index 7209a85762..448762a9fe 100644 --- a/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs +++ b/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs @@ -207,6 +207,12 @@ private static int CreateDeployment(string[] args) $"Unable to launch the deployment(s). This is likely because the project '{projectName}' or assembly '{assemblyName}' doesn't exist."); return 1; } + else if (e.Status.StatusCode == Grpc.Core.StatusCode.ResourceExhausted) + { + Console.WriteLine( + $"Unable to launch the deployment(s). Cloud cluster resources exhausted, Detail: '{e.Status.Detail}'" ); + return 1; + } else { throw; From d637770fdd08c5041778abaeaf0dd0e61462a169 Mon Sep 17 00:00:00 2001 From: MatthewSandfordImprobable Date: Wed, 11 Mar 2020 11:59:51 +0000 Subject: [PATCH 22/30] [UNR-3062][MS] Fixing spatial auth to west when in china in local deployment (#1891) * [UNR-3064][MS] catching this exception and printing error. * [UNR-3062][MS] Fixing local deployment manager auth to west issue. * Revert "[UNR-3064][MS] catching this exception and printing error." This reverts commit 8cb0f5b9ecfaa062933b4b7532b9eba0c5bc0999. --- .../Private/LocalDeploymentManager.cpp | 10 +++------- .../SpatialGDKServices/Public/LocalDeploymentManager.h | 4 +--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp b/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp index 08df271f39..edb90d3b82 100644 --- a/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp +++ b/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp @@ -37,14 +37,15 @@ FLocalDeploymentManager::FLocalDeploymentManager() { } -void FLocalDeploymentManager::PreInit(bool IsInChina) +void FLocalDeploymentManager::PreInit(bool bChinaEnabled) { #if PLATFORM_WINDOWS + bIsInChina = bChinaEnabled; // Don't kick off background processes when running commandlets if (IsRunningCommandlet() == false) { // Check for the existence of Spatial and Spot. If they don't exist then don't start any background processes. Disable spatial networking if either is true. - if (!FSpatialGDKServicesModule::SpatialPreRunChecks(IsInChina)) + if (!FSpatialGDKServicesModule::SpatialPreRunChecks(bIsInChina)) { UE_LOG(LogSpatialDeploymentManager, Warning, TEXT("Pre run checks for LocalDeploymentManager failed. Local deployments cannot be started. Spatial networking will be disabled.")); GetMutableDefault()->bSpatialNetworking = false; @@ -90,11 +91,6 @@ void FLocalDeploymentManager::Init(FString RuntimeIPToExpose) #endif // PLATFORM_WINDOWS } -void FLocalDeploymentManager::SetInChina(bool bChinaEnabled) -{ - bIsInChina = bChinaEnabled; -} - void FLocalDeploymentManager::StartUpWorkerConfigDirectoryWatcher() { FDirectoryWatcherModule& DirectoryWatcherModule = FModuleManager::LoadModuleChecked(TEXT("DirectoryWatcher")); diff --git a/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h b/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h index 9f9a56f628..b81af5aeef 100644 --- a/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h +++ b/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h @@ -18,12 +18,10 @@ class FLocalDeploymentManager FLocalDeploymentManager(); // Needs to be ran after SetInChina is called. - void SPATIALGDKSERVICES_API PreInit(bool IsInChina); + void SPATIALGDKSERVICES_API PreInit(bool bChinaEnabled); void SPATIALGDKSERVICES_API Init(FString RuntimeIPToExpose); - void SPATIALGDKSERVICES_API SetInChina(bool IsInChina); - void SPATIALGDKSERVICES_API RefreshServiceStatus(); bool CheckIfPortIsBound(int32 Port); From 2bdac94a43a604c83817a3de3b495b837fb974bc Mon Sep 17 00:00:00 2001 From: MatthewSandfordImprobable Date: Wed, 11 Mar 2020 12:39:43 +0000 Subject: [PATCH 23/30] [UNR-3064][MS] Adding extra logging for unhandled exceptions (#1892) * [UNR-3064][MS] catching this exception and printing error. * [UNR-3064][MS] Extra logging. --- .../DeploymentLauncher/DeploymentLauncher.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs b/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs index 448762a9fe..2441248a51 100644 --- a/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs +++ b/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs @@ -205,18 +205,19 @@ private static int CreateDeployment(string[] args) { Console.WriteLine( $"Unable to launch the deployment(s). This is likely because the project '{projectName}' or assembly '{assemblyName}' doesn't exist."); - return 1; } else if (e.Status.StatusCode == Grpc.Core.StatusCode.ResourceExhausted) { Console.WriteLine( $"Unable to launch the deployment(s). Cloud cluster resources exhausted, Detail: '{e.Status.Detail}'" ); - return 1; } else { - throw; + Console.WriteLine( + $"Unable to launch the deployment(s). Detail: '{e.Status.Detail}'"); } + + return 1; } return 0; From d935bd243518d15d078c69ee06560527b270f17e Mon Sep 17 00:00:00 2001 From: MatthewSandfordImprobable Date: Thu, 12 Mar 2020 17:30:30 +0000 Subject: [PATCH 24/30] [UNR-3055][MS] Simplayer connection now knows about region to choose locator. (#1886) * [UNR-3064][MS] catching this exception and printing error. * [UNR-3055][MS] Adding idea of region to simplayer connection to choose correct locator host. * Revert "[UNR-3064][MS] catching this exception and printing error." This reverts commit 8cb0f5b9ecfaa062933b4b7532b9eba0c5bc0999. --- .../DeploymentLauncher/DeploymentLauncher.cs | 5 +++++ .../WorkerCoordinator/Authentication.cs | 14 ++++++++++---- .../WorkerCoordinator/ManagedWorkerCoordinator.cs | 10 ++++++---- 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs b/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs index 2441248a51..fcf5cb7b1b 100644 --- a/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs +++ b/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs @@ -317,6 +317,10 @@ private static Operation CreateSimPlayerDe }); // Add worker flags to sim deployment JSON. + var regionFlag = new JObject(); + regionFlag.Add("name", "simulated_players_region"); + regionFlag.Add("value", regionCode); + var devAuthTokenFlag = new JObject(); devAuthTokenFlag.Add("name", "simulated_players_dev_auth_token"); devAuthTokenFlag.Add("value", dat.TokenSecret); @@ -336,6 +340,7 @@ private static Operation CreateSimPlayerDe { if (simWorkerConfig.workers[i].worker_type == CoordinatorWorkerName) { + simWorkerConfig.workers[i].flags.Add(regionFlag); simWorkerConfig.workers[i].flags.Add(devAuthTokenFlag); simWorkerConfig.workers[i].flags.Add(targetDeploymentFlag); simWorkerConfig.workers[i].flags.Add(numSimulatedPlayersFlag); diff --git a/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/WorkerCoordinator/Authentication.cs b/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/WorkerCoordinator/Authentication.cs index fc30c07567..2d2cdf7d42 100644 --- a/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/WorkerCoordinator/Authentication.cs +++ b/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/WorkerCoordinator/Authentication.cs @@ -11,11 +11,17 @@ namespace Improbable.WorkerCoordinator class Authentication { private const string LOCATOR_HOST_NAME = "locator.improbable.io"; + private const string LOCATOR_HOST_NAME_CN = "locator.spatialoschina.com"; private const int LOCATOR_PORT = 444; - public static string GetDevelopmentPlayerIdentityToken(string devAuthToken, string clientName) + public static string GetLocatorHost(string region) { - var pitResponse = DevelopmentAuthentication.CreateDevelopmentPlayerIdentityTokenAsync("locator.improbable.io", 444, + return region == "CN" ? LOCATOR_HOST_NAME_CN : LOCATOR_HOST_NAME; + } + + public static string GetDevelopmentPlayerIdentityToken(string devAuthToken, string clientName, string region) + { + var pitResponse = DevelopmentAuthentication.CreateDevelopmentPlayerIdentityTokenAsync(GetLocatorHost(region), LOCATOR_PORT, new PlayerIdentityTokenRequest { DevelopmentAuthenticationToken = devAuthToken, @@ -33,9 +39,9 @@ public static string GetDevelopmentPlayerIdentityToken(string devAuthToken, stri return pitResponse.PlayerIdentityToken; } - public static List GetDevelopmentLoginTokens(string workerType, string pit) + public static List GetDevelopmentLoginTokens(string workerType, string pit, string region) { - var loginTokensResponse = DevelopmentAuthentication.CreateDevelopmentLoginTokensAsync(LOCATOR_HOST_NAME, LOCATOR_PORT, + var loginTokensResponse = DevelopmentAuthentication.CreateDevelopmentLoginTokensAsync(GetLocatorHost(region), LOCATOR_PORT, new LoginTokensRequest { PlayerIdentityToken = pit, diff --git a/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/WorkerCoordinator/ManagedWorkerCoordinator.cs b/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/WorkerCoordinator/ManagedWorkerCoordinator.cs index 8cb99bf959..0c201986e3 100644 --- a/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/WorkerCoordinator/ManagedWorkerCoordinator.cs +++ b/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/WorkerCoordinator/ManagedWorkerCoordinator.cs @@ -20,6 +20,7 @@ internal class ManagedWorkerCoordinator : AbstractWorkerCoordinator private const string InitialStartDelayArg = "coordinator_start_delay_millis"; // Worker flags. + private const string RegionFlag = "simulated_players_region"; private const string DevAuthTokenWorkerFlag = "simulated_players_dev_auth_token"; private const string TargetDeploymentWorkerFlag = "simulated_players_target_deployment"; private const string DeploymentTotalNumSimulatedPlayersWorkerFlag = "total_num_simulated_players"; @@ -119,6 +120,7 @@ public override void Run() var connection = CoordinatorConnection.ConnectAndKeepAlive(Logger, ReceptionistHost, ReceptionistPort, CoordinatorWorkerId, CoordinatorWorkerType); // Read worker flags. + Option region = connection.GetWorkerFlag(RegionFlag); Option devAuthTokenOpt = connection.GetWorkerFlag(DevAuthTokenWorkerFlag); Option targetDeploymentOpt = connection.GetWorkerFlag(TargetDeploymentWorkerFlag); int deploymentTotalNumSimulatedPlayers = int.Parse(GetWorkerFlagOrDefault(connection, DeploymentTotalNumSimulatedPlayersWorkerFlag, "100")); @@ -152,14 +154,14 @@ public override void Run() } Thread.Sleep(timeToSleep); - StartSimulatedPlayer(clientName, devAuthTokenOpt, targetDeploymentOpt); + StartSimulatedPlayer(clientName, region, devAuthTokenOpt, targetDeploymentOpt); } // Wait for all clients to exit. WaitForPlayersToExit(); } - private void StartSimulatedPlayer(string simulatedPlayerName, Option devAuthTokenOpt, Option targetDeploymentOpt) + private void StartSimulatedPlayer(string simulatedPlayerName, Option region, Option devAuthTokenOpt, Option targetDeploymentOpt) { try { @@ -168,11 +170,11 @@ private void StartSimulatedPlayer(string simulatedPlayerName, Option dev string loginToken = ""; if (devAuthTokenOpt.HasValue) { - pit = Authentication.GetDevelopmentPlayerIdentityToken(devAuthTokenOpt.Value, simulatedPlayerName); + pit = Authentication.GetDevelopmentPlayerIdentityToken(devAuthTokenOpt.Value, simulatedPlayerName, region.Value); if (targetDeploymentOpt.HasValue) { - var loginTokens = Authentication.GetDevelopmentLoginTokens(SimulatedPlayerWorkerType, pit); + var loginTokens = Authentication.GetDevelopmentLoginTokens(SimulatedPlayerWorkerType, pit, region.Value); loginToken = Authentication.SelectLoginToken(loginTokens, targetDeploymentOpt.Value); } else From b6a634443faffb033ef25515aa3bec34e5a1dfed Mon Sep 17 00:00:00 2001 From: MatthewSandfordImprobable Date: Thu, 12 Mar 2020 17:58:18 +0000 Subject: [PATCH 25/30] [UNR-3071][MS] Update Worker SDK version (#1896) * [UNR-3064][MS] catching this exception and printing error. * [UNR-3071][MS] Update Setup.bat to work with Worker SDK 14.5 * [UNR-3071][MS] Updating changelog and updating Worker SDK version. --- CHANGELOG.md | 2 +- Setup.bat | 8 ++++---- SpatialGDK/Extras/core-sdk.version | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b432797326..37c35c8ebe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Deployments can now be launched in China, when the **Region where services are located** is set to `CN`. - Updated the version of the local API service used by the UnrealGDK. - The Spatial output log will now be open by default. -- The GDK now uses SpatialOS 14.3.0. +- The GDK now uses SpatialOS 14.5.0. ### Bug fixes: - Replicated references to newly created dynamic subobjects will now be resolved correctly. diff --git a/Setup.bat b/Setup.bat index 1a24223a54..09793ebe8b 100644 --- a/Setup.bat +++ b/Setup.bat @@ -93,8 +93,8 @@ call :MarkStartOfBlock "Retrieve dependencies" spatial package retrieve tools schema_compiler-x86_64-win32 %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\tools\schema_compiler-x86_64-win32.zip" spatial package retrieve schema standard_library %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\schema\standard_library.zip" spatial package retrieve worker_sdk c_headers %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\c_headers.zip" - spatial package retrieve worker_sdk c-dynamic-x86-vc140_md-win32 %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86-vc140_md-win32.zip" - spatial package retrieve worker_sdk c-dynamic-x86_64-vc140_md-win32 %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86_64-vc140_md-win32.zip" + spatial package retrieve worker_sdk c-dynamic-x86-vc141_md-win32 %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86-vc141_md-win32.zip" + spatial package retrieve worker_sdk c-dynamic-x86_64-vc141_md-win32 %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86_64-vc141_md-win32.zip" spatial package retrieve worker_sdk c-dynamic-x86_64-gcc510-linux %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86_64-gcc510-linux.zip" spatial package retrieve worker_sdk c-static-fullylinked-arm-clang-ios %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\c-static-fullylinked-arm-clang-ios.zip" spatial package retrieve worker_sdk csharp %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\csharp.zip" @@ -103,8 +103,8 @@ call :MarkEndOfBlock "Retrieve dependencies" call :MarkStartOfBlock "Unpack dependencies" powershell -Command "Expand-Archive -Path \"%CORE_SDK_DIR%\worker_sdk\c_headers.zip\" -DestinationPath \"%BINARIES_DIR%\Headers\" -Force; "^ - "Expand-Archive -Path \"%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86-vc140_md-win32.zip\" -DestinationPath \"%BINARIES_DIR%\Win32\" -Force; "^ - "Expand-Archive -Path \"%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86_64-vc140_md-win32.zip\" -DestinationPath \"%BINARIES_DIR%\Win64\" -Force; "^ + "Expand-Archive -Path \"%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86-vc141_md-win32.zip\" -DestinationPath \"%BINARIES_DIR%\Win32\" -Force; "^ + "Expand-Archive -Path \"%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86_64-vc141_md-win32.zip\" -DestinationPath \"%BINARIES_DIR%\Win64\" -Force; "^ "Expand-Archive -Path \"%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86_64-gcc510-linux.zip\" -DestinationPath \"%BINARIES_DIR%\Linux\" -Force; "^ "Expand-Archive -Path \"%CORE_SDK_DIR%\worker_sdk\csharp.zip\" -DestinationPath \"%BINARIES_DIR%\Programs\worker_sdk\csharp\" -Force; "^ "Expand-Archive -Path \"%CORE_SDK_DIR%\worker_sdk\c-static-fullylinked-arm-clang-ios.zip\" -DestinationPath \"%BINARIES_DIR%\IOS\" -Force;"^ diff --git a/SpatialGDK/Extras/core-sdk.version b/SpatialGDK/Extras/core-sdk.version index 1cbb0aa64c..d3be72cbe1 100644 --- a/SpatialGDK/Extras/core-sdk.version +++ b/SpatialGDK/Extras/core-sdk.version @@ -1 +1 @@ -14.3.0 \ No newline at end of file +14.5.0 \ No newline at end of file From 1e543958990d25a4e74d0990d3adbcf3e4526696 Mon Sep 17 00:00:00 2001 From: Oliver Balaam Date: Mon, 16 Mar 2020 12:24:28 +0000 Subject: [PATCH 26/30] Update CHANGELOG.md (#1906) --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 37c35c8ebe..a0fcf2f014 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased-`x.y.z`] - 2020-xx-xx -## [`0.8.1-preview`] - 2020-05-12 +## [`0.8.1-preview`] - 2020-03-16 ### Features: - **SpatialOS GDK for Unreal** > **Editor Settings** > **Region Settings** has been moved to **SpatialOS GDK for Unreal** > **Runtime Settings** > **Region Settings**. - You can now choose which SpatialOS service region you want to use by adjusting the**Region where services are located** setting. You must use the service region that you're geographically located in. From 80110b345711ee957e09040bff81fdf7cae1d50d Mon Sep 17 00:00:00 2001 From: Ernest Oppetit Date: Mon, 16 Mar 2020 15:23:28 +0000 Subject: [PATCH 27/30] New Docs Website + Readme Cleanup (#1880) * Update links to new docs site + readme cleanup * correct docs URL * recommneded use only once * update recommended use Co-authored-by: Ernest Oppetit --- CONTRIBUTING.md | 6 +----- README.md | 17 ++++++----------- SpatialGDK/Documentation/README.md | 2 +- .../SpatialGDKSimulatedPlayerDeployment.cpp | 2 +- SpatialGDK/SpatialGDK.uplugin | 2 +- 5 files changed, 10 insertions(+), 19 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 4a9ac3a3fa..cd283bb0b7 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,8 +13,4 @@ We welcome any and all ## Coding standards -See the [GDK for Unreal C++ coding standards guide](./SpatialGDK/Documentation/contributions/unreal-gdk-coding-standards.md). - -## Warning - -This is an [alpha](https://docs.improbable.io/reference/latest/shared/release-policy#maturity-stages) release of the SpatialOS GDK for Unreal, pending stability and performance improvements. The API may change as we learn from feedback - see the guidance on [Recommended use](https://docs.improbable.io/unreal/latest/content/recommended-use). \ No newline at end of file +See the [GDK for Unreal C++ coding standards guide](./SpatialGDK/Documentation/contributions/unreal-gdk-coding-standards.md). \ No newline at end of file diff --git a/README.md b/README.md index 344c148940..6d63f43598 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,7 @@ ![](SpatialGDK/Documentation/spatialos-gdkforunreal-header.png) -The SpatialOS Game Development Kit (GDK) for Unreal is an Unreal Engine fork and plugin with associated projects. It gives you the features of [SpatialOS](https://spatialos.improbable.io/docs/reference/latest), within the familiar workflows and APIs of Unreal Engine. For more information, please see the GDK's [documentation website](https://docs.improbable.io/unreal/latest). - -> The SpatialOS GDK for Unreal is in alpha. It is ready to use for development of single-server games, but not recommended for public releases. We are committed to rapid development of the GDK to provide a performant release - for information on this, see our [development roadmap](https://github.com/spatialos/UnrealGDK/projects/1) and [Unreal features support](https://docs.improbable.io/unreal/latest/unreal-features-support) pages, and contact us via our forums, or on Discord. +The SpatialOS Game Development Kit (GDK) for Unreal is an Unreal Engine fork and plugin with associated projects. It gives you the features of [SpatialOS](https://documentation.improbable.io/spatialos-overview/docs), within the familiar workflows and APIs of Unreal Engine. For more information, please see the GDK's [documentation website](https://documentation.improbable.io/gdk-for-unreal/docs). This is the repository for the GDK plugin, which includes the Starter Template (a blank starter project). @@ -15,7 +13,7 @@ In addition to the plugin, the GDK also includes: You must be a member of the [Epic Games organization](https://github.com/EpicGames) on GitHub to access this. If you aren't, the link returns a 404 error. * [The Example Project](https://github.com/spatialos/UnrealGDKExampleProject) -If you’re an Unreal game developer and you’re ready to try out the GDK, follow the [Get started guide](https://docs.improbable.io/unreal/latest/content/get-started/introduction). +If you’re an Unreal game developer and you’re ready to try out the GDK, follow the [Get started guide](https://documentation.improbable.io/gdk-for-unreal/docs/get-started-introduction). ## SpatialOS Unreal Engine fork changes In order to transform Unreal from a single-server engine to a distributed model, we made a number of small changes to Unreal Engine code. We are attempting to consolidate and remove (or submit as PR to Epic) as many of these changes as possible. You can see the changes in the [SpatialOS Unreal Engine fork repository](https://github.com/improbableio/UnrealEngine). @@ -23,18 +21,16 @@ In order to transform Unreal from a single-server engine to a distributed model, > In order to get access to this fork, you need to link your GitHub account to a verified Epic Games account, and to have agreed to Epic's license. You will not be able to use the GDK for Unreal without doing this first. To do this, see the [Unreal documentation](https://www.unrealengine.com/en-US/ue4-on-github). ## Recommended use -The GDK is in [alpha](https://docs.improbable.io/reference/latest/shared/release-policy#maturity-stages) so we can react to feedback and iterate on development quickly. To facilitate this, during our alpha stage we don't have a formal deprecation cycle for APIs and workflows. This means that everything and anything can change. - -We recommend using the GDK in projects in the early production or prototype stage. This ensures that your project's requirements are in line with the GDK's timeline. +To understand the feature-completeness, stability, performance, and support levels you can expect from the GDK, see the [product maturity lifecycle page](https://documentation.improbable.io/gdk-for-unreal/docs/product-maturity-lifecycle). For more information, visit the [development roadmap](https://github.com/spatialos/UnrealGDK/projects/1) and [Unreal features support](https://documentation.improbable.io/gdk-for-unreal/docs/unreal-features-support) pages, and contact us via our forums, or on Discord. ## Versioning and support -Please visit [this page](https://docs.improbable.io/unreal/latest/content/pricing-and-support/versioning-scheme) for a description of the GDK's versioning scheme, and which branches to use when developing. +Please visit [this page](https://documentation.improbable.io/gdk-for-unreal/docs/versioning-scheme) for a description of the GDK's versioning scheme, and which branches to use when developing. ## Contributions We welcome [Github issues](https://github.com/spatialos/UnrealGDK/issues) from all users, and accept public contributions subject to the signing of our Contributors License Agreement - please see our [contributions](CONTRIBUTING.md) policy for more details. ## Run into problems? -* [Troubleshooting](https://docs.improbable.io/unreal/latest/content/troubleshooting) +* [Troubleshooting](https://documentation.improbable.io/gdk-for-unreal/docs/troubleshooting) * [Known issues](https://github.com/spatialos/UnrealGDK/projects/2) ## Give us feedback @@ -43,6 +39,5 @@ We have released the GDK for Unreal this early in development because we want yo ------ * Your access to and use of the Unreal Engine is governed by the [Unreal Engine End User License Agreement](https://www.unrealengine.com/en-US/previous-versions/udk-licensing-resources?sessionInvalidated=true). Please ensure that you have agreed to those terms before you access or use the Unreal Engine. -* Version: alpha -(c) 2019 Improbable +(c) 2020 Improbable diff --git a/SpatialGDK/Documentation/README.md b/SpatialGDK/Documentation/README.md index c103841554..c2e6b7dc05 100644 --- a/SpatialGDK/Documentation/README.md +++ b/SpatialGDK/Documentation/README.md @@ -1,3 +1,3 @@ # The SpatialOS GDK for Unreal documentation -The GDK's documentation is available at https://docs.improbable.io/unreal/latest. \ No newline at end of file +The GDK's documentation is available at https://documentation.improbable.io/gdk-for-unreal/docs. \ No newline at end of file diff --git a/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKSimulatedPlayerDeployment.cpp b/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKSimulatedPlayerDeployment.cpp index 4542dc55bc..7d7a03ed9c 100644 --- a/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKSimulatedPlayerDeployment.cpp +++ b/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKSimulatedPlayerDeployment.cpp @@ -603,7 +603,7 @@ FReply SSpatialGDKSimulatedPlayerDeployment::OnStopClicked() void SSpatialGDKSimulatedPlayerDeployment::OnCloudDocumentationClicked() { FString WebError; - FPlatformProcess::LaunchURL(TEXT("https://docs.improbable.io/unreal/latest/content/cloud-deployment-workflow#build-server-worker-assembly"), TEXT(""), &WebError); + FPlatformProcess::LaunchURL(TEXT("https://documentation.improbable.io/gdk-for-unreal/docs/cloud-deployment-workflow#section-build-server-worker-assembly"), TEXT(""), &WebError); if (!WebError.IsEmpty()) { FNotificationInfo Info(FText::FromString(WebError)); diff --git a/SpatialGDK/SpatialGDK.uplugin b/SpatialGDK/SpatialGDK.uplugin index 2ec2574b5d..601a55b4f3 100644 --- a/SpatialGDK/SpatialGDK.uplugin +++ b/SpatialGDK/SpatialGDK.uplugin @@ -7,7 +7,7 @@ "Category": "SpatialOS", "CreatedBy": "Improbable Worlds, Ltd.", "CreatedByURL": "https://improbable.io", - "DocsURL": "https://docs.improbable.io/unreal/", + "DocsURL": "https://documentation.improbable.io/gdk-for-unreal/", "MarketplaceURL": "", "SupportURL": "https://forums.improbable.io/", "EnabledByDefault": true, From 9697ef1c0425a0fd2a3f4948177a20b49e2ef76b Mon Sep 17 00:00:00 2001 From: Oliver Balaam Date: Mon, 16 Mar 2020 16:23:44 +0000 Subject: [PATCH 28/30] Create log directory if it doesn't exist for the spatial output (#1863) (#1908) * Create log directory if it doesn't exist for the spatial output * Update SpatialGDK/Source/SpatialGDKServices/Private/SSpatialOutputLog.cpp Co-Authored-By: Michael Samiec Co-authored-by: Michael Samiec Co-authored-by: Joshua Huburn <31517089+joshuahuburn@users.noreply.github.com> Co-authored-by: Michael Samiec --- .../SpatialGDKServices/Private/SSpatialOutputLog.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/SpatialGDK/Source/SpatialGDKServices/Private/SSpatialOutputLog.cpp b/SpatialGDK/Source/SpatialGDKServices/Private/SSpatialOutputLog.cpp index 55bb79e6eb..901fbd156f 100644 --- a/SpatialGDK/Source/SpatialGDKServices/Private/SSpatialOutputLog.cpp +++ b/SpatialGDK/Source/SpatialGDKServices/Private/SSpatialOutputLog.cpp @@ -102,8 +102,12 @@ void SSpatialOutputLog::StartUpLogDirectoryWatcher(const FString& LogDirectory) // Watch the log directory for changes. if (!FPaths::DirectoryExists(LogDirectory)) { - UE_LOG(LogSpatialOutputLog, Error, TEXT("Local deployment log directory does not exist!")); - return; + UE_LOG(LogSpatialOutputLog, Log, TEXT("Spatial local deployment log directory '%s' does not exist. Will create it."), *LogDirectory); + if (!FPlatformFileManager::Get().GetPlatformFile().CreateDirectoryTree(*LogDirectory)) + { + UE_LOG(LogSpatialOutputLog, Error, TEXT("Could not create the spatial local deployment log directory. The Spatial Output window will not function.")); + return; + } } LogDirectoryChangedDelegate = IDirectoryWatcher::FDirectoryChanged::CreateRaw(this, &SSpatialOutputLog::OnLogDirectoryChanged); From db2cd465a711f7f9f2f9734c4de918d9066ef248 Mon Sep 17 00:00:00 2001 From: Oliver Balaam Date: Mon, 16 Mar 2020 16:48:38 +0000 Subject: [PATCH 29/30] Update SpatialGDK.uplugin (#1909) --- SpatialGDK/SpatialGDK.uplugin | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/SpatialGDK/SpatialGDK.uplugin b/SpatialGDK/SpatialGDK.uplugin index 601a55b4f3..70c6398442 100644 --- a/SpatialGDK/SpatialGDK.uplugin +++ b/SpatialGDK/SpatialGDK.uplugin @@ -1,6 +1,6 @@ { "FileVersion": 3, - "Version": 6, + "Version": 5, "VersionName": "0.8.1", "FriendlyName": "SpatialOS GDK for Unreal", "Description": "The SpatialOS Game Development Kit (GDK) for Unreal Engine allows you to host your game and combine multiple dedicated server instances across one seamless game world whilst using the Unreal Engine networking API.", From 68c66aba8f626ed6c3c7d4cbf3f4a4aa75592f50 Mon Sep 17 00:00:00 2001 From: Oliver Balaam Date: Mon, 16 Mar 2020 16:48:58 +0000 Subject: [PATCH 30/30] Update CHANGELOG.md (#1910) Co-authored-by: Michael Samiec --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a0fcf2f014..f821134058 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [`0.8.1-preview`] - 2020-03-16 ### Features: - **SpatialOS GDK for Unreal** > **Editor Settings** > **Region Settings** has been moved to **SpatialOS GDK for Unreal** > **Runtime Settings** > **Region Settings**. -- You can now choose which SpatialOS service region you want to use by adjusting the**Region where services are located** setting. You must use the service region that you're geographically located in. +- You can now choose which SpatialOS service region you want to use by adjusting the **Region where services are located** setting. You must use the service region that you're geographically located in. - Deployments can now be launched in China, when the **Region where services are located** is set to `CN`. - Updated the version of the local API service used by the UnrealGDK. - The Spatial output log will now be open by default.