Some initial updates for eventual support of locally predicted input processing
This commit is contained in:
@@ -33,22 +33,36 @@ namespace Multiplayer
|
||||
return *this;
|
||||
}
|
||||
|
||||
void NetworkInput::SetNetworkInputId(NetworkInputId inputId)
|
||||
void NetworkInput::SetClientInputId(ClientInputId inputId)
|
||||
{
|
||||
m_inputId = inputId;
|
||||
}
|
||||
|
||||
NetworkInputId NetworkInput::GetNetworkInputId() const
|
||||
ClientInputId NetworkInput::GetClientInputId() const
|
||||
{
|
||||
return m_inputId;
|
||||
}
|
||||
|
||||
|
||||
NetworkInputId& NetworkInput::ModifyNetworkInputId()
|
||||
ClientInputId& NetworkInput::ModifyClientInputId()
|
||||
{
|
||||
return m_inputId;
|
||||
}
|
||||
|
||||
void NetworkInput::SetServerTimeMs(AZ::TimeMs serverTimeMs)
|
||||
{
|
||||
m_serverTimeMs = serverTimeMs;
|
||||
}
|
||||
|
||||
AZ::TimeMs NetworkInput::GetServerTimeMs() const
|
||||
{
|
||||
return m_serverTimeMs;
|
||||
}
|
||||
|
||||
AZ::TimeMs& NetworkInput::ModifyServerTimeMs()
|
||||
{
|
||||
return m_serverTimeMs;
|
||||
}
|
||||
|
||||
void NetworkInput::AttachNetBindComponent(NetBindComponent* netBindComponent)
|
||||
{
|
||||
m_wasAttached = true;
|
||||
@@ -62,7 +76,6 @@ namespace Multiplayer
|
||||
|
||||
bool NetworkInput::Serialize(AzNetworking::ISerializer& serializer)
|
||||
{
|
||||
//static_assert(UINT8_MAX >= Multiplayer::ComponentTypes::c_Count, "Expected fewer than 255 components, this code needs to be updated");
|
||||
if (!serializer.Serialize(m_inputId, "InputId"))
|
||||
{
|
||||
return false;
|
||||
@@ -135,8 +148,9 @@ namespace Multiplayer
|
||||
void NetworkInput::CopyInternal(const NetworkInput& rhs)
|
||||
{
|
||||
m_inputId = rhs.m_inputId;
|
||||
m_serverTimeMs = rhs.m_serverTimeMs;
|
||||
m_componentInputs.resize(rhs.m_componentInputs.size());
|
||||
for (int i = 0; i < rhs.m_componentInputs.size(); ++i)
|
||||
for (int32_t i = 0; i < rhs.m_componentInputs.size(); ++i)
|
||||
{
|
||||
if (m_componentInputs[i] == nullptr || m_componentInputs[i]->GetComponentId() != rhs.m_componentInputs[i]->GetComponentId())
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace Multiplayer
|
||||
// Forwards
|
||||
class NetBindComponent;
|
||||
|
||||
AZ_TYPE_SAFE_INTEGRAL(NetworkInputId, uint16_t);
|
||||
AZ_TYPE_SAFE_INTEGRAL(ClientInputId, uint16_t);
|
||||
|
||||
//! @class NetworkInput
|
||||
//! @brief A single networked client input command.
|
||||
@@ -38,9 +38,13 @@ namespace Multiplayer
|
||||
NetworkInput(const NetworkInput&);
|
||||
NetworkInput& operator= (const NetworkInput&);
|
||||
|
||||
void SetNetworkInputId(NetworkInputId inputId);
|
||||
NetworkInputId GetNetworkInputId() const;
|
||||
NetworkInputId& ModifyNetworkInputId();
|
||||
void SetClientInputId(ClientInputId inputId);
|
||||
ClientInputId GetClientInputId() const;
|
||||
ClientInputId& ModifyClientInputId();
|
||||
|
||||
void SetServerTimeMs(AZ::TimeMs serverTimeMs);
|
||||
AZ::TimeMs GetServerTimeMs() const;
|
||||
AZ::TimeMs& ModifyServerTimeMs();
|
||||
|
||||
void AttachNetBindComponent(NetBindComponent* netBindComponent);
|
||||
|
||||
@@ -67,10 +71,11 @@ namespace Multiplayer
|
||||
void CopyInternal(const NetworkInput& rhs);
|
||||
|
||||
MultiplayerComponentInputVector m_componentInputs;
|
||||
NetworkInputId m_inputId = NetworkInputId{ 0 };
|
||||
ClientInputId m_inputId = ClientInputId{ 0 };
|
||||
AZ::TimeMs m_serverTimeMs = AZ::TimeMs{ 0 };
|
||||
ConstNetworkEntityHandle m_owner;
|
||||
bool m_wasAttached = false;
|
||||
};
|
||||
}
|
||||
|
||||
AZ_TYPE_SAFE_INTEGRAL_SERIALIZEBINDING(Multiplayer::NetworkInputId);
|
||||
AZ_TYPE_SAFE_INTEGRAL_SERIALIZEBINDING(Multiplayer::ClientInputId);
|
||||
|
||||
@@ -48,12 +48,12 @@ namespace Multiplayer
|
||||
return m_inputs[index].m_networkInput;
|
||||
}
|
||||
|
||||
void NetworkInputVector::SetPreviousInputId(NetworkInputId previousInputId)
|
||||
void NetworkInputVector::SetPreviousInputId(ClientInputId previousInputId)
|
||||
{
|
||||
m_previousInputId = previousInputId;
|
||||
}
|
||||
|
||||
NetworkInputId NetworkInputVector::GetPreviousInputId() const
|
||||
ClientInputId NetworkInputVector::GetPreviousInputId() const
|
||||
{
|
||||
return m_previousInputId;
|
||||
}
|
||||
|
||||
@@ -32,8 +32,8 @@ namespace Multiplayer
|
||||
NetworkInput& operator[](uint32_t index);
|
||||
const NetworkInput& operator[](uint32_t index) const;
|
||||
|
||||
void SetPreviousInputId(NetworkInputId previousInputId);
|
||||
NetworkInputId GetPreviousInputId() const;
|
||||
void SetPreviousInputId(ClientInputId previousInputId);
|
||||
ClientInputId GetPreviousInputId() const;
|
||||
|
||||
bool Serialize(AzNetworking::ISerializer& serializer);
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace Multiplayer
|
||||
|
||||
ConstNetworkEntityHandle m_owner;
|
||||
AZStd::fixed_vector<Wrapper, MaxElements> m_inputs;
|
||||
NetworkInputId m_previousInputId;
|
||||
ClientInputId m_previousInputId;
|
||||
};
|
||||
|
||||
//! @class MigrateNetworkInputVector
|
||||
|
||||
Reference in New Issue
Block a user