Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
05c95b9
Add command line cheats to set lobby and match timers (#39)
yumnuska Aug 1, 2019
4dca10c
Convert InformPlayerCount into a CrossServer RPC (#41)
cmsmithio Aug 1, 2019
5100f3d
Merge pull request #50 from spatialos/release
improbable-valy Aug 19, 2019
18344d3
update splash (#51)
oblm Aug 23, 2019
c30d4c5
Finding engine when path contains spaces fixed. (#56)
bartoszrudzki-improbable Sep 12, 2019
4d5dc72
UNR-2019: Example Project CI (#57)
ieva-improbable Sep 26, 2019
960f18b
Feature: CrashBot_Gym fixes for Offloading Tutorial (#55)
mattyoung-improbable Sep 30, 2019
a1302f2
[UNR-2093] Upgrade to SpatialOS 14.1.0 (#58)
mironec Sep 30, 2019
0ea4607
Extend CI Slack output (#61)
ieva-improbable Sep 30, 2019
ff3fba4
UNR 2168: Remove QBI toggle (#59)
sjtsilvester Sep 30, 2019
0ed0682
Fix UNR-2188
oblm Oct 3, 2019
1f8e984
Merge pull request #63 from spatialos/0.7.0-preview-rc
oblm Oct 11, 2019
36e6f45
Fix default launch config by removing comma (#65)
Joe-Improbable Oct 21, 2019
0e5fa68
Adapt Example Project nightly CI to use Setup.bat (#64)
mironec Oct 21, 2019
73efc02
Merge preview into master (#66)
joshuahuburn Oct 24, 2019
f181163
Feature/unr 2101 allow scheduled builds (#68)
ImprobableVlad Nov 4, 2019
cb6aa0c
Task/unr 1905 improve slack hooks (#69)
ImprobableVlad Nov 5, 2019
9bd9fe9
truncate long build messages (#71)
ImprobableVlad Nov 6, 2019
346c539
2 hour session duration (#67)
Nov 6, 2019
22081be
15 seconds to 3 seconds (#73)
Nov 6, 2019
a789b61
make slack message pretty (#72)
ImprobableVlad Nov 6, 2019
d0fa4ce
Bugfix/unr 1905 truncate string correctly (#74)
ImprobableVlad Nov 7, 2019
19076f0
[GV-115] Enable multiple engines in CI with Example Project (#76)
mironec Nov 18, 2019
cc2b1fe
[UNR-2425][MS] Fixing bug with sim players not moving. (#77)
MatthewSandfordImprobable Nov 28, 2019
fdbfd33
0.8.0-preview (#83)
joshuahuburn Dec 17, 2019
e4b0f0c
0.8.1 preview rc > preview (#118)
oblm Mar 17, 2020
170d48f
Merge branch 'release' into preview
oblm Mar 17, 2020
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
11 changes: 11 additions & 0 deletions .buildkite/nightly.definition.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
agent_queue_id: trigger-pipelines
description: Nightly build and deployment of Unreal Example project
github:
branch_configuration: []
default_branch: master
pull_request_branch_filter_configuration: []
teams:
- name: Everyone
permission: BUILD_AND_READ
- name: gbu/develop/unreal
permission: MANAGE_BUILD_AND_READ
49 changes: 49 additions & 0 deletions .buildkite/nightly.steps.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
script_runner: &script_runner
agents:
- "agent_count=8"
- "capable_of_building=platform"
- "environment=production"
- "machine_type=quarter"
- "permission_set=builder"
- "platform=linux"
- "queue=${CI_LINUX_BUILDER_QUEUE:-v3-1572524284-e64831bf1e88b227-------z}"
- "scaler_version=2"
- "working_hours_time_zone=london"

common: &common
agents:
- "agent_count=1"
- "capable_of_building=gdk-for-unreal"
- "environment=production"
- "machine_type=quad"
- "permission_set=builder"
- "platform=windows"
- "scaler_version=2"
- "queue=${CI_WINDOWS_BUILDER_QUEUE:-v4-2019-11-07-bk3700-fbffad576b9676d7}" # Has FASTbuild disabled
timeout_in_minutes: 60 # TODO(ENG-548): reduce timeout once agent-cold-start is optimised.
retry:
automatic:
# This is designed to trap and retry failures because agent lost connection. Agent exits with -1 in this case.
- exit_status: -1
limit: 3
plugins:
- ca-johnson/taskkill#v4.1: ~

# NOTE: step labels turn into commit-status names like {org}/{repo}/{pipeline}/{step-label}, lower-case and hyphenated.
# These are then relied on to have stable names by other things, so once named, please beware renaming has consequences.

steps:
- label: "generate-pipeline-steps"
commands:
- "chmod -R +rwx ci"
- "ci/generate-pipeline-steps.sh"
env:
ENGINE_VERSION: "${ENGINE_VERSION}"
<<: *script_runner

- wait

- label: "slack-notify"
if: build.env("SLACK_NOTIFY") == "true" || build.branch == "master"
command: "powershell -NoProfile -NonInteractive -InputFormat Text -Command ./ci/slack-notify.ps1"
<<: *common # This folds the YAML named anchor into this step. Overrides, if any, should follow, not precede.
4 changes: 2 additions & 2 deletions FindEngine.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ set UNREAL_ENGINE=""
set UPROJECT=""

rem First find the .uproject
for /f "delims=" %%A in (' powershell -Command "Get-ChildItem %~dp0 -Depth 1 -Filter *.uproject -File | %% {$_.FullName}" ') do set UPROJECT="%%A"
for /f "delims=" %%A in (' powershell -Command "Get-ChildItem '%~dp0' -Depth 1 -Filter *.uproject -File | %% {$_.FullName}" ') do set UPROJECT="%%A"

if %UPROJECT%=="" (
echo Error: Could not find uproject. Please make sure you have passed in the project directory correctly.
Expand All @@ -18,7 +18,7 @@ if %UPROJECT%=="" (
echo Using uproject: %UPROJECT%

rem Get the Engine association from the uproject.
for /f "delims=" %%A in (' powershell -Command "(Get-Content %UPROJECT% | ConvertFrom-Json).EngineAssociation" ') do set ENGINE_ASSOCIATION=%%A
for /f "delims=" %%A in (' powershell -Command "(Get-Content '%UPROJECT%' | ConvertFrom-Json).EngineAssociation" ') do set ENGINE_ASSOCIATION=%%A

echo Engine association for uproject is: %ENGINE_ASSOCIATION%

Expand Down
2 changes: 1 addition & 1 deletion Game/Config/DefaultSpatialGDKEditorSettings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ bDeleteDynamicEntities=True
bGenerateDefaultLaunchConfig=True
bStopSpatialOnExit=False
SpatialOSSnapshotFile=default.snapshot
LaunchConfigDesc=(Template="w2_r0500_e5",World=(Dimensions=(X=2000,Y=2000),ChunkEdgeLengthMeters=5,StreamingQueryIntervalSeconds=4,SnapshotWritePeriodSeconds=0,LegacyFlags=(("bridge_qos_max_timeout", "0"),("bridge_soft_handover_enabled", "false"),("enable_chunk_interest", "false")),LegacyJavaParams=()),ServerWorkers=((WorkerTypeName="UnrealWorker")))
LaunchConfigDesc=(Template="w2_r0500_e5",World=(Dimensions=(X=2000,Y=2000),ChunkEdgeLengthMeters=5,SnapshotWritePeriodSeconds=0,LegacyFlags=(("bridge_qos_max_timeout", "0"),("bridge_soft_handover_enabled", "false")),LegacyJavaParams=()),ServerWorkers=((WorkerTypeName="UnrealWorker")))
bGeneratePlaceholderEntitiesInSnapshot=True

3 changes: 1 addition & 2 deletions Game/Config/DefaultSpatialGDKSettings.ini
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ OpsUpdateRate=1000.000000
bEnableHandover=True
MaxNetCullDistanceSquared=900000000.000000
QueuedIncomingRPCWaitTime=1.000000
bUsingQBI=True
PositionUpdateFrequency=1.000000
PositionDistanceThreshold=100.000000
bEnableMetrics=True
Expand All @@ -30,4 +29,4 @@ DefaultWorkerType=(WorkerTypeName="UnrealWorker")
bEnableOffloading=False
ActorGroups=()
ServerWorkerTypes=("UnrealWorker")

ServicesRegion=Default
Binary file modified Game/Content/Characters/BP_Base_Character.uasset
Binary file not shown.
Binary file modified Game/Content/Characters/BP_FPS_Character.uasset
Binary file not shown.
Binary file modified Game/Content/Controllers/BP_GDK_PlayerController.uasset
Binary file not shown.
Binary file modified Game/Content/GameMode/BP_DeathmatchGameState.uasset
Binary file not shown.
Binary file modified Game/Content/GameMode/BP_PlayerState.uasset
Binary file not shown.
Binary file modified Game/Content/Splash/EdSplash.bmp
Binary file not shown.
Binary file modified Game/Content/Splash/Splash.bmp
Binary file not shown.
2 changes: 0 additions & 2 deletions Game/Source/GDKShooter.Target.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,5 @@ public GDKShooterTarget(TargetInfo Target) : base(Target)
{
Type = TargetType.Game;
ExtraModuleNames.Add("GDKShooter");
// TODO: UNR-1791 for long-term fix
GlobalDefinitions.Add("UE_ALLOW_MAP_OVERRIDE_IN_SHIPPING=1");
}
}
15 changes: 2 additions & 13 deletions Game/Source/GDKShooter/Private/Controllers/GDKPlayerController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,10 @@ AGDKPlayerController::AGDKPlayerController()

}

void AGDKPlayerController::BeginPlay()
{
Super::BeginPlay();

if (PlayerState)
{
if (UPlayerPublisher* PlayerPublisher = Cast<UPlayerPublisher>(GetWorld()->GetGameState()->GetComponentByClass(UPlayerPublisher::StaticClass())))
{
PlayerPublisher->PublishPlayer(PlayerState, EPlayerProgress::Connected);
}
}
}

void AGDKPlayerController::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);

if (GetPawn())
{
LatestPawnYaw = GetPawn()->GetActorRotation().Yaw;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ bool UDeploymentSnapshotTemplate::WriteToSnapshotOutput(Worker_SnapshotOutputStr
// Serialize Session component data
Worker_ComponentData SessionComponentData{};
SessionComponentData.component_id = 1000;
SessionComponentData.schema_type = Schema_CreateComponentData(1000);
SessionComponentData.schema_type = Schema_CreateComponentData();
Schema_Object* SessionComponentDataObject = Schema_GetComponentDataFields(SessionComponentData.schema_type);
Schema_AddInt32(SessionComponentDataObject, 1, 1);

Worker_ComponentData DeploymentComponentData{};
DeploymentComponentData.component_id = 1001;
DeploymentComponentData.schema_type = Schema_CreateComponentData(1001);
DeploymentComponentData.schema_type = Schema_CreateComponentData();

Components.Add(SpatialGDK::Position(SpatialGDK::Origin).CreatePositionData());
Components.Add(SpatialGDK::Metadata(TEXT("Session")).CreateMetadataData());
Expand All @@ -46,7 +46,8 @@ bool UDeploymentSnapshotTemplate::WriteToSnapshotOutput(Worker_SnapshotOutputStr
SessionEntity.component_count = Components.Num();
SessionEntity.components = Components.GetData();

bool success = Worker_SnapshotOutputStream_WriteEntity(OutputStream, &SessionEntity) != 0;
Worker_SnapshotOutputStream_WriteEntity(OutputStream, &SessionEntity);
bool success = Worker_SnapshotOutputStream_GetState(OutputStream).stream_state == WORKER_STREAM_STATE_GOOD;
if (success) {
NextEntityId++;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include "SpatialGameInstance.h"
#include "TimerManager.h"
#include "SpatialGDKSettings.h"
#include "SpatialWorkerConnection.h"

#include "GDKLogging.h"
Expand All @@ -15,79 +16,36 @@ void ADeploymentsPlayerController::BeginPlay()

bShowMouseCursor = true;

QueryPIT();
}
USpatialGameInstance* SpatialGameInstance = GetGameInstance<USpatialGameInstance>();
SpatialWorkerConnection = SpatialGameInstance->GetSpatialWorkerConnection();

void ADeploymentsPlayerController::EndPlay(const EEndPlayReason::Type Reason)
{
GetWorld()->GetTimerManager().ClearAllTimersForObject(this);
}

void OnLoginTokens(void* UserData, const Worker_Alpha_LoginTokensResponse* LoginTokens)
{
ADeploymentsPlayerController* contoller = static_cast<ADeploymentsPlayerController*>(UserData);
if (LoginTokens->status.code == WORKER_CONNECTION_STATUS_CODE_SUCCESS)
{
UE_LOG(LogGDK, Log, TEXT("Success: Login Token Count %d"), LoginTokens->login_token_count);
contoller->Populate(LoginTokens);
}
else
if (SpatialWorkerConnection == nullptr)
{
UE_LOG(LogGDK, Log, TEXT("Failure: Error %s"), UTF8_TO_TCHAR(LoginTokens->status.detail));
// We might not be using spatial networking in which case SpatialWorkerConnection will not exist so we should just return
return;
}
}

void OnPlayerIdentityToken(void* UserData, const Worker_Alpha_PlayerIdentityTokenResponse* PIToken)
{
if (PIToken->status.code == WORKER_CONNECTION_STATUS_CODE_SUCCESS)
{
UE_LOG(LogGDK, Log, TEXT("Success: Received PIToken: %s"), UTF8_TO_TCHAR(PIToken->player_identity_token));
ADeploymentsPlayerController* controller = static_cast<ADeploymentsPlayerController*>(UserData);
controller->LatestPITokenData = PIToken->player_identity_token;
controller->LatestPIToken = UTF8_TO_TCHAR(PIToken->player_identity_token);

if (!controller->GetWorld()->GetTimerManager().IsTimerActive(controller->QueryDeploymentsTimer))
FString SpatialWorkerType = SpatialGameInstance->GetSpatialWorkerType().ToString();
SpatialWorkerConnection->RegisterOnLoginTokensCallback([this](const Worker_Alpha_LoginTokensResponse* Deployments){
Populate(Deployments);
if (!GetWorld()->GetTimerManager().IsTimerActive(QueryDeploymentsTimer))
{
controller->GetWorld()->GetTimerManager().SetTimer(controller->QueryDeploymentsTimer, controller, &ADeploymentsPlayerController::QueryDeployments, 5.0f, true, 0.0f);
GetWorld()->GetTimerManager().SetTimer(QueryDeploymentsTimer, this, &ADeploymentsPlayerController::ScheduleRefreshDeployments, 10.0f, true, 0.0f);
}
}
else
return true;
});

if (GetDefault<USpatialGDKSettings>()->bUseDevelopmentAuthenticationFlow)
{
UE_LOG(LogGDK, Log, TEXT("Failure: Error %s"), UTF8_TO_TCHAR(PIToken->status.detail));
ADeploymentsPlayerController* controller = static_cast<ADeploymentsPlayerController*>(UserData);

if (controller->GetWorld()->GetTimerManager().IsTimerActive(controller->QueryDeploymentsTimer))
{
controller->GetWorld()->GetTimerManager().ClearTimer(controller->QueryDeploymentsTimer);
}
SpatialWorkerConnection->Connect(true, 0);
}
}

void ADeploymentsPlayerController::QueryDeployments()
{
Worker_Alpha_LoginTokensRequest* LTParams = new Worker_Alpha_LoginTokensRequest();
LTParams->player_identity_token = LatestPITokenData;
LTParams->worker_type = "UnrealClient";
Worker_Alpha_LoginTokensResponseFuture* LTFuture = Worker_Alpha_CreateDevelopmentLoginTokensAsync("locator.improbable.io", 444, LTParams);
Worker_Alpha_LoginTokensResponseFuture_Get(LTFuture, nullptr, this, OnLoginTokens);
}

void ADeploymentsPlayerController::QueryPIT()
void ADeploymentsPlayerController::EndPlay(const EEndPlayReason::Type Reason)
{
Worker_Alpha_PlayerIdentityTokenRequest* PITParams = new Worker_Alpha_PlayerIdentityTokenRequest();
// Replace this string with a dev auth token, see docs for information on how to generate one of these
PITParams->development_authentication_token = "REPLACE ME";
PITParams->player_id = "Player Id";
PITParams->display_name = "";
PITParams->metadata = "";
PITParams->use_insecure_connection = false;

Worker_Alpha_PlayerIdentityTokenResponseFuture* PITFuture = Worker_Alpha_CreateDevelopmentPlayerIdentityTokenAsync("locator.improbable.io", 444, PITParams);

if (PITFuture != nullptr)
{
Worker_Alpha_PlayerIdentityTokenResponseFuture_Get(PITFuture, nullptr, this, OnPlayerIdentityToken);
}
if (SpatialWorkerConnection != nullptr)
SpatialWorkerConnection->RegisterOnLoginTokensCallback([](const Worker_Alpha_LoginTokensResponse* Deployments){return false;});
GetWorld()->GetTimerManager().ClearAllTimersForObject(this);
}

FDeploymentInfo Parse(const Worker_Alpha_LoginTokenDetails LoginToken)
Expand Down Expand Up @@ -137,12 +95,19 @@ void ADeploymentsPlayerController::Populate(const Worker_Alpha_LoginTokensRespon

void ADeploymentsPlayerController::JoinDeployment(const FString& LoginToken)
{
if (SpatialWorkerConnection == nullptr)
{
UE_LOG(LogGDK, Error, TEXT("Failure: failed to Join Deployment caused by SpatialWorkerConnection is nullptr"));
return;
}

const FLocatorConfig& LocatorConfig = SpatialWorkerConnection->LocatorConfig;
FURL TravelURL;
TravelURL.Host = TEXT("locator.improbable.io");
TravelURL.Host = LocatorConfig.LocatorHost;
TravelURL.AddOption(TEXT("locator"));
TravelURL.AddOption(*FString::Printf(TEXT("playeridentity=%s"), *LatestPIToken));
TravelURL.AddOption(*FString::Printf(TEXT("playeridentity=%s"), *LocatorConfig.PlayerIdentityToken));
TravelURL.AddOption(*FString::Printf(TEXT("login=%s"), *LoginToken));

OnLoadingStarted.Broadcast();

ClientTravel(TravelURL.ToString(), TRAVEL_Absolute, false);
Expand All @@ -152,3 +117,9 @@ void ADeploymentsPlayerController::SetLoadingScreen(UUserWidget* LoadingScreen)
{
GetGameInstance()->GetGameViewportClient()->AddViewportWidgetContent(LoadingScreen->TakeWidget());
}

void ADeploymentsPlayerController::ScheduleRefreshDeployments()
{
if (SpatialWorkerConnection != nullptr)
SpatialWorkerConnection->RequestDeploymentLoginTokens();
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,21 @@
#include "LobbyTimerComponent.h"
#include "GDKLogging.h"
#include "GameFramework/Actor.h"
#include "Misc/CommandLine.h"

void ULobbyTimerComponent::BeginPlay()
{
#if !UE_BUILD_SHIPPING
// Developer cheat so you don't have to wait for a long time before entering a match.
const TCHAR* CommandLine = FCommandLine::Get();
FParse::Value(CommandLine, TEXT("lobbytime"), DefaultTimerDuration);
FParse::Value(CommandLine, TEXT("lobbyminplayers"), MinimumPlayersToStartCountdown);
#endif
bAutoStart = (MinimumPlayersToStartCountdown == 0);
Super::BeginPlay();
}

void ULobbyTimerComponent::InformOfPlayerCount(int32 PlayerCount)
void ULobbyTimerComponent::ServerInformOfPlayerCount_Implementation(int32 PlayerCount)
{
if (bHasTimerFinished || !GetOwner()->HasAuthority())
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
// Copyright (c) Improbable Worlds Ltd, All Rights Reserved

#include "MatchTimerComponent.h"
#include "Misc/CommandLine.h"


void UMatchTimerComponent::BeginPlay()
{
#if !UE_BUILD_SHIPPING
// Developer cheat so you can run an arbitrarily long match for testing.
const TCHAR* CommandLine = FCommandLine::Get();
FParse::Value(CommandLine, TEXT("matchtime"), DefaultTimerDuration);
#endif
Super::BeginPlay();
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ void USpatialSessionStateComponent::SendStateUpdate(EGDKSessionProgress SessionP
Worker_EntityId target_entity_id = SessionEntityId;
Worker_ComponentUpdate component_update = {};
component_update.component_id = SessionComponentId;
component_update.schema_type = Schema_CreateComponentUpdate(SessionComponentId);
component_update.schema_type = Schema_CreateComponentUpdate();
Schema_Object* fields_object = Schema_GetComponentUpdateFields(component_update.schema_type);
Schema_AddInt32(fields_object, 1, SessionState);
SpatialNetDriver->Connection->SendComponentUpdate(target_entity_id, &component_update);
Expand Down
6 changes: 6 additions & 0 deletions Game/Source/GDKShooter/Private/UI/GDKWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "Components/ControllerEventsComponent.h"
#include "Components/GDKMovementComponent.h"
#include "Components/HealthComponent.h"
#include "EngineClasses/SpatialGameInstance.h"
#include "Game/Components/LobbyTimerComponent.h"
#include "Game/Components/MatchTimerComponent.h"
#include "Game/Components/PlayerCountingComponent.h"
Expand Down Expand Up @@ -106,6 +107,11 @@ void UGDKWidget::LeaveGame(const FString& TargetMap)
FURL TravelURL;
TravelURL.Map = *TargetMap;

if (USpatialGameInstance* GameInstance = Cast<USpatialGameInstance>(GetGameInstance()))
{
GameInstance->GetSpatialWorkerConnection()->DestroyConnection();
}

GetOwningPlayer()->ClientTravel(TravelURL.ToString(), TRAVEL_Absolute, false /*bSeamless*/);

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class GDKSHOOTER_API AGDKPlayerController : public APlayerController
public:
AGDKPlayerController();

virtual void BeginPlay() override;
virtual void Tick(float DeltaTime) override;

FPawnEvent& OnPawn() { return PawnEvent; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

#include "CoreMinimal.h"
#include "Utils/SnapshotGenerationTemplate.h"
#include <WorkerSDK/improbable/c_worker.h>

#include "DeploymentSnapshotTemplate.generated.h"


Expand Down
Loading