Improved network accuracy
This commit is contained in:
@@ -6048,6 +6048,10 @@ PrefabInstance:
|
||||
propertyPath: serializationData.Prefab
|
||||
value:
|
||||
objectReference: {fileID: 3521573303519548534, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
|
||||
- target: {fileID: 3555002988650332767, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: -0.2
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3559251034056489513, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
|
||||
propertyPath: serializationData.Prefab
|
||||
value:
|
||||
@@ -13506,6 +13510,10 @@ PrefabInstance:
|
||||
propertyPath: serializationData.Prefab
|
||||
value:
|
||||
objectReference: {fileID: 3521573303519548534, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
|
||||
- target: {fileID: 3555002988650332767, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
|
||||
propertyPath: m_LocalPosition.x
|
||||
value: 0.91
|
||||
objectReference: {fileID: 0}
|
||||
- target: {fileID: 3559251034056489513, guid: 15ac0ed4c56c7784ea3ae9000fc2af1f, type: 3}
|
||||
propertyPath: serializationData.Prefab
|
||||
value:
|
||||
|
||||
@@ -386,25 +386,10 @@ namespace Marro.PacManUdon
|
||||
// Get our target time
|
||||
UpdateInternalTime();
|
||||
|
||||
if (Ready)
|
||||
{
|
||||
if (IsOwner)
|
||||
{
|
||||
ProcessEventsToSend(); // Prepare events from last cycle
|
||||
ProgressPingTime(); // See if we need to send a ping
|
||||
}
|
||||
else
|
||||
{
|
||||
ApplyReceivedEvents(); // See if there's events that need to be replayed
|
||||
}
|
||||
}
|
||||
|
||||
// Forwards simulated time by updateDelta until we're caught up
|
||||
while (nextUpdateTime <= internalTime)
|
||||
{
|
||||
ProgressSyncedTime(nextUpdateTime);
|
||||
PerformFixedSyncedUpdate();
|
||||
nextUpdateTime = SyncedTime + updateDelta;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -432,6 +417,26 @@ namespace Marro.PacManUdon
|
||||
}
|
||||
|
||||
private void PerformFixedSyncedUpdate()
|
||||
{
|
||||
if (Ready)
|
||||
{
|
||||
if (IsOwner)
|
||||
{
|
||||
ProcessEventsToSend(); // Prepare events from last cycle
|
||||
ProgressPingTime(); // See if we need to send a ping
|
||||
}
|
||||
else
|
||||
{
|
||||
ApplyReceivedEvents(); // See if there's events after last update that need to be replayed
|
||||
}
|
||||
}
|
||||
|
||||
ProgressSyncedTime(nextUpdateTime);
|
||||
CallSyncedUpdate();
|
||||
nextUpdateTime = SyncedTime + updateDelta;
|
||||
}
|
||||
|
||||
private void CallSyncedUpdate()
|
||||
{
|
||||
IsEventUpdate = false;
|
||||
|
||||
@@ -817,7 +822,7 @@ namespace Marro.PacManUdon
|
||||
{
|
||||
IsEventUpdate = true;
|
||||
|
||||
while (eventsQueueIndex > 0 && nextEventTime <= internalTime)
|
||||
while (eventsQueueIndex > 0 && nextEventTime <= SyncedTime)
|
||||
{
|
||||
var success = ApplyEvent(eventsQueue[0]);
|
||||
|
||||
|
||||
@@ -370,6 +370,7 @@ namespace Marro.PacManUdon
|
||||
{
|
||||
index += 8;
|
||||
base.ConsumeSyncedData(data, ref index, eventType);
|
||||
return true;
|
||||
}
|
||||
|
||||
SetTargetDirection(data.ReadVector2(ref index));
|
||||
|
||||
Reference in New Issue
Block a user