Integrating github/staging through commit ab87ed9

This commit is contained in:
alexpete
2021-04-09 11:27:37 -07:00
parent ae62a97894
commit 1044dc3da1
1582 changed files with 29374 additions and 519051 deletions
@@ -17,10 +17,11 @@
#include <AzNetworking/DataStructures/FixedSizeBitsetView.h>
#include <Source/NetworkEntity/NetworkEntityHandle.h>
#include <Source/MultiplayerTypes.h>
#include <Include/IMultiplayer.h>
//! Macro to declare bindings for a multiplayer component inheriting from MultiplayerComponent
#define AZ_MULTIPLAYER_COMPONENT(ComponentClass, Guid, Base) \
AZ_RTTI(ComponentClass, Guid, AZ::Component) \
AZ_RTTI(ComponentClass, Guid, Base) \
AZ_COMPONENT_INTRUSIVE_DESCRIPTOR_TYPE(ComponentClass) \
AZ_COMPONENT_BASE(ComponentClass, Guid, Base)
@@ -38,7 +39,7 @@ namespace Multiplayer
AZ_CLASS_ALLOCATOR(MultiplayerComponent, AZ::SystemAllocator, 0);
AZ_RTTI(MultiplayerComponent, "{B7F5B743-CCD3-4981-8F1A-FC2B95CE22D7}", AZ::Component);
static void Reflect(AZ::ReflectContext* reflection);
static void Reflect(AZ::ReflectContext* context);
static void GetRequiredServices(AZ::ComponentDescriptor::DependencyArrayType& required);
MultiplayerComponent() = default;
@@ -70,10 +71,10 @@ namespace Multiplayer
virtual bool HandleRpcMessage(NetEntityRole netEntityRole, NetworkEntityRpcMessage& rpcMessage) = 0;
virtual bool SerializeStateDeltaMessage(ReplicationRecord& replicationRecord, AzNetworking::ISerializer& serializer) = 0;
virtual void NotifyStateDeltaChanges(ReplicationRecord& replicationRecord) = 0;
protected:
virtual bool HasController() const = 0;
virtual MultiplayerController* GetController() = 0;
protected:
virtual void ConstructController() = 0;
virtual void DestructController() = 0;
virtual void ActivateController(EntityIsMigrating entityIsMigrating) = 0;
@@ -113,27 +114,30 @@ namespace Multiplayer
{
if (bitset.GetBit(bitIndex))
{
//uint32_t prevUpdateSize = serializer.GetSize();
const uint32_t prevUpdateSize = serializer.GetSize();
serializer.ClearTrackedChangesFlag();
serializer.Serialize(value, name);
if (modifyRecord && !serializer.GetTrackedChangesFlag())
{
bitset.SetBit(bitIndex, false);
}
//uint32_t postUpdateSize = serializer.GetSize();
const uint32_t postUpdateSize = serializer.GetSize();
// Network Property metrics
// uint32_t updateSize = (postUpdateSize - prevUpdateSize);
// if (updateSize > 0)
// {
// if (serializer.GetSerializerMode() == AzNetworking::SerializerMode::WriteToObject)
// {
// GetPacketHandlerMetricsInstance().LogRecvNetworkPropertyUpdates(componentType, name, updateSize);
// }
// else
// {
// GetPacketHandlerMetricsInstance().LogSentNetworkPropertyUpdates(componentType, name, updateSize);
// }
// }
const uint32_t updateSize = (postUpdateSize - prevUpdateSize);
if (updateSize > 0)
{
MultiplayerStats& stats = AZ::Interface<IMultiplayer>::Get()->GetStats();
if (serializer.GetSerializerMode() == AzNetworking::SerializerMode::WriteToObject)
{
stats.m_propertyUpdatesRecv++;
stats.m_propertyUpdatesRecvBytes += updateSize;
}
else
{
stats.m_propertyUpdatesSent++;
stats.m_propertyUpdatesSentBytes += updateSize;
}
}
}
}
}