Changes to desync debug output to make it less stressful on bandwidth and the server, as well as some fixes to corrections on the local client

Signed-off-by: kberg-amzn <karlberg@amazon.com>
This commit is contained in:
kberg-amzn
2021-08-03 13:12:37 -07:00
parent f0cafd0e9d
commit e0d0bbfdae
15 changed files with 154 additions and 138 deletions
@@ -524,6 +524,7 @@ namespace Multiplayer
bool EntityReplicationManager::HandlePropertyChangeMessage
(
AzNetworking::IConnection* invokingConnection,
EntityReplicator* entityReplicator,
AzNetworking::PacketId packetId,
NetEntityId netEntityId,
@@ -558,6 +559,12 @@ namespace Multiplayer
NetBindComponent* netBindComponent = replicatorEntity.GetNetBindComponent();
AZ_Assert(netBindComponent != nullptr, "No NetBindComponent");
if (createEntity)
{
// Always set our invoking connectionId for any newly created entities, since this connection now 'owns' them from a rewind perspective
netBindComponent->SetOwningConnectionId(invokingConnection->GetConnectionId());
}
const bool changeNetworkRole = (netBindComponent->GetNetEntityRole() != localNetworkRole);
if (changeNetworkRole)
{
@@ -744,7 +751,7 @@ namespace Multiplayer
bool EntityReplicationManager::HandleEntityUpdateMessage
(
[[maybe_unused]] AzNetworking::IConnection* invokingConnection,
AzNetworking::IConnection* invokingConnection,
const AzNetworking::IPacketHeader& packetHeader,
const NetworkEntityUpdateMessage& updateMessage
)
@@ -794,7 +801,7 @@ namespace Multiplayer
}
// This may implicitly create a replicator for us
bool handled = HandlePropertyChangeMessage(entityReplicator, packetHeader.GetPacketId(), updateMessage.GetEntityId(), updateMessage.GetNetworkRole(), outputSerializer, prefabEntityId);
bool handled = HandlePropertyChangeMessage(invokingConnection, entityReplicator, packetHeader.GetPacketId(), updateMessage.GetEntityId(), updateMessage.GetNetworkRole(), outputSerializer, prefabEntityId);
AZ_Assert(handled, "Failed to handle NetworkEntityUpdateMessage message");
return handled;
@@ -1121,7 +1128,7 @@ namespace Multiplayer
}
}
bool EntityReplicationManager::HandleEntityMigration([[maybe_unused]] AzNetworking::IConnection* invokingConnection, EntityMigrationMessage& message)
bool EntityReplicationManager::HandleEntityMigration(AzNetworking::IConnection* invokingConnection, EntityMigrationMessage& message)
{
EntityReplicator* replicator = GetEntityReplicator(message.m_entityId);
{
@@ -1130,6 +1137,7 @@ namespace Multiplayer
AzNetworking::TrackChangedSerializer<AzNetworking::NetworkOutputSerializer> outputSerializer(message.m_propertyUpdateData.GetBuffer(), message.m_propertyUpdateData.GetSize());
if (!HandlePropertyChangeMessage
(
invokingConnection,
replicator,
AzNetworking::InvalidPacketId,
message.m_entityId,
@@ -136,6 +136,7 @@ namespace Multiplayer
bool HandlePropertyChangeMessage
(
AzNetworking::IConnection* invokingConnection,
EntityReplicator* entityReplicator,
AzNetworking::PacketId packetId,
NetEntityId netEntityId,