Working on ghost issues

This commit is contained in:
2026-01-24 16:23:53 +01:00
parent 1433b9bdfc
commit 912be35172
5 changed files with 980 additions and 975 deletions

View File

@@ -55392,9 +55392,9 @@ MonoBehaviour:
- {fileID: 2541243872366204002, guid: 7168d13094fcae94b81e672d1f4ab73f, type: 2}
- {fileID: 10758, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 10303, guid: 0000000000000000f000000000000000, type: 0}
- {fileID: 2100000, guid: ae0c7562e66fca1469f7ee603e462581, type: 2}
- {fileID: 2100000, guid: a3869014ba4893d409f150224856180a, type: 2}
- {fileID: 2100000, guid: fc67956adbc95584ba3ae3b18d1e430d, type: 2}
- {fileID: 2100000, guid: ae0c7562e66fca1469f7ee603e462581, type: 2}
- {fileID: 2100000, guid: db2b6d76bdd134244912a5c1c9971804, type: 2}
LightMapsNear: []
LightMapsFar: []

File diff suppressed because it is too large Load Diff

View File

@@ -168,9 +168,10 @@ namespace Marro.PacManUdon
if (turnAroundSoon && ghostState == PacManGhostState.Normal
&& GridMoverTools.CrossesTileBorder(position, nextPosition, direction.x != 0, direction.y != 0))
{
// Debug.Log($"{gameObject} turned around");
SetDirection(direction * -1);
Debug.Log($"{gameObject} turned around to direction {GetDirection()}");
turnAroundSoon = false;
return GridMoverTools.PositionToGrid(nextPosition);
}
if (kinematic)
@@ -232,6 +233,12 @@ namespace Marro.PacManUdon
// Debug.Log($"{gameObject} crossed tile center {gridPosition}, new target: {target}, new direction: {direction}");
}
var distance = Vector2.Distance(position, nextPosition);
if (distance > 0.5f)
{
Debug.LogError($"{gameObject} Just jumped by distance {distance}! position: {position}, nextPosition: {nextPosition}, direction: {direction}, offGrid: {offGrid}, ghostState: {ghostState}");
}
return nextPosition;
}

View File

@@ -193,7 +193,7 @@ namespace Marro.PacManUdon
}
// Debug.Log($"{gameObject} GhostCaughtQueue with ghost {ghost}");
networkManager.SendEventSoon(NetworkEventType.GhostUpdate);
//networkManager.SendEventSoon(NetworkEventType.GhostUpdate);
ghostScaredQueue.Add(ghost);
GhostCaughtExecute(ghost);
}
@@ -576,6 +576,7 @@ namespace Marro.PacManUdon
}
ghostScaredQueue.Add(ghosts[ghostIndex]);
}
index += ghosts.Length;
Debug.Log($"{gameObject} Read back a ghostScareQueue of length {ghostScaredQueue.Count}");
return true;

View File

@@ -272,6 +272,7 @@ namespace Marro.PacManUdon
{
if (IsOwner)
{
ProcessEventsToSend(); // Prepare events from last cycle
ProgressPingTime(); // See if we need to send a ping
}
else
@@ -282,11 +283,6 @@ namespace Marro.PacManUdon
// Forwards simulated time at the FixedUpdate pace
PerformFixedSyncedUpdate();
if (IsOwner)
{
ProcessEventsToSend();
}
}
private void UpdateInternalTime()
@@ -709,7 +705,7 @@ namespace Marro.PacManUdon
Synced = true;
}
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Processed incoming event! Total {index} bytes.");
Debug.Log($"({nameof(PacManUdon)} {nameof(NetworkManager)}) Performed incoming eventof type {eventType}! Total {index} bytes.");
retriesWithoutSuccess = 0; // We had success!