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

Commit

Permalink
Cleanup FPS Project for 0.3.0 (#239)
Browse files Browse the repository at this point in the history
  • Loading branch information
zeroZshadow authored and Paul Balaji committed Nov 11, 2019
1 parent 4904e20 commit 7a58843
Show file tree
Hide file tree
Showing 341 changed files with 1,775 additions and 1,903 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## Unreleased

### Breaking Changes

- Restructured the project's layout. [#239](https://github.com/spatialos/gdk-for-unity-fps-starter-project/pull/239)
- Moved all code and schema from FPS "packages" into the project directly.
- Cleaned up namespaces to make it clearer that this is game-specific schema and code.
- Flattened and tidied up the `Assets/Fps/Scripts` folder.

### Changed

- Changed the default client and simulated player network connection types to Modular UDP with compression enabled. [#238](https://github.com/spatialos/gdk-for-unity-fps-starter-project/pull/238)
Expand Down
7 changes: 7 additions & 0 deletions schema/fps/common.schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package fps;

type Vector3Int {
int32 x = 1;
int32 y = 2;
int32 z = 3;
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package improbable.gdk.guns;
package fps;

component GunComponent {
id = 2051;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package improbable.gdk.health;
package fps;

component HealthRegenComponent {
id = 2041;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
package improbable.gdk.health;
package fps;

import "improbable/gdk/core/common.schema";
import "improbable/gdk/standardtypes/standardtypes.schema";
import "fps/common.schema";

type HealthModifier {
uint32 type = 1;
float amount = 2;
improbable.gdk.standardtypes.IntAbsolute applied_location = 3;
improbable.gdk.standardtypes.IntAbsolute origin = 4;
int64 owner = 5;
fps.Vector3Int applied_location = 3;
fps.Vector3Int origin = 4;
EntityId owner = 5;
}

type HealthModifiedInfo {
HealthModifier modifier = 1;
float health_before = 2;
float health_after = 3;
bool died = 4;
int64 owner = 5;
EntityId owner = 5;
}

component HealthComponent {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
package improbable.gdk.movement;
package fps;

import "improbable/gdk/standardtypes/standardtypes.schema";
import "fps/common.schema";

type ClientRequest {
improbable.gdk.standardtypes.IntDelta movement = 1;
fps.Vector3Int movement = 1;
int32 timestamp = 2;
float time_delta = 3;
bool includes_jump = 4;
}

type ServerResponse {
improbable.gdk.standardtypes.IntAbsolute position = 1;
fps.Vector3Int position = 1;
int32 timestamp = 2;
float time_delta = 3;
bool includes_jump = 4;
Expand Down
16 changes: 16 additions & 0 deletions schema/fps/shooting.schema
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package fps;

import "fps/common.schema";

type ShotInfo {
bool hit_something = 1;
EntityId entity_id = 2;
fps.Vector3Int hit_location = 3;
fps.Vector3Int hit_origin = 4;
}

component ShootingComponent {
id = 2050;

event ShotInfo shots;
}
8 changes: 5 additions & 3 deletions workers/unity/Assets/Config/GdkToolsConfiguration.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
{
"SchemaStdLibDir": "../../build/dependencies/schema/standard_library",
"SchemaSourceDirs": [],
"SchemaSourceDirs": [
"../../schema"
],
"CodegenOutputDir": "Assets/Generated/Source",
"DescriptorOutputDir": "../../build/assembly/schema",
"DevAuthTokenDir": "Resources",
"DevAuthTokenLifetimeDays": 1,
"SaveDevAuthTokenToFile": false
"SaveDevAuthTokenToFile": false,
"SerializationOverrides": []
}
12 changes: 3 additions & 9 deletions workers/unity/Assets/Fps/Improbable.Fps.asmdef
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,19 @@
"Improbable.Gdk.Core",
"Improbable.Gdk.GameObjectCreation",
"Improbable.Gdk.Generated",
"Improbable.Gdk.Guns",
"Improbable.Gdk.Health",
"Improbable.Gdk.Movement",
"Improbable.Gdk.Mobile",
"Improbable.Gdk.ObjectPooling",
"Improbable.Gdk.PlayerLifecycle",
"Improbable.Gdk.QueryBasedInterestHelper",
"Improbable.Gdk.Ragdoll",
"Improbable.Gdk.StandardTypes",
"Unity.Entities",
"Unity.Entities.Hybrid",
"Unity.Postprocessing.Runtime"
],
"optionalUnityReferences": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
}
"defineConstraints": [],
"versionDefines": []
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Improbable.Gdk.Movement;
using Fps.Movement;
using UnityEngine;

namespace Fps
namespace Fps.Animation
{
public class FpsAnimator : MonoBehaviour
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using Improbable.Gdk.Core;
using Fps.Movement;
using Fps.SchemaExtensions;
using Improbable.Gdk.Subscriptions;
using Improbable.Gdk.Guns;
using Improbable.Gdk.Movement;
using Improbable.Gdk.StandardTypes;
using UnityEngine;

namespace Fps
namespace Fps.Animation
{
[RequireComponent(typeof(FpsAnimator), typeof(ProxyMovementDriver))]
public class ProxyAnimation : MonoBehaviour
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using System;
using System.Collections.Generic;
using Fps.Movement;
using Fps.SchemaExtensions;
using Improbable;
using Improbable.Gdk.Core;
using Improbable.Gdk.GameObjectCreation;
using Improbable.Gdk.Movement;
using Improbable.Gdk.PlayerLifecycle;
using Improbable.Gdk.StandardTypes;
using Improbable.Gdk.Subscriptions;
using UnityEngine;
using Object = UnityEngine.Object;

namespace Fps
namespace Fps.Config
{
public class AdvancedEntityPipeline : IEntityGameObjectCreator
{
Expand Down
16 changes: 8 additions & 8 deletions workers/unity/Assets/Fps/Scripts/Config/FpsEntityTemplates.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
using System.Text;
using Fps.Guns;
using Fps.Health;
using Fps.Respawning;
using Fps.SchemaExtensions;
using Improbable;
using Improbable.Gdk.Core;
using Improbable.Gdk.Guns;
using Improbable.Gdk.Health;
using Improbable.Gdk.Movement;
using Improbable.Gdk.PlayerLifecycle;
using Improbable.Gdk.QueryBasedInterest;
using Improbable.Gdk.Session;
using Improbable.Gdk.StandardTypes;

namespace Fps
namespace Fps.Config
{
public static class FpsEntityTemplates
{
Expand All @@ -24,7 +24,7 @@ public static EntityTemplate DeploymentState()
template.AddComponent(position, WorkerUtils.UnityGameLogic);
template.AddComponent(metadata, WorkerUtils.UnityGameLogic);
template.AddComponent(new Persistence.Snapshot(), WorkerUtils.UnityGameLogic);
template.AddComponent(new Session.Snapshot(Status.LOBBY), WorkerUtils.UnityGameLogic);
template.AddComponent(new Improbable.Gdk.Session.Session.Snapshot(Status.LOBBY), WorkerUtils.UnityGameLogic);
template.AddComponent(new Deployment.Snapshot(), WorkerUtils.DeploymentManager);
template.AddComponent(new Timer.Snapshot(0, sessionTimeSeconds), WorkerUtils.UnityGameLogic);

Expand Down Expand Up @@ -59,7 +59,7 @@ public static EntityTemplate Player(string workerId, byte[] args)

var serverResponse = new ServerResponse
{
Position = spawnPosition.ToIntAbsolute()
Position = spawnPosition.ToVector3Int()
};

var rotationUpdate = new RotationUpdate
Expand Down Expand Up @@ -91,7 +91,7 @@ public static EntityTemplate Player(string workerId, byte[] args)
RegenPauseTime = 0,
};

var sessionQuery = InterestQuery.Query(Constraint.Component<Session.Component>());
var sessionQuery = InterestQuery.Query(Constraint.Component<Improbable.Gdk.Session.Session.Component>());
var checkoutQuery = InterestQuery.Query(Constraint.RelativeCylinder(150));

var interestTemplate = InterestTemplate.Create().AddQueries<ClientMovement.Component>(sessionQuery, checkoutQuery);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Unity.Entities;
using UnityEngine;

namespace Fps
namespace Fps.Config
{
public static class OneTimeInitialisation
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using UnityEngine;
using Fps.Config;
using UnityEngine;

namespace Fps
namespace Fps.Config
{
public class SettingsPublisher : MonoBehaviour
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Improbable.Gdk.Guns;
using Fps.Guns;
using UnityEngine;

namespace Fps
namespace Fps.Config
{
public class GunDictionaryPublisher : MonoBehaviour, ISettingsPublisher
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Fps
namespace Fps.Config
{
public interface ISettingsPublisher
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using UnityEngine;
using Fps.WorldTiles;
using UnityEngine;

namespace Fps
namespace Fps.Config
{
public class MapQualitySettingsPublisher : MonoBehaviour, ISettingsPublisher
{
Expand Down
2 changes: 1 addition & 1 deletion workers/unity/Assets/Fps/Scripts/Config/WorkerUtils.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Fps
namespace Fps.Config
{
public static class WorkerUtils
{
Expand Down
Loading

0 comments on commit 7a58843

Please sign in to comment.