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

Commit

Permalink
Merging final GDK for Unreal 0.11.0 release
Browse files Browse the repository at this point in the history
Release 0.11.0
  • Loading branch information
gdk-for-unreal-bot authored Sep 3, 2020
2 parents 9140900 + 6f7a703 commit 884b065
Show file tree
Hide file tree
Showing 258 changed files with 9,746 additions and 2,853 deletions.
14 changes: 14 additions & 0 deletions .buildkite/release.steps.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -88,3 +88,17 @@ steps:
concurrency: 1
concurrency_group: "unrealgdk-release"
<<: *common # This folds the YAML named anchor into this step. Overrides, if any, should follow, not precede.

# Stage 5: Mirror the release code from Github to Gitee
- block: "Unblock mirror code to gitee"
prompt: "This action will mirror all of the release code to gitee."

- trigger: platform-copybara
label: "Run platform-copybara"
depends_on: Release
build:
message: "Triggered from UnrealGDK Release"
commit: "HEAD"
branch: "master"
concurrency: 1
concurrency_group: "unrealgdk-release"
197 changes: 192 additions & 5 deletions CHANGELOG.md

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions OWNERS.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
filters:
'CHANGELOG\.md$':
approvers:
- sig-tech-writers
labels:
- docs/changelog
5 changes: 5 additions & 0 deletions OWNERS_ALIASES.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
aliases:
sig-tech-writers:
- anne-edwards # Anne Edwards
- ElleEss # Laura Holmwood
- SPPWilliams # Simon Williams
2 changes: 1 addition & 1 deletion RequireSetup
Original file line number Diff line number Diff line change
@@ -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.

60
61
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static void Main(string[] args)

if (help)
{
Console.WriteLine("Usage: <GameName> <Platform> <Configuration> <game.uproject> [-nocompile] <Additional UAT args>");
Console.WriteLine("Usage: <GameName> <Platform> <Configuration> <game.uproject> [-nobuild] [-nocompile] <Additional UAT args>");

Environment.Exit(exitCode);
}
Expand All @@ -36,8 +36,9 @@ public static void Main(string[] args)
var platform = args[1];
var configuration = args[2];
var projectFile = Path.GetFullPath(args[3]);
var noBuild = args.Count(arg => arg.ToLowerInvariant() == "-nobuild") > 0;
var noCompile = args.Count(arg => arg.ToLowerInvariant() == "-nocompile") > 0;
var additionalUATArgs = string.Join(" ", args.Skip(4).Where(arg => arg.ToLowerInvariant() != "-nocompile"));
var additionalUATArgs = string.Join(" ", args.Skip(4).Where(arg => (arg.ToLowerInvariant() != "-nobuild") && (arg.ToLowerInvariant() != "-nocompile")));

var stagingDir = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(projectFile), "../spatial", "build", "unreal"));
var outputDir = Path.GetFullPath(Path.Combine(Path.GetDirectoryName(projectFile), "../spatial", "build", "assembly", "worker"));
Expand Down Expand Up @@ -152,7 +153,7 @@ public static void Main(string[] args)
Common.RunRedirected(runUATBat, new[]
{
"BuildCookRun",
noCompile ? "-nobuild" : "-build",
noBuild ? "-nobuild" : "-build",
noCompile ? "-nocompile" : "-compile",
"-project=" + Quote(projectFile),
"-noP4",
Expand Down Expand Up @@ -195,13 +196,13 @@ public static void Main(string[] args)
Common.RunRedirected(runUATBat, new[]
{
"BuildCookRun",
"-build",
noBuild ? "-nobuild" : "-build",
noCompile ? "-nocompile" : "-compile",
"-project=" + Quote(projectFile),
"-noP4",
"-clientconfig=" + configuration,
"-serverconfig=" + configuration,
"-utf8output",
"-compile",
"-cook",
"-stage",
"-package",
Expand Down Expand Up @@ -260,7 +261,7 @@ public static void Main(string[] args)
Common.RunRedirected(runUATBat, new[]
{
"BuildCookRun",
noCompile ? "-nobuild" : "-build",
noBuild ? "-nobuild" : "-build",
noCompile ? "-nocompile" : "-compile",
"-project=" + Quote(projectFile),
"-noP4",
Expand Down Expand Up @@ -311,7 +312,7 @@ public static void Main(string[] args)
Common.RunRedirected(runUATBat, new[]
{
"BuildCookRun",
noCompile ? "-nobuild" : "-build",
noBuild ? "-nobuild" : "-build",
noCompile ? "-nocompile" : "-compile",
"-project=" + Quote(projectFile),
"-noP4",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ internal class DeploymentLauncher
{
private const string SIM_PLAYER_DEPLOYMENT_TAG = "simulated_players";
private const string DEPLOYMENT_LAUNCHED_BY_LAUNCHER_TAG = "unreal_deployment_launcher";
private const string TARGET_DEPLOYMENT_READY_TAG = "target_deployment_ready";

private const string CoordinatorWorkerName = "SimulatedPlayerCoordinator";

Expand Down Expand Up @@ -155,44 +156,62 @@ private static int CreateDeployment(string[] args, bool useChinaPlatform)
mainDeploymentName, mainDeploymentJsonPath, mainDeploymentSnapshotPath,
mainDeploymentRegion, mainDeploymentCluster, mainDeploymentTags, useChinaPlatform);

if (launchSimPlayerDeployment && DeploymentExists(deploymentServiceClient, projectName, simDeploymentName))
if (!launchSimPlayerDeployment)
{
// Don't launch a simulated player deployment. Wait for main deployment to be created and then return.
Console.WriteLine("Waiting for deployment to be ready...");
var result = createMainDeploymentOp.PollUntilCompleted().GetResultOrNull();
if (result == null)
{
Console.WriteLine("Failed to create the main deployment");
return 1;
}

Console.WriteLine("Successfully created the main deployment");
return 0;
}

if (DeploymentExists(deploymentServiceClient, projectName, simDeploymentName))
{
StopDeploymentByName(deploymentServiceClient, projectName, simDeploymentName);
}

// TODO: UNR-3550 - Re-add dynamic worker flags when supported with new runtime.
// We need to wait for the main deployment to be finished starting before we can launch the sim player deployment.
Console.WriteLine("Waiting for deployment to be ready...");
var result = createMainDeploymentOp.PollUntilCompleted().GetResultOrNull();
if (result == null)
// we are using the main deployment snapshot also for the sim player deployment, because we only need to specify a snapshot
// to be able to start the deployment. The sim players don't care about the actual snapshot.
var createSimDeploymentOp = CreateSimPlayerDeploymentAsync(deploymentServiceClient,
projectName, assemblyName, runtimeVersion, mainDeploymentName, simDeploymentName,
simDeploymentJson, mainDeploymentSnapshotPath, simDeploymentRegion, simDeploymentCluster,
simNumPlayers, useChinaPlatform);

// Wait for both deployments to be created.
Console.WriteLine("Waiting for deployments to be ready...");
var mainDeploymentResult = createMainDeploymentOp.PollUntilCompleted().GetResultOrNull();
if (mainDeploymentResult == null)
{
Console.WriteLine("Failed to create the main deployment");
return 1;
}

Console.WriteLine("Successfully created the main deployment");

if (launchSimPlayerDeployment)
var simPlayerDeployment = createSimDeploymentOp.PollUntilCompleted().GetResultOrNull();
if (simPlayerDeployment == null)
{
// we are using the main deployment snapshot also for the sim player deployment, because we only need to specify a snapshot
// to be able to start the deployment. The sim players don't care about the actual snapshot.
var createSimDeploymentOp = CreateSimPlayerDeploymentAsync(deploymentServiceClient,
projectName, assemblyName, runtimeVersion, mainDeploymentName, simDeploymentName,
simDeploymentJson, mainDeploymentSnapshotPath, simDeploymentRegion, simDeploymentCluster,
simNumPlayers, useChinaPlatform);
Console.WriteLine("Failed to create the simulated player deployment");
return 1;
}

// Wait for both deployments to be created.
Console.WriteLine("Waiting for simulated player deployment to be ready...");
Console.WriteLine("Successfully created the simulated player deployment");

var simPlayerDeployment = createSimDeploymentOp.PollUntilCompleted().GetResultOrNull();
if (simPlayerDeployment == null)
{
Console.WriteLine("Failed to create the simulated player deployment");
return 1;
}
// Update coordinator worker flag for simulated player deployment to notify target deployment is ready.
simPlayerDeployment.WorkerFlags.Add(new WorkerFlag
{
Key = TARGET_DEPLOYMENT_READY_TAG,
Value = "true",
WorkerType = CoordinatorWorkerName
});
deploymentServiceClient.UpdateDeployment(new UpdateDeploymentRequest { Deployment = simPlayerDeployment });

Console.WriteLine("Done! Simulated players will start to connect to your deployment");
}
Console.WriteLine("Done! Simulated players will start to connect to your deployment");
}
catch (Grpc.Core.RpcException e)
{
Expand Down Expand Up @@ -235,6 +254,13 @@ private static int CreateSimDeployments(string[] args, bool useChinaPlatform)
return 1;
}

var autoConnect = false;
if (!Boolean.TryParse(args[11], out autoConnect))
{
Console.WriteLine("Cannot parse the auto-connect flag.");
return 1;
}

try
{
var deploymentServiceClient = DeploymentServiceClient.Create(GetApiEndpoint(useChinaPlatform));
Expand All @@ -257,7 +283,21 @@ private static int CreateSimDeployments(string[] args, bool useChinaPlatform)
return 1;
}

Console.WriteLine("Done! Simulated players will start to connect to your deployment");
Console.WriteLine("Successfully created the simulated player deployment");

// Update coordinator worker flag for simulated player deployment to notify target deployment is ready.
simPlayerDeployment.WorkerFlags.Add(new WorkerFlag
{
Key = TARGET_DEPLOYMENT_READY_TAG,
Value = autoConnect.ToString().ToLower(),
WorkerType = CoordinatorWorkerName
});
deploymentServiceClient.UpdateDeployment(new UpdateDeploymentRequest { Deployment = simPlayerDeployment });

if (autoConnect)
{
Console.WriteLine("Done! Simulated players will start to connect to your deployment");
}
}
catch (Grpc.Core.RpcException e)
{
Expand Down Expand Up @@ -633,7 +673,7 @@ private static void ShowUsage()
Console.WriteLine("Usage:");
Console.WriteLine("DeploymentLauncher create <project-name> <assembly-name> <runtime-version> <main-deployment-name> <main-deployment-json> <main-deployment-snapshot> <main-deployment-region> <main-deployment-cluster> <main-deployment-tags> [<sim-deployment-name> <sim-deployment-json> <sim-deployment-region> <sim-deployment-cluster> <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', 'AP' and 'CN').");
Console.WriteLine("DeploymentLauncher createsim <project-name> <assembly-name> <runtime-version> <target-deployment-name> <sim-deployment-name> <sim-deployment-json> <sim-deployment-region> <sim-deployment-cluster> <sim-deployment-snapshot-path> <num-sim-players>");
Console.WriteLine("DeploymentLauncher createsim <project-name> <assembly-name> <runtime-version> <target-deployment-name> <sim-deployment-name> <sim-deployment-json> <sim-deployment-region> <sim-deployment-cluster> <sim-deployment-snapshot-path> <num-sim-players> <auto-connect>");
Console.WriteLine($" Starts a simulated player deployment. Can be started in a different region from the target deployment ('EU', 'US', 'AP' and 'CN').");
Console.WriteLine("DeploymentLauncher stop <project-name> [deployment-id]");
Console.WriteLine(" Stops the specified deployment within the project.");
Expand All @@ -655,7 +695,7 @@ private static int Main(string[] args)

if (args.Length == 0 ||
(args[0] == "create" && (args.Length != 15 && args.Length != 10)) ||
(args[0] == "createsim" && args.Length != 11) ||
(args[0] == "createsim" && args.Length != 12) ||
(args[0] == "stop" && (args.Length != 2 && args.Length != 3)) ||
(args[0] == "list" && args.Length != 2))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Improbable.Collections;
using Improbable.Worker;

Expand All @@ -23,6 +24,7 @@ internal class ManagedWorkerCoordinator : AbstractWorkerCoordinator
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";
private const string TargetDeploymentReadyWorkerFlag = "target_deployment_ready";

private const int AverageDelayMillisBetweenConnections = 1500;
private const int PollTargetDeploymentReadyIntervalMillis = 5000;
Expand Down Expand Up @@ -60,8 +62,8 @@ internal class ManagedWorkerCoordinator : AbstractWorkerCoordinator
/// All following arguments will be passed to the simulated player instance.
/// These arguments can contain the following placeholders, which will be replaced by the coordinator:
/// `<IMPROBABLE_SIM_PLAYER_WORKER_ID>` will be replaced with the worker id of the simulated player
/// `<LOGIN_TOKEN>` if a development auth token is specified as a worker flag, this will be replaced by the generated development auth login token
/// `<PLAYER_IDENTITY_TOKEN>` if both a development auth token and a target deployment are specified through the worker flags, this will be replaced by the generated development auth player identity token
/// `<DEV_AUTH_TOKEN>` if a development auth token is specified as a worker flag, this will be replaced by the generated development auth login token
/// `<TARGET_DEPLOYMENT>` will be replaced with the name of the deployment the simulated player clients will connect to
///
/// WORKER FLAGS
/// Additionally, the following worker flags are expected by the coordinator:
Expand Down Expand Up @@ -121,7 +123,14 @@ public override void Run()
Option<string> targetDeploymentOpt = connection.GetWorkerFlag(TargetDeploymentWorkerFlag);
int deploymentTotalNumSimulatedPlayers = int.Parse(GetWorkerFlagOrDefault(connection, DeploymentTotalNumSimulatedPlayersWorkerFlag, "100"));

Logger.WriteLog($"Starting {NumSimulatedPlayersToStart} simulated players.");
Logger.WriteLog("Waiting for target deployment to become ready.");
var deploymentReadyTask = Task.Run(() => WaitForTargetDeploymentReady(connection));
if (!deploymentReadyTask.Wait(TimeSpan.FromMinutes(15)))
{
throw new TimeoutException("Timed out waiting for the deployment to be ready. Waited 15 minutes.");
}

Logger.WriteLog($"Target deployment is ready. Starting {NumSimulatedPlayersToStart} simulated players.");
Thread.Sleep(InitialStartDelayMillis);

var maxDelayMillis = deploymentTotalNumSimulatedPlayers * AverageDelayMillisBetweenConnections;
Expand Down Expand Up @@ -197,5 +206,20 @@ private static string GetWorkerFlagOrDefault(Connection connection, string flagN

return defaultValue;
}

private void WaitForTargetDeploymentReady(Connection connection)
{
while (true)
{
var readyFlagOpt = connection.GetWorkerFlag(TargetDeploymentReadyWorkerFlag);
if (readyFlagOpt.HasValue && readyFlagOpt.Value.ToLower() == "true")
{
// Ready.
break;
}

Thread.Sleep(PollTargetDeploymentReadyIntervalMillis);
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,14 @@
"${IMPROBABLE_RECEPTIONIST_PORT}",
"${IMPROBABLE_WORKER_ID}",
"coordinator_start_delay_millis=10000",


"127.0.0.1",
"+workerType",
"UnrealClient",
"+loginToken",
"<LOGIN_TOKEN>",
"+playerIdentityToken",
"<PLAYER_IDENTITY_TOKEN>",
"+deployment",
"<TARGET_DEPLOYMENT>",
"+devAuthToken",
"<DEV_AUTH_TOKEN>",
"+workerId",
"<IMPROBABLE_SIM_PLAYER_WORKER_ID>",
"+useExternalIpForBridge",
Expand Down
12 changes: 5 additions & 7 deletions SpatialGDK/Build/Scripts/BuildWorker.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
@echo off

if [%4] == [] goto :MissingParams

rem Try and build as a project plugin first, check for a project plugin structure.
set UNREAL_PROJECT_DIR="%~dp0..\..\..\..\..\"
set FOUND_UPROJECT=""
Expand All @@ -21,6 +19,9 @@ goto :Build

:BuildAsEnginePlugin
rem If we are running as an Engine plugin then we need a full path to the .uproject file!
rem Path to the SpatialGDK build tool as an Engine plugin.
set BUILD_EXE_PATH="%~dp0..\..\Binaries\ThirdParty\Improbable\Programs\Build.exe"
if [%4] == [] goto :MissingParams
set UPROJECT=%4

if not exist %UPROJECT% (
Expand All @@ -34,13 +35,9 @@ for %%i in (%UPROJECT%) do (
set UNREAL_PROJECT_DIR="%%~di%%~pi"
)

rem Path to the SpatialGDK build tool as an Engine plugin.
set BUILD_EXE_PATH="%~dp0..\..\Binaries\ThirdParty\Improbable\Programs\Build.exe"
set SPATIAL_DIR=%UNREAL_PROJECT_DIR%..\spatial\


:Build

if not exist %SPATIAL_DIR% (
echo Could not find the project's 'spatial' directory! Please ensure your input arguments are correct and your GDK is correctly installed.
exit /b 1
Expand Down Expand Up @@ -69,5 +66,6 @@ popd
exit /b %ERRORLEVEL%

:MissingParams
echo Missing input arguments! Usage: "<GameName> <Platform> <Configuration> <game.uproject> [-nocompile] <Additional UAT args>"
echo Missing input arguments!
%BUILD_EXE_PATH% --help
exit /b 1
Loading

0 comments on commit 884b065

Please sign in to comment.