Skip to content
This repository has been archived by the owner on Oct 20, 2021. It is now read-only.

Commit

Permalink
Release 0.2.3 (#197)
Browse files Browse the repository at this point in the history
* Release 0.2.3

* updating gdk tools config

* Fix mapbuilder in editor (#198)

* 2019.1 no longer allows temp scenes in editor mode. Refactored code to work again

* Update link.xml

* disabled burst compilation (#199)

* Make the mobile connector use the Dev Auth Token that's passed through as an argument. (#201)

* updated changelog

* enable burst just for iOS

* remove new line

* Deferring the client-worker destroy by a frame (#200)

* deferring player destroy by a frame

* updating pin

* updating pinned version
  • Loading branch information
jessicafalk authored Jun 12, 2019
1 parent a29bc2e commit 5657970
Show file tree
Hide file tree
Showing 21 changed files with 174 additions and 67 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

## Unreleased

## `0.2.3` - 2019-06-12

### Changed

- Upgraded the project to be compatible with `2019.1.3f1`. [#185](https://github.com/spatialos/gdk-for-unity-fps-starter-project/pull/185)
Expand Down Expand Up @@ -39,6 +41,11 @@

- Fixed a bug where your own gun would not appear until after you moved around for a while.

### Internal

- Disabled Burst compilation for all platforms except for iOS, because Burst throws benign errors when building workers for other platforms than the one you are currently using. [#977](https://github.com/spatialos/gdk-for-unity/pull/977)
- Enabled Burst compilation for iOS, because disabling results in an invalid XCode project. [#975](https://github.com/spatialos/gdk-for-unity/pull/975)

## `0.2.1` - 2019-04-15

### Changed
Expand Down
2 changes: 1 addition & 1 deletion gdk.pinned
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8708f8b47e323b5b54dcb8e4528a05ad5ee81b0b
eae6cf5dcdb72655bde2121614001cdf1dde51bf
2 changes: 1 addition & 1 deletion packer.config.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"package_name": "gdk-for-unity-fps-starter-project",
"version": "0.2.2",
"version": "0.2.3",
"git_packages": [
{
"clone_url": "[email protected]:spatialos/gdk-for-unity-fps-starter-project.git",
Expand Down
9 changes: 4 additions & 5 deletions workers/unity/Assets/Config/GdkToolsConfiguration.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
{
"SchemaStdLibDir": "../../build/dependencies/schema/standard_library",
"SchemaSourceDirs": [
"../../schema"
],
"SchemaSourceDirs": [],
"CodegenOutputDir": "Assets/Generated/Source",
"RuntimeIp": "",
"DescriptorOutputDir": "../../build/assembly/schema",
"DevAuthTokenDir": "Resources",
"DevAuthTokenLifetimeDays": 1
"DevAuthTokenLifetimeDays": 1,
"SaveDevAuthTokenToFile": false
}
104 changes: 65 additions & 39 deletions workers/unity/Assets/Fps/Scripts/Config/MapBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Collections.Generic;
using Improbable.Gdk.Core;
using UnityEngine;
using UnityEngine.Profiling;
using UnityEngine.SceneManagement;
using Object = UnityEngine.Object;
using Random = System.Random;
Expand All @@ -18,7 +17,7 @@ public class MapBuilder
private int layers;
private Random random;
private Scene tempScene;
private Scene activeScene;
private Scene mainScene;

private GameObject groundTile;
private GameObject groundEdge;
Expand Down Expand Up @@ -67,8 +66,12 @@ public MapBuilder(MapTemplate mapTemplate, GameObject parentGameObject)

layers = worldLayers;
random = new Random(seed.GetHashCode());
tempScene = SceneManager.CreateScene(parentGameObject.name, new CreateSceneParameters(LocalPhysicsMode.None));
activeScene = SceneManager.GetActiveScene();
if (Application.isPlaying)
{
tempScene = SceneManager.CreateScene(parentGameObject.name,
new CreateSceneParameters(LocalPhysicsMode.None));
mainScene = SceneManager.GetActiveScene();
}

if (!TryLoadResources())
{
Expand All @@ -81,45 +84,44 @@ public MapBuilder(MapTemplate mapTemplate, GameObject parentGameObject)
InitializeGroupsAndComponents();

// Initialize tiles
SceneManager.SetActiveScene(tempScene);
foreach (var tileCollection in mapTemplate.tileCollections)
using (new SceneScope(tempScene))
{
tileCollection.LoadAndOptimizeTiles();
}

mapTemplate.defaultTileCollection.LoadAndOptimizeTiles();
SceneManager.SetActiveScene(activeScene);
foreach (var tileCollection in mapTemplate.tileCollections)
{
tileCollection.LoadAndOptimizeTiles();
}

yield return null;
mapTemplate.defaultTileCollection.LoadAndOptimizeTiles();

var originalPosition = parentGameObject.transform.position;
var originalRotation = parentGameObject.transform.rotation;
parentGameObject.transform.position = Vector3.zero;
parentGameObject.transform.rotation = Quaternion.identity;
var originalPosition = parentGameObject.transform.position;
var originalRotation = parentGameObject.transform.rotation;
parentGameObject.transform.position = Vector3.zero;
parentGameObject.transform.rotation = Quaternion.identity;

yield return PlaceTiles();
yield return PlaceTiles();

SceneManager.SetActiveScene(tempScene);
PlaceGround();
FillSurround();

PlaceGround();
FillSurround();
spawnPointSystemTransform.gameObject.GetComponent<SpawnPoints>()?.SetSpawnPoints();

spawnPointSystemTransform.gameObject.GetComponent<SpawnPoints>()?.SetSpawnPoints();
parentGameObject.transform.position = originalPosition;
parentGameObject.transform.rotation = originalRotation;

parentGameObject.transform.position = originalPosition;
parentGameObject.transform.rotation = originalRotation;
// Cleanup
foreach (var tileCollection in mapTemplate.tileCollections)
{
tileCollection.Clear();
}

// Cleanup
foreach (var tileCollection in mapTemplate.tileCollections)
{
tileCollection.Clear();
mapTemplate.defaultTileCollection.Clear();
}

mapTemplate.defaultTileCollection.Clear();

// Merge building temp scene into active scene
SceneManager.SetActiveScene(activeScene);
SceneManager.MergeScenes(tempScene, activeScene);
if (Application.isPlaying)
{
SceneManager.MergeScenes(tempScene, mainScene);
}
}

private void InitializeGroupsAndComponents()
Expand Down Expand Up @@ -281,7 +283,6 @@ private IEnumerator PlaceTiles()

// Tiles are built in a spiral manner from the centre outward to ensure increasing the # of tile layers doesn't
// alter the existing tile types.
SceneManager.SetActiveScene(tempScene);
for (var i = 0; i < tileCount; i++)
{
// -layers < x <= layers AND -layers < y <= layers
Expand All @@ -300,17 +301,16 @@ private IEnumerator PlaceTiles()

tileCoord += diff;

if (DateTime.UtcNow.Subtract(timeStart) >= timeLimit)
if (Application.isPlaying && DateTime.UtcNow.Subtract(timeStart) >= timeLimit)
{
SceneManager.SetActiveScene(activeScene);
yield return null;
timeStart = DateTime.UtcNow;
SceneManager.SetActiveScene(tempScene);
using (new SceneScope(mainScene))
{
yield return null;
timeStart = DateTime.UtcNow;
}
}
}

SceneManager.SetActiveScene(activeScene);

tileParentTransform.position = new Vector3
{
x = tileParentTransform.position.x,
Expand Down Expand Up @@ -442,5 +442,31 @@ public static IEnumerator GenerateMap(

worker.LevelInstance = levelInstance;
}

private class SceneScope : IDisposable
{
private readonly Scene activeScene;

public SceneScope(Scene newActive)
{
#if UNITY_EDITOR
if (Application.isPlaying)
#endif
{
activeScene = SceneManager.GetActiveScene();
SceneManager.SetActiveScene(newActive);
}
}

public void Dispose()
{
#if UNITY_EDITOR
if (Application.isPlaying)
#endif
{
SceneManager.SetActiveScene(activeScene);
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,13 @@ public override void Tick()

var results = trackPlayerSystem.PlayerResults;
var playerRank = results.FirstOrDefault(res => res.PlayerName == Blackboard.PlayerName).Rank;
Debug.Log($"playerRank {playerRank}");
Debug.Log($"player name {Blackboard.PlayerName}");

ScreenManager.ResultsScreenDoneButton.onClick.AddListener(Restart);
ScreenManager.InformOfResults(results, playerRank);
Manager.ShowFrontEnd();
ScreenManager.SwitchToResultsScreen();

UnityObjectDestroyer.Destroy(Blackboard.ClientConnector);
Blackboard.ClientConnector.DisconnectPlayer();
Blackboard.ClientConnector = null;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
using UnityEngine;
using Improbable.Gdk.GameObjectCreation;
using Improbable.Gdk.PlayerLifecycle;
using Improbable.Worker.CInterop;
using Improbable.Worker.CInterop.Alpha;
using Unity.Entities;

namespace Fps
{
Expand Down Expand Up @@ -41,6 +43,11 @@ public bool HasConnected()
return Worker != null;
}

public void DisconnectPlayer()
{
StartCoroutine(PrepareDestroy());
}

protected override string GetWorkerType()
{
return WorkerUtils.UnityClient;
Expand Down Expand Up @@ -149,6 +156,12 @@ public override void Dispose()
base.Dispose();
}

private IEnumerator PrepareDestroy()
{
yield return DeferredDisposeWorker();
Destroy(gameObject);
}

private void SendRequest()
{
var serializedArgs = Encoding.ASCII.GetBytes(playerName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,12 @@ private void InitializeClient()
PlayerPrefs.DeleteKey(HostIpPlayerPrefsKey);
}

var devAuthToken = CommandLineUtility.GetCommandLineValue(arguments, RuntimeConfigNames.DevAuthTokenKey, string.Empty);
if (!string.IsNullOrEmpty(devAuthToken))
{
PlayerPrefs.SetString(RuntimeConfigNames.DevAuthTokenKey, devAuthToken);
}

PlayerPrefs.Save();
}

Expand Down
3 changes: 3 additions & 0 deletions workers/unity/Assets/link.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,7 @@
<assembly fullname="Improbable.Gdk.ObjectPooling" preserve="all"/>
<assembly fullname="Improbable.Gdk.Ragdoll" preserve="all"/>
<assembly fullname="Improbable.Gdk.StandardTypes" preserve="all"/>
<assembly fullname="Unity.Entities.Hybrid">
<type fullname="Unity.Entities.GameObjectEntity" preserve="all"/>
</assembly>
</linker>
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.improbable.gdk.deploymentmanager",
"displayName": "SpatialOS GDK Deployment Manager",
"version": "0.2.2",
"version": "0.2.3",
"unity": "2019.1",
"author": "Improbable Worlds Ltd",
"description": "SpatialOS GDK Deployment Manager. Made by Improbable.",
Expand Down
8 changes: 4 additions & 4 deletions workers/unity/Packages/com.improbable.gdk.guns/package.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"name": "com.improbable.gdk.guns",
"displayName": "SpatialOS GDK Guns",
"version": "0.2.2",
"version": "0.2.3",
"unity": "2019.1",
"author": "Improbable Worlds Ltd",
"description": "SpatialOS GDK Guns Module. Made by Improbable.",
"dependencies": {
"com.improbable.gdk.core": "0.2.2",
"com.improbable.gdk.standardtypes": "0.2.2",
"com.improbable.gdk.objectpooling": "0.2.2"
"com.improbable.gdk.core": "0.2.3",
"com.improbable.gdk.standardtypes": "0.2.3",
"com.improbable.gdk.objectpooling": "0.2.3"
}
}
4 changes: 2 additions & 2 deletions workers/unity/Packages/com.improbable.gdk.health/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "com.improbable.gdk.health",
"displayName": "SpatialOS GDK Health",
"version": "0.2.2",
"version": "0.2.3",
"unity": "2019.1",
"author": "Improbable Worlds Ltd",
"description": "SpatialOS GDK Health Module. Made by Improbable.",
"dependencies": {
"com.improbable.gdk.core": "0.2.2"
"com.improbable.gdk.core": "0.2.3"
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "com.improbable.gdk.movement",
"displayName": "SpatialOS GDK Movement",
"version": "0.2.2",
"version": "0.2.3",
"unity": "2019.1",
"author": "Improbable Worlds Ltd",
"description": "SpatialOS GDK Movement Module. Made by Improbable.",
"dependencies": {
"com.improbable.gdk.core": "0.2.2",
"com.improbable.gdk.standardtypes": "0.2.2"
"com.improbable.gdk.core": "0.2.3",
"com.improbable.gdk.standardtypes": "0.2.3"
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "com.improbable.gdk.objectpooling",
"displayName": "SpatialOS GDK Object Pooling",
"version": "0.2.2",
"version": "0.2.3",
"unity": "2019.1",
"author": "Improbable Worlds Ltd",
"description": "SpatialOS GDK Object Pooling Module. Made by Improbable.",
Expand Down
10 changes: 5 additions & 5 deletions workers/unity/Packages/com.improbable.gdk.ragdolls/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
{
"name": "com.improbable.gdk.ragdolls",
"displayName": "SpatialOS GDK Ragdolls",
"version": "0.2.2",
"version": "0.2.3",
"unity": "2019.1",
"author": "Improbable Worlds Ltd",
"description": "SpatialOS GDK Ragdolls Module. Made by Improbable.",
"dependencies": {
"com.improbable.gdk.core": "0.2.2",
"com.improbable.gdk.health": "0.2.2",
"com.improbable.gdk.objectpooling": "0.2.2",
"com.improbable.gdk.standardtypes": "0.2.2"
"com.improbable.gdk.core": "0.2.3",
"com.improbable.gdk.health": "0.2.3",
"com.improbable.gdk.objectpooling": "0.2.3",
"com.improbable.gdk.standardtypes": "0.2.3"
}
}
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "com.improbable.gdk.standardtypes",
"displayName": "SpatialOS GDK Standard Types",
"version": "0.2.2",
"version": "0.2.3",
"unity": "2019.1",
"author": "Improbable Worlds Ltd",
"description": "SpatialOS GDK Standard Types Module. Made by Improbable.",
"dependencies": {
"com.improbable.gdk.core": "0.2.2"
"com.improbable.gdk.core": "0.2.3"
}
}
Loading

0 comments on commit 5657970

Please sign in to comment.