Fix positional desync of network objects plus related log spam

Signed-off-by: puvvadar <puvvadar@amazon.com>
This commit is contained in:
puvvadar
2021-07-12 11:15:38 -07:00
parent e7b44b7d6b
commit a48a0d1f8a
5 changed files with 31 additions and 14 deletions
@@ -123,20 +123,23 @@ namespace Multiplayer
bool PropertyPublisher::PrepareUpdateEntityRecord()
{
// If we reach the maximum outstanding records, reset the replication state
bool didPrepare = true;
if (m_sentRecords.size() >= net_EntityReplicatorRecordsMax)
{
return PrepareAddEntityRecord();
// If we reach the maximum outstanding records, reset the replication state
didPrepare = PrepareAddEntityRecord();
}
// We need to clear out old records, and build up a list of everything that has changed since the last acked packet
m_sentRecords.push_front(m_pendingRecord);
auto iter = m_sentRecords.begin();
++iter; // Consider everything after the record we are going to send
for (; iter != m_sentRecords.end(); ++iter)
else
{
// Sequence wasn't acked, so we need to send these bits again
m_pendingRecord.Append(*iter);
// We need to clear out old records, and build up a list of everything that has changed since the last acked packet
m_sentRecords.push_front(m_pendingRecord);
auto iter = m_sentRecords.begin();
++iter; // Consider everything after the record we are going to send
for (; iter != m_sentRecords.end(); ++iter)
{
// Sequence wasn't acked, so we need to send these bits again
m_pendingRecord.Append(*iter);
}
}
// Don't send predictable properties back to the Autonomous unless we correct them
@@ -145,7 +148,7 @@ namespace Multiplayer
m_pendingRecord.Subtract(m_netBindComponent->GetPredictableRecord());
}
return true;
return didPrepare;
}
bool PropertyPublisher::PrepareDeleteEntityRecord()
@@ -191,6 +191,8 @@ namespace Multiplayer
bool ReplicationRecord::ContainsAuthorityToClientBits() const
{
// Check != Authority here since several modes require information about client updates
// (i.e. Autonomous when performing corrections)
return (m_remoteNetEntityRole != NetEntityRole::Authority)
|| (m_remoteNetEntityRole == NetEntityRole::InvalidRole);
}