game version overlay, working on actors sync

This commit is contained in:
2025-07-16 23:03:48 +02:00
parent 0da6f275c0
commit 4ec3dedd42
31 changed files with 1826 additions and 680 deletions

3
Editor/Background.meta Normal file
View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 94ddf6c8713749dda84e4de934d39bf0
timeCreated: 1752350242

View File

@@ -0,0 +1,34 @@
using RebootKit.Engine.Foundation;
using RebootKit.Engine.Simulation;
using UnityEditor;
using UnityEngine;
namespace RebootKit.Editor.Background {
[InitializeOnLoad]
public class EnsureUniqueActorID {
static EnsureUniqueActorID() {
ObjectChangeEvents.changesPublished += OnObjectChange;
}
static void OnObjectChange(ref ObjectChangeEventStream stream) {
for (int i = 0; i < stream.length; ++i) {
switch (stream.GetEventType(i)) {
case ObjectChangeKind.CreateGameObjectHierarchy:
stream.GetCreateGameObjectHierarchyEvent(i, out CreateGameObjectHierarchyEventArgs createEvent);
GameObject gameObjectChanged =
EditorUtility.InstanceIDToObject(createEvent.instanceId) as GameObject;
if (gameObjectChanged != null && gameObjectChanged.TryGetComponent(out Actor actor)) {
actor.ActorID = UniqueID.NewULongFromGuid();
EditorUtility.SetDirty(actor);
}
break;
}
}
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: bccf1b1891f9486e85330d8c7be3ea52
timeCreated: 1752350253

View File

@@ -1,6 +1,6 @@
{
"name": "SzafaKitEditor",
"rootNamespace": "RebootKitEditor",
"name": "RebootKit.Editor",
"rootNamespace": "RebootKit.Editor",
"references": [
"GUID:284059c7949783646b281a1b815580e6",
"GUID:9e24947de15b9834991c9d8411ea37cf",

View File

@@ -48,15 +48,15 @@ namespace RebootKit.Engine.Components {
}
void CopyTransformComponents() {
if (m_Components.HasFlag(TransformComponents.Position)) {
if ((m_Components & TransformComponents.Position) != 0) {
m_Transform.position = m_Source.position;
}
if (m_Components.HasFlag(TransformComponents.Rotation)) {
if ((m_Components & TransformComponents.Rotation) != 0) {
m_Transform.rotation = m_Source.rotation;
}
if (m_Components.HasFlag(TransformComponents.Scale)) {
if ((m_Components & TransformComponents.Scale) != 0) {
m_Transform.localScale = m_Source.localScale;
}
}

View File

@@ -86,7 +86,7 @@ namespace RebootKit.Engine.Console {
return;
}
if (!cvar.flags.HasFlag(CVarFlags.ReadOnly)) {
if ((cvar.flags & CVarFlags.ReadOnly) == 0) {
Save();
}
}
@@ -158,8 +158,8 @@ namespace RebootKit.Engine.Console {
IEnumerable<MethodInfo> methods = AppDomain.CurrentDomain.GetAssemblies()
.SelectMany(assembly => assembly.GetTypes())
.SelectMany(type => type.GetMethods(BindingFlags.NonPublic |
BindingFlags.Public |
BindingFlags.Static))
BindingFlags.Public |
BindingFlags.Static))
.Where(method => method.GetCustomAttributes(typeof(RCCMD), false)
.Length >
0);
@@ -256,7 +256,7 @@ namespace RebootKit.Engine.Console {
StringBuilder sb = new StringBuilder();
foreach (ConfigVar cvar in ConfigVarsContainer.All()) {
if (!cvar.flags.HasFlag(CVarFlags.ReadOnly)) {
if ((cvar.flags & CVarFlags.ReadOnly) == 0) {
sb.AppendFormat("{0} {1}\n", cvar.name, cvar);
}
}

View File

@@ -26,9 +26,9 @@ namespace RebootKit.Engine.Development {
StringBuilder sb = new StringBuilder();
sb.Append("Network: ");
sb.Append($"IsServer: {nm.IsServer}");
sb.Append($" | IsClient: {nm.IsClient}");
sb.Append($" | IsHost: {nm.IsHost}");
sb.Append($"IsServer: {nm.IsServer.ToString()}");
sb.Append($" | IsClient: {nm.IsClient.ToString()}");
sb.Append($" | IsHost: {nm.IsHost.ToString()}");
m_NetworkStatsLabel.text = sb.ToString();
}
@@ -37,7 +37,7 @@ namespace RebootKit.Engine.Development {
m_RootElement = new VisualElement();
CreateLabel($"Toggle Overlay [F3] | RebootKit | game: {Application.productName}, version: {Application.version}");
m_FPSLabel = CreateLabel($"FPS: {Application.targetFrameRate}");
m_FPSLabel = CreateLabel($"FPS: {Application.targetFrameRate.ToString()}");
m_NetworkStatsLabel = CreateLabel("Network Stats");

View File

@@ -4,18 +4,29 @@ using UnityEngine;
using UnityEngine.InputSystem;
namespace RebootKit.Engine.Development {
static class DebugConfig {
[ConfigVar("debug.overlay", 0, "Controls overlay visibility. 0 - hidden, 1 - visible")] public static ConfigVar s_OverlayMode;
static class DebugCVars {
[ConfigVar("debug.overlay", 0, "Controls overlay visibility. 0 - hidden, 1 - visible")]
public static ConfigVar OverlayMode;
[ConfigVar("debug.game_version", 1, "Controls game version overlay visibility. 0 - hidden, 1 - visible")]
public static ConfigVar ShowGameVersion;
[ConfigVar("debug.network_stats", 1, "Controls network stats overlay visibility. 0 - hidden, 1 - visible")]
public static ConfigVar ShowNetworkStats;
}
public class DevToolsService : ServiceMonoBehaviour {
[SerializeField] DebugOverlayView m_DebugOverlayView;
[SerializeField] GameVersionOverlay m_GameVersionOverlay;
[SerializeField] GameObject m_NetworkStatsOverlay;
IDisposable m_CVarChangedListener;
void Start() {
ConfigVar.StateChanged += OnCVarChanged;
OnCVarChanged(DebugConfig.s_OverlayMode);
OnCVarChanged(DebugCVars.OverlayMode);
OnCVarChanged(DebugCVars.ShowGameVersion);
OnCVarChanged(DebugCVars.ShowNetworkStats);
}
void OnDisable() {
@@ -28,7 +39,7 @@ namespace RebootKit.Engine.Development {
void Update() {
if (InputSystem.GetDevice<Keyboard>().f3Key.wasReleasedThisFrame) {
DebugConfig.s_OverlayMode.Set(DebugConfig.s_OverlayMode.IndexValue == 1 ? 0 : 1);
DebugCVars.OverlayMode.Set(DebugCVars.OverlayMode.IndexValue == 1 ? 0 : 1);
}
}
@@ -41,8 +52,12 @@ namespace RebootKit.Engine.Development {
}
void OnCVarChanged(ConfigVar cvar) {
if (cvar == DebugConfig.s_OverlayMode) {
if (cvar == DebugCVars.OverlayMode) {
OnOverlayModeChanged(cvar.IndexValue);
} else if (cvar == DebugCVars.ShowGameVersion) {
m_GameVersionOverlay.gameObject.SetActive(cvar.IndexValue > 0);
} else if (cvar == DebugCVars.ShowNetworkStats) {
m_NetworkStatsOverlay.SetActive(cvar.IndexValue > 0);
}
}
}

View File

@@ -0,0 +1,34 @@
using System;
using System.Text;
using RebootKit.Engine.Foundation;
using UnityEngine;
using UnityEngine.UIElements;
namespace RebootKit.Engine.Development {
public class GameVersionOverlay : MonoBehaviour {
const string k_VersionLabelName = "rr-dev__version_label";
[SerializeField] UIDocument m_Document;
void OnEnable() {
Label versionLabel = m_Document.rootVisualElement.Q<Label>(k_VersionLabelName);
versionLabel.text = BuildLabel();
}
string BuildLabel() {
StringBuilder sb = new StringBuilder();
sb.Append("ver. ");
sb.Append(Application.version);
#if RR_DEBUG
sb.Append(" (RR_DEBUG)");
#endif
#if RR_STEAM
sb.Append(" (RR_STEAM)");
#endif
return sb.ToString();
}
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 8faa5154dbc44f83ae3fa5c6057c11bb
timeCreated: 1752494644

View File

@@ -121,7 +121,7 @@ namespace RebootKit.Engine.Foundation {
public static event Action<ConfigVar> StateChanged = delegate { };
public void Set(int value) {
if (flags.HasFlag(CVarFlags.ReadOnly)) {
if ((flags & CVarFlags.ReadOnly) != 0) {
return;
}
@@ -130,7 +130,7 @@ namespace RebootKit.Engine.Foundation {
}
public void Set(float value) {
if (flags.HasFlag(CVarFlags.ReadOnly)) {
if ((flags & CVarFlags.ReadOnly) != 0) {
return;
}
@@ -139,7 +139,7 @@ namespace RebootKit.Engine.Foundation {
}
public void Set(string value) {
if (flags.HasFlag(CVarFlags.ReadOnly)) {
if ((flags & CVarFlags.ReadOnly) != 0) {
return;
}
@@ -148,7 +148,7 @@ namespace RebootKit.Engine.Foundation {
}
public void ParseFromString(string str) {
if (flags.HasFlag(CVarFlags.ReadOnly)) {
if ((flags & CVarFlags.ReadOnly) != 0) {
return;
}
@@ -160,7 +160,7 @@ namespace RebootKit.Engine.Foundation {
}
public void Reset() {
if (flags.HasFlag(CVarFlags.ReadOnly)) {
if ((flags & CVarFlags.ReadOnly) != 0) {
return;
}

View File

@@ -108,7 +108,7 @@ namespace RebootKit.Engine.Foundation {
StringBuilder sb = new StringBuilder();
foreach (ConfigVar cvar in All()) {
if (!cvar.flags.HasFlag(CVarFlags.ReadOnly)) {
if ((cvar.flags & CVarFlags.ReadOnly) == 0) {
sb.AppendFormat("{0} {1}\n", cvar.name, cvar);
}
}

View File

@@ -1,249 +0,0 @@
using System;
using UnityEngine.Assertions;
using UnityEngine.Events;
namespace RebootKit.Engine.Foundation {
public static class DisposableListenerEx {
/// Action
public static IDisposable Listen(this Action action, Action listener) {
Assert.IsNotNull(action);
Assert.IsNotNull(listener);
return new DisposableActionListener(action, listener);
}
public static IDisposable Listen<T>(this Action<T> action, Action<T> listener) {
Assert.IsNotNull(action);
Assert.IsNotNull(listener);
return new DisposableActionListener<T>(action, listener);
}
public static IDisposable Listen<T1, T2>(this Action<T1, T2> action, Action<T1, T2> listener) {
Assert.IsNotNull(action);
Assert.IsNotNull(listener);
return new DisposableActionListener<T1, T2>(action, listener);
}
public static IDisposable Listen<T1, T2, T3>(this Action<T1, T2, T3> action, Action<T1, T2, T3> listener) {
Assert.IsNotNull(action);
Assert.IsNotNull(listener);
return new DisposableActionListener<T1, T2, T3>(action, listener);
}
public static IDisposable Listen<T1, T2, T3, T4>(this Action<T1, T2, T3, T4> action, Action<T1, T2, T3, T4> listener) {
Assert.IsNotNull(action);
Assert.IsNotNull(listener);
return new DisposableActionListener<T1, T2, T3, T4>(action, listener);
}
/// UnityEvent
public static IDisposable Listen(this UnityEvent unityEvent, UnityAction listener) {
Assert.IsNotNull(unityEvent);
Assert.IsNotNull(listener);
return new DisposableUnityEventListener(unityEvent, listener);
}
public static IDisposable Listen<T>(this UnityEvent<T> unityEvent, UnityAction<T> listener) {
Assert.IsNotNull(unityEvent);
Assert.IsNotNull(listener);
return new DisposableUnityEventListener<T>(unityEvent, listener);
}
public static IDisposable Listen<T1, T2>(this UnityEvent<T1, T2> unityEvent, UnityAction<T1, T2> listener) {
Assert.IsNotNull(unityEvent);
Assert.IsNotNull(listener);
return new DisposableUnityEventListener<T1, T2>(unityEvent, listener);
}
public static IDisposable Listen<T1, T2, T3>(this UnityEvent<T1, T2, T3> unityEvent, UnityAction<T1, T2, T3> listener) {
Assert.IsNotNull(unityEvent);
Assert.IsNotNull(listener);
return new DisposableUnityEventListener<T1, T2, T3>(unityEvent, listener);
}
public static IDisposable Listen<T1, T2, T3, T4>(this UnityEvent<T1, T2, T3, T4> unityEvent, UnityAction<T1, T2, T3, T4> listener) {
Assert.IsNotNull(unityEvent);
Assert.IsNotNull(listener);
return new DisposableUnityEventListener<T1, T2, T3, T4>(unityEvent, listener);
}
}
struct DisposableActionListener : IDisposable {
Action m_Action;
readonly Action m_Listener;
internal DisposableActionListener(Action action, Action listener) {
m_Action = action;
m_Listener = listener;
m_Action += m_Listener;
}
public void Dispose() {
if (m_Action != null) {
m_Action -= m_Listener;
m_Action = null;
}
}
}
struct DisposableActionListener<T> : IDisposable {
Action<T> m_Action;
readonly Action<T> m_Listener;
internal DisposableActionListener(Action<T> action, Action<T> listener) {
m_Action = action;
m_Listener = listener;
m_Action += m_Listener;
}
public void Dispose() {
if (m_Action != null) {
m_Action -= m_Listener;
m_Action = null;
}
}
}
struct DisposableActionListener<T1, T2> : IDisposable {
Action<T1, T2> m_Action;
readonly Action<T1, T2> m_Listener;
internal DisposableActionListener(Action<T1, T2> action, Action<T1, T2> listener) {
m_Action = action;
m_Listener = listener;
m_Action += m_Listener;
}
public void Dispose() {
if (m_Action != null) {
m_Action -= m_Listener;
m_Action = null;
}
}
}
struct DisposableActionListener<T1, T2, T3> : IDisposable {
Action<T1, T2, T3> m_Action;
readonly Action<T1, T2, T3> m_Listener;
internal DisposableActionListener(Action<T1, T2, T3> action, Action<T1, T2, T3> listener) {
m_Action = action;
m_Listener = listener;
m_Action += m_Listener;
}
public void Dispose() {
if (m_Action != null) {
m_Action -= m_Listener;
m_Action = null;
}
}
}
struct DisposableActionListener<T1, T2, T3, T4> : IDisposable {
Action<T1, T2, T3, T4> m_Action;
readonly Action<T1, T2, T3, T4> m_Listener;
internal DisposableActionListener(Action<T1, T2, T3, T4> action, Action<T1, T2, T3, T4> listener) {
m_Action = action;
m_Listener = listener;
m_Action += m_Listener;
}
public void Dispose() {
if (m_Action != null) {
m_Action -= m_Listener;
m_Action = null;
}
}
}
struct DisposableUnityEventListener : IDisposable {
UnityEvent m_Event;
readonly UnityAction m_Listener;
internal DisposableUnityEventListener(UnityEvent unityEvent, UnityAction listener) {
m_Event = unityEvent;
m_Listener = listener;
m_Event.AddListener(m_Listener);
}
public void Dispose() {
if (m_Event != null) {
m_Event.RemoveListener(m_Listener);
m_Event = null;
}
}
}
struct DisposableUnityEventListener<T> : IDisposable {
UnityEvent<T> m_Event;
readonly UnityAction<T> m_Listener;
internal DisposableUnityEventListener(UnityEvent<T> unityEvent, UnityAction<T> listener) {
m_Event = unityEvent;
m_Listener = listener;
m_Event.AddListener(m_Listener);
}
public void Dispose() {
if (m_Event != null) {
m_Event.RemoveListener(m_Listener);
m_Event = null;
}
}
}
struct DisposableUnityEventListener<T1, T2> : IDisposable {
UnityEvent<T1, T2> m_Event;
readonly UnityAction<T1, T2> m_Listener;
internal DisposableUnityEventListener(UnityEvent<T1, T2> unityEvent, UnityAction<T1, T2> listener) {
m_Event = unityEvent;
m_Listener = listener;
m_Event.AddListener(m_Listener);
}
public void Dispose() {
if (m_Event != null) {
m_Event.RemoveListener(m_Listener);
m_Event = null;
}
}
}
struct DisposableUnityEventListener<T1, T2, T3> : IDisposable {
UnityEvent<T1, T2, T3> m_Event;
readonly UnityAction<T1, T2, T3> m_Listener;
internal DisposableUnityEventListener(UnityEvent<T1, T2, T3> unityEvent, UnityAction<T1, T2, T3> listener) {
m_Event = unityEvent;
m_Listener = listener;
m_Event.AddListener(m_Listener);
}
public void Dispose() {
if (m_Event != null) {
m_Event.RemoveListener(m_Listener);
m_Event = null;
}
}
}
struct DisposableUnityEventListener<T1, T2, T3, T4> : IDisposable {
UnityEvent<T1, T2, T3, T4> m_Event;
readonly UnityAction<T1, T2, T3, T4> m_Listener;
internal DisposableUnityEventListener(UnityEvent<T1, T2, T3, T4> unityEvent, UnityAction<T1, T2, T3, T4> listener) {
m_Event = unityEvent;
m_Listener = listener;
m_Event.AddListener(m_Listener);
}
public void Dispose() {
if (m_Event != null) {
m_Event.RemoveListener(m_Listener);
m_Event = null;
}
}
}
}

View File

@@ -1,3 +0,0 @@
fileFormatVersion: 2
guid: 60723820074047008649a9c5c1caa1eb
timeCreated: 1743248914

View File

@@ -79,8 +79,6 @@ namespace RebootKit.Engine.Foundation {
default:
throw new ArgumentOutOfRangeException(nameof(level), level, null);
}
return "";
}
}
}

View File

@@ -1,6 +1,68 @@
using Unity.Netcode;
using RebootKit.Engine.Foundation;
using RebootKit.Engine.Simulation;
using Unity.Netcode;
namespace RebootKit.Engine.Main {
public abstract class NetworkPlayerController : NetworkBehaviour {
static readonly Logger s_Logger = new Logger(nameof(NetworkPlayerController));
public Actor PossessedActor { get; private set; }
public void PossessActor(Actor actor) {
if (!IsServer) {
s_Logger.Error("PossessActor can only be called on the server.");
return;
}
if (actor == null) {
s_Logger.Error("Cannot possess a null actor.");
return;
}
PossessActorRpc(actor.ActorID, RpcTarget.Everyone);
}
[Rpc(SendTo.SpecifiedInParams)]
void PossessActorRpc(ulong actorID, RpcParams rpcParams) {
Actor actor = RR.FindSpawnedActor(actorID);
if (actor == null) {
s_Logger.Error($"Actor with ID {actorID} not found.");
return;
}
if (PossessedActor is not null) {
OnUnpossessActor(PossessedActor);
}
PossessedActor = actor;
OnPossessActor(actor);
}
public void UnPossessActor() {
if (!IsServer) {
s_Logger.Error("UnPossessActor can only be called on the server.");
return;
}
if (PossessedActor == null) {
return;
}
UnPossessActorRpc(RpcTarget.Everyone);
}
[Rpc(SendTo.SpecifiedInParams)]
void UnPossessActorRpc(RpcParams rpcParams) {
if (PossessedActor is not null) {
OnUnpossessActor(PossessedActor);
PossessedActor = null;
}
}
protected virtual void OnPossessActor(Actor actor) {
}
protected virtual void OnUnpossessActor(Actor actor) {
}
}
}

View File

@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading;
using Cysharp.Threading.Tasks;
using RebootKit.Engine.Simulation;
@@ -24,7 +23,7 @@ namespace RebootKit.Engine.Main {
[field: SerializeField] public ActorsManager Actors { get; private set; }
readonly Dictionary<ulong, NetworkClientState> m_Clients = new Dictionary<ulong, NetworkClientState>();
internal readonly Dictionary<ulong, NetworkClientState> Clients = new Dictionary<ulong, NetworkClientState>();
FixedString512Bytes m_WorldID = new FixedString512Bytes("");
bool m_IsChangingWorld = false;
@@ -61,7 +60,7 @@ namespace RebootKit.Engine.Main {
IsReadyForActorsSync = false,
IsReady = false
};
m_Clients.Add(clientID, newClientState);
Clients.Add(clientID, newClientState);
if (!m_WorldID.IsEmpty) {
s_Logger.Info($"Synchronizing world load for client {clientID} with world ID '{m_WorldID}'");
@@ -75,11 +74,11 @@ namespace RebootKit.Engine.Main {
}
s_Logger.Info($"OnClientDisconnect: {clientID}");
m_Clients.Remove(clientID);
Clients.Remove(clientID);
}
internal NetworkClientState GetClientState(ulong clientID) {
if (m_Clients.TryGetValue(clientID, out NetworkClientState clientState)) {
if (Clients.TryGetValue(clientID, out NetworkClientState clientState)) {
return clientState;
}
@@ -106,7 +105,7 @@ namespace RebootKit.Engine.Main {
m_WorldID = worldID;
foreach (KeyValuePair<ulong, NetworkClientState> kv in m_Clients) {
foreach (KeyValuePair<ulong, NetworkClientState> kv in Clients) {
kv.Value.IsWorldLoaded = false;
kv.Value.AreActorsSynced = false;
kv.Value.IsReadyForActorsSync = false;
@@ -176,7 +175,7 @@ namespace RebootKit.Engine.Main {
return;
}
if (m_Clients.TryGetValue(clientID, out NetworkClientState clientState)) {
if (Clients.TryGetValue(clientID, out NetworkClientState clientState)) {
clientState.IsWorldLoaded = true;
clientState.IsReadyForActorsSync = false;
Actors.SynchronizeActorsForClient(clientID);

View File

@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using System.Threading;
using Cysharp.Threading.Tasks;
using R3;
@@ -18,6 +19,8 @@ using Assert = UnityEngine.Assertions.Assert;
using Logger = RebootKit.Engine.Foundation.Logger;
using Object = UnityEngine.Object;
[assembly: InternalsVisibleTo("RebootKit.Editor")]
namespace RebootKit.Engine.Main {
public static class RR {
static readonly Logger s_Logger = new Logger("RR");
@@ -61,7 +64,7 @@ namespace RebootKit.Engine.Main {
s_Logger.Info("Initializing");
s_servicesBag = new DisposableBag();
s_disposableBag = new DisposableBag();
s_Logger.Info("Registering core services");
Console = CreateService<ConsoleService>();
Input = new InputService(EngineConfig.inputConfig);
@@ -70,7 +73,9 @@ namespace RebootKit.Engine.Main {
await InitializeAssetsAsync(cancellationToken);
// await SteamManager.InitializeAsync(cancellationToken);
#if RR_STEAM
await SteamManager.InitializeAsync(cancellationToken);
#endif
}
// @NOTE: This method is called after the main scene is loaded.
@@ -82,6 +87,14 @@ namespace RebootKit.Engine.Main {
NetworkManager.Singleton.OnServerStarted += OnServerStarted;
NetworkManager.Singleton.OnServerStopped += OnServerStopped;
#if RR_STEAM
if (NetworkManager.Singleton.TryGetComponent(out FacepunchTransport facepunchTransport)) {
NetworkManager.Singleton.NetworkConfig.NetworkTransport = facepunchTransport;
} else {
s_Logger.Error("Steam integration is enabled but FacepunchTransport is not found in NetworkManager.");
}
#endif
Observable.EveryUpdate()
.Subscribe(_ => Tick())
.AddTo(ref s_disposableBag);
@@ -116,7 +129,9 @@ namespace RebootKit.Engine.Main {
NetworkManager.Singleton.OnServerStopped -= OnServerStopped;
}
// SteamManager.Shutdown();
#if RR_STEAM
SteamManager.Shutdown();
#endif
s_servicesBag.Dispose();
s_disposableBag.Dispose();
@@ -195,28 +210,28 @@ namespace RebootKit.Engine.Main {
NetworkSystemInstance.SetCurrentWorld(worldID);
}
public static void SpawnActor(AssetReferenceGameObject assetReference,
Vector3 position,
Quaternion rotation) {
public static Actor SpawnActor(AssetReferenceGameObject assetReference,
Vector3 position,
Quaternion rotation) {
if (!IsServer()) {
s_Logger.Error("Cannot spawn actor. Not a server instance.");
return;
return null;
}
if (NetworkSystemInstance is null) {
s_Logger.Error("NetworkSystemInstance is not initialized. Cannot spawn actor.");
return;
return null;
}
if (!assetReference.RuntimeKeyIsValid()) {
s_Logger.Error("Asset reference is not valid. Cannot spawn actor.");
return;
return null;
}
s_Logger.Info($"Spawning actor from asset reference: {assetReference.RuntimeKey}");
NetworkSystemInstance.Actors.SpawnActor(assetReference, position, rotation);
return NetworkSystemInstance.Actors.SpawnActor(assetReference, position, rotation);
}
public static Actor FindSpawnedActor(ulong actorID) {
if (NetworkSystemInstance is null) {
s_Logger.Error("NetworkSystemInstance is not initialized. Cannot find actor.");
@@ -334,6 +349,8 @@ namespace RebootKit.Engine.Main {
}
public static void ConnectWithSteamID(ulong steamId) {
#if RR_STEAM
if (NetworkManager.Singleton.IsClient) {
s_Logger.Error("Already connected to a server");
return;
@@ -346,6 +363,9 @@ namespace RebootKit.Engine.Main {
} else {
s_Logger.Error("Network transport is not FacepunchTransport. Cannot connect with Steam ID.");
}
#else
s_Logger.Error("Steam integration is not enabled. Cannot connect with Steam ID.");
#endif
}
public static void Disconnect() { }
@@ -395,7 +415,7 @@ namespace RebootKit.Engine.Main {
GameInstance = Object.Instantiate(EngineConfig.gamePrefab);
GameInstance.NetworkObject.Spawn();
NetworkSystemInstance = Object.Instantiate(s_networkSystemPrefab);
NetworkSystemInstance.NetworkObject.Spawn();
}
@@ -407,7 +427,7 @@ namespace RebootKit.Engine.Main {
GameInstance.NetworkObject.Despawn();
GameInstance = null;
}
if (NetworkSystemInstance is not null) {
if (NetworkSystemInstance.NetworkObject is not null && NetworkSystemInstance.NetworkObject.IsSpawned) {
NetworkSystemInstance.NetworkObject.Despawn();

View File

@@ -1,7 +1,9 @@
using System;
using NUnit.Framework;
using System.ComponentModel.DataAnnotations;
using System.Globalization;
using RebootKit.Engine.Foundation;
using RebootKit.Engine.Main;
using TriInspector;
using Unity.Collections;
using Unity.Collections.LowLevel.Unsafe;
using Unity.Netcode;
@@ -122,48 +124,514 @@ namespace RebootKit.Engine.Simulation {
}
}
[Flags]
enum ActorPhysicsFlags : byte {
None = 0,
IsKinematic = 1 << 0,
DisableColliders = 1 << 1,
}
struct ActorCoreStateSnapshot : INetworkSerializable {
public DateTime Timestamp;
// @NOTE: Position, Rotation, and Scale are in local space.
public Vector3 Position;
public Quaternion Rotation;
public Vector3 Scale;
public bool IsHidden;
public ActorPhysicsFlags Flags;
public ulong MasterActorID;
public FixedString32Bytes MasterSocketName;
public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter {
serializer.SerializeValue(ref Timestamp);
serializer.SerializeValue(ref Position);
serializer.SerializeValue(ref Rotation);
serializer.SerializeValue(ref Scale);
serializer.SerializeValue(ref IsHidden);
serializer.SerializeValue(ref Flags);
serializer.SerializeValue(ref MasterActorID);
serializer.SerializeValue(ref MasterSocketName);
}
}
///
/// Represents the synchronization mode for actor transforms (and rigidbody).
/// @TODO: Might be a good idea to keep client-side actors rigidbody as kinematic and simulate physics only on the server.
/// IMPORTANT:
/// - Position, Rotation, and Scale are in local space.
/// - Velocity and AngularVelocity are only used if UsingRigidbody is set.
/// - When Actor is mounted to another actor, sync won't happen.
///
[Flags]
public enum ActorTransformSyncMode : byte {
None = 0,
Position = 1 << 0,
Rotation = 1 << 1,
Scale = 1 << 2,
UsingRigidbody = 1 << 3, // @NOTE: If this is set, Position and Rotation will be synced using Rigidbody's position and rotation.
Velocity = 1 << 4, // @NOTE: Velocity is only used if UsingRigidbody is set.
AngularVelocity = 1 << 5 // @NOTE: AngularVelocity is only used if UsingRigidbody is set.
}
public struct ActorTransformSyncData : INetworkSerializable {
public ActorTransformSyncMode SyncMode;
public Vector3 Position;
public Quaternion Rotation;
public Vector3 Scale;
public Vector3 Velocity;
public Vector3 AngularVelocity;
public void NetworkSerialize<T>(BufferSerializer<T> serializer) where T : IReaderWriter {
serializer.SerializeValue(ref SyncMode);
if ((SyncMode & ActorTransformSyncMode.Position) != 0) {
serializer.SerializeValue(ref Position);
}
if ((SyncMode & ActorTransformSyncMode.Rotation) != 0) {
serializer.SerializeValue(ref Rotation);
}
if ((SyncMode & ActorTransformSyncMode.Scale) != 0) {
serializer.SerializeValue(ref Scale);
}
if ((SyncMode & ActorTransformSyncMode.Velocity) != 0) {
serializer.SerializeValue(ref Velocity);
}
if ((SyncMode & ActorTransformSyncMode.AngularVelocity) != 0) {
serializer.SerializeValue(ref AngularVelocity);
}
}
}
public abstract class Actor : MonoBehaviour {
static readonly Logger s_ActorLogger = new Logger(nameof(Actor));
[field: SerializeField, TriInspector.ReadOnly] public string SourceActorPath { get; internal set; } = "";
[field: SerializeField, ReadOnly] public ulong ActorID { get; internal set; }
[field: SerializeField, Unity.Collections.ReadOnly] public ulong ActorID { get; internal set; }
[NonSerialized] internal IActorData Data;
[SerializeField] string m_ActorName = "";
public string ActorName {
get {
return m_ActorName;
}
}
[SerializeField] internal Rigidbody actorRigidbody;
[InfoBox("If empty, will use GetComponentsInChildren<Collider>() to find colliders.")]
[SerializeField] Collider[] m_OverrideActorColliders;
[SerializeField] bool m_SetKinematicOnMount = true;
[SerializeField] bool m_DisableCollidersOnMount = true;
internal ActorPhysicsFlags PhysicsFlagsBeforeMount = ActorPhysicsFlags.None;
internal ActorPhysicsFlags PhysicsFlags = ActorPhysicsFlags.None;
// @NOTE: Sync won't happen if actor is mounted to another actor.
[SerializeField] internal ActorTransformSyncMode transformSyncMode = ActorTransformSyncMode.None;
[Serializable]
public struct AttachmentSocket {
[MaxLength(32)]
public string socketName;
public Transform root;
public Vector3 localPosition;
public Quaternion localRotation;
}
[SerializeField] AttachmentSocket[] m_AttachmentSockets;
// @NOTE: Master actor is the actor that this actor is attached to, if any.
internal Actor MasterActor;
internal FixedString32Bytes MasterSocketName;
public bool IsDataDirty { get; protected internal set; }
internal ActorsManager Manager;
public bool IsHidden() {
return !gameObject.activeSelf;
}
internal DateTime LastCoreStateSyncTime = DateTime.MinValue;
// @MARK: Callbacks to override in derived classes
protected abstract IActorData CreateActorData();
// Override this method to implement server-side logic
public virtual void ServerTick(float deltaTime) { }
// Override this method to implement client-side logic
public virtual void ClientTick(float deltaTime) { }
// @NOTE: Server-side method to handle actor commands
protected virtual void OnActorCommandServer(ActorCommand actorCommand) { }
// @NOTE: Client-side method to handle actor events
protected virtual void OnActorEventClient(ActorEvent actorEvent) { }
// @MARK: Server API
public void SetHidden(bool hidden) {
if (!RR.IsServer()) {
s_ActorLogger.Error($"Only the server can set actor visibility. Actor: {name} (ID: {ActorID})");
return;
}
Manager.SetActorHidden(ActorID, hidden);
bool shouldBeActive = !hidden;
if (gameObject.activeSelf == shouldBeActive) {
s_ActorLogger
.Warning($"Actor {name} (ID: {ActorID}) is already in the desired visibility state: {shouldBeActive.ToString()}");
return;
}
gameObject.SetActive(shouldBeActive);
Manager.SynchronizeActorCoreStateWithOther(this);
}
public void MountTo(Actor actor, string slotName) {
if (!RR.IsServer()) {
s_ActorLogger.Error($"Only the server can mount actors. Actor: {name} (ID: {ActorID})");
return;
}
if (actor.TryGetAttachmentSocket(slotName, out AttachmentSocket _)) {
MasterActor = actor;
MasterSocketName = new FixedString32Bytes(slotName);
PhysicsFlagsBeforeMount = PhysicsFlags;
if (m_SetKinematicOnMount) {
PhysicsFlags |= ActorPhysicsFlags.IsKinematic;
}
if (m_DisableCollidersOnMount) {
PhysicsFlags |= ActorPhysicsFlags.DisableColliders;
}
UpdateLocalPhysicsState(PhysicsFlags);
UpdateMountedTransform();
Manager.SynchronizeActorCoreStateWithOther(this);
}
}
public void UnMount() {
if (!RR.IsServer()) {
s_ActorLogger.Error($"Only the server can unmount actors. Actor: {name} (ID: {ActorID})");
return;
}
if (MasterActor == null) {
s_ActorLogger.Error($"Actor {name} (ID: {ActorID}) is not mounted to any actor.");
return;
}
MasterActor = null;
MasterSocketName = default;
UpdateMountedTransform();
PhysicsFlags = PhysicsFlagsBeforeMount;
UpdateLocalPhysicsState(PhysicsFlags);
Manager.SynchronizeActorCoreStateWithOther(this);
}
public void SetCollidersEnabled(bool enableColliders) {
if (!RR.IsServer()) {
s_ActorLogger.Error($"Only the server can enable/disable colliders. Actor: {name} (ID: {ActorID})");
return;
}
if (actorRigidbody is null) {
s_ActorLogger.Error($"Actor {name} (ID: {ActorID}) has no Rigidbody to set colliders on.");
return;
}
if (enableColliders) {
PhysicsFlags &= ~ActorPhysicsFlags.DisableColliders;
} else {
PhysicsFlags |= ActorPhysicsFlags.DisableColliders;
}
UpdateLocalCollidersState(enableColliders);
Manager.SynchronizeActorCoreStateWithOther(this);
}
public void SetKinematic(bool isKinematic) {
if (!RR.IsServer()) {
s_ActorLogger.Error($"Only the server can set kinematic state. Actor: {name} (ID: {ActorID})");
return;
}
if (actorRigidbody is null) {
s_ActorLogger.Error($"Actor {name} (ID: {ActorID}) has no Rigidbody to set kinematic state on.");
return;
}
if (isKinematic) {
PhysicsFlags |= ActorPhysicsFlags.IsKinematic;
} else {
PhysicsFlags &= ~ActorPhysicsFlags.IsKinematic;
}
actorRigidbody.isKinematic = isKinematic;
Manager.SynchronizeActorCoreStateWithOther(this);
}
// @MARK: Common API
public bool IsHidden() {
return !gameObject.activeSelf;
}
protected void SendActorCommand<TCmdData>(ushort commandID, ref TCmdData commandData)
where TCmdData : struct, ISerializableEntity {
NativeArray<byte> data = DataSerializationUtils.Serialize(commandData);
SendActorCommand(commandID, data);
}
protected void SendActorCommand(ushort commandID, NativeArray<byte> data = default) {
if (Manager is null) {
s_ActorLogger.Error($"Cannot send command because Manager is null for actor {name} (ID: {ActorID})");
return;
}
ActorCommand command = new ActorCommand {
ActorID = ActorID,
ClientID = NetworkManager.Singleton.LocalClientId,
CommandID = commandID,
Data = data
};
Manager.SendActorCommandToServerRpc(command);
}
protected void SendActorEvent<TEventData>(ushort eventID, ref TEventData eventData)
where TEventData : struct, ISerializableEntity {
NativeArray<byte> data = DataSerializationUtils.Serialize(eventData);
SendActorEvent(eventID, data);
}
protected void SendActorEvent(ushort eventID, NativeArray<byte> data = default) {
if (!RR.IsServer()) {
s_ActorLogger.Error($"Only the server can send actor events. Actor: {name} (ID: {ActorID})");
return;
}
if (Manager is null) {
s_ActorLogger.Error($"Cannot send event because Manager is null for actor {name} (ID: {ActorID})");
return;
}
ActorEvent actorEvent = new ActorEvent {
ActorID = ActorID,
ClientID = NetworkManager.Singleton.LocalClientId,
EventID = eventID,
Data = data
};
Manager.SendActorEvent(actorEvent);
}
protected T DataAs<T>() where T : IActorData {
if (Data is T data) {
return data;
}
throw new InvalidCastException($"Actor data is not of type {typeof(T).Name}");
}
bool TryGetAttachmentSocket(string socketName, out AttachmentSocket socket) {
foreach (AttachmentSocket attachmentSocket in m_AttachmentSockets) {
if (attachmentSocket.socketName == socketName) {
socket = attachmentSocket;
return true;
}
}
socket = default;
return false;
}
// @MARK: Internal API
internal ActorCoreStateSnapshot GetCoreStateSnapshot() {
ActorCoreStateSnapshot snapshot = new ActorCoreStateSnapshot();
snapshot.Timestamp = DateTime.UtcNow;
snapshot.Position = transform.localPosition;
snapshot.Rotation = transform.localRotation;
snapshot.Scale = transform.localScale;
snapshot.IsHidden = !gameObject.activeSelf;
snapshot.Flags = PhysicsFlags;
snapshot.MasterActorID = MasterActor != null ? MasterActor.ActorID : 0;
if (snapshot.MasterActorID != 0) {
snapshot.MasterSocketName = MasterSocketName;
} else {
snapshot.MasterSocketName = default;
}
return snapshot;
}
internal void RestoreCoreState(ActorCoreStateSnapshot snapshot) {
if (snapshot.Timestamp < LastCoreStateSyncTime) {
s_ActorLogger.Warning($"Received an outdated core state snapshot for actor {name} (ID: {ActorID}). " +
$"Current time: {DateTime.UtcNow.ToString(CultureInfo.InvariantCulture)}, Snapshot time: {snapshot.Timestamp}");
return;
}
LastCoreStateSyncTime = snapshot.Timestamp;
PhysicsFlags = snapshot.Flags;
if (snapshot.MasterActorID != 0) {
MasterActor = RR.FindSpawnedActor(snapshot.MasterActorID);
MasterSocketName = snapshot.MasterSocketName;
UpdateMountedTransform();
} else {
MasterActor = null;
MasterSocketName = default;
UpdateMountedTransform();
transform.localPosition = snapshot.Position;
transform.localRotation = snapshot.Rotation;
transform.localScale = snapshot.Scale;
}
if (snapshot.IsHidden) {
gameObject.SetActive(false);
} else {
gameObject.SetActive(true);
}
UpdateLocalPhysicsState(PhysicsFlags);
}
internal ActorTransformSyncData GetTransformSyncData() {
ActorTransformSyncData data = new ActorTransformSyncData {
SyncMode = transformSyncMode
};
bool useRigidbody = (data.SyncMode & ActorTransformSyncMode.UsingRigidbody) != 0;
if (useRigidbody && actorRigidbody == null) {
s_ActorLogger
.Error($"Actor {name} (ID: {ActorID.ToString()}) has no Rigidbody to sync transform. Ignoring transform sync.");
data.SyncMode = ActorTransformSyncMode.None;
return data;
}
if ((data.SyncMode & ActorTransformSyncMode.Position) != 0) {
if (useRigidbody) {
data.Position = actorRigidbody.position;
} else {
data.Position = transform.localPosition;
}
}
if ((data.SyncMode & ActorTransformSyncMode.Rotation) != 0) {
if (useRigidbody) {
data.Rotation = actorRigidbody.rotation;
} else {
data.Rotation = transform.localRotation;
}
}
if ((data.SyncMode & ActorTransformSyncMode.Scale) != 0) {
data.Scale = transform.localScale;
}
if (useRigidbody && actorRigidbody != null) {
if ((data.SyncMode & ActorTransformSyncMode.Velocity) != 0) {
data.Velocity = actorRigidbody.linearVelocity;
}
if ((data.SyncMode & ActorTransformSyncMode.AngularVelocity) != 0) {
data.AngularVelocity = actorRigidbody.angularVelocity;
}
}
return data;
}
internal void RestoreTransformState(ActorTransformSyncData data) {
bool useRigidbody = (data.SyncMode & ActorTransformSyncMode.UsingRigidbody) != 0;
if (useRigidbody && actorRigidbody == null) {
s_ActorLogger
.Error($"Actor {name} (ID: {ActorID.ToString()}) has no Rigidbody to restore transform state. Ignoring transform sync.");
return;
}
if ((data.SyncMode & ActorTransformSyncMode.Position) != 0) {
if (useRigidbody) {
actorRigidbody.position = data.Position;
} else {
transform.localPosition = data.Position;
}
}
if ((data.SyncMode & ActorTransformSyncMode.Rotation) != 0) {
if (useRigidbody) {
actorRigidbody.rotation = data.Rotation;
} else {
transform.localRotation = data.Rotation;
}
}
if ((data.SyncMode & ActorTransformSyncMode.Scale) != 0) {
transform.localScale = data.Scale;
}
if (useRigidbody && (data.SyncMode & ActorTransformSyncMode.Velocity) != 0) {
actorRigidbody.linearVelocity = data.Velocity;
}
if (useRigidbody && (data.SyncMode & ActorTransformSyncMode.AngularVelocity) != 0) {
actorRigidbody.angularVelocity = data.AngularVelocity;
}
}
void UpdateLocalPhysicsState(ActorPhysicsFlags flags) {
if (actorRigidbody == null) {
return;
}
if ((flags & ActorPhysicsFlags.IsKinematic) != 0) {
actorRigidbody.isKinematic = true;
} else {
actorRigidbody.isKinematic = false;
}
bool enableColliders = (flags & ActorPhysicsFlags.DisableColliders) == 0;
UpdateLocalCollidersState(enableColliders);
}
void UpdateLocalCollidersState(bool enable) {
Collider[] colliders = m_OverrideActorColliders.Length > 0 ? m_OverrideActorColliders
: GetComponentsInChildren<Collider>();
foreach (Collider col in colliders) {
col.enabled = enable;
}
}
void UpdateMountedTransform() {
if (MasterActor == null) {
transform.SetParent(null);
return;
}
if (MasterActor.TryGetAttachmentSocket(MasterSocketName.Value, out AttachmentSocket socket)) {
transform.SetParent(socket.root);
transform.localPosition = socket.localPosition;
transform.localRotation = socket.localRotation;
} else {
s_ActorLogger
.Error($"Failed to update mounted transform: Socket {MasterSocketName} not found on {MasterActor.name}");
}
}
internal IActorData InternalCreateActorData() {
@@ -205,71 +673,8 @@ namespace RebootKit.Engine.Simulation {
OnActorEventClient(actorEvent);
}
protected abstract IActorData CreateActorData();
// Override this method to implement server-side logic
public virtual void ServerTick(float deltaTime) { }
// Override this method to implement client-side logic
public virtual void ClientTick(float deltaTime) { }
// @NOTE: Server-side method to handle actor commands
protected virtual void OnActorCommandServer(ActorCommand actorCommand) { }
// @NOTE: Client-side method to handle actor events
protected virtual void OnActorEventClient(ActorEvent actorEvent) { }
protected void SendActorCommand<TCmdData>(ushort commandID, ref TCmdData commandData)
where TCmdData : struct, ISerializableEntity {
NativeArray<byte> data = DataSerializationUtils.Serialize(commandData);
SendActorCommand(commandID, data);
}
protected void SendActorCommand(ushort commandID, NativeArray<byte> data = default) {
if (Manager is null) {
s_ActorLogger.Error($"Cannot send command because Manager is null for actor {name} (ID: {ActorID})");
return;
}
ActorCommand command = new ActorCommand {
ActorID = ActorID,
ClientID = NetworkManager.Singleton.LocalClientId,
CommandID = commandID,
Data = data
};
Manager.SendActorCommandToServerRpc(command);
}
protected void SendActorEvent(ushort eventID, NativeArray<byte> data = default) {
if (!RR.IsServer()) {
s_ActorLogger.Error($"Only the server can send actor events. Actor: {name} (ID: {ActorID})");
return;
}
if (Manager is null) {
s_ActorLogger.Error($"Cannot send event because Manager is null for actor {name} (ID: {ActorID})");
return;
}
ActorEvent actorEvent = new ActorEvent {
ActorID = ActorID,
ClientID = NetworkManager.Singleton.LocalClientId,
EventID = eventID,
Data = data
};
Manager.SendActorEventToClientsRpc(actorEvent);
}
protected T DataAs<T>() where T : IActorData {
if (Data is T data) {
return data;
}
throw new System.InvalidCastException($"Actor data is not of type {typeof(T).Name}");
}
// @MARK: Unity lifecycle methods
void OnValidate() {
if (ActorID == 0) {
ActorID = UniqueID.NewULongFromGuid();

View File

@@ -1,4 +1,5 @@
using System.Collections.Generic;
using RebootKit.Engine.Extensions;
using RebootKit.Engine.Foundation;
using RebootKit.Engine.Main;
using Unity.Collections;
@@ -30,6 +31,10 @@ namespace RebootKit.Engine.Simulation {
foreach (Actor actor in m_InSceneActors) {
actor.ClientTick(Time.deltaTime);
}
foreach (Actor actor in m_SpawnedActors) {
actor.ClientTick(Time.deltaTime);
}
}
void OnServerTick(ulong tick) {
@@ -39,47 +44,82 @@ namespace RebootKit.Engine.Simulation {
float dt = 1.0f / RR.TickRate.IndexValue;
foreach (Actor actor in m_InSceneActors) {
actor.ServerTick(dt);
TickActorsList(m_InSceneActors, dt);
TickActorsList(m_SpawnedActors, dt);
}
void TickActorsList(List<Actor> actors, float deltaTime) {
foreach (Actor actor in actors) {
actor.ServerTick(deltaTime);
if (actor.IsDataDirty) {
actor.IsDataDirty = false;
NativeArray<byte> data = SerializeActorState(actor);
if (data.IsCreated) {
SynchronizeActorStateClientRpc(actor.ActorID, data);
SynchronizeActorStateWithClients(actor.ActorID, data);
} else {
s_Logger.Error($"Failed to serialize actor data for {actor.name}");
}
}
}
foreach (Actor actor in m_SpawnedActors) {
actor.ServerTick(dt);
if (actor.transformSyncMode != ActorTransformSyncMode.None && actor.MasterActor == null) {
ActorTransformSyncData syncData = actor.GetTransformSyncData();
if (actor.IsDataDirty) {
actor.IsDataDirty = false;
NativeArray<byte> data = SerializeActorState(actor);
if (data.IsCreated) {
SynchronizeActorStateClientRpc(actor.ActorID, data);
} else {
s_Logger.Error($"Failed to serialize actor data for {actor.name}");
foreach ((ulong _, NetworkClientState state) in RR.NetworkSystemInstance.Clients) {
if (state.IsReady) {
SynchronizeActorTransformStateRpc(actor.ActorID, syncData, RpcTarget.NotMe);
}
}
}
}
}
[ClientRpc(Delivery = RpcDelivery.Unreliable)]
void SynchronizeActorStateClientRpc(ulong actorID, NativeArray<byte> data) {
internal void SynchronizeActorCoreStateWithOther(Actor actor) {
if (!RR.IsServer()) {
s_Logger.Error("Only the server can synchronize actor core states.");
return;
}
SynchronizeCoreActorStateRpc(actor.ActorID, actor.GetCoreStateSnapshot(), RpcTarget.NotMe);
}
void SynchronizeActorStateWithClients(ulong actorID, NativeArray<byte> data) {
if (!RR.IsServer()) {
s_Logger.Error("Only the server can synchronize actor states with clients.");
return;
}
foreach ((ulong clientID, NetworkClientState state) in RR.NetworkSystemInstance.Clients) {
if (state.IsReady) {
SynchronizeActorStateRpc(actorID, data, RpcTarget.Single(clientID, RpcTargetUse.Temp));
}
}
}
[Rpc(SendTo.SpecifiedInParams, Delivery = RpcDelivery.Unreliable)]
void SynchronizeActorStateRpc(ulong actorID, NativeArray<byte> data, RpcParams rpcParams) {
Actor actor = FindActorByID(actorID);
if (actor is null) {
return;
}
s_Logger.Info($"Synchronizing actor state for {actor.name} with ID {actorID}");
DeserializeActorState(actor, data);
}
[Rpc(SendTo.SpecifiedInParams, Delivery = RpcDelivery.Unreliable)]
void SynchronizeActorTransformStateRpc(ulong actorID, ActorTransformSyncData syncData, RpcParams rpcParams) {
Actor actor = FindActorByID(actorID);
if (actor is null) {
s_Logger.Error($"Actor with ID {actorID} not found for transform synchronization.");
return;
}
actor.RestoreTransformState(syncData);
}
NativeArray<byte> SerializeActorState(Actor actor) {
return DataSerializationUtils.Serialize(actor.Data);
}
@@ -130,9 +170,9 @@ namespace RebootKit.Engine.Simulation {
continue;
}
SynchronizeActorStateForClientRpc(actor.ActorID, data, sendParams);
SynchronizeActorStateForClientRpc(actor.ActorID, actor.GetCoreStateSnapshot(), data, sendParams);
}
foreach (Actor actor in m_SpawnedActors) {
NativeArray<byte> data = SerializeActorState(actor);
if (!data.IsCreated) {
@@ -140,26 +180,41 @@ namespace RebootKit.Engine.Simulation {
continue;
}
ActorCoreStateSnapshot coreStateSnapshot = actor.GetCoreStateSnapshot();
SpawnActorRpc(actor.SourceActorPath,
actor.ActorID,
actor.transform.position,
actor.transform.localRotation,
coreStateSnapshot,
data,
sendParams);
}
}
[Rpc(SendTo.SpecifiedInParams, Delivery = RpcDelivery.Reliable)]
void SynchronizeActorStateForClientRpc(ulong actorID, NativeArray<byte> data, RpcParams rpcParams) {
void SynchronizeActorStateForClientRpc(ulong actorID,
ActorCoreStateSnapshot coreStateSnapshot,
NativeArray<byte> data,
RpcParams rpcParams) {
Actor actor = FindActorByID(actorID);
if (actor is null) {
return;
}
actor.RestoreCoreState(coreStateSnapshot);
DeserializeActorState(actor, data);
ClientSynchronizedActorRpc();
}
[Rpc(SendTo.SpecifiedInParams, Delivery = RpcDelivery.Reliable)]
void SynchronizeCoreActorStateRpc(ulong actorID, ActorCoreStateSnapshot snapshot, RpcParams rpcParams) {
Actor actor = FindActorByID(actorID);
if (actor is null) {
s_Logger.Error($"Actor with ID {actorID} not found for core state synchronization.");
return;
}
actor.RestoreCoreState(snapshot);
}
[Rpc(SendTo.Server, Delivery = RpcDelivery.Reliable)]
void ClientSynchronizedActorRpc(RpcParams rpcParams = default) {
ulong clientID = rpcParams.Receive.SenderClientId;
@@ -192,8 +247,21 @@ namespace RebootKit.Engine.Simulation {
actor.HandleActorCommand(cmd);
}
[Rpc(SendTo.Everyone)]
internal void SendActorEventToClientsRpc(ActorEvent actorEvent) {
internal void SendActorEvent(ActorEvent actorEvent) {
if (!RR.IsServer()) {
s_Logger.Error("Only the server can send actor events.");
return;
}
foreach ((ulong clientID, NetworkClientState state) in RR.NetworkSystemInstance.Clients) {
if (state.IsReady) {
SendActorEventRpc(actorEvent, RpcTarget.Single(clientID, RpcTargetUse.Temp));
}
}
}
[Rpc(SendTo.SpecifiedInParams)]
void SendActorEventRpc(ActorEvent actorEvent, RpcParams rpcParams) {
Actor actor = FindActorByID(actorEvent.ActorID);
if (actor is null) {
s_Logger.Error($"Actor with ID {actorEvent.ActorID} not found for event {actorEvent.EventID}");
@@ -221,7 +289,7 @@ namespace RebootKit.Engine.Simulation {
m_InSceneActors.Clear();
foreach (Actor actor in m_SpawnedActors) {
if (actor is not null) {
if (actor.OrNull() != null) {
Destroy(actor.gameObject);
}
}
@@ -250,42 +318,48 @@ namespace RebootKit.Engine.Simulation {
return null;
}
public void SpawnActor(AssetReferenceGameObject assetReference, Vector3 position, Quaternion rotation) {
public Actor SpawnActor(AssetReferenceGameObject assetReference, Vector3 position, Quaternion rotation) {
if (!IsServer) {
s_Logger.Error("Only the server can spawn actors.");
return;
return null;
}
if (!assetReference.RuntimeKeyIsValid()) {
s_Logger.Error("Trying to spawn an actor with an invalid asset reference.");
return;
return null;
}
ulong actorID = UniqueID.NewULongFromGuid();
GameObject actorObject = assetReference.InstantiateAsync(position, rotation).WaitForCompletion();
Actor actor = actorObject.GetComponent<Actor>();
if (actor is null) {
s_Logger.Error($"GameObject {actorObject.name} does not have an Actor component.");
Destroy(actorObject);
return;
return null;
}
actor.Manager = this;
actor.SourceActorPath = assetReference.AssetGUID;
actor.ActorID = UniqueID.NewULongFromGuid();
actor.ActorID = actorID;
actor.Data = actor.InternalCreateActorData();
m_SpawnedActors.Add(actor);
NativeArray<byte> stateData = SerializeActorState(actor);
SpawnActorRpc(assetReference.AssetGUID, actor.ActorID, position, rotation, stateData, RpcTarget.NotMe);
SpawnActorRpc(assetReference.AssetGUID,
actor.ActorID,
actor.GetCoreStateSnapshot(),
stateData,
RpcTarget.NotMe);
return actor;
}
// @NOTE: This RPC is used to spawn actors on clients.
[Rpc(SendTo.SpecifiedInParams)]
void SpawnActorRpc(string guid,
ulong actorID,
Vector3 position,
Quaternion rotation,
ActorCoreStateSnapshot coreStateSnapshot,
NativeArray<byte> stateData,
RpcParams rpcParams) {
AssetReferenceGameObject assetReference = new AssetReferenceGameObject(guid);
@@ -294,7 +368,9 @@ namespace RebootKit.Engine.Simulation {
return;
}
GameObject actorObject = assetReference.InstantiateAsync(position, rotation).WaitForCompletion();
GameObject actorObject = assetReference
.InstantiateAsync(coreStateSnapshot.Position, coreStateSnapshot.Rotation)
.WaitForCompletion();
if (actorObject == null) {
s_Logger.Error($"Failed to instantiate actor with GUID {guid}");
return;
@@ -312,6 +388,7 @@ namespace RebootKit.Engine.Simulation {
actor.ActorID = actorID;
actor.Data = actor.InternalCreateActorData();
actor.RestoreCoreState(coreStateSnapshot);
DeserializeActorState(actor, stateData);
m_SpawnedActors.Add(actor);
}
@@ -335,39 +412,5 @@ namespace RebootKit.Engine.Simulation {
Destroy(actor.gameObject);
}
public bool IsActorHidden(ulong actorID) {
Actor actor = FindActorByID(actorID);
if (actor is null) {
s_Logger.Error($"Actor with ID {actorID} not found.");
return false;
}
return !actor.gameObject.activeSelf;
}
public void SetActorHidden(ulong actorID, bool hidden) {
if (!IsServer) {
s_Logger.Error("Only the server can set actor visibility.");
return;
}
SetActorHiddenRpc(actorID, hidden, RpcTarget.Everyone);
}
[Rpc(SendTo.SpecifiedInParams)]
void SetActorHiddenRpc(ulong actorID, bool hidden, RpcParams rpcParams) {
Actor actor = FindActorByID(actorID);
if (actor is null) {
s_Logger.Error($"Actor with ID {actorID} not found.");
return;
}
if (hidden) {
actor.gameObject.SetActive(false);
} else {
actor.gameObject.SetActive(true);
}
}
}
}

View File

@@ -96,7 +96,7 @@ namespace RebootKit.Engine.Simulation {
return;
}
if (RR.NetworkSystemInstance is not null) {
if (RR.NetworkSystemInstance != null) {
RR.NetworkSystemInstance.Actors.CleanUp();
}

View File

@@ -1,46 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 19101, guid: 0000000000000000e000000000000000, type: 0}
m_Name: panel_main_menu
m_EditorClassIdentifier:
themeUss: {fileID: -4733365628477956816, guid: e23ba26e2a2f5a24fbba6ba1d0d59b11, type: 3}
m_DisableNoThemeWarning: 0
m_TargetTexture: {fileID: 0}
m_RenderMode: 0
m_WorldSpaceLayer: 0
m_ScaleMode: 1
m_ReferenceSpritePixelsPerUnit: 100
m_PixelsPerUnit: 100
m_Scale: 1
m_ReferenceDpi: 96
m_FallbackDpi: 96
m_ReferenceResolution: {x: 1200, y: 800}
m_ScreenMatchMode: 0
m_Match: 0
m_SortingOrder: 0
m_TargetDisplay: 0
m_BindingLogLevel: 0
m_ClearDepthStencil: 1
m_ClearColor: 0
m_ColorClearValue: {r: 0, g: 0, b: 0, a: 0}
m_VertexBudget: 0
m_DynamicAtlasSettings:
m_MinAtlasSize: 64
m_MaxAtlasSize: 4096
m_MaxSubTextureSize: 64
m_ActiveFilters: -1
m_AtlasBlitShader: {fileID: 9101, guid: 0000000000000000f000000000000000, type: 0}
m_RuntimeShader: {fileID: 9100, guid: 0000000000000000f000000000000000, type: 0}
m_RuntimeWorldShader: {fileID: 9102, guid: 0000000000000000f000000000000000, type: 0}
m_ICUDataAsset: {fileID: 0}
forceGammaRendering: 0
textSettings: {fileID: 0}

View File

@@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 358c21fd21b91a9468509e0dd81a2f08
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -1,125 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 10
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 13
m_BakeOnSceneLoad: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 1
m_PVRFilteringGaussRadiusAO: 1
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 3
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
buildHeightMesh: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots: []

View File

@@ -1,11 +0,0 @@
<engine:UXML xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:engine="UnityEngine.UIElements" xmlns:editor="UnityEditor.UIElements" noNamespaceSchemaLocation="../../../../../../UIElementsSchema/UIElements.xsd" editor-extension-mode="False">
<engine:VisualElement style="flex-grow: 1; background-color: rgb(0, 0, 0);">
<engine:VisualElement style="flex-grow: 1; background-image: url(&quot;project://database/Packages/com.rebootreality.rebootkit/Runtime/Engine/Assets/Sprites/logo_rr.png?fileID=2800000&amp;guid=b1c861e6353e19f48a56fff1559c1a76&amp;type=3#logo_rr&quot;); max-width: 500px; max-height: 500px; width: 500px; height: 500px; position: absolute; top: 0; left: 0;" />
<engine:VisualElement style="flex-grow: 1; position: absolute; top: 0; left: auto; right: 0; bottom: 0; justify-content: center;">
<engine:Label text="RebootKit - test menu" style="color: rgb(255, 255, 255); font-size: 72px;" />
<engine:Button text="Start" enable-rich-text="true" name="btn_start" />
<engine:Button text="Options" name="btn_options" />
<engine:Button text="Exit" name="btn_exit" />
</engine:VisualElement>
</engine:VisualElement>
</engine:UXML>

View File

@@ -1,10 +0,0 @@
fileFormatVersion: 2
guid: 82e9402c7fb775a45819bd34a69e2c5f
ScriptedImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 2
userData:
assetBundleName:
assetBundleVariant:
script: {fileID: 13804, guid: 0000000000000000e000000000000000, type: 0}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: a9ede814e8e155840988af362db4ecd8
guid: 94fbb2a495e2bd947ae56fe7321b7b8a
folderAsset: yes
DefaultImporter:
externalObjects: {}

View File

@@ -0,0 +1,775 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 10
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_UseRadianceAmbientProbe: 0
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 13
m_BakeOnSceneLoad: 0
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 0
m_LightmapEditorSettings:
serializedVersion: 12
m_Resolution: 2
m_BakeResolution: 40
m_AtlasSize: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_ExtractAmbientOcclusion: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVREnvironmentSampleCount: 256
m_PVREnvironmentReferencePointCount: 2048
m_PVRFilteringMode: 1
m_PVRDenoiserTypeDirect: 1
m_PVRDenoiserTypeIndirect: 1
m_PVRDenoiserTypeAO: 1
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVREnvironmentMIS: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ExportTrainingData: 0
m_TrainingDataDestination: TrainingData
m_LightProbeSampleCountMultiplier: 4
m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0}
m_LightingSettings: {fileID: 0}
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 3
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
buildHeightMesh: 0
maxJobWorkers: 0
preserveTilesOutsideBounds: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &330585543
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 330585546}
- component: {fileID: 330585545}
- component: {fileID: 330585544}
- component: {fileID: 330585547}
- component: {fileID: 330585548}
m_Layer: 0
m_Name: camera_main
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &330585544
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 330585543}
m_Enabled: 1
--- !u!20 &330585545
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 330585543}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_Iso: 200
m_ShutterSpeed: 0.005
m_Aperture: 16
m_FocusDistance: 10
m_FocalLength: 50
m_BladeCount: 5
m_Curvature: {x: 2, y: 11}
m_BarrelClipping: 0.25
m_Anamorphism: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.12
far clip plane: 500
field of view: 70
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &330585546
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 330585543}
serializedVersion: 2
m_LocalRotation: {x: 0.000000007450581, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 1.6674563, z: 0.061968558}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &330585547
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 330585543}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a79441f348de89743a2939f4d699eac1, type: 3}
m_Name:
m_EditorClassIdentifier:
m_RenderShadows: 1
m_RequiresDepthTextureOption: 2
m_RequiresOpaqueTextureOption: 2
m_CameraType: 0
m_Cameras: []
m_RendererIndex: -1
m_VolumeLayerMask:
serializedVersion: 2
m_Bits: 1
m_VolumeTrigger: {fileID: 0}
m_VolumeFrameworkUpdateModeOption: 2
m_RenderPostProcessing: 1
m_Antialiasing: 0
m_AntialiasingQuality: 2
m_StopNaN: 0
m_Dithering: 0
m_ClearDepth: 1
m_AllowXRRendering: 1
m_AllowHDROutput: 1
m_UseScreenCoordOverride: 0
m_ScreenSizeOverride: {x: 0, y: 0, z: 0, w: 0}
m_ScreenCoordScaleBias: {x: 0, y: 0, z: 0, w: 0}
m_RequiresDepthTexture: 0
m_RequiresColorTexture: 0
m_Version: 2
m_TaaSettings:
m_Quality: 3
m_FrameInfluence: 0.1
m_JitterScale: 1
m_MipBias: 0
m_VarianceClampScale: 0.9
m_ContrastAdaptiveSharpening: 0
--- !u!114 &330585548
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 330585543}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 72ece51f2901e7445ab60da3685d6b5f, type: 3}
m_Name:
m_EditorClassIdentifier:
ShowDebugText: 0
ShowCameraFrustum: 1
IgnoreTimeScale: 0
WorldUpOverride: {fileID: 0}
ChannelMask: -1
UpdateMethod: 1
BlendUpdateMethod: 1
LensModeOverride:
Enabled: 0
DefaultMode: 2
DefaultBlend:
Style: 1
Time: 2
CustomCurve:
serializedVersion: 2
m_Curve: []
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
CustomBlends: {fileID: 0}
--- !u!1 &379890219
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 379890220}
- component: {fileID: 379890221}
- component: {fileID: 379890222}
m_Layer: 0
m_Name: ConsoleVC
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!4 &379890220
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 379890219}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1468139327}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &379890221
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 379890219}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_PanelSettings: {fileID: 11400000, guid: c4c93f1ef3cc3324696c439305139cbb, type: 2}
m_ParentUI: {fileID: 0}
sourceAsset: {fileID: 9197481963319205126, guid: 15eee085e73feee4eba58c073b1455c5, type: 3}
m_SortingOrder: 0
m_WorldSpaceSizeMode: 1
m_WorldSpaceWidth: 1920
m_WorldSpaceHeight: 1080
--- !u!114 &379890222
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 379890219}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a6131b8af74b4894ba7b95b12286bc66, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Document: {fileID: 379890221}
--- !u!1 &599568088
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 599568090}
- component: {fileID: 599568089}
m_Layer: 0
m_Name: RainbowHierarchyRuleset
m_TagString: EditorOnly
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &599568089
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 599568088}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 848a85510b808ee4994e553f35ca73bd, type: 3}
m_Name:
m_EditorClassIdentifier:
Rules:
- Type: 0
Name:
GameObject: {fileID: 647954086}
Ordinal: 0
Priority: 0
IconType: 0
IconTexture: {fileID: 0}
IsIconRecursive: 0
BackgroundType: 1000
BackgroundTexture: {fileID: 0}
IsBackgroundRecursive: 0
IsHidden: 0
--- !u!4 &599568090
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 599568088}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &638618784
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 638618786}
- component: {fileID: 638618785}
- component: {fileID: 638618787}
m_Layer: 5
m_Name: game_version_overlay
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &638618785
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 638618784}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_PanelSettings: {fileID: 11400000, guid: c4c93f1ef3cc3324696c439305139cbb, type: 2}
m_ParentUI: {fileID: 0}
sourceAsset: {fileID: 9197481963319205126, guid: c2f32d01bf5f9d644aee3c2a41b14a66, type: 3}
m_SortingOrder: 1000
m_WorldSpaceSizeMode: 1
m_WorldSpaceWidth: 1920
m_WorldSpaceHeight: 1080
--- !u!4 &638618786
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 638618784}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1493735124}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &638618787
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 638618784}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8faa5154dbc44f83ae3fa5c6057c11bb, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Document: {fileID: 638618785}
--- !u!1 &647954086
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 647954090}
- component: {fileID: 647954089}
- component: {fileID: 647954088}
- component: {fileID: 647954087}
m_Layer: 0
m_Name: scene_context
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &647954087
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 647954086}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 4238ea1a17e342e583cdd929103a22c6, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &647954088
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 647954086}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 351d6b8577644d599058e76fa02a11c0, type: 3}
m_Name:
m_EditorClassIdentifier:
<Camera>k__BackingField: {fileID: 330585545}
--- !u!114 &647954089
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 647954086}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 8dd28652b58c4d689ab3f2f9354d7589, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Installers:
- {fileID: 647954087}
--- !u!4 &647954090
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 647954086}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &735095186
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 735095188}
- component: {fileID: 735095187}
m_Layer: 0
m_Name: Runtime Network Stats Monitor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &735095187
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 735095186}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 17737e0516da2445b9b0077ae2bd9b4f, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Visible: 1
m_MaxRefreshRate: 30
<CustomStyleSheet>k__BackingField: {fileID: 0}
<PanelSettingsOverride>k__BackingField: {fileID: 0}
<Position>k__BackingField:
<OverridePosition>k__BackingField: 1
m_PositionLeftToRight: 0
m_PositionTopToBottom: 0
<Configuration>k__BackingField: {fileID: 11400000, guid: 8f1b4e3792d8446399527749cfb591a2, type: 2}
--- !u!4 &735095188
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 735095186}
serializedVersion: 2
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1493735124}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1468139325
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1468139327}
- component: {fileID: 1468139326}
m_Layer: 0
m_Name: ui_console
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1468139326
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1468139325}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: ca844a0157054677b2f129fdbf6ddc45, type: 3}
m_Name:
m_EditorClassIdentifier:
m_ConsoleVC: {fileID: 379890222}
m_ToggleAction: {fileID: 11400000, guid: 1c5aabf95d7e5d949af83d0a4c686e95, type: 2}
--- !u!4 &1468139327
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1468139325}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 379890220}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1493735122
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1493735124}
- component: {fileID: 1493735123}
m_Layer: 0
m_Name: dev_tools
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1493735123
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1493735122}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 0ea9757c83234daaae0d4227ac495da2, type: 3}
m_Name:
m_EditorClassIdentifier:
m_DebugOverlayView: {fileID: 1809244332}
m_GameVersionOverlay: {fileID: 638618787}
m_NetworkStatsOverlay: {fileID: 735095186}
--- !u!4 &1493735124
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1493735122}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children:
- {fileID: 1809244330}
- {fileID: 638618786}
- {fileID: 735095188}
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1809244329
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1809244330}
- component: {fileID: 1809244331}
- component: {fileID: 1809244332}
m_Layer: 0
m_Name: ui_debug_overlay
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1809244330
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1809244329}
serializedVersion: 2
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_ConstrainProportionsScale: 0
m_Children: []
m_Father: {fileID: 1493735124}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &1809244331
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1809244329}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 19102, guid: 0000000000000000e000000000000000, type: 0}
m_Name:
m_EditorClassIdentifier:
m_PanelSettings: {fileID: 11400000, guid: c4c93f1ef3cc3324696c439305139cbb, type: 2}
m_ParentUI: {fileID: 0}
sourceAsset: {fileID: 9197481963319205126, guid: efa5e4d1b21059c448f8a23fbe41890a, type: 3}
m_SortingOrder: 0
m_WorldSpaceSizeMode: 1
m_WorldSpaceWidth: 1920
m_WorldSpaceHeight: 1080
--- !u!114 &1809244332
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1809244329}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: f18f4d0e8d914fdca81f98faf0e1546f, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Document: {fileID: 1809244331}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
m_Roots:
- {fileID: 647954090}
- {fileID: 330585546}
- {fileID: 1468139327}
- {fileID: 1493735124}
- {fileID: 599568090}

View File

@@ -1,5 +1,5 @@
fileFormatVersion: 2
guid: 9442a2e8baed7af4c92460a3803eefbc
guid: 99c9720ab356a0642a771bea13969a05
DefaultImporter:
externalObjects: {}
userData:

File diff suppressed because one or more lines are too long