gg.easy.airship 0.1.2162 → 0.1.2163
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Editor/BuildMenu.cs +25 -25
- package/Runtime/Code/Auth/Socket/SocketManager.cs +8 -0
- package/Runtime/Code/Bootstrap/AirshipEntryPoint.cs +13 -0
- package/Runtime/Code/Bootstrap/AirshipEntryPoint.cs.meta +3 -0
- package/Runtime/Code/Bootstrap/AirshipLogHandler.cs +22 -0
- package/Runtime/Code/Bootstrap/AirshipLogHandler.cs.meta +3 -0
- package/Runtime/Code/Bootstrap/SignalHandler.cs +37 -24
- package/Runtime/Code/CoreUI/Login/LoginApp.cs +1 -1
- package/Runtime/Code/Luau/LuauCoreCallbacks.cs +0 -5
- package/Runtime/Code/LuauAPI/FrameTimingManagerAPI.cs +10 -0
- package/Runtime/Code/LuauAPI/FrameTimingManagerAPI.cs.meta +3 -0
- package/Runtime/Code/Network/AirshipNetworkManager.cs +3 -1
- package/Runtime/Code/Network/StateSystem/AirshipNetworkedStateManager.cs +25 -37
- package/Runtime/Code/Player/Character/MovementSystems/Character/Structures/CharacterSnapshotData.cs +33 -33
- package/Runtime/Code/TSCodeGen/TypeGenerator.cs +1 -0
- package/Runtime/Code/VoxelWorld/Resources/VoxelWorldDefaultBlocks/DefaultDirt/DefaultDirt.asset +26 -6
- package/Runtime/Code/VoxelWorld/Resources/VoxelWorldDefaultBlocks/DefaultGrass/DefaultGrass.asset +30 -10
- package/Runtime/Code/VoxelWorld/VoxelMeshCopy.cs +155 -138
- package/Runtime/Plugins/Android/libLuauPlugin.so +0 -0
- package/Runtime/Plugins/Linux/libLuauPlugin.so +0 -0
- package/Runtime/Plugins/Mac/LuauPlugin.bundle/Contents/MacOS/LuauPlugin +0 -0
- package/Runtime/Plugins/Windows/x64/LuauPlugin.dll +0 -0
- package/Runtime/Plugins/Windows/x64/LuauPlugin.pdb +0 -0
- package/Runtime/Plugins/iOS/LuauPluginIos.a +0 -0
- package/Runtime/Scenes/CoreScene.unity +494 -353
- package/Runtime/Scenes/Login.unity +414 -369
- package/Runtime/Scenes/MainMenu.unity +87 -42
- package/package.json +1 -1
package/Editor/BuildMenu.cs
CHANGED
|
@@ -49,38 +49,38 @@ namespace Editor {
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
public static void BuildLinuxServerStaging() {
|
|
52
|
-
|
|
53
|
-
BuildLinuxServer();
|
|
52
|
+
BuildLinuxServer(new []{"AIRSHIP_STAGING"});
|
|
54
53
|
}
|
|
55
|
-
|
|
54
|
+
|
|
56
55
|
#if AIRSHIP_PLAYER
|
|
57
56
|
[MenuItem("Airship/Create Binary/Server/Linux", priority = 80)]
|
|
58
57
|
#endif
|
|
59
|
-
public static void
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
new("Packages/gg.easy.airship/Runtime/Scenes/CoreScene.unity", true),
|
|
64
|
-
new("Packages/gg.easy.airship/Runtime/Scenes/Login.unity", true)
|
|
65
|
-
};
|
|
66
|
-
EditorBuildSettings.scenes = scenes;
|
|
58
|
+
public static void BuildLinuxServerProduction() {
|
|
59
|
+
BuildLinuxServer(new string[]{});
|
|
60
|
+
}
|
|
61
|
+
|
|
67
62
|
|
|
63
|
+
public static void BuildLinuxServer(string[] extraDefines) {
|
|
64
|
+
OnBuild();
|
|
68
65
|
FileUtil.DeleteFileOrDirectory("build/StandaloneLinux64");
|
|
69
66
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
67
|
+
BuildProfile buildProfile =
|
|
68
|
+
AssetDatabase.LoadAssetAtPath<BuildProfile>("Assets/Settings/Build Profiles/Dedicated Server (Linux).asset");
|
|
69
|
+
buildProfile.overrideGlobalScenes = true;
|
|
70
|
+
buildProfile.scenes = new[] {
|
|
71
|
+
new EditorBuildSettingsScene("Packages/gg.easy.airship/Runtime/Scenes/CoreScene.unity", true)
|
|
72
|
+
};
|
|
73
|
+
buildProfile.scriptingDefines = new[] { "UNITY_SERVER", "AIRSHIP_PLAYER", "AIRSHIP_INTERAL" }.Concat(extraDefines).ToArray();
|
|
74
|
+
BuildProfile.SetActiveBuildProfile(buildProfile);
|
|
75
|
+
|
|
76
|
+
Debug.Log("Building with " + buildProfile.scenes.Length + " scenes");
|
|
75
77
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
options.subtarget = (int)StandaloneBuildSubtarget.Server;
|
|
83
|
-
options.options |= BuildOptions.Development; //Enable the profiler
|
|
78
|
+
var options = new BuildPlayerWithProfileOptions() {
|
|
79
|
+
buildProfile = buildProfile,
|
|
80
|
+
locationPathName = $"build/StandaloneLinux64/{ServerExecutableName}",
|
|
81
|
+
options = BuildOptions.Development,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
84
|
var report = BuildPipeline.BuildPlayer(options);
|
|
85
85
|
var summary = report.summary;
|
|
86
86
|
switch (summary.result) {
|
|
@@ -94,7 +94,7 @@ namespace Editor {
|
|
|
94
94
|
Debug.Log("Build Linux unexpected result:" + summary.result);
|
|
95
95
|
break;
|
|
96
96
|
}
|
|
97
|
-
|
|
97
|
+
|
|
98
98
|
CreateAssetBundles.AddAllGameBundleScenes();
|
|
99
99
|
}
|
|
100
100
|
|
|
@@ -5,6 +5,7 @@ using System.Threading.Tasks;
|
|
|
5
5
|
using Airship.DevConsole;
|
|
6
6
|
using Code.Auth;
|
|
7
7
|
using Code.Http.Internal;
|
|
8
|
+
using Code.Network;
|
|
8
9
|
using Code.Platform.Shared;
|
|
9
10
|
using Code.Util;
|
|
10
11
|
using Luau;
|
|
@@ -62,6 +63,13 @@ public class SocketManager : Singleton<SocketManager> {
|
|
|
62
63
|
Debug.LogError("Failed to join game: " + res.error);
|
|
63
64
|
}
|
|
64
65
|
}));
|
|
66
|
+
|
|
67
|
+
DevConsole.AddCommand(Command.Create<string>("ping", "", "Measure ping to an airship server cluster",
|
|
68
|
+
Parameter.Create("Ping Server IP", "IP of the Airship cluster ping server."), (serverIp) => {
|
|
69
|
+
UdpPingTool.GetPing(serverIp, 1000).ContinueWith((result) => {
|
|
70
|
+
Debug.Log($"Latency to {serverIp.Trim()} is {result.Result}ms");
|
|
71
|
+
});
|
|
72
|
+
}));
|
|
65
73
|
}
|
|
66
74
|
|
|
67
75
|
public static async Task<bool> ConnectAsyncInternal() {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using Code.Bootstrap;
|
|
3
|
+
using UnityEngine;
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/// <summary>
|
|
7
|
+
/// This singleton is exists in the CoreScene, MainMenu, and Login scene.
|
|
8
|
+
/// </summary>
|
|
9
|
+
public class AirshipEntryPoint : Singleton<AirshipEntryPoint> {
|
|
10
|
+
private void Start() {
|
|
11
|
+
Debug.unityLogger.logHandler = new AirshipLogHandler();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
using System;
|
|
2
|
+
using UnityEngine;
|
|
3
|
+
using Object = UnityEngine.Object;
|
|
4
|
+
|
|
5
|
+
namespace Code.Bootstrap {
|
|
6
|
+
public class AirshipLogHandler : ILogHandler {
|
|
7
|
+
private readonly ILogHandler defaultLogHandler = Debug.unityLogger.logHandler;
|
|
8
|
+
|
|
9
|
+
public void LogFormat(LogType logType, Object context, string format, params object[] args) {
|
|
10
|
+
string message = string.Format(format, args);
|
|
11
|
+
|
|
12
|
+
// TextMeshPro warning about unsupported character.
|
|
13
|
+
if (message.Contains("Unicode value \\u0007")) return;
|
|
14
|
+
|
|
15
|
+
defaultLogHandler.LogFormat(logType, context, format, args);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
public void LogException(Exception exception, Object context) {
|
|
19
|
+
defaultLogHandler.LogException(exception, context);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
using System.Collections;
|
|
2
|
-
using System.
|
|
2
|
+
using System.Runtime.InteropServices;
|
|
3
3
|
using Code.Util;
|
|
4
|
-
#if UNITY_STANDALONE_LINUX || UNITY_EDITOR_LINUX
|
|
5
|
-
using Mono.Unix;
|
|
6
|
-
using Mono.Unix.Native;
|
|
7
|
-
#endif
|
|
8
4
|
using UnityEngine;
|
|
9
5
|
|
|
10
6
|
namespace Code.Bootstrap {
|
|
@@ -12,34 +8,51 @@ namespace Code.Bootstrap {
|
|
|
12
8
|
public ServerBootstrap serverBootstrap;
|
|
13
9
|
public UnityMainThreadDispatcher unityMainThread;
|
|
14
10
|
|
|
15
|
-
|
|
16
11
|
#if UNITY_STANDALONE_LINUX || UNITY_EDITOR_LINUX
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
[UnmanagedFunctionPointer(CallingConvention.Cdecl)]
|
|
13
|
+
private delegate void SignalDelegate();
|
|
14
|
+
|
|
15
|
+
[DllImport("signalhandler", CallingConvention = CallingConvention.Cdecl)]
|
|
16
|
+
private static extern void RegisterSigTermHandler(SignalDelegate callback);
|
|
17
|
+
|
|
18
|
+
private static SignalDelegate cachedDelegate;
|
|
19
|
+
|
|
20
|
+
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.BeforeSceneLoad)]
|
|
21
|
+
private static void Init()
|
|
22
|
+
{
|
|
23
|
+
cachedDelegate = OnSigTerm;
|
|
24
|
+
RegisterSigTermHandler(cachedDelegate);
|
|
25
|
+
Debug.Log("Unix SIGTERM handler registered");
|
|
20
26
|
}
|
|
21
27
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
// This is called from a POSIX signal context
|
|
29
|
+
[AOT.MonoPInvokeCallback(typeof(SignalDelegate))]
|
|
30
|
+
private static void OnSigTerm()
|
|
31
|
+
{
|
|
32
|
+
Debug.Log("SIGTERM signal received from native");
|
|
33
|
+
|
|
34
|
+
// We can't call Unity APIs directly from signal thread,
|
|
35
|
+
// So we need to dispatch back to main thread
|
|
36
|
+
_hasSigterm = true;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
private static bool _hasSigterm;
|
|
40
|
+
|
|
41
|
+
private void Update()
|
|
42
|
+
{
|
|
43
|
+
if (_hasSigterm)
|
|
44
|
+
{
|
|
45
|
+
_hasSigterm = false;
|
|
46
|
+
unityMainThread.Enqueue(HandleSigterm());
|
|
34
47
|
}
|
|
35
48
|
}
|
|
36
49
|
|
|
37
|
-
private IEnumerator HandleSigterm()
|
|
50
|
+
private IEnumerator HandleSigterm()
|
|
51
|
+
{
|
|
38
52
|
Debug.Log("SIGTERM received. Performing cleanup.");
|
|
39
|
-
// Perform your cleanup here
|
|
40
53
|
serverBootstrap.InvokeOnProcessExit();
|
|
41
54
|
yield return null;
|
|
42
|
-
|
|
55
|
+
Application.Quit();
|
|
43
56
|
}
|
|
44
57
|
#endif
|
|
45
58
|
}
|
|
@@ -283,7 +283,7 @@ public class LoginApp : MonoBehaviour {
|
|
|
283
283
|
RestClient.Get(new RequestHelper() {
|
|
284
284
|
Uri = AirshipPlatformUrl.gameCoordinator + (prodApp ? "/auth/steam/in-game" : "/auth/steam/in-game-playtest"),
|
|
285
285
|
Headers = new Dictionary<string, string>() {
|
|
286
|
-
{ "
|
|
286
|
+
{ "steam-token", steamToken }
|
|
287
287
|
},
|
|
288
288
|
}).Then((gcRes) => {
|
|
289
289
|
print("gc response: " + gcRes.Text);
|
|
@@ -1157,10 +1157,8 @@ public partial class LuauCore : MonoBehaviour {
|
|
|
1157
1157
|
static unsafe int CallMethodCallback(LuauContext context, IntPtr thread, int instanceId, IntPtr classNamePtr, int classNameSize, IntPtr methodNamePtr, int methodNameLength, int numParameters, IntPtr firstParameterType, IntPtr firstParameterData, IntPtr firstParameterSize, IntPtr firstParameterIsTable, IntPtr shouldYield) {
|
|
1158
1158
|
CurrentContext = context;
|
|
1159
1159
|
|
|
1160
|
-
// if (s_shutdown) return 0;
|
|
1161
1160
|
Marshal.WriteInt32(shouldYield, 0);
|
|
1162
1161
|
if (!IsReady) {
|
|
1163
|
-
Profiler.EndSample();
|
|
1164
1162
|
return 0;
|
|
1165
1163
|
}
|
|
1166
1164
|
|
|
@@ -1428,7 +1426,6 @@ public partial class LuauCore : MonoBehaviour {
|
|
|
1428
1426
|
return returnCount;
|
|
1429
1427
|
}
|
|
1430
1428
|
|
|
1431
|
-
Profiler.BeginSample("LuauCore.InvokeMethod");
|
|
1432
1429
|
try {
|
|
1433
1430
|
returnValue = finalMethod.Invoke(invokeObj, parsedData.Array);
|
|
1434
1431
|
}
|
|
@@ -1439,8 +1436,6 @@ public partial class LuauCore : MonoBehaviour {
|
|
|
1439
1436
|
catch (Exception e) {
|
|
1440
1437
|
return LuauError(thread,
|
|
1441
1438
|
"Error: Exception thrown in method " + type.Name + "." + finalMethod.Name + ": " + e);
|
|
1442
|
-
} finally {
|
|
1443
|
-
Profiler.EndSample();
|
|
1444
1439
|
}
|
|
1445
1440
|
|
|
1446
1441
|
WriteMethodReturnValuesToThread(thread, type, finalMethod.ReturnType, finalParameters, returnValue, parsedData.Array);
|
|
@@ -58,7 +58,9 @@ public class AirshipNetworkManager : NetworkManager {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
public override void ConfigureHeadlessFrameRate() {
|
|
61
|
-
|
|
61
|
+
if (RunCore.IsClient()) return;
|
|
62
|
+
|
|
63
|
+
// Override default behavior of setting target frame rate equal to send rate.
|
|
62
64
|
// Since we aren't rendering anything, doing tons of Update calls isn't really very important, so we definitely should
|
|
63
65
|
// lower the target frame rate, we just don't want to use the mirror default of using send rate because we may
|
|
64
66
|
// set send rate lower than tick rate in the future and we want framerate to always match tick rate for dedicated servers.
|
|
@@ -246,10 +246,6 @@ namespace Code.Network.StateSystem
|
|
|
246
246
|
if (commands.Length > 0) {
|
|
247
247
|
this.clientLastSentLocalTick = this.inputHistory.Keys[^1];
|
|
248
248
|
}
|
|
249
|
-
else {
|
|
250
|
-
Debug.LogWarning(
|
|
251
|
-
$"Sending no commands on interval. Last local tick: {clientLastSentLocalTick}. Local command history size: {this.inputHistory.Keys.Count}");
|
|
252
|
-
}
|
|
253
249
|
|
|
254
250
|
// print($"Sending {commands.Length} cmds to the server");
|
|
255
251
|
|
|
@@ -341,7 +337,7 @@ namespace Code.Network.StateSystem
|
|
|
341
337
|
if (isServer && serverAuth) {
|
|
342
338
|
if (serverCommandBuffer.Count > serverCommandBufferTargetSize) {
|
|
343
339
|
serverCommandCatchUpRequired = serverCommandBuffer.Count - serverCommandBufferTargetSize;
|
|
344
|
-
print($"Command catchup required for {this.name}: {serverCommandCatchUpRequired}");
|
|
340
|
+
// print($"Command catchup required for {this.name}: {serverCommandCatchUpRequired}");
|
|
345
341
|
}
|
|
346
342
|
else {
|
|
347
343
|
serverCommandCatchUpRequired = 0;
|
|
@@ -352,7 +348,7 @@ namespace Code.Network.StateSystem
|
|
|
352
348
|
if (isServer && !serverAuth) {
|
|
353
349
|
if (serverReceivedStateBuffer.Count > serverCommandBufferTargetSize) {
|
|
354
350
|
serverCommandCatchUpRequired = serverReceivedStateBuffer.Count - serverCommandBufferTargetSize;
|
|
355
|
-
print($"State catchup required for {this.name}: {serverCommandCatchUpRequired}");
|
|
351
|
+
// print($"State catchup required for {this.name}: {serverCommandCatchUpRequired}");
|
|
356
352
|
}
|
|
357
353
|
else {
|
|
358
354
|
serverCommandCatchUpRequired = 0;
|
|
@@ -518,18 +514,10 @@ namespace Code.Network.StateSystem
|
|
|
518
514
|
var totalBuffer = (latency * 2) + bufferTime + commandBufferTime;
|
|
519
515
|
var lagCompensatedTime = currentTime - totalBuffer;
|
|
520
516
|
var lagCompensatedTick = AirshipSimulationManager.Instance.GetNearestTickForUnscaledTime(lagCompensatedTime);
|
|
521
|
-
|
|
522
|
-
// This test was with .34 timescale and 1/40 send rate
|
|
523
|
-
// 12.9068027064583 - (13.1350901077098 - ((0.0275639141664629 * 2) + 0.0500000007450581 + 0.025 + (0.07352941 * .34) + 0.07352941)) = 0.00036983722
|
|
524
|
-
// 16.074496323404 - (16.296857560941 - ((0.0142610969939435 * 2) + 0.0500000007450581 + 0.025 + (0.07352941 * 0.34) + 0.07352941 + 0.025)) = 0.00469036659
|
|
525
|
-
// 19.2368007725462 - (19.4586250708617 - ((0.0123929982200843 * 2) + 0.0500000007450581 + 0.025 + (0.07352941 * 0.34) + 0.07352941 + 0.025)) = 0.00149110826
|
|
526
|
-
// 22.5390862366273 - (22.7674515306122 - ((0.0122401664944862 * 2) + 0.0500000007450581 + 0.025 + (0.07352941 * 0.34) + 0.07352941 + .025)) = -0.00535555085
|
|
527
|
-
// print($"CLIENTTIME - ({currentTime} - (({latency} * 2) + {bufferTime} + {NetworkServer.sendInterval} + ({Time.fixedUnscaledDeltaTime} * {commandsInOneInterval})))");
|
|
517
|
+
|
|
528
518
|
// print($"CLIENTTIME - ({currentTime} - (({latency} * 2) + {bufferTime} + {commandBufferTime}))");
|
|
529
519
|
// print($"CLIENTTIME - {lagCompensatedTime}");
|
|
530
520
|
// print($"Rolling back to {lagCompensatedTick} using total rollback of {totalBuffer}");
|
|
531
|
-
// print(
|
|
532
|
-
// $"{currentTime} - (({latency} * 2) + {bufferTime} + ({tickGenerationTime} * {commandsInOneInterval} * 2)) = {lagCompensatedTime} ({lagCompensatedTick})");
|
|
533
521
|
this.OnSetSnapshot(lagCompensatedTick);
|
|
534
522
|
}
|
|
535
523
|
|
|
@@ -574,12 +562,12 @@ namespace Code.Network.StateSystem
|
|
|
574
562
|
this.serverCommandBuffer.RemoveAt(0);
|
|
575
563
|
dropCount++;
|
|
576
564
|
}
|
|
577
|
-
print("Dropped " + dropCount + " command(s) from " + this.gameObject.name + " due to exceeding command buffer size.");
|
|
565
|
+
// print("Dropped " + dropCount + " command(s) from " + this.gameObject.name + " due to exceeding command buffer size.");
|
|
578
566
|
}
|
|
579
567
|
|
|
580
568
|
// Delay processing until we have at least one send interval worth of commands to process.
|
|
581
569
|
if (this.serverCommandBuffer.Count == 0 || this.serverCommandBuffer.Count < Math.Ceiling(NetworkClient.sendInterval / Time.fixedUnscaledDeltaTime)) {
|
|
582
|
-
Debug.Log($"Waiting for additional commands for {this.name}. There are {this.serverCommandBuffer.Count} commands in the buffer.");
|
|
570
|
+
// Debug.Log($"Waiting for additional commands for {this.name}. There are {this.serverCommandBuffer.Count} commands in the buffer.");
|
|
583
571
|
this.stateSystem.Tick(null, tick, time, false);
|
|
584
572
|
return;
|
|
585
573
|
}
|
|
@@ -606,11 +594,11 @@ namespace Code.Network.StateSystem
|
|
|
606
594
|
this.serverPredictedCommandCount < Math.Ceiling(this.maxServerCommandPrediction *
|
|
607
595
|
(NetworkServer.sendInterval /
|
|
608
596
|
Time.fixedUnscaledDeltaTime))) {
|
|
609
|
-
Debug.LogWarning("Missing command " + expectedNextCommandNumber +
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
597
|
+
// Debug.LogWarning("Missing command " + expectedNextCommandNumber +
|
|
598
|
+
// " in the command buffer for " + this.name + ". Next command was: " +
|
|
599
|
+
// command.commandNumber +
|
|
600
|
+
// ". Predicted " +
|
|
601
|
+
// (this.serverPredictedCommandCount + 1) + " command(s) so far.");
|
|
614
602
|
this.serverLastProcessedCommandNumber = expectedNextCommandNumber;
|
|
615
603
|
command = this.lastProcessedCommand;
|
|
616
604
|
command.commandNumber = expectedNextCommandNumber;
|
|
@@ -632,8 +620,8 @@ namespace Code.Network.StateSystem
|
|
|
632
620
|
}
|
|
633
621
|
else {
|
|
634
622
|
// Ensure that we always tick the system even if there's no command to process.
|
|
635
|
-
Debug.LogWarning($"No commands left for {this.name}. Last command processed: " +
|
|
636
|
-
|
|
623
|
+
// Debug.LogWarning($"No commands left for {this.name}. Last command processed: " +
|
|
624
|
+
// this.lastProcessedCommand);
|
|
637
625
|
this.stateSystem.Tick(null, tick, time, false);
|
|
638
626
|
// we processed a command that never reached the server, advance so the associated
|
|
639
627
|
// command's tick result will be used to match up with state. The command that should have been used
|
|
@@ -648,10 +636,10 @@ namespace Code.Network.StateSystem
|
|
|
648
636
|
} while (commandsProcessed < 1 + this.maxServerCommandCatchup && serverCommandCatchUpRequired > 0);
|
|
649
637
|
// We add 1 to maxServerCommandCatchup because we always want to process at least 1 command per fixed update.
|
|
650
638
|
|
|
651
|
-
if (commandsProcessed > 1)
|
|
652
|
-
{
|
|
653
|
-
|
|
654
|
-
}
|
|
639
|
+
// if (commandsProcessed > 1)
|
|
640
|
+
// {
|
|
641
|
+
// print("Processed " + commandsProcessed + " commands for " + this.gameObject.name + $". There are now {this.serverCommandBuffer.Count} commands in the buffer.");
|
|
642
|
+
// }
|
|
655
643
|
}
|
|
656
644
|
|
|
657
645
|
public void AuthServerCaptureSnapshot(int tick, double time, bool replay)
|
|
@@ -676,7 +664,7 @@ namespace Code.Network.StateSystem
|
|
|
676
664
|
{
|
|
677
665
|
// In the case where there's no state to roll back to, we simply leave the state system where it is. This technically means
|
|
678
666
|
// that freshly spawned players will exist in rollback when they shouldn't but we won't handle that edge case for now.
|
|
679
|
-
Debug.LogWarning($"Set snapshot to {tick} resulted in null state for {this.name}. State history size is {this.stateHistory.Keys.Count}");
|
|
667
|
+
// Debug.LogWarning($"Set snapshot to {tick} resulted in null state for {this.name}. State history size is {this.stateHistory.Keys.Count}");
|
|
680
668
|
return;
|
|
681
669
|
}
|
|
682
670
|
this.stateSystem.SetCurrentState(state);
|
|
@@ -784,10 +772,10 @@ namespace Code.Network.StateSystem
|
|
|
784
772
|
do
|
|
785
773
|
{
|
|
786
774
|
statesProcessed++;
|
|
787
|
-
if (statesProcessed > 1)
|
|
788
|
-
{
|
|
789
|
-
|
|
790
|
-
}
|
|
775
|
+
// if (statesProcessed > 1)
|
|
776
|
+
// {
|
|
777
|
+
// Debug.Log($"Processing additional client auth state for {this.name}. The server needs to catch up.");
|
|
778
|
+
// }
|
|
791
779
|
|
|
792
780
|
// Attempt to get a new state out of the buffer.
|
|
793
781
|
latestState = this.serverReceivedStateBuffer.Count > 0
|
|
@@ -1032,8 +1020,8 @@ namespace Code.Network.StateSystem
|
|
|
1032
1020
|
// On extremely high ping, this will mean that the local player will freeze in place while we wait for
|
|
1033
1021
|
// confirmation from the server.
|
|
1034
1022
|
// this.clientPausePrediction = true; // disabled for now
|
|
1035
|
-
Debug.LogWarning(
|
|
1036
|
-
|
|
1023
|
+
// Debug.LogWarning(
|
|
1024
|
+
// "We have a large number of unconfirmed commands to the server. Is there something wrong with the network or is the server lagging?");
|
|
1037
1025
|
return;
|
|
1038
1026
|
}
|
|
1039
1027
|
|
|
@@ -1059,7 +1047,7 @@ namespace Code.Network.StateSystem
|
|
|
1059
1047
|
// This may happen from time to time if the client clock gets out of sync with the server for a moment.
|
|
1060
1048
|
// Generally a situation like this is recoverable by processing an additional state snapshot from the
|
|
1061
1049
|
// server.
|
|
1062
|
-
Debug.LogWarning("Couldn't find client predicted state for command " + state.lastProcessedCommand);
|
|
1050
|
+
// Debug.LogWarning("Couldn't find client predicted state for command " + state.lastProcessedCommand);
|
|
1063
1051
|
return;
|
|
1064
1052
|
}
|
|
1065
1053
|
|
|
@@ -1079,7 +1067,7 @@ namespace Code.Network.StateSystem
|
|
|
1079
1067
|
return;
|
|
1080
1068
|
}
|
|
1081
1069
|
|
|
1082
|
-
Debug.LogWarning("Misprediction for " + this.name + " on cmd#" + state.lastProcessedCommand + ". Requesting resimulation.");
|
|
1070
|
+
// Debug.LogWarning("Misprediction for " + this.name + " on cmd#" + state.lastProcessedCommand + ". Requesting resimulation.");
|
|
1083
1071
|
|
|
1084
1072
|
// We use the client prediction time so we can act like we got this right in our history. Server gives us
|
|
1085
1073
|
// a time value in its local timeline so the provided time is not useful to us.
|
package/Runtime/Code/Player/Character/MovementSystems/Character/Structures/CharacterSnapshotData.cs
CHANGED
|
@@ -73,36 +73,36 @@ namespace Code.Player.Character.MovementSystems.Character
|
|
|
73
73
|
var isGroundedEqual = isGrounded == other.isGrounded;
|
|
74
74
|
var stateEqual = state == other.state;
|
|
75
75
|
|
|
76
|
-
if (!lastProcessedCommandEqual)
|
|
77
|
-
|
|
78
|
-
if (!positionEqual)
|
|
79
|
-
|
|
80
|
-
if (!velocityEqual)
|
|
81
|
-
|
|
82
|
-
if (!currentSpeedEqual)
|
|
83
|
-
|
|
84
|
-
if (!speedModifierEqual)
|
|
85
|
-
|
|
86
|
-
if (!inputDisabledEqual)
|
|
87
|
-
|
|
88
|
-
if (!isFlyingEqual)
|
|
89
|
-
|
|
90
|
-
if (!isSprintingEqual)
|
|
91
|
-
|
|
92
|
-
if (!jumpCountEqual)
|
|
93
|
-
|
|
94
|
-
if (!airborneFromImpulseEqual)
|
|
95
|
-
|
|
96
|
-
if (!alreadyJumpedEqual)
|
|
97
|
-
|
|
98
|
-
if (!isCrouchingEqual)
|
|
99
|
-
|
|
100
|
-
if (!prevStepUpEqual)
|
|
101
|
-
|
|
102
|
-
if (!isGroundedEqual)
|
|
103
|
-
|
|
104
|
-
if (!stateEqual)
|
|
105
|
-
|
|
76
|
+
// if (!lastProcessedCommandEqual)
|
|
77
|
+
// message += $"lastProcessedCommand: {this.lastProcessedCommand} != {other.lastProcessedCommand}\n";
|
|
78
|
+
// if (!positionEqual)
|
|
79
|
+
// message += $"position: {this.position} != {other.position}\n";
|
|
80
|
+
// if (!velocityEqual)
|
|
81
|
+
// message += $"velocity: {this.velocity} != {other.velocity}\n";
|
|
82
|
+
// if (!currentSpeedEqual)
|
|
83
|
+
// message += $"currentSpeed: {this.currentSpeed} != {other.currentSpeed}\n";
|
|
84
|
+
// if (!speedModifierEqual)
|
|
85
|
+
// message += $"speedModifier: {this.speedModifier} != {other.speedModifier}\n";
|
|
86
|
+
// if (!inputDisabledEqual)
|
|
87
|
+
// message += $"inputDisabled: {inputDisabled} != {other.inputDisabled}\n";
|
|
88
|
+
// if (!isFlyingEqual)
|
|
89
|
+
// message += $"isFlying: {isFlying} != {other.isFlying}\n";
|
|
90
|
+
// if (!isSprintingEqual)
|
|
91
|
+
// message += $"isSprinting: {isSprinting} != {other.isSprinting}\n";
|
|
92
|
+
// if (!jumpCountEqual)
|
|
93
|
+
// message += $"jumpCount: {jumpCount} != {other.jumpCount}\n";
|
|
94
|
+
// if (!airborneFromImpulseEqual)
|
|
95
|
+
// message += $"airborneFromImpulse: {airborneFromImpulse} != {other.airborneFromImpulse}\n";
|
|
96
|
+
// if (!alreadyJumpedEqual)
|
|
97
|
+
// message += $"alreadyJumped: {alreadyJumped} != {other.alreadyJumped}\n";
|
|
98
|
+
// if (!isCrouchingEqual)
|
|
99
|
+
// message += $"prevCrouch: {isCrouching} != {other.isCrouching}\n";
|
|
100
|
+
// if (!prevStepUpEqual)
|
|
101
|
+
// message += $"prevStepUp: {prevStepUp} != {other.prevStepUp}\n";
|
|
102
|
+
// if (!isGroundedEqual)
|
|
103
|
+
// message += $"prevGrounded: {isGrounded} != {other.isGrounded}\n";
|
|
104
|
+
// if (!stateEqual)
|
|
105
|
+
// message += $"state: {state} != {other.state}\n";
|
|
106
106
|
|
|
107
107
|
var same =
|
|
108
108
|
lastProcessedCommandEqual &&
|
|
@@ -127,10 +127,10 @@ namespace Code.Player.Character.MovementSystems.Character
|
|
|
127
127
|
movement.compareResult = true;
|
|
128
128
|
movement.FireTsCompare(this, other);
|
|
129
129
|
same = movement.compareResult;
|
|
130
|
-
if (same == false) message += $"customData: a != b";
|
|
130
|
+
// if (same == false) message += $"customData: a != b";
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
-
if (message.Length != 0) Debug.Log(message.TrimEnd());
|
|
133
|
+
// if (message.Length != 0) Debug.Log(message.TrimEnd());
|
|
134
134
|
return same;
|
|
135
135
|
}
|
|
136
136
|
|
|
@@ -356,7 +356,7 @@ namespace Code.Player.Character.MovementSystems.Character
|
|
|
356
356
|
if (crc32 != diff.crc32) {
|
|
357
357
|
// We return null here since we are essentially unable to construct a correct snapshot from the provided diff
|
|
358
358
|
// using this snapshot as the base.
|
|
359
|
-
Debug.LogWarning($"Applying diff failed CRC check. This may happen due to poor network conditions.");
|
|
359
|
+
// Debug.LogWarning($"Applying diff failed CRC check. This may happen due to poor network conditions.");
|
|
360
360
|
return null;
|
|
361
361
|
}
|
|
362
362
|
|
package/Runtime/Code/VoxelWorld/Resources/VoxelWorldDefaultBlocks/DefaultDirt/DefaultDirt.asset
CHANGED
|
@@ -15,10 +15,12 @@ MonoBehaviour:
|
|
|
15
15
|
blockName: DefaultDirt
|
|
16
16
|
description:
|
|
17
17
|
contextStyle: 0
|
|
18
|
+
meshMaterial: {fileID: 0}
|
|
19
|
+
halfBlock: 0
|
|
18
20
|
topTexture:
|
|
19
21
|
material: {fileID: 0}
|
|
20
|
-
diffuse: {fileID: 2800000, guid:
|
|
21
|
-
normal: {fileID: 2800000, guid:
|
|
22
|
+
diffuse: {fileID: 2800000, guid: bd09fa45c18442546858afeccf4a5cc3, type: 3}
|
|
23
|
+
normal: {fileID: 2800000, guid: 0c33d3bfe43dead49b46acc3f45fe2cf, type: 3}
|
|
22
24
|
smooth: {fileID: 0}
|
|
23
25
|
metallic: {fileID: 0}
|
|
24
26
|
emissive: {fileID: 0}
|
|
@@ -36,9 +38,28 @@ MonoBehaviour:
|
|
|
36
38
|
smooth: {fileID: 0}
|
|
37
39
|
metallic: {fileID: 0}
|
|
38
40
|
emissive: {fileID: 0}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
41
|
+
quarterBlockMeshes: []
|
|
42
|
+
prefab: {fileID: 0}
|
|
43
|
+
staticMeshLOD0: {fileID: 0}
|
|
44
|
+
staticMeshLOD1: {fileID: 0}
|
|
45
|
+
staticMeshLOD2: {fileID: 0}
|
|
46
|
+
meshTile1x1x1:
|
|
47
|
+
mesh_LOD0: {fileID: 0}
|
|
48
|
+
mesh_LOD1: {fileID: 0}
|
|
49
|
+
mesh_LOD2: {fileID: 0}
|
|
50
|
+
meshTile2x2x2:
|
|
51
|
+
mesh_LOD0: {fileID: 0}
|
|
52
|
+
mesh_LOD1: {fileID: 0}
|
|
53
|
+
mesh_LOD2: {fileID: 0}
|
|
54
|
+
meshTile3x3x3:
|
|
55
|
+
mesh_LOD0: {fileID: 0}
|
|
56
|
+
mesh_LOD1: {fileID: 0}
|
|
57
|
+
mesh_LOD2: {fileID: 0}
|
|
58
|
+
meshTile4x4x4:
|
|
59
|
+
mesh_LOD0: {fileID: 0}
|
|
60
|
+
mesh_LOD1: {fileID: 0}
|
|
61
|
+
mesh_LOD2: {fileID: 0}
|
|
62
|
+
rotatedPlacement: 0
|
|
42
63
|
metallic: 0
|
|
43
64
|
smoothness: 0
|
|
44
65
|
normalScale: 1
|
|
@@ -47,4 +68,3 @@ MonoBehaviour:
|
|
|
47
68
|
solid: 1
|
|
48
69
|
collisionType: 1
|
|
49
70
|
randomRotation: 0
|
|
50
|
-
minecraftIds:
|