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

Commit

Permalink
Release 0.1.4 prep (#97)
Browse files Browse the repository at this point in the history
* updating entity templates

* defaulting to receptionist

* adding ticket number

* updating pinned & spatial version

* using empty constructor instead

* upgrading to 2018.3

* updating change log

* updating sdk version

* finalizing release
  • Loading branch information
jessicafalk authored Jan 25, 2019
1 parent 9525dd6 commit c5392ed
Show file tree
Hide file tree
Showing 21 changed files with 197 additions and 193 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.1.4` - 2019-01-28

### Added

- Added mobile support for local deployments.
Expand All @@ -10,6 +12,11 @@

- Updated all the launch configs to better match the world sizes and to use the new Runtime.
- `MapBuilder.cs` performance and visual improvements, now generates worlds around the GameObject's position rather than at origin.
- Upgraded the Worker SDK version to `13.5.1`. This is a stable Worker SDK release! :tada:
- Upgraded the project to be compatible with `2018.3.2f1`.
- Upgraded the postprocessing package to `2.1.2`.
- Upgraded the package manager package to `2.0.3`.
- Upgraded to GDK for Unity version `0.1.4`.

### Fixed

Expand Down
2 changes: 1 addition & 1 deletion gdk.pinned
Original file line number Diff line number Diff line change
@@ -1 +1 @@
afa93bc4b0a96b49bbb844be5ed7d1c88d4d87a7
a518da67ab9e0c87a4f44ceed6b072416688e529
4 changes: 2 additions & 2 deletions spatialos.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "unity_gdk",
"project_version": "0.0.1",
"sdk_version": "14.0-b6841-3d544-WORKER-SNAPSHOT",
"sdk_version": "13.5.1-gdk-for-unity",
"dependencies": [
{"name": "standard_library", "version": "14.0-b6841-3d544-WORKER-SNAPSHOT"}
{"name": "standard_library", "version": "13.5.1-gdk-for-unity"}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Shader "FPS/LowHealthVignette"
{
HLSLINCLUDE

#include "PostProcessing/Shaders/StdLib.hlsl"
#include "Packages/com.unity.postprocessing/PostProcessing/Shaders/StdLib.hlsl"

TEXTURE2D_SAMPLER2D(_MainTex, sampler_MainTex);
TEXTURE2D_SAMPLER2D(_VignetteMaterial, sampler_VignetteMaterial);
Expand All @@ -18,7 +18,7 @@ Shader "FPS/LowHealthVignette"
float4 maskValue = SAMPLE_TEXTURE2D(_VignetteMask, sampler_VignetteMask, i.texcoord);
float4 vignetteValue = SAMPLE_TEXTURE2D(_VignetteMaterial, sampler_VignetteMaterial, i.texcoord);
float4 color = SAMPLE_TEXTURE2D(_MainTex, sampler_MainTex, i.texcoord);

float vignetteColour = pow((((vignetteValue.r+color.g)+color.b)*0.3),1.25);
float health_saturation = pow(saturate(_HEALTH_VALUE),4.0);
float angle = (fmod(_DAMAGE_YAW,360.0)/360.0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 0
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
Expand All @@ -50,7 +50,6 @@ LightmapSettings:
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 0
m_EnableRealtimeLightmaps: 0
Expand Down Expand Up @@ -114,132 +113,129 @@ NavMeshSettings:
m_Flags: 0
m_NavMeshData: {fileID: 23800000, guid: 3daa9e7d489573e4daebd2ed80d44aa6, type: 2}
--- !u!1001 &762447397
Prefab:
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4599106417802648, guid: de9de090270a7f64b91c24e64242f1aa, type: 2}
- target: {fileID: 4599106417802648, guid: de9de090270a7f64b91c24e64242f1aa, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4599106417802648, guid: de9de090270a7f64b91c24e64242f1aa, type: 2}
- target: {fileID: 4599106417802648, guid: de9de090270a7f64b91c24e64242f1aa, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4599106417802648, guid: de9de090270a7f64b91c24e64242f1aa, type: 2}
- target: {fileID: 4599106417802648, guid: de9de090270a7f64b91c24e64242f1aa, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4599106417802648, guid: de9de090270a7f64b91c24e64242f1aa, type: 2}
- target: {fileID: 4599106417802648, guid: de9de090270a7f64b91c24e64242f1aa, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4599106417802648, guid: de9de090270a7f64b91c24e64242f1aa, type: 2}
- target: {fileID: 4599106417802648, guid: de9de090270a7f64b91c24e64242f1aa, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4599106417802648, guid: de9de090270a7f64b91c24e64242f1aa, type: 2}
- target: {fileID: 4599106417802648, guid: de9de090270a7f64b91c24e64242f1aa, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4599106417802648, guid: de9de090270a7f64b91c24e64242f1aa, type: 2}
- target: {fileID: 4599106417802648, guid: de9de090270a7f64b91c24e64242f1aa, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4599106417802648, guid: de9de090270a7f64b91c24e64242f1aa, type: 2}
- target: {fileID: 4599106417802648, guid: de9de090270a7f64b91c24e64242f1aa, type: 3}
propertyPath: m_RootOrder
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: de9de090270a7f64b91c24e64242f1aa, type: 2}
m_IsPrefabAsset: 0
m_SourcePrefab: {fileID: 100100000, guid: de9de090270a7f64b91c24e64242f1aa, type: 3}
--- !u!1001 &1413886359
Prefab:
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4527984774241536, guid: a18c738cbcda9914591d9af24a618907, type: 2}
- target: {fileID: 4527984774241536, guid: a18c738cbcda9914591d9af24a618907, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4527984774241536, guid: a18c738cbcda9914591d9af24a618907, type: 2}
- target: {fileID: 4527984774241536, guid: a18c738cbcda9914591d9af24a618907, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4527984774241536, guid: a18c738cbcda9914591d9af24a618907, type: 2}
- target: {fileID: 4527984774241536, guid: a18c738cbcda9914591d9af24a618907, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4527984774241536, guid: a18c738cbcda9914591d9af24a618907, type: 2}
- target: {fileID: 4527984774241536, guid: a18c738cbcda9914591d9af24a618907, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4527984774241536, guid: a18c738cbcda9914591d9af24a618907, type: 2}
- target: {fileID: 4527984774241536, guid: a18c738cbcda9914591d9af24a618907, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4527984774241536, guid: a18c738cbcda9914591d9af24a618907, type: 2}
- target: {fileID: 4527984774241536, guid: a18c738cbcda9914591d9af24a618907, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4527984774241536, guid: a18c738cbcda9914591d9af24a618907, type: 2}
- target: {fileID: 4527984774241536, guid: a18c738cbcda9914591d9af24a618907, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4527984774241536, guid: a18c738cbcda9914591d9af24a618907, type: 2}
- target: {fileID: 4527984774241536, guid: a18c738cbcda9914591d9af24a618907, type: 3}
propertyPath: m_RootOrder
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: a18c738cbcda9914591d9af24a618907, type: 2}
m_IsPrefabAsset: 0
m_SourcePrefab: {fileID: 100100000, guid: a18c738cbcda9914591d9af24a618907, type: 3}
--- !u!1001 &1860465035
Prefab:
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 4977616286773460, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 2}
- target: {fileID: 1620385508151754, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 3}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4977616286773460, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 3}
propertyPath: m_LocalPosition.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4977616286773460, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 2}
- target: {fileID: 4977616286773460, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 3}
propertyPath: m_LocalPosition.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4977616286773460, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 2}
- target: {fileID: 4977616286773460, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 3}
propertyPath: m_LocalPosition.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4977616286773460, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 2}
- target: {fileID: 4977616286773460, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4977616286773460, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 2}
- target: {fileID: 4977616286773460, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4977616286773460, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 2}
- target: {fileID: 4977616286773460, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 4977616286773460, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 2}
- target: {fileID: 4977616286773460, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4977616286773460, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 2}
- target: {fileID: 4977616286773460, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 3}
propertyPath: m_RootOrder
value: 2
objectReference: {fileID: 0}
- target: {fileID: 1620385508151754, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 2}
propertyPath: m_IsActive
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 2}
m_IsPrefabAsset: 0
m_SourcePrefab: {fileID: 100100000, guid: 1d177d0ca1e95c646a6a7b9b84364f9b, type: 3}
Binary file not shown.
117 changes: 66 additions & 51 deletions workers/unity/Assets/Fps/Scripts/Config/FpsEntityTemplates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,40 +7,46 @@
using Improbable.Gdk.PlayerLifecycle;
using Improbable.Gdk.StandardTypes;
using Improbable.PlayerLifecycle;
using UnityEngine;

namespace Fps
{
public static class FpsEntityTemplates
{
private static readonly List<string> AllWorkerAttributes =
new List<string> { WorkerUtils.UnityGameLogic, WorkerUtils.UnityClient, WorkerUtils.SimulatedPlayer, WorkerUtils.AndroidClient, WorkerUtils.iOSClient };

public static EntityTemplate Spawner()
{
const string gameLogic = WorkerUtils.UnityGameLogic;

return EntityBuilder.Begin()
.AddPosition(0, 0, 0, gameLogic)
.AddMetadata("PlayerCreator", gameLogic)
.SetPersistence(true)
.SetReadAcl(gameLogic)
.AddComponent(PlayerCreator.Component.CreateSchemaComponentData(), gameLogic)
.Build();
var position = new Position.Snapshot { Coords = new Vector3().ToSpatialCoordinates() };
var metadata = new Metadata.Snapshot { EntityType = "PlayerCreator" };

var template = new EntityTemplate();
template.AddComponent(position, WorkerUtils.UnityGameLogic);
template.AddComponent(metadata, WorkerUtils.UnityGameLogic);
template.AddComponent(new Persistence.Snapshot(), WorkerUtils.UnityGameLogic);
template.AddComponent(new PlayerCreator.Snapshot(), WorkerUtils.UnityGameLogic);

template.SetReadAccess(WorkerUtils.UnityGameLogic);
template.SetComponentWriteAccess(EntityAcl.ComponentId, WorkerUtils.UnityGameLogic);

return template;
}

public static EntityTemplate SimulatedPlayerCoordinatorTrigger()
{
return EntityBuilder.Begin()
.AddPosition(0, 0, 0, WorkerUtils.SimulatedPlayerCoorindator)
.AddMetadata("SimulatedPlayerCoordinatorTrigger", WorkerUtils.SimulatedPlayerCoorindator)
.SetPersistence(true)
.SetReadAcl(WorkerUtils.SimulatedPlayerCoorindator)
.Build();
var metadata = new Metadata.Snapshot { EntityType = "SimulatedPlayerCoordinatorTrigger" };

var template = new EntityTemplate();
template.AddComponent(new Position.Snapshot(), WorkerUtils.SimulatedPlayerCoorindator);
template.AddComponent(metadata, WorkerUtils.SimulatedPlayerCoorindator);
template.AddComponent(new Persistence.Snapshot(), WorkerUtils.SimulatedPlayerCoorindator);

template.SetReadAccess(WorkerUtils.SimulatedPlayerCoorindator);
template.SetComponentWriteAccess(EntityAcl.ComponentId, WorkerUtils.SimulatedPlayerCoorindator);

return template;
}

public static EntityTemplate Player(string workerId, Vector3f position)
{
const string gameLogic = WorkerUtils.UnityGameLogic;
var client = $"workerId:{workerId}";

var (spawnPosition, spawnYaw, spawnPitch) = SpawnPoints.GetRandomSpawnPoint();
Expand All @@ -50,43 +56,52 @@ public static EntityTemplate Player(string workerId, Vector3f position)
Position = spawnPosition.ToIntAbsolute()
};

var serverMovement = ServerMovement.Component.CreateSchemaComponentData(serverResponse);
var clientMovementData = new ClientRequest();
var rotationUpdate = new RotationUpdate
{
Yaw = spawnYaw.ToInt1k(),
Pitch = spawnPitch.ToInt1k()
};
var clientMovement = ClientMovement.Component.CreateSchemaComponentData(clientMovementData);
var clientRotation = ClientRotation.Component.CreateSchemaComponentData(rotationUpdate);
var shootingComponent = ShootingComponent.Component.CreateSchemaComponentData();
var gunStateComponent = GunStateComponent.Component.CreateSchemaComponentData(false);
var gunComponent = GunComponent.Component.CreateSchemaComponentData(PlayerGunSettings.DefaultGunIndex);
var maxHealth = PlayerHealthSettings.MaxHealth;

var healthComponent = HealthComponent.Component.CreateSchemaComponentData(maxHealth, maxHealth);
var healthRegenComponent = HealthRegenComponent.Component.CreateSchemaComponentData(false,
0,
PlayerHealthSettings.SpatialCooldownSyncInterval,
PlayerHealthSettings.RegenAfterDamageCooldown,
PlayerHealthSettings.RegenInterval,
PlayerHealthSettings.RegenAmount);

return EntityBuilder.Begin()
.AddPosition(spawnPosition.x, spawnPosition.y, spawnPosition.z, gameLogic)
.AddMetadata("Player", gameLogic)
.SetPersistence(false)
.SetReadAcl(AllWorkerAttributes)
.AddComponent(serverMovement, gameLogic)
.AddComponent(clientMovement, client)
.AddComponent(clientRotation, client)
.AddComponent(shootingComponent, client)
.AddComponent(gunComponent, gameLogic)
.AddComponent(gunStateComponent, client)
.AddComponent(healthComponent, gameLogic)
.AddComponent(healthRegenComponent, gameLogic)
.AddPlayerLifecycleComponents(workerId, client, gameLogic)
.Build();

var pos = new Position.Snapshot { Coords = spawnPosition.ToSpatialCoordinates() };
var serverMovement = new ServerMovement.Snapshot { Latest = serverResponse };
var clientMovement = new ClientMovement.Snapshot { Latest = new ClientRequest() };
var clientRotation = new ClientRotation.Snapshot { Latest = rotationUpdate };
var shootingComponent = new ShootingComponent.Snapshot();
var gunComponent = new GunComponent.Snapshot { GunId = PlayerGunSettings.DefaultGunIndex };
var gunStateComponent = new GunStateComponent.Snapshot { IsAiming = false };
var healthComponent = new HealthComponent.Snapshot
{
Health = PlayerHealthSettings.MaxHealth,
MaxHealth = PlayerHealthSettings.MaxHealth,
};

var healthRegenComponent = new HealthRegenComponent.Snapshot
{
CooldownSyncInterval = PlayerHealthSettings.SpatialCooldownSyncInterval,
DamagedRecently = false,
RegenAmount = PlayerHealthSettings.RegenAmount,
RegenCooldownTimer = PlayerHealthSettings.RegenAfterDamageCooldown,
RegenInterval = PlayerHealthSettings.RegenInterval,
RegenPauseTime = 0,
};

var template = new EntityTemplate();
template.AddComponent(pos, WorkerUtils.UnityGameLogic);
template.AddComponent(new Metadata.Snapshot { EntityType = "Player" }, WorkerUtils.UnityGameLogic);
template.AddComponent(serverMovement, WorkerUtils.UnityGameLogic);
template.AddComponent(clientMovement, client);
template.AddComponent(clientRotation, client);
template.AddComponent(shootingComponent, client);
template.AddComponent(gunComponent, WorkerUtils.UnityGameLogic);
template.AddComponent(gunStateComponent, client);
template.AddComponent(healthComponent, WorkerUtils.UnityGameLogic);
template.AddComponent(healthRegenComponent, WorkerUtils.UnityGameLogic);
PlayerLifecycleHelper.AddPlayerLifecycleComponents(template, workerId, client, WorkerUtils.UnityGameLogic);

template.SetReadAccess(WorkerUtils.UnityClient, WorkerUtils.UnityGameLogic, WorkerUtils.SimulatedPlayer, WorkerUtils.AndroidClient, WorkerUtils.iOSClient);
template.SetComponentWriteAccess(EntityAcl.ComponentId, WorkerUtils.UnityGameLogic);

return template;
}
}
}
Loading

0 comments on commit c5392ed

Please sign in to comment.