A bunch of work to get external multiplayer components to actually work
This commit is contained in:
+7
-7
@@ -14,14 +14,14 @@
|
||||
#include <Source/NetworkEntity/EntityReplication/EntityReplicator.h>
|
||||
#include <Source/NetworkEntity/EntityReplication/PropertyPublisher.h>
|
||||
#include <Source/NetworkEntity/EntityReplication/PropertySubscriber.h>
|
||||
#include <Source/NetworkEntity/NetworkEntityUpdateMessage.h>
|
||||
#include <Source/NetworkEntity/NetworkEntityRpcMessage.h>
|
||||
#include <Source/Components/NetBindComponent.h>
|
||||
#include <Source/AutoGen/Multiplayer.AutoPackets.h>
|
||||
#include <Include/IEntityDomain.h>
|
||||
#include <Include/IMultiplayer.h>
|
||||
#include <Include/INetworkEntityManager.h>
|
||||
#include <Include/IReplicationWindow.h>
|
||||
#include <Multiplayer/NetworkEntityUpdateMessage.h>
|
||||
#include <Multiplayer/NetworkEntityRpcMessage.h>
|
||||
#include <Multiplayer/NetBindComponent.h>
|
||||
#include <Multiplayer/IEntityDomain.h>
|
||||
#include <Multiplayer/IMultiplayer.h>
|
||||
#include <Multiplayer/INetworkEntityManager.h>
|
||||
#include <Multiplayer/IReplicationWindow.h>
|
||||
#include <AzNetworking/ConnectionLayer/IConnection.h>
|
||||
#include <AzNetworking/ConnectionLayer/IConnectionListener.h>
|
||||
#include <AzNetworking/PacketLayer/IPacketHeader.h>
|
||||
|
||||
+5
-5
@@ -13,11 +13,11 @@
|
||||
#pragma once
|
||||
|
||||
#include <Source/NetworkEntity/EntityReplication/EntityReplicator.h>
|
||||
#include <Source/Components/NetBindComponent.h>
|
||||
#include <Include/INetworkEntityManager.h>
|
||||
#include <Include/IReplicationWindow.h>
|
||||
#include <Include/IEntityDomain.h>
|
||||
#include <Include/NetworkEntityHandle.h>
|
||||
#include <Multiplayer/NetBindComponent.h>
|
||||
#include <Multiplayer/INetworkEntityManager.h>
|
||||
#include <Multiplayer/IReplicationWindow.h>
|
||||
#include <Multiplayer/IEntityDomain.h>
|
||||
#include <Multiplayer/NetworkEntityHandle.h>
|
||||
#include <AzNetworking/DataStructures/TimeoutQueue.h>
|
||||
#include <AzNetworking/PacketLayer/IPacketHeader.h>
|
||||
#include <AzCore/std/containers/map.h>
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
#include <Source/NetworkEntity/EntityReplication/PropertySubscriber.h>
|
||||
#include <Source/NetworkEntity/NetworkEntityAuthorityTracker.h>
|
||||
#include <Source/NetworkEntity/NetworkEntityTracker.h>
|
||||
#include <Source/NetworkEntity/NetworkEntityRpcMessage.h>
|
||||
#include <Source/Components/NetBindComponent.h>
|
||||
#include <Source/Components/NetworkTransformComponent.h>
|
||||
#include <Source/AutoGen/Multiplayer.AutoPackets.h>
|
||||
#include <Include/IMultiplayer.h>
|
||||
#include <Multiplayer/IMultiplayer.h>
|
||||
#include <Multiplayer/NetworkEntityRpcMessage.h>
|
||||
#include <Multiplayer/NetBindComponent.h>
|
||||
|
||||
#include <AzNetworking/PacketLayer/IPacket.h>
|
||||
#include <AzNetworking/Serialization/ISerializer.h>
|
||||
|
||||
@@ -18,8 +18,8 @@
|
||||
#include <AzCore/Component/EntityBus.h>
|
||||
#include <AzCore/std/smart_ptr/unique_ptr.h>
|
||||
#include <AzCore/std/containers/ring_buffer.h>
|
||||
#include <Source/Components/NetBindComponent.h>
|
||||
#include <Source/NetworkEntity/NetworkEntityUpdateMessage.h>
|
||||
#include <Multiplayer/NetBindComponent.h>
|
||||
#include <Multiplayer/NetworkEntityUpdateMessage.h>
|
||||
|
||||
namespace AzNetworking
|
||||
{
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Source/Components/NetBindComponent.h>
|
||||
#include <Multiplayer/NetBindComponent.h>
|
||||
#include <AzCore/std/containers/ring_buffer.h>
|
||||
|
||||
namespace AzNetworking
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
#include <Source/NetworkEntity/EntityReplication/PropertySubscriber.h>
|
||||
#include <Source/NetworkEntity/EntityReplication/EntityReplicationManager.h>
|
||||
#include <Source/Components/NetBindComponent.h>
|
||||
#include <Multiplayer/NetBindComponent.h>
|
||||
|
||||
namespace Multiplayer
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <Source/NetworkEntity/EntityReplication/ReplicationRecord.h>
|
||||
#include <Multiplayer/ReplicationRecord.h>
|
||||
|
||||
namespace Multiplayer
|
||||
{
|
||||
|
||||
@@ -1,104 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzNetworking/DataStructures/FixedSizeVectorBitset.h>
|
||||
#include <AzNetworking/Serialization/ISerializer.h>
|
||||
#include <AzNetworking/Utilities/NetworkCommon.h>
|
||||
#include <Include/MultiplayerTypes.h>
|
||||
|
||||
namespace Multiplayer
|
||||
{
|
||||
struct ReplicationRecordStats
|
||||
{
|
||||
ReplicationRecordStats() = default;
|
||||
ReplicationRecordStats
|
||||
(
|
||||
uint32_t authorityToAuthorityCount,
|
||||
uint32_t authorityToClientCount,
|
||||
uint32_t authorityToServerCount,
|
||||
uint32_t authorityToAutonomousCount,
|
||||
uint32_t autonomousToAuthorityCount
|
||||
);
|
||||
|
||||
uint32_t m_authorityToAuthorityCount = 0;
|
||||
uint32_t m_authorityToClientCount = 0;
|
||||
uint32_t m_authorityToServerCount = 0;
|
||||
uint32_t m_authorityToAutonomousCount = 0;
|
||||
uint32_t m_autonomousToAuthorityCount = 0;
|
||||
|
||||
bool operator ==(const ReplicationRecordStats& rhs) const;
|
||||
ReplicationRecordStats operator-(const ReplicationRecordStats& rhs) const;
|
||||
};
|
||||
|
||||
class ReplicationRecord
|
||||
{
|
||||
public:
|
||||
static constexpr uint32_t MaxRecordBits = 2048;
|
||||
|
||||
ReplicationRecord() = default;
|
||||
ReplicationRecord(NetEntityRole netEntityRole);
|
||||
|
||||
void SetNetworkRole(NetEntityRole netEntityRole);
|
||||
NetEntityRole GetNetworkRole() const;
|
||||
|
||||
bool AreAllBitsConsumed() const;
|
||||
void ResetConsumedBits();
|
||||
|
||||
void Clear();
|
||||
|
||||
void Append(const ReplicationRecord &rhs);
|
||||
void Subtract(const ReplicationRecord &rhs);
|
||||
bool HasChanges() const;
|
||||
|
||||
bool Serialize(AzNetworking::ISerializer& serializer);
|
||||
|
||||
void ConsumeAuthorityToAuthorityBits(uint32_t consumedBits);
|
||||
void ConsumeAuthorityToClientBits(uint32_t consumedBits);
|
||||
void ConsumeAuthorityToServerBits(uint32_t consumedBits);
|
||||
void ConsumeAuthorityToAutonomousBits(uint32_t consumedBits);
|
||||
void ConsumeAutonomousToAuthorityBits(uint32_t consumedBits);
|
||||
|
||||
bool ContainsAuthorityToAuthorityBits() const;
|
||||
bool ContainsAuthorityToClientBits() const;
|
||||
bool ContainsAuthorityToServerBits() const;
|
||||
bool ContainsAuthorityToAutonomousBits() const;
|
||||
bool ContainsAutonomousToAuthorityBits() const;
|
||||
|
||||
uint32_t GetRemainingAuthorityToAuthorityBits() const;
|
||||
uint32_t GetRemainingAuthorityToClientBits() const;
|
||||
uint32_t GetRemainingAuthorityToServerBits() const;
|
||||
uint32_t GetRemainingAuthorityToAutonomousBits() const;
|
||||
uint32_t GetRemainingAutonomousToAuthorityBits() const;
|
||||
|
||||
ReplicationRecordStats GetStats() const;
|
||||
|
||||
using RecordBitset = AzNetworking::FixedSizeVectorBitset<MaxRecordBits>;
|
||||
RecordBitset m_authorityToAuthority;
|
||||
RecordBitset m_authorityToClient;
|
||||
RecordBitset m_authorityToServer;
|
||||
RecordBitset m_authorityToAutonomous;
|
||||
RecordBitset m_autonomousToAuthority;
|
||||
|
||||
uint32_t m_authorityToAuthorityConsumedBits = 0;
|
||||
uint32_t m_authorityToClientConsumedBits = 0;
|
||||
uint32_t m_authorityToServerConsumedBits = 0;
|
||||
uint32_t m_authorityToAutonomousConsumedBits = 0;
|
||||
uint32_t m_autonomousToAuthorityConsumedBits = 0;
|
||||
|
||||
// Sequence number this ReplicationRecord was sent on
|
||||
AzNetworking::PacketId m_sentPacketId = AzNetworking::InvalidPacketId;
|
||||
|
||||
NetEntityRole m_netEntityRole = NetEntityRole::InvalidRole;;
|
||||
};
|
||||
}
|
||||
@@ -11,8 +11,8 @@
|
||||
*/
|
||||
|
||||
#include <Source/NetworkEntity/NetworkEntityAuthorityTracker.h>
|
||||
#include <Source/Components/NetBindComponent.h>
|
||||
#include <Include/INetworkEntityManager.h>
|
||||
#include <Multiplayer/NetBindComponent.h>
|
||||
#include <Multiplayer/INetworkEntityManager.h>
|
||||
#include <AzCore/Console/IConsole.h>
|
||||
#include <AzCore/Console/ILogger.h>
|
||||
#include <AzNetworking/Utilities/NetworkCommon.h>
|
||||
|
||||
@@ -10,11 +10,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <Include/NetworkEntityHandle.h>
|
||||
#include <Multiplayer/NetworkEntityHandle.h>
|
||||
#include <Multiplayer/MultiplayerController.h>
|
||||
#include <Multiplayer/MultiplayerComponent.h>
|
||||
#include <Multiplayer/NetBindComponent.h>
|
||||
#include <Source/NetworkEntity/NetworkEntityTracker.h>
|
||||
#include <Source/Components/NetBindComponent.h>
|
||||
#include <Source/Components/MultiplayerController.h>
|
||||
#include <Source/Components/MultiplayerComponent.h>
|
||||
#include <AzCore/Console/IConsole.h>
|
||||
#include <AzCore/Console/ILogger.h>
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@
|
||||
*/
|
||||
|
||||
#include <Source/NetworkEntity/NetworkEntityManager.h>
|
||||
|
||||
#include <AzCore/Asset/AssetManager.h>
|
||||
#include <AzCore/Console/IConsole.h>
|
||||
#include <AzCore/Console/ILogger.h>
|
||||
@@ -22,9 +21,9 @@
|
||||
#include <AzFramework/Entity/EntityContextBus.h>
|
||||
#include <AzFramework/Entity/GameEntityContextBus.h>
|
||||
#include <AzFramework/Spawnable/SpawnableEntitiesInterface.h>
|
||||
#include <Include/IMultiplayer.h>
|
||||
#include <Multiplayer/IMultiplayer.h>
|
||||
#include <Multiplayer/NetBindComponent.h>
|
||||
#include <Pipeline/NetworkSpawnableHolderComponent.h>
|
||||
#include <Source/Components/NetBindComponent.h>
|
||||
|
||||
namespace Multiplayer
|
||||
{
|
||||
|
||||
@@ -17,11 +17,11 @@
|
||||
#include <AzFramework/Spawnable/RootSpawnableInterface.h>
|
||||
#include <Source/NetworkEntity/NetworkEntityAuthorityTracker.h>
|
||||
#include <Source/NetworkEntity/NetworkEntityTracker.h>
|
||||
#include <Source/NetworkEntity/NetworkEntityRpcMessage.h>
|
||||
#include <Include/IEntityDomain.h>
|
||||
#include <Include/INetworkEntityManager.h>
|
||||
#include <Source/NetworkEntity/NetworkSpawnableLibrary.h>
|
||||
#include <Source/Components/MultiplayerComponentRegistry.h>
|
||||
#include <Multiplayer/IEntityDomain.h>
|
||||
#include <Multiplayer/INetworkEntityManager.h>
|
||||
#include <Multiplayer/MultiplayerComponentRegistry.h>
|
||||
#include <Multiplayer/NetworkEntityRpcMessage.h>
|
||||
|
||||
namespace Multiplayer
|
||||
{
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <Source/NetworkEntity/NetworkEntityRpcMessage.h>
|
||||
#include <Multiplayer/NetworkEntityRpcMessage.h>
|
||||
#include <AzNetworking/Serialization/NetworkInputSerializer.h>
|
||||
#include <AzNetworking/Serialization/NetworkOutputSerializer.h>
|
||||
#include <AzCore/Console/ILogger.h>
|
||||
|
||||
@@ -1,122 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzNetworking/Serialization/ISerializer.h>
|
||||
#include <AzNetworking/DataStructures/ByteBuffer.h>
|
||||
#include <Include/MultiplayerTypes.h>
|
||||
|
||||
namespace Multiplayer
|
||||
{
|
||||
struct IRpcParamStruct;
|
||||
|
||||
// The maximum number of RPC's we can aggregate into a single packet
|
||||
static constexpr uint32_t MaxAggregateRpcMessages = 1024;
|
||||
|
||||
//! @class NetworkEntityRpcMessage
|
||||
//! @brief Remote procedure call data.
|
||||
class NetworkEntityRpcMessage
|
||||
{
|
||||
public:
|
||||
AZ_TYPE_INFO(NetworkEntityRpcMessage, "{3AA5E1A5-6383-46C1-9817-F1B8C2325178}");
|
||||
|
||||
NetworkEntityRpcMessage() = default;
|
||||
NetworkEntityRpcMessage(NetworkEntityRpcMessage&& rhs);
|
||||
NetworkEntityRpcMessage(const NetworkEntityRpcMessage& rhs);
|
||||
|
||||
//! Fill explicit constructor.
|
||||
//! @param rpcDeliveryType the delivery type (origin and target) for this rpc
|
||||
//! @param entityId the networked entityId of the entity handling this rpc
|
||||
//! @param componentType the networked componentId of the component handling this rpc
|
||||
//! @param rpcIndex the component defined rpc index, so the component knows which rpc this message corresponds to
|
||||
//! @param isReliable whether or not this rpc should be sent reliably
|
||||
explicit NetworkEntityRpcMessage(RpcDeliveryType rpcDeliveryType, NetEntityId entityId, NetComponentId componentId, RpcIndex rpcIndex, ReliabilityType isReliable);
|
||||
|
||||
NetworkEntityRpcMessage& operator =(NetworkEntityRpcMessage&& rhs);
|
||||
NetworkEntityRpcMessage& operator =(const NetworkEntityRpcMessage& rhs);
|
||||
bool operator ==(const NetworkEntityRpcMessage& rhs) const;
|
||||
bool operator !=(const NetworkEntityRpcMessage& rhs) const;
|
||||
|
||||
//! Returns an estimated serialization footprint for this NetworkEntityRpcMessage.
|
||||
//! @return an estimated serialization footprint for this NetworkEntityRpcMessage
|
||||
uint32_t GetEstimatedSerializeSize() const;
|
||||
|
||||
//! Gets the current value of RpcDeliveryType.
|
||||
//! @return the current value of RpcDeliveryType
|
||||
RpcDeliveryType GetRpcDeliveryType() const;
|
||||
|
||||
//! Sets the current value for RpcDeliveryType.
|
||||
//! @param value the value to set RpcDeliveryType to
|
||||
void SetRpcDeliveryType(RpcDeliveryType value);
|
||||
|
||||
//! Gets the current value of EntityId.
|
||||
//! @return the current value of EntityId
|
||||
NetEntityId GetEntityId() const;
|
||||
|
||||
//! Gets the current value of EntityComponentType.
|
||||
//! @return the current value of EntityComponentType
|
||||
NetComponentId GetComponentId() const;
|
||||
|
||||
//! Gets the current value of RpcIndex.
|
||||
//! @return the current value of RpcIndex
|
||||
RpcIndex GetRpcIndex() const;
|
||||
|
||||
//! Writes the data contained inside a_Params to this NetworkEntityRpcMessage's blob buffer.
|
||||
//! @param params the parameters to save inside this NetworkEntityRpcMessage instance
|
||||
bool SetRpcParams(IRpcParamStruct& params);
|
||||
|
||||
//! Reads the data contained inside this NetworkEntityRpcMessage's blob buffer and stores them in outParams.
|
||||
//! @param outParams the parameters instance to store to the resulting data inside
|
||||
bool GetRpcParams(IRpcParamStruct& outParams);
|
||||
|
||||
//! Base serialize method for all serializable structures or classes to implement.
|
||||
//! @param serializer ISerializer instance to use for serialization
|
||||
//! @return boolean true for success, false for serialization failure
|
||||
bool Serialize(AzNetworking::ISerializer& serializer);
|
||||
|
||||
//! Sets this RPC's reliable delivery flag.
|
||||
//! @param reliabilityType the reliability type for this RPC
|
||||
void SetReliability(ReliabilityType reliabilityType);
|
||||
|
||||
//! Returns whether or not this RPC has been flagged for reliable delivery.
|
||||
//! @return the reliability type of this RPC
|
||||
ReliabilityType GetReliability() const;
|
||||
|
||||
private:
|
||||
|
||||
// Serialized payload data
|
||||
RpcDeliveryType m_rpcDeliveryType = RpcDeliveryType::None;
|
||||
NetEntityId m_entityId = InvalidNetEntityId;
|
||||
NetComponentId m_componentId = InvalidNetComponentId;
|
||||
RpcIndex m_rpcIndex = RpcIndex{ 0 };
|
||||
|
||||
// Only allocated if we actually have data
|
||||
// This is to prevent blowing out stack memory if we declare an array of these EntityUpdateMessages
|
||||
AZStd::unique_ptr<AzNetworking::PacketEncodingBuffer> m_data;
|
||||
|
||||
// Non-serialized RPC metadata
|
||||
ReliabilityType m_isReliable = ReliabilityType::Reliable;
|
||||
};
|
||||
|
||||
struct IRpcParamStruct
|
||||
{
|
||||
virtual ~IRpcParamStruct() {}
|
||||
virtual bool Serialize(AzNetworking::ISerializer& serializer) = 0;
|
||||
};
|
||||
|
||||
struct ComponentRpcEmptyStruct
|
||||
: public IRpcParamStruct
|
||||
{
|
||||
bool Serialize(AzNetworking::ISerializer&) override { return true; }
|
||||
};
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
#include <Source/NetworkEntity/NetworkEntityTracker.h>
|
||||
#include <Include/NetworkEntityHandle.h>
|
||||
#include <Multiplayer/NetworkEntityHandle.h>
|
||||
#include <AzCore/Console/IConsole.h>
|
||||
#include <AzCore/Console/ILogger.h>
|
||||
|
||||
|
||||
@@ -12,8 +12,8 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Include/MultiplayerTypes.h>
|
||||
#include <Include/NetworkEntityHandle.h>
|
||||
#include <Multiplayer/MultiplayerTypes.h>
|
||||
#include <Multiplayer/NetworkEntityHandle.h>
|
||||
#include <AzCore/std/containers/unordered_map.h>
|
||||
#include <AzCore/Component/Entity.h>
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include <Source/NetworkEntity/NetworkEntityUpdateMessage.h>
|
||||
#include <Multiplayer/NetworkEntityUpdateMessage.h>
|
||||
#include <AzNetworking/Serialization/NetworkInputSerializer.h>
|
||||
#include <AzNetworking/Serialization/NetworkOutputSerializer.h>
|
||||
#include <AzCore/Console/ILogger.h>
|
||||
|
||||
@@ -1,125 +0,0 @@
|
||||
/*
|
||||
* All or portions of this file Copyright (c) Amazon.com, Inc. or its affiliates or
|
||||
* its licensors.
|
||||
*
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this
|
||||
* distribution (the "License"). All use of this software is governed by the License,
|
||||
* or, if provided, by the license below or the license accompanying this file. Do not
|
||||
* remove or modify any license notices. This file is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <AzNetworking/Serialization/ISerializer.h>
|
||||
#include <AzNetworking/DataStructures/ByteBuffer.h>
|
||||
#include <AzCore/Name/Name.h>
|
||||
#include <Include/MultiplayerTypes.h>
|
||||
|
||||
namespace Multiplayer
|
||||
{
|
||||
// The maximum number of entity updates we can stuff into a single update packet
|
||||
static const uint32_t MaxAggregateEntityMessages = 2048;
|
||||
|
||||
//! @class NetworkEntityUpdateMessage
|
||||
//! @brief Property replication packet.
|
||||
class NetworkEntityUpdateMessage
|
||||
{
|
||||
public:
|
||||
AZ_TYPE_INFO(NetworkEntityUpdateMessage, "{CFCA08F7-547B-4B89-9794-37A8679608DF}");
|
||||
|
||||
NetworkEntityUpdateMessage() = default;
|
||||
NetworkEntityUpdateMessage(NetworkEntityUpdateMessage&& rhs);
|
||||
NetworkEntityUpdateMessage(const NetworkEntityUpdateMessage& rhs);
|
||||
|
||||
//! Constructor for update without a slice name (remote replicator established).
|
||||
//! @param entityRole the role of the entity being replicated
|
||||
//! @param entityId the networkId of the entity being replicated
|
||||
explicit NetworkEntityUpdateMessage(NetEntityRole entityRole, NetEntityId entityId);
|
||||
|
||||
//! Constructor for update with a slice name (no remote replicator established).
|
||||
//! @param entityRole the role of the entity being replicated
|
||||
//! @param entityId the networkId of the entity being replicated
|
||||
//! @param prefabEntityId the prefab entityId to clone this replicated entity from
|
||||
explicit NetworkEntityUpdateMessage(NetEntityRole entityRole, NetEntityId entityId, const PrefabEntityId& prefabEntityId);
|
||||
|
||||
//! Constructor for an entity delete message.
|
||||
//! @param entityId the networkId of the entity being deleted
|
||||
//! @param isMigrated whether or not the entity is being migrated or deleted
|
||||
//! @param takeOwnership true if the remote replicator should take ownership of the entity
|
||||
explicit NetworkEntityUpdateMessage(NetEntityId entityId, bool isMigrated, bool takeOwnership);
|
||||
|
||||
NetworkEntityUpdateMessage& operator =(NetworkEntityUpdateMessage&& rhs);
|
||||
NetworkEntityUpdateMessage& operator =(const NetworkEntityUpdateMessage& rhs);
|
||||
bool operator ==(const NetworkEntityUpdateMessage& rhs) const;
|
||||
bool operator !=(const NetworkEntityUpdateMessage& rhs) const;
|
||||
|
||||
//! Returns an estimated serialization footprint for this NetworkEntityUpdateMessage.
|
||||
//! @return an estimated serialization footprint for this NetworkEntityUpdateMessage
|
||||
uint32_t GetEstimatedSerializeSize() const;
|
||||
|
||||
//! Gets the current value of NetworkRole.
|
||||
//! @return the current value of NetworkRole
|
||||
NetEntityRole GetNetworkRole() const;
|
||||
|
||||
//! Gets the entities networkId.
|
||||
//! @return the entities networkId
|
||||
NetEntityId GetEntityId() const;
|
||||
|
||||
//! Gets the current value of IsDelete (true if this represents a DeleteProxy message).
|
||||
//! @return the current value of IsDelete
|
||||
bool GetIsDelete() const;
|
||||
|
||||
//! Returns whether or not the entity was migrated.
|
||||
//! @return whether or not the entity was migrated
|
||||
bool GetWasMigrated() const;
|
||||
|
||||
//! Gets the current value of TakeOwnership.
|
||||
//! @return the current value of TakeOwnership
|
||||
bool GetTakeOwnership() const;
|
||||
|
||||
//! Gets the current value of HasValidPrefabId.
|
||||
//! @return the current value of HasValidPrefabId
|
||||
bool GetHasValidPrefabId() const;
|
||||
|
||||
//! Sets the current value for PrefabEntityId.
|
||||
//! @param value the value to set PrefabEntityId to
|
||||
void SetPrefabEntityId(const PrefabEntityId& value);
|
||||
|
||||
//! Gets the current value of PrefabEntityId.
|
||||
//! @return the current value of PrefabEntityId
|
||||
const PrefabEntityId& GetPrefabEntityId() const;
|
||||
|
||||
//! Sets the current value for Data
|
||||
//! @param value the value to set Data to
|
||||
void SetData(const AzNetworking::PacketEncodingBuffer& value);
|
||||
|
||||
//! Gets the current value of Data.
|
||||
//! @return the current value of Data
|
||||
const AzNetworking::PacketEncodingBuffer* GetData() const;
|
||||
|
||||
//! Retrieves a non-const reference to the value of Data.
|
||||
//! @return a non-const reference to the value of Data
|
||||
AzNetworking::PacketEncodingBuffer& ModifyData();
|
||||
|
||||
//! Base serialize method for all serializable structures or classes to implement.
|
||||
//! @param serializer ISerializer instance to use for serialization
|
||||
//! @return boolean true for success, false for serialization failure
|
||||
bool Serialize(AzNetworking::ISerializer& serializer);
|
||||
|
||||
private:
|
||||
|
||||
NetEntityRole m_networkRole = NetEntityRole::InvalidRole;
|
||||
NetEntityId m_entityId = InvalidNetEntityId;
|
||||
bool m_isDelete = false;
|
||||
bool m_wasMigrated = false;
|
||||
bool m_takeOwnership = false;
|
||||
bool m_hasValidPrefabId = false;
|
||||
PrefabEntityId m_prefabEntityId;
|
||||
|
||||
// Only allocated if we actually have data
|
||||
// This is to prevent blowing out stack memory if we declare an array of these EntityUpdateMessages
|
||||
AZStd::unique_ptr<AzNetworking::PacketEncodingBuffer> m_data;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user