@ -26,8 +26,11 @@
# include <AzCore/Component/ComponentApplicationBus.h>
# include <AzCore/Console/IConsole.h>
# include <AzCore/Console/ILogger.h>
# include <AzCore/Debug/Profiler.h>
# include <AzCore/Math/Transform.h>
AZ_DECLARE_BUDGET ( MULTIPLAYER ) ;
namespace Multiplayer
{
// Current max size for a UdpPacketHeader is 11 bytes
@ -78,6 +81,8 @@ namespace Multiplayer
void EntityReplicationManager : : ActivatePendingEntities ( )
{
AZ_PROFILE_SCOPE ( MULTIPLAYER , " EntityReplicationManager: ActivatePendingEntities " ) ;
AZStd : : vector < NetEntityId > notReadyEntities ;
const AZ : : TimeMs endTimeMs = AZ : : GetElapsedTimeMs ( ) + m_entityActivationTimeSliceMs ;
@ -126,17 +131,23 @@ namespace Multiplayer
GetRemoteHostId ( ) . GetString ( ) . c_str ( )
) ;
// Prep a replication record for send, at this point, everything needs to be sent
for ( EntityReplicator * replicator : toSendList )
{
replicator - > GetPropertyPublisher ( ) - > PrepareSerialization ( ) ;
AZ_PROFILE_SCOPE ( MULTIPLAYER , " EntityReplicationManager: SendUpdates - PrepareSerialization " ) ;
// Prep a replication record for send, at this point, everything needs to be sent
for ( EntityReplicator * replicator : toSendList )
{
replicator - > GetPropertyPublisher ( ) - > PrepareSerialization ( ) ;
}
}
// While our to send list is not empty, build up another packet to send
do
{
SendEntityUpdateMessages ( toSendList ) ;
} while ( ! toSendList . empty ( ) ) ;
AZ_PROFILE_SCOPE ( MULTIPLAYER , " EntityReplicationManager: SendUpdates - SendEntityUpdateMessages " ) ;
// While our to send list is not empty, build up another packet to send
do
{
SendEntityUpdateMessages ( toSendList ) ;
} while ( ! toSendList . empty ( ) ) ;
}
}
SendEntityRpcs ( m_deferredRpcMessagesReliable , true ) ;
@ -164,6 +175,8 @@ namespace Multiplayer
return EntityReplicatorList ( ) ;
}
AZ_PROFILE_SCOPE ( MULTIPLAYER , " EntityReplicationManager: GenerateEntityUpdateList " ) ;
// Generate a list of all our entities that need updates
EntityReplicatorList toSendList ;