Skip to content

Commit

Permalink
nightly v1.8.0.0 (12/30)
Browse files Browse the repository at this point in the history
  • Loading branch information
ipodtouch0218 committed Dec 31, 2023
1 parent 5087963 commit 378b419
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 82 deletions.
17 changes: 0 additions & 17 deletions Assets/Scenes/Levels/DefaultCastle.unity
Original file line number Diff line number Diff line change
Expand Up @@ -4231,7 +4231,6 @@ GameObject:
- component: {fileID: 361225204}
- component: {fileID: 361225200}
- component: {fileID: 361225208}
- component: {fileID: 361225205}
- component: {fileID: 361225209}
m_Layer: 8
m_Name: Tilemap_Squishy
Expand Down Expand Up @@ -11798,21 +11797,6 @@ TilemapCollider2D:
m_MaximumTileChangeCount: 1000
m_ExtrusionFactor: 0.00001
m_UseDelaunayMesh: 0
--- !u!114 &361225205
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 361225195}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: fedcefda7c82c5f4483ddc0098f43865, type: 3}
m_Name:
m_EditorClassIdentifier:
target: 0
behaviours:
- {fileID: 361225208}
--- !u!114 &361225208
MonoBehaviour:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -11903,7 +11887,6 @@ MonoBehaviour:
NestedObjects: []
NetworkedBehaviours:
- {fileID: 361225208}
- {fileID: 361225205}
--- !u!1001 &379146488
PrefabInstance:
m_ObjectHideFlags: 0
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/BuildInfo.cs
Original file line number Diff line number Diff line change
@@ -1 +1 @@
public static class BuildInfo{public static string BUILD_TIME = "12/30/2023 4:30:11 AM";}
public static class BuildInfo{public static string BUILD_TIME = "12/31/2023 4:26:34 AM";}
2 changes: 1 addition & 1 deletion Assets/Scripts/Entity/BigStar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ public void Rpc_StarCollected(PlayerController collector) {

public override void Despawned(NetworkRunner runner, bool hasState) {

if (GameManager.Instance && GameManager.Instance.GameState == Enums.GameState.Playing && !Collector) {
if (GameManager.Instance && GameManager.Instance.Object && GameManager.Instance.GameState == Enums.GameState.Playing && !Collector) {
GameManager.Instance.particleManager.Play(Enums.Particle.Generic_Puff, transform.position);
}

Expand Down
23 changes: 10 additions & 13 deletions Assets/Scripts/Entity/Player/PlayerController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -332,8 +332,6 @@ public override void Spawned() {

Data = Object.InputAuthority.GetPlayerData(Runner);
if (HasInputAuthority) {
//body.InterpolationDataSource = InterpolationDataSources.Predicted;

GameManager.Instance.localPlayer = this;
GameManager.Instance.spectationManager.Spectating = false;
ControlSystem.controls.Player.ReserveItem.performed += OnReserveItem;
Expand Down Expand Up @@ -466,16 +464,16 @@ public override void FixedUpdateNetwork() {

if (!IsProxy) {
#if INPUT_BUFFERING_TEST
int inputIndex = Runner.Tick % InputBufferCapacity;
PlayerNetworkInput input = InputBuffer[inputIndex];

if (GetInput(out PlayerNetworkInput inputsThisTick)) {
// Add later inputs to the buffer.
InputBuffer.Set(inputIndex, inputsThisTick);
} else if (!IsProxy) {
// Didn't get the inputs, but we *need* them. Interpolate based on what it *could* be?
InputBuffer.Set(inputIndex, HandleMissingInputs());
}
int inputIndex = Runner.Tick % InputBufferCapacity;
PlayerNetworkInput input = InputBuffer[inputIndex];

if (GetInput(out PlayerNetworkInput inputsThisTick)) {
// Add later inputs to the buffer.
InputBuffer.Set(inputIndex, inputsThisTick);
} else if (!IsProxy) {
// Didn't get the inputs, but we *need* them. Interpolate based on what it *could* be?
InputBuffer.Set(inputIndex, HandleMissingInputs());
}
#else
PlayerNetworkInput input;
if (GetInput(out PlayerNetworkInput currentInputs)) {
Expand All @@ -495,7 +493,6 @@ public override void FixedUpdateNetwork() {
if (IsDead) {
HandleDeathTimers();
} else if (!IsFrozen) {

NetworkButtons heldButtons = input.buttons;
NetworkButtons pressedButtons = input.buttons.GetPressed(PreviousInputs.buttons);

Expand Down
1 change: 1 addition & 0 deletions Assets/Scripts/Entity/World Elements/GenericMover.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ public void Start() {

public override void Spawned() {
Origin = transform.position;
Runner.SetIsSimulated(Object, true);
}

public void BeforeTick() {
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/Entity/World Elements/GenericMover.cs.meta

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

2 changes: 2 additions & 0 deletions Assets/Scripts/GameManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,8 @@ private void Rpc_StartGame() {
}

private IEnumerator WaitToStartGame() {
GameStartTime = Runner.SimulationTime + 1.3f;

yield return new WaitForSecondsRealtime(1.3f);

// Keep track of game timestamps
Expand Down
67 changes: 21 additions & 46 deletions Assets/Scripts/Networking/Fusion/NetworkHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,6 @@ public class NetworkHandler : Singleton<NetworkHandler>, INetworkRunnerCallbacks

//---Static Variables
public static readonly string[] Regions = { "asia", "eu", "jp", "kr", "sa", "us", "usw" };
public static readonly Dictionary<string, string> RegionIPs = new() {
["asia"] = "15.235.132.46",
["eu"] = "192.36.27.39",
["jp"] = "139.162.127.196",
["kr"] = "158.247.198.230",
["sa"] = "200.25.36.72",
["us"] = "45.86.230.227",
["usw"] = "45.145.148.21",
};
public static readonly Dictionary<string, int> RegionPings = new();
public static readonly string RoomIdValidChars = "BCDFGHJKLMNPRQSTVWXYZ";
private static readonly int RoomIdLength = 8;
Expand Down Expand Up @@ -456,6 +447,27 @@ public static async Task<StartGameResult> ConnectToRegion(string region = "") {
// And join lobby
StartGameResult result = await Runner.JoinSessionLobby(SessionLobby.ClientServer, authentication: authValues, customAppSettings: appSettings);
if (result.Ok) {
try {
// Wacky reflection to get the region pings.
object cloudServices = Runner.GetType().GetField("_cloudServices", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).GetValue(Runner);
object communicator = cloudServices.GetType().GetProperty("Communicator", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public).GetValue(cloudServices);
object client = communicator.GetType().GetProperty("Client", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public).GetValue(communicator);
object regionHandler = client.GetType().GetField("RegionHandler", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public).GetValue(client);
IList regions = (IList) regionHandler.GetType().GetProperty("EnabledRegions", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public).GetValue(regionHandler);

var codeField = regions[0].GetType().GetProperty("Code", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
var pingField = regions[0].GetType().GetProperty("Ping", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Public);
foreach (object item in regions) {
string code = (string) codeField.GetValue(item);
int ping = (int) pingField.GetValue(item);
RegionPings[code] = ping;
}

OnRegionPingsUpdated?.Invoke();
} catch (Exception e) {
Debug.LogError(e);
}

CurrentRegion = Runner.LobbyInfo.Region;

Debug.Log($"[Network] Connected to a Lobby ({Runner.LobbyInfo.Name}, {CurrentRegion})");
Expand Down Expand Up @@ -595,43 +607,6 @@ public static async Task<StartGameResult> JoinRoom(string roomId) {
}
#endregion

private static float pingStartTime;
public static IEnumerator PingRegions() {
foreach ((string region, _) in RegionIPs) {
RegionPings[region] = 0;
}

pingStartTime = Time.time;
Dictionary<string, Ping> pingers = new();

foreach ((string region, string ip) in RegionIPs) {
pingers[region] = new(ip);
}

bool anyRemaining = true;
while (anyRemaining && Time.time - pingStartTime < 4) {
anyRemaining = false;

foreach ((string region, Ping pinger) in pingers) {
if (pinger == null) {
continue;
}

if (!pinger.isDone) {
anyRemaining = true;
continue;
}

// Ping done.
RegionPings[region] = pinger.time;
pinger.DestroyPing();
}
yield return null;
}

OnRegionPingsUpdated?.Invoke();
}

private static void RoomInitialized(NetworkRunner runner) {

Instance.playerDatas.Clear();
Expand Down
2 changes: 1 addition & 1 deletion Assets/Scripts/UI/Menu/MainMenuManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public void Start() {

PreviewLevel(UnityEngine.Random.Range(0, maps.Count));
UpdateRegionDropdown();
StartCoroutine(NetworkHandler.PingRegions());
//StartCoroutine(NetworkHandler.PingRegions());

// Photon stuff.
if (GlobalController.Instance.firstConnection) {
Expand Down
3 changes: 1 addition & 2 deletions ProjectSettings/ProjectSettings.asset
Original file line number Diff line number Diff line change
Expand Up @@ -134,8 +134,7 @@ PlayerSettings:
vulkanEnableCommandBufferRecycling: 1
loadStoreDebugModeEnabled: 0
bundleVersion: 1.8.0.0
preloadedAssets:
- {fileID: 11400000, guid: 49335f30d253220488d2d332ade6e901, type: 2}
preloadedAssets: []
metroInputSource: 0
wsaTransparentSwapchain: 0
m_HolographicPauseOnTrackingLoss: 1
Expand Down

0 comments on commit 378b419

Please sign in to comment.