Skip to content
This repository has been archived by the owner on Aug 29, 2024. It is now read-only.

0.6.3 #1561

Merged
merged 6 commits into from
Dec 5, 2019
Merged

0.6.3 #1561

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
23 changes: 13 additions & 10 deletions Setup.bat
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down
22 changes: 13 additions & 9 deletions Setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
@@ -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
{
Expand All @@ -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)
{
Expand Down Expand Up @@ -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)
{
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -220,7 +233,7 @@ private static void StopDeploymentByName(DeploymentServiceClient deploymentServi
private static Operation<Deployment, CreateDeploymentMetadata> 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,
Expand Down Expand Up @@ -268,7 +281,7 @@ private static Operation<Deployment, CreateDeploymentMetadata> CreateMainDeploym
private static Operation<Deployment, CreateDeploymentMetadata> 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(
Expand Down Expand Up @@ -356,13 +369,14 @@ private static Operation<Deployment, CreateDeploymentMetadata> 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;
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -462,20 +477,20 @@ private static void ShowUsage()
{
Console.WriteLine("Usage:");
Console.WriteLine("DeploymentLauncher create <project-name> <assembly-name> <main-deployment-name> <main-deployment-json> <main-deployment-snapshot> <main-deployment-region> [<sim-deployment-name> <sim-deployment-json> <sim-deployment-region> <num-sim-players>]");
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 <project-name> [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 <project-name> <main-deployment-region> [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 <project-name>");
Console.WriteLine("DeploymentLauncher list <project-name> <main-deployment-region>");
Console.WriteLine(" Lists all active deployments within the specified project that are started by the deployment launcher.");
}

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;
Expand Down
2 changes: 1 addition & 1 deletion SpatialGDK/Extras/spot.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20190626.145947.9ed060f1af
20191029.144741.87a7d78768
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion SpatialGDK/Source/SpatialGDK/Public/SpatialConstants.h
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@ bool SpatialGDKCloudStop()
const USpatialGDKEditorSettings* SpatialGDKSettings = GetDefault<USpatialGDKEditorSettings>();

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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,17 @@ namespace ERegionCode
US = 1,
EU,
AP,
CN
};
}

UENUM()
namespace EServicesRegion
{
enum Type
{
Default,
CN
};
}

Expand Down Expand Up @@ -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<EServicesRegion::Type> ServicesRegion;

static bool IsAssemblyNameValid(const FString& Name);
static bool IsProjectNameValid(const FString& Name);
static bool IsDeploymentNameValid(const FString& Name);
Expand Down Expand Up @@ -452,4 +466,6 @@ class SPATIALGDKEDITOR_API USpatialGDKEditorSettings : public UObject
}

bool IsDeploymentConfigurationValid() const;

FORCEINLINE bool IsRunningInChina() const { return ServicesRegion == EServicesRegion::CN; }
};
Loading