More fixes to migration, plus some quality of life fixes to TimeoutQueue to allow lambda based handlers and a quick fix to OctreeSystemComponent to more gracefully handle enumerate calls that lie outside the vis system bounds
Signed-off-by: kberg-amzn <karlberg@amazon.com>
This commit is contained in:
+8
@@ -57,6 +57,14 @@ namespace Multiplayer
|
||||
const AzNetworking::PacketEncodingBuffer& correction
|
||||
) override;
|
||||
|
||||
//! Forcibly enables ProcessInput to execute on the entity.
|
||||
//! Note that this function is quite dangerous and should normally never be used
|
||||
void ForceEnableAutonomousUpdate();
|
||||
|
||||
//! Forcibly disables ProcessInput from executing on the entity.
|
||||
//! Note that this function is quite dangerous and should normally never be used
|
||||
void ForceDisableAutonomousUpdate();
|
||||
|
||||
//! Return true if we're currently migrating from one host to another.
|
||||
//! @return boolean true if we're currently migrating from one host to another
|
||||
bool IsMigrating() const;
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Multiplayer/NetworkInput/NetworkInput.h>
|
||||
#include <Multiplayer/NetworkEntity/NetworkEntityHandle.h>
|
||||
#include <AzCore/std/containers/array.h>
|
||||
#include <AzCore/std/containers/fixed_vector.h>
|
||||
|
||||
namespace Multiplayer
|
||||
{
|
||||
//! @class NetworkInputArray
|
||||
//! @brief An array of network inputs. Used to mitigate loss of input packets on the server. Compresses subsequent elements.
|
||||
class NetworkInputArray final
|
||||
{
|
||||
public:
|
||||
static constexpr uint32_t MaxElements = 8; // Never try to replicate a list larger than this amount
|
||||
|
||||
NetworkInputArray();
|
||||
NetworkInputArray(const ConstNetworkEntityHandle& entityHandle);
|
||||
~NetworkInputArray() = default;
|
||||
|
||||
NetworkInput& operator[](uint32_t index);
|
||||
const NetworkInput& operator[](uint32_t index) const;
|
||||
|
||||
bool Serialize(AzNetworking::ISerializer& serializer);
|
||||
|
||||
private:
|
||||
|
||||
struct Wrapper // Strictly a workaround to deal with the private constructor of NetworkInput
|
||||
{
|
||||
Wrapper() : m_networkInput() {}
|
||||
Wrapper(const NetworkInput& networkInput) : m_networkInput(networkInput) {}
|
||||
NetworkInput m_networkInput;
|
||||
};
|
||||
|
||||
ConstNetworkEntityHandle m_owner;
|
||||
AZStd::array<Wrapper, MaxElements> m_inputs;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Multiplayer/NetworkInput/NetworkInput.h>
|
||||
|
||||
namespace Multiplayer
|
||||
{
|
||||
//! Max number of entities that can be children of our netbound player entity.
|
||||
static constexpr uint32_t MaxEntityHierarchyChildren = 16;
|
||||
|
||||
//! Used by the EntityHierarchyComponent. This component allows the gameplay programmer to specify inputs for dependent entities.
|
||||
//! Since it is possible to for the Client/Server to disagree about the state of related entities,
|
||||
//! this network input encodes the entity that is associated with it.
|
||||
class NetworkInputChild
|
||||
{
|
||||
public:
|
||||
NetworkInputChild() = default;
|
||||
NetworkInputChild(const NetworkInputChild& rhs) = default;
|
||||
NetworkInputChild(const ConstNetworkEntityHandle& entityHandle);
|
||||
|
||||
NetworkInputChild& operator= (const NetworkInputChild& rhs);
|
||||
|
||||
void Attach(const ConstNetworkEntityHandle& entityHandle);
|
||||
const ConstNetworkEntityHandle& GetOwner() const;
|
||||
const NetworkInput& GetNetworkInput() const;
|
||||
NetworkInput& GetNetworkInput();
|
||||
|
||||
bool Serialize(AzNetworking::ISerializer& serializer);
|
||||
private:
|
||||
ConstNetworkEntityHandle m_owner;
|
||||
NetworkInput m_networkInput;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Multiplayer/NetworkInput/NetworkInput.h>
|
||||
#include <AzCore/std/containers/deque.h>
|
||||
|
||||
namespace Multiplayer
|
||||
{
|
||||
//! @class NetworkInputHistory
|
||||
//! @brief A list of input commands, used for bookkeeping on the client.
|
||||
class NetworkInputHistory final
|
||||
{
|
||||
public:
|
||||
AZStd::size_t Size() const;
|
||||
|
||||
const NetworkInput& operator[](AZStd::size_t index) const;
|
||||
NetworkInput& operator[](AZStd::size_t index);
|
||||
|
||||
void PushBack(NetworkInput& networkInput);
|
||||
void PopFront();
|
||||
const NetworkInput& Front() const;
|
||||
|
||||
private:
|
||||
|
||||
struct Wrapper // Strictly a workaround to deal with the private constructor of NetworkInput
|
||||
{
|
||||
Wrapper() : m_networkInput() {}
|
||||
Wrapper(const NetworkInput& networkInput) : m_networkInput(networkInput) {}
|
||||
NetworkInput m_networkInput;
|
||||
};
|
||||
|
||||
AZStd::deque<Wrapper> m_history;
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright (c) Contributors to the Open 3D Engine Project.
|
||||
* For complete copyright and license terms please see the LICENSE at the root of this distribution.
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0 OR MIT
|
||||
*
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#include <Multiplayer/NetworkInput/NetworkInput.h>
|
||||
#include <Multiplayer/NetworkEntity/NetworkEntityHandle.h>
|
||||
#include <AzCore/std/containers/array.h>
|
||||
#include <AzCore/std/containers/fixed_vector.h>
|
||||
|
||||
namespace Multiplayer
|
||||
{
|
||||
//! @class NetworkInputMigrationVector
|
||||
//! @brief A variable sized array of input commands, used specifically when migrate a clients inputs.
|
||||
class NetworkInputMigrationVector final
|
||||
{
|
||||
public:
|
||||
static constexpr uint32_t MaxElements = 90; // Never try to migrate a list larger than this amount, bumped up to handle DTLS connection time
|
||||
|
||||
NetworkInputMigrationVector();
|
||||
NetworkInputMigrationVector(const ConstNetworkEntityHandle& entityHandle);
|
||||
virtual ~NetworkInputMigrationVector() = default;
|
||||
|
||||
uint32_t GetSize() const;
|
||||
NetworkInput& operator[](uint32_t index);
|
||||
const NetworkInput& operator[](uint32_t index) const;
|
||||
bool PushBack(const NetworkInput& networkInput);
|
||||
|
||||
bool Serialize(AzNetworking::ISerializer& serializer);
|
||||
|
||||
private:
|
||||
|
||||
struct Wrapper // Strictly a workaround to deal with the private constructor of NetworkInput
|
||||
{
|
||||
Wrapper() : m_networkInput() {}
|
||||
Wrapper(const NetworkInput& networkInput) : m_networkInput(networkInput) {}
|
||||
bool Serialize(AzNetworking::ISerializer& serializer) { return m_networkInput.Serialize(serializer); }
|
||||
NetworkInput m_networkInput;
|
||||
};
|
||||
|
||||
ConstNetworkEntityHandle m_owner;
|
||||
AZStd::fixed_vector<Wrapper, MaxElements> m_inputs;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user