Skip to content
This repository was archived by the owner on Jan 18, 2022. It is now read-only.

Commit 618c28c

Browse files
author
Jamie Brynes
authored
Worker SDK 14.0.0 upgrade (#1112)
1 parent 2545d14 commit 618c28c

File tree

83 files changed

+309
-635
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

83 files changed

+309
-635
lines changed

CHANGELOG.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,20 @@
55
### Breaking Changes
66

77
- Renamed the public field `AnonymousAuthenticationPort` to `LocatorPort` on the `AlphaLocatorFlow` class and the `RuntimeConfigDefaults` static class. [#1105](https://github.com/spatialos/gdk-for-unity/pull/1105)
8+
- Upgraded to Worker SDK `14.0.1`. This brings a number of breaking changes. [#1112](https://github.com/spatialos/gdk-for-unity/pull/1112)
9+
- `Vector3f` and `Vector3d` are no longer available in the schema standard library.
10+
- The `Improbable.Coordinates.ToSpatialVector3d()` method has been removed.
11+
- `LocatorFlow` and `AlphaLocatorFlow` have been merged.
12+
- The implementation of the old `LocatorFlow` has been removed.
13+
- The `ConnectionService.AlphaLocator` enum value has been removed.
14+
- The `ProjectName`, `SteamDeploymentTag`, and `SteamTicket` constants have been removed from the `RuntimeConfigNames` static class.
815

916
### Added
1017

1118
- Added the ability to connect to an arbitrary host/port combo for the `AlphaLocatorFlow`. [#1105](https://github.com/spatialos/gdk-for-unity/pull/1105)
1219
- Added a `SpatialdManager` class for managing local deployments with `SpatialD` into `io.improbable.gdk.testutils`. [#1104](https://github.com/spatialos/gdk-for-unity/pull/1104)
1320
- Added the ability to specify a snapshot to be used when launching a deployment in the Editor. [#1098](https://github.com/spatialos/gdk-for-unity/pull/1098)
21+
- Added the ability to select the modular UDP network type as part of the Worker SDK 14.0.1 upgrade. [#1112](https://github.com/spatialos/gdk-for-unity/pull/1112)
1422

1523
### Changed
1624

@@ -32,6 +40,7 @@
3240
- Added `spot` downloading to `init.sh` & `init.ps` into the `io.improbable.worker.sdk` package. [#1104](https://github.com/spatialos/gdk-for-unity/pull/1104)
3341
- Added tests for the `AlphaLocatorFlow` class. [#1108](https://github.com/spatialos/gdk-for-unity/pull/1108)
3442
- `Option<T>` is now explicitly immutable as a `readonly struct`. [#1110](https://github.com/spatialos/gdk-for-unity/pull/1110)
43+
- Removed unused arguments from worker configuration files. [#1112](https://github.com/spatialos/gdk-for-unity/pull/1112)
3544

3645
## `0.2.6` - 2019-08-05
3746

UPGRADE_GUIDE.md

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,80 @@
11
# Upgrade Guide
22

3+
## From `0.2.6` to `0.2.7`
4+
5+
### Worker SDK `14.0.1` upgrade
6+
7+
The Worker SDK upgrade introduces breaking changes to the connection flow, and removes the `Vector3f` and `Vector3d` types from the standard schema library.
8+
9+
#### Removal of `Vector3f` and `Vector3d`
10+
11+
These two schema types are no longer available in the standard schema library. You can replace their definitions by first defining a schema file in your project:
12+
13+
```
14+
package my_game;
15+
16+
type Vector3f {
17+
float x = 1;
18+
float y = 2;
19+
float z = 3;
20+
}
21+
22+
type Vector3d {
23+
double x = 1;
24+
double y = 2;
25+
double z = 3;
26+
}
27+
```
28+
29+
You should then replace the import of `improbable/vector.schema` and usage of `improbable.Vector3f`/`improbable.Vector3d` with the schema file you defined.
30+
31+
> Note that methods such as `Vector3f.ToUnityVector();` are no longer available and you'll need to reimplement them yourself as extension/static methods. You can find the old implementations here: [`Vector3f`](https://github.com/spatialos/gdk-for-unity/blob/0.2.6/workers/unity/Packages/io.improbable.gdk.tools/.CodeGenerator/GdkCodeGenerator/Partials/Improbable.Vector3f) and [`Vector3d`](https://github.com/spatialos/gdk-for-unity/blob/0.2.6/workers/unity/Packages/io.improbable.gdk.tools/.CodeGenerator/GdkCodeGenerator/Partials/Improbable.Vector3d).
32+
>
33+
> You will be unable to reimplement the operators since C# lacks the ability to define operations via extension methods.
34+
>
35+
> Note that the `Coordinates` type can be used as a replacement for `Vector3d` as they are structurally the same.
36+
37+
#### Connection flow changes
38+
39+
The `AlphaLocatorFlow` and the `LocatorFlow` have been merged. This means that your worker connectors may require some changes. Wherever you were previously using the `AlphaLocatorFlow` or the `ConnectionService.AlphaLocator` enum value, you should now be using the `LocatorFlow` and the `ConnectionService.Locator` enum value.
40+
41+
For example:
42+
43+
```csharp
44+
var initializer = new CommandLineConnectionFlowInitializer();
45+
switch (initializer.GetConnectionService())
46+
{
47+
case ConnectionService.Receptionist:
48+
builder.SetConnectionFlow(new ReceptionistFlow(CreateNewWorkerId(WorkerUtils.UnityClient), initializer));
49+
break;
50+
case ConnectionService.Locator:
51+
builder.SetConnectionFlow(new LocatorFlow(initializer));
52+
break;
53+
case ConnectionService.AlphaLocator:
54+
builder.SetConnectionFlow(new AlphaLocatorFlow(initializer));
55+
break;
56+
default:
57+
throw new ArgumentOutOfRangeException();
58+
}
59+
```
60+
61+
Would change into:
62+
63+
```csharp
64+
var initializer = new CommandLineConnectionFlowInitializer();
65+
switch (initializer.GetConnectionService())
66+
{
67+
case ConnectionService.Receptionist:
68+
builder.SetConnectionFlow(new ReceptionistFlow(CreateNewWorkerId(WorkerUtils.UnityClient), initializer));
69+
break;
70+
case ConnectionService.Locator:
71+
builder.SetConnectionFlow(new LocatorFlow(initializer));
72+
break;
73+
default:
74+
throw new ArgumentOutOfRangeException();
75+
}
76+
```
77+
378
## From `0.2.5` to `0.2.6`
479

580
### General changes

init.ps1

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ cd $PSScriptRoot
33
$PkgRoot = $PSScriptRoot + "/workers/unity/Packages"
44
$SdkPath = $PkgRoot + "/io.improbable.worker.sdk"
55
$SdkMobilePath = $PkgRoot + "/io.improbable.worker.sdk.mobile"
6+
$TestSdkPath="test-project/Packages/io.improbable.worker.sdk.testschema"
67

7-
$SdkVersion = Get-Content ($SdkPath + "/package.json") | jq -r '.version'
8+
$SdkVersion = "14.0.1-b1352-614f42b-WORKER-SNAPSHOT"
9+
# $SdkVersion = Get-Content ($SdkPath + "/package.json") | jq -r '.version'
810
$SpotVersion = Get-Content ($SdkPath + "/.spot.version")
911

1012
function UpdatePackage($type, $identifier, $path, $removes)
@@ -24,13 +26,14 @@ function UpdateSpot($identifier, $path)
2426
spatial package get spot $identifier $SpotVersion "$path" --force --json_output
2527
}
2628

27-
UpdatePackage worker_sdk core-dynamic-x86_64-linux "$SdkPath/Plugins/Improbable/Core/Linux/x86_64"
28-
UpdatePackage worker_sdk core-bundle-x86_64-macos "$SdkPath/Plugins/Improbable/Core/OSX"
29-
UpdatePackage worker_sdk core-dynamic-x86_64-win32 "$SdkPath/Plugins/Improbable/Core/Windows/x86_64" "CoreSdkDll.lib"
29+
UpdatePackage worker_sdk c-dynamic-x86_64-gcc510-linux "$SdkPath/Plugins/Improbable/Core/Linux/x86_64"
30+
UpdatePackage worker_sdk c-bundle-x86_64-clang-macos "$SdkPath/Plugins/Improbable/Core/OSX"
31+
UpdatePackage worker_sdk c-dynamic-x86_64-vc140_mt-win32 "$SdkPath/Plugins/Improbable/Core/Windows/x86_64" "improbable_worker.lib"
3032

31-
UpdatePackage worker_sdk csharp-c-interop "$SdkPath/Plugins/Improbable/Sdk/Common" "Improbable.Worker.CInterop.pdb"
33+
UpdatePackage worker_sdk csharp_cinterop "$SdkPath/Plugins/Improbable/Sdk/Common" "Improbable.Worker.CInterop.pdb"
3234

3335
UpdatePackage schema standard_library "$SdkPath/.schema"
36+
UpdatePackage schema test_schema_library "$TestSdkPath/.schema" "test_schema/recursion.schema"
3437

3538
UpdatePackage tools schema_compiler-x86_64-win32 "$SdkPath/.schema_compiler"
3639
UpdatePackage tools schema_compiler-x86_64-macos "$SdkPath/.schema_compiler"
@@ -39,11 +42,11 @@ UpdateSpot spot-win64 "$SdkPath/.spot/spot.exe"
3942
UpdateSpot spot-macos "$SdkPath/.spot/spot"
4043

4144
#Update Mobile SDK
42-
UpdatePackage worker_sdk core-static-fullylinked-arm-ios "$SdkMobilePath/Plugins/Improbable/Core/iOS/arm" "CoreSdkStatic.lib;libCoreSdkStatic.a.pic"
43-
UpdatePackage worker_sdk core-static-fullylinked-x86_64-ios "$SdkMobilePath/Plugins/Improbable/Core/iOS/x86_64" "CoreSdkStatic.lib;libCoreSdkStatic.a.pic"
45+
UpdatePackage worker_sdk c-static-fullylinked-arm-clang-ios "$SdkMobilePath/Plugins/Improbable/Core/iOS/arm" "improbable_worker_static.lib;libimprobable_worker_static.a.pic"
46+
UpdatePackage worker_sdk c-static-fullylinked-x86_64-clang-ios "$SdkMobilePath/Plugins/Improbable/Core/iOS/x86_64" "improbable_worker_static.lib;libimprobable_worker_static.a.pic"
4447

45-
UpdatePackage worker_sdk core-dynamic-arm64v8a-android "$SdkMobilePath/Plugins/Improbable/Core/Android/arm64"
46-
UpdatePackage worker_sdk core-dynamic-armv7a-android "$SdkMobilePath/Plugins/Improbable/Core/Android/armv7"
47-
UpdatePackage worker_sdk core-dynamic-x86-android "$SdkMobilePath/Plugins/Improbable/Core/Android/x86"
48+
UpdatePackage worker_sdk c-dynamic-arm64v8a-clang_ndk16b-android "$SdkMobilePath/Plugins/Improbable/Core/Android/arm64"
49+
UpdatePackage worker_sdk c-dynamic-armv7a-clang_ndk16b-android "$SdkMobilePath/Plugins/Improbable/Core/Android/armv7"
50+
UpdatePackage worker_sdk c-dynamic-x86-clang_ndk16b-android "$SdkMobilePath/Plugins/Improbable/Core/Android/x86"
4851

49-
UpdatePackage worker_sdk csharp-c-interop-static "$SdkMobilePath/Plugins/Improbable/Sdk/iOS" "Improbable.Worker.CInteropStatic.pdb"
52+
UpdatePackage worker_sdk csharp_cinterop_static "$SdkMobilePath/Plugins/Improbable/Sdk/iOS" "Improbable.Worker.CInteropStatic.pdb"

init.sh

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ SDK_PATH="${PKG_ROOT}/io.improbable.worker.sdk"
88
SDK_MOBILE_PATH="${PKG_ROOT}/io.improbable.worker.sdk.mobile"
99
TEST_SDK_PATH="test-project/Packages/io.improbable.worker.sdk.testschema"
1010

11-
SDK_VERSION="$(cat "${SDK_PATH}"/package.json | jq -r '.version')"
11+
SDK_VERSION="14.0.1-b1352-614f42b-WORKER-SNAPSHOT"
12+
# SDK_VERSION="$(cat "${SDK_PATH}"/package.json | jq -r '.version')"
1213
SPOT_VERSION="$(cat "${SDK_PATH}"/.spot.version)"
1314

1415
update_package() {
@@ -32,11 +33,11 @@ update_spot() {
3233
}
3334

3435
# Update Core SDK
35-
update_package worker_sdk core-dynamic-x86_64-linux "${SDK_PATH}/Plugins/Improbable/Core/Linux/x86_64"
36-
update_package worker_sdk core-bundle-x86_64-macos "${SDK_PATH}/Plugins/Improbable/Core/OSX"
37-
update_package worker_sdk core-dynamic-x86_64-win32 "${SDK_PATH}/Plugins/Improbable/Core/Windows/x86_64" "CoreSdkDll.lib"
36+
update_package worker_sdk c-dynamic-x86_64-gcc510-linux "${SDK_PATH}/Plugins/Improbable/Core/Linux/x86_64"
37+
update_package worker_sdk c-bundle-x86_64-clang-macos "${SDK_PATH}/Plugins/Improbable/Core/OSX"
38+
update_package worker_sdk c-dynamic-x86_64-vc140_mt-win32 "${SDK_PATH}/Plugins/Improbable/Core/Windows/x86_64" "improbable_worker.lib"
3839

39-
update_package worker_sdk csharp-c-interop "${SDK_PATH}/Plugins/Improbable/Sdk/Common" "Improbable.Worker.CInterop.pdb"
40+
update_package worker_sdk csharp_cinterop "${SDK_PATH}/Plugins/Improbable/Sdk/Common" "Improbable.Worker.CInterop.pdb"
4041

4142
update_package schema standard_library "${SDK_PATH}/.schema"
4243
update_package schema test_schema_library "${TEST_SDK_PATH}/.schema" "test_schema/recursion.schema"
@@ -48,11 +49,11 @@ update_spot spot-win64 "${SDK_PATH}/.spot/spot.exe"
4849
update_spot spot-macos "${SDK_PATH}/.spot/spot"
4950

5051
#Update Mobile SDK
51-
update_package worker_sdk core-static-fullylinked-arm-ios "${SDK_MOBILE_PATH}/Plugins/Improbable/Core/iOS/arm" "CoreSdkStatic.lib;libCoreSdkStatic.a.pic"
52-
update_package worker_sdk core-static-fullylinked-x86_64-ios "${SDK_MOBILE_PATH}/Plugins/Improbable/Core/iOS/x86_64" "CoreSdkStatic.lib;libCoreSdkStatic.a.pic"
52+
update_package worker_sdk c-static-fullylinked-arm-clang-ios "${SDK_MOBILE_PATH}/Plugins/Improbable/Core/iOS/arm" "improbable_worker_static.lib;libimprobable_worker_static.a.pic"
53+
update_package worker_sdk c-static-fullylinked-x86_64-clang-ios "${SDK_MOBILE_PATH}/Plugins/Improbable/Core/iOS/x86_64" "improbable_worker_static.lib;libimprobable_worker_static.a.pic"
5354

54-
update_package worker_sdk core-dynamic-arm64v8a-android "${SDK_MOBILE_PATH}/Plugins/Improbable/Core/Android/arm64"
55-
update_package worker_sdk core-dynamic-armv7a-android "${SDK_MOBILE_PATH}/Plugins/Improbable/Core/Android/armv7"
56-
update_package worker_sdk core-dynamic-x86-android "${SDK_MOBILE_PATH}/Plugins/Improbable/Core/Android/x86"
55+
update_package worker_sdk c-dynamic-arm64v8a-clang_ndk16b-android "${SDK_MOBILE_PATH}/Plugins/Improbable/Core/Android/arm64"
56+
update_package worker_sdk c-dynamic-armv7a-clang_ndk16b-android "${SDK_MOBILE_PATH}/Plugins/Improbable/Core/Android/armv7"
57+
update_package worker_sdk c-dynamic-x86-clang_ndk16b-android "${SDK_MOBILE_PATH}/Plugins/Improbable/Core/Android/x86"
5758

58-
update_package worker_sdk csharp-c-interop-static "${SDK_MOBILE_PATH}/Plugins/Improbable/Sdk/iOS" "Improbable.Worker.CInteropStatic.pdb"
59+
update_package worker_sdk csharp_cinterop_static "${SDK_MOBILE_PATH}/Plugins/Improbable/Sdk/iOS" "Improbable.Worker.CInteropStatic.pdb"

schema/playground/cube.schema

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package playground;
2-
import "improbable/vector3.schema";
2+
import "playground/shared.schema";
33

44
component CubeTargetVelocity {
55
id = 12008;
6-
improbable.Vector3f target_velocity = 1;
6+
playground.Vector3f target_velocity = 1;
77
}

schema/playground/launcher.schema

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package playground;
2-
import "improbable/vector3.schema";
2+
3+
import "playground/shared.schema";
34

45
// Launcher represents an entity that can launch Launchables.
56
// The act of launching costs the launcher energy.
@@ -8,8 +9,8 @@ import "improbable/vector3.schema";
89
// Command sent by clients to request launching a Launchable.
910
type LaunchCommandRequest {
1011
EntityId entity_to_launch = 1;
11-
improbable.Vector3f impact_point = 2;
12-
improbable.Vector3f launch_direction = 3;
12+
playground.Vector3f impact_point = 2;
13+
playground.Vector3f launch_direction = 3;
1314
float launch_energy = 4;
1415
EntityId player = 5;
1516
}
@@ -18,8 +19,8 @@ type LaunchCommandResponse {}
1819

1920
// Command sent by gamelogic to get a Launchable to launch itself.
2021
type LaunchMeCommandRequest {
21-
improbable.Vector3f impact_point = 1;
22-
improbable.Vector3f launch_direction = 2;
22+
playground.Vector3f impact_point = 1;
23+
playground.Vector3f launch_direction = 2;
2324
float launch_energy = 3;
2425
EntityId player = 4;
2526
}

schema/playground/shared.schema

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
package playground;
2+
3+
type Vector3f {
4+
float x = 1;
5+
float y = 2;
6+
float z = 3;
7+
}

spatialos.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
{
22
"name": "unity_gdk",
33
"project_version": "0.0.1",
4-
"sdk_version": "13.8.2",
4+
"sdk_version": "14.0.1",
55
"dependencies": [
6-
{"name": "standard_library", "version": "13.8.2"}
6+
{"name": "standard_library", "version": "14.0.1"}
77
]
88
}

test-project/Assets/EditmodeTests/Utility/EntitySnapshotTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public void Can_create_from_entity_template()
2727
[Test]
2828
public void Can_create_from_schema_object()
2929
{
30-
var data = new ComponentData(new SchemaComponentData(0)); // Easiest way to get a valid `SchemaObject`.
30+
var data = new ComponentData(0, SchemaComponentData.Create()); // Easiest way to get a valid `SchemaObject`.
3131
try
3232
{
3333
var schemaObject = data.SchemaData.Value.GetFields();

test-project/Assets/Generated/Source/improbable/dependentschema/DependentComponent.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public void MarkDataClean()
8989

9090
public Snapshot ToComponentSnapshot(global::Unity.Entities.World world)
9191
{
92-
var componentDataSchema = new ComponentData(new SchemaComponentData(198800));
92+
var componentDataSchema = new ComponentData(198800, SchemaComponentData.Create());
9393
Serialization.SerializeComponent(this, componentDataSchema.SchemaData.Value.GetFields(), world);
9494
var snapshot = Serialization.DeserializeSnapshot(componentDataSchema.SchemaData.Value.GetFields());
9595

0 commit comments

Comments
 (0)