-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
spatial.log | ||
spatialos_worker_packages.json | ||
build/ | ||
logs/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,26 @@ | ||
# StarterProject | ||
This is a SpatialOS starter project with useful core features that you can extend to build your own SpatialOS application | ||
# Starter Project | ||
--- | ||
|
||
*Copyright Improbable Worlds Ltd, 2017* | ||
|
||
- *GitHub repository*: [https://github.com/spatialos/StarterProject](https://github.com/spatialos/StarterProject) | ||
|
||
--- | ||
|
||
## Introduction | ||
|
||
This is a SpatialOS starter project with useful core features that you can extend to build your own SpatialOS application. | ||
|
||
It contains: | ||
|
||
* A Player spawned on client connection as per the [Unity Client Lifecycle Guide](https://spatialos.improbable.io/docs/reference/latest/tutorials/client-lifecycle). | ||
* A Cube spawned through a snapshot via an entity template method and an Unity prefab. | ||
* The rest of the features included in the [BlankProject](https://github.com/spatialos/BlankProject). | ||
|
||
If you run into problems, or want to give us feedback, please visit the [SpatialOS forums](https://forums.improbable.io/). | ||
|
||
## Running the project | ||
|
||
To run the project locally, first build it by running `spatial worker build`, then start the server with `spatial local start`. You can connect a client by opening the Unity project and pressing the play button, or by running `spatial local worker launch UnityClient default`. See the [documentation](https://spatialos.improbable.io/docs/reference/latest/developing/local/run) for more details. | ||
|
||
To deploy the project to the cloud, first build it by running `spatial worker build -t=deployment`, then upload the assembly with `spatial cloud upload <assembly name>`, and finally deploy it with `spatial cloud launch <assembly name> <launch configuration file> <deployment name> --snapshot=<snapshot file>`. You can obtain and share links to connect to the deployment from the [console](http://console.improbable.io/projects). See the [documentation](https://spatialos.improbable.io/docs/reference/latest/developing/deploy-an-application) for more details. |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{ | ||
"template": "small", | ||
"world": { | ||
"chunkEdgeLengthMeters": 50, | ||
"snapshots": { | ||
"snapshotWritePeriodSeconds": 0 | ||
}, | ||
"dimensions": { | ||
"xMeters": 1500, | ||
"zMeters": 1500 | ||
} | ||
}, | ||
"workers": [ | ||
{ | ||
"worker_type": "UnityWorker", | ||
"load_balancing": { | ||
"auto_hex_grid": { | ||
"num_workers": 1 | ||
} | ||
}, | ||
"permissions": [{ | ||
"all": {} | ||
}] | ||
}, | ||
{ | ||
"worker_type": "UnityClient", | ||
"permissions": [{ | ||
"entity_creation": { | ||
"allow": false | ||
}, | ||
"entity_deletion": { | ||
"allow": false | ||
}, | ||
"entity_query": { | ||
"allow": true, | ||
"components": [ | ||
"*" | ||
] | ||
} | ||
}] | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package improbable.global; | ||
|
||
component ClientAuthorityCheck { | ||
id = 1002; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package improbable.global; | ||
|
||
type CreatePlayerRequest {} | ||
type CreatePlayerResponse {} | ||
|
||
component PlayerCreation { | ||
id = 1001; | ||
command CreatePlayerResponse create_player(CreatePlayerRequest); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package improbable.global; | ||
|
||
type Quaternion { | ||
float x = 1; | ||
float y = 2; | ||
float z = 3; | ||
float w = 4; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package improbable.global; | ||
|
||
import "improbable/global/Quaternion.schema"; | ||
|
||
component WorldTransform { | ||
id = 1000; | ||
EntityPosition position = 1; | ||
improbable.global.Quaternion rotation = 2; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package improbable.player; | ||
|
||
type ClientDisconnectRequest{} | ||
type ClientDisconnectResponse{} | ||
|
||
type HeartbeatRequest{} | ||
type HeartbeatResponse{} | ||
|
||
component ClientConnection { | ||
id = 1003; | ||
uint32 timeout_beats_remaining = 1; | ||
command HeartbeatResponse heartbeat(HeartbeatRequest); | ||
command ClientDisconnectResponse disconnect_client(ClientDisconnectRequest); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"name": "your_project_name_here", | ||
"project_version": "1.0.0", | ||
"sdk_version": "10.2.0", | ||
"dependencies": [ | ||
{"name": "WorkerSdkSchema", "version": "10.2.0"} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
spatialos_nexus.sbt | ||
spatialos_pack.sbt | ||
.spatialos | ||
generated | ||
project | ||
target | ||
build.json |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
{ | ||
"tasks": [ | ||
{ | ||
"name": "Codegen", | ||
"steps": [ | ||
{ | ||
"name": "Scala", | ||
"arguments": [ | ||
"process_schema", | ||
"generate", | ||
"--input=../../schema/", | ||
"--repository=../../build/dependencies/schema/", | ||
"--output=generated", | ||
"--language=scala" | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "Build", | ||
"steps": [ | ||
{ | ||
"name": "Codegen", | ||
"arguments": [ | ||
"invoke-task", | ||
"Codegen" | ||
] | ||
}, | ||
{ | ||
"name": "scala", | ||
"arguments": [ | ||
"invoke", | ||
"sbt", | ||
"workerPackage" | ||
] | ||
} | ||
] | ||
}, | ||
{ | ||
"name": "Clean", | ||
"steps": [ | ||
{ | ||
"name": "Scala", | ||
"arguments": [ | ||
"invoke", | ||
"sbt", | ||
"clean" | ||
] | ||
}, | ||
{ | ||
"name": "Generated code", | ||
"arguments": [ | ||
"process_schema", | ||
"clean", | ||
"generated" | ||
] | ||
} | ||
] | ||
} | ||
] | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"build": { | ||
"tasks_filename": "spatialos.gsim.build.json", | ||
"generated_build_scripts_type": "gsim" | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
// The sbt-pack plugin will print a warning if there is no main class in the | ||
// project. The sole purpose of this file is to mask this warning. | ||
|
||
object DummyMain extends App |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#Improbable Unity Ignores | ||
build.json | ||
.invoke.log | ||
zip_toolbelt.log | ||
Improbable.meta | ||
Assets/Improbable | ||
Assets/Plugins/Improbable | ||
Assets/Plugins/x86/Improbable | ||
Assets/Plugins/x86.meta | ||
Assets/Plugins/x86_64/Improbable | ||
Assets/Plugins/x86_64.meta | ||
Assets/Gamelogic/Generated/ | ||
Assets/Gamelogic/Generated.meta | ||
Assembly-CSharp-Editor.csproj | ||
Assembly-CSharp-firstpass.csproj | ||
Assembly-CSharp.csproj | ||
.spatialos | ||
|
||
# Standard Unity Ignores | ||
/[Ll]ibrary/ | ||
/[Tt]emp/ | ||
/[Oo]bj/ | ||
/[Bb]uild/ | ||
/[Bb]uilds/ | ||
/Assets/AssetStoreTools* | ||
|
||
# Autogenerated VS/MD solution and project files | ||
ExportedObj/ | ||
*.csproj | ||
*.unityproj | ||
*.sln | ||
*.suo | ||
*.tmp | ||
*.user | ||
*.userprefs | ||
*.pidb | ||
*.booproj | ||
*.svd | ||
|
||
# Unity3D generated meta files | ||
*.pidb.meta | ||
|
||
# Unity3D Generated File On Crash Reports | ||
sysinfo.txt | ||
|
||
# Builds | ||
*.apk | ||
*.unitypackage | ||
|
||
.idea/ |
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
using System.Collections.Generic; | ||
using System.IO; | ||
using Assets.Gamelogic.EntityTemplates; | ||
using Improbable; | ||
using Improbable.Worker; | ||
using UnityEngine; | ||
using JetBrains.Annotations; | ||
using UnityEditor; | ||
using Assets.Gamelogic.Global; | ||
|
||
namespace Assets.Editor | ||
{ | ||
public class SnapshotMenu : MonoBehaviour | ||
{ | ||
[MenuItem("Improbable/Snapshots/Generate Default Snapshot")] | ||
[UsedImplicitly] | ||
private static void GenerateDefaultSnapshot() | ||
{ | ||
var snapshotEntities = new Dictionary<EntityId, SnapshotEntity>(); | ||
var currentEntityId = 1; | ||
|
||
snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreatePlayerCreatorTemplate()); | ||
snapshotEntities.Add(new EntityId(currentEntityId++), EntityTemplateFactory.CreateCubeTemplate()); | ||
|
||
SaveSnapshot(snapshotEntities); | ||
} | ||
|
||
private static void SaveSnapshot(IDictionary<EntityId, SnapshotEntity> snapshotEntities) | ||
{ | ||
File.Delete(SimulationSettings.DefaultSnapshotPath); | ||
var maybeError = Snapshot.Save(SimulationSettings.DefaultSnapshotPath, snapshotEntities); | ||
|
||
if (maybeError.HasValue) | ||
{ | ||
Debug.LogErrorFormat("Failed to generate initial world snapshot: {0}", maybeError.Value); | ||
} | ||
else | ||
{ | ||
Debug.LogFormat("Successfully generated initial world snapshot at {0}", SimulationSettings.DefaultSnapshotPath); | ||
} | ||
} | ||
} | ||
} |
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.
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.
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.