Changes to desync debug output to make it less stressful on bandwidth and the server, as well as some fixes to corrections on the local client
Signed-off-by: kberg-amzn <karlberg@amazon.com>
This commit is contained in:
+5
-8
@@ -10,6 +10,7 @@
|
||||
|
||||
#include <Source/AutoGen/LocalPredictionPlayerInputComponent.AutoComponent.h>
|
||||
#include <Multiplayer/Components/NetBindComponent.h>
|
||||
#include <AzNetworking/Serialization/StringifySerializer.h>
|
||||
|
||||
namespace Multiplayer
|
||||
{
|
||||
@@ -41,8 +42,7 @@ namespace Multiplayer
|
||||
(
|
||||
AzNetworking::IConnection* invokingConnection,
|
||||
const Multiplayer::NetworkInputArray& inputArray,
|
||||
const AZ::HashValue32& stateHash,
|
||||
const AzNetworking::PacketEncodingBuffer& clientState
|
||||
const AZ::HashValue32& stateHash
|
||||
) override;
|
||||
|
||||
void HandleSendMigrateClientInput
|
||||
@@ -58,11 +58,6 @@ namespace Multiplayer
|
||||
const AzNetworking::PacketEncodingBuffer& correction
|
||||
) override;
|
||||
|
||||
//! Return true if we're currently replaying inputs after a correction.
|
||||
//! If this value returns true, effects, audio, and other cosmetic triggers should be suppressed
|
||||
//! @return true if we're within correction scope and replaying inputs
|
||||
bool IsReplayingInput() const;
|
||||
|
||||
//! 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;
|
||||
@@ -79,6 +74,9 @@ namespace Multiplayer
|
||||
void UpdateAutonomous(AZ::TimeMs deltaTimeMs);
|
||||
void UpdateBankedTime(AZ::TimeMs deltaTimeMs);
|
||||
|
||||
using StateHistoryItem = AZStd::unique_ptr<AzNetworking::StringifySerializer>;
|
||||
AZStd::map<ClientInputId, StateHistoryItem> m_predictiveStateHistory;
|
||||
|
||||
// Implicitly sorted player input history, back() is the input that corresponds to the latest client input Id
|
||||
NetworkInputHistory m_inputHistory;
|
||||
|
||||
@@ -104,7 +102,6 @@ namespace Multiplayer
|
||||
ClientInputId m_lastMigratedInputId = ClientInputId{ 0 }; // Used to resend inputs that were queued during a migration event
|
||||
HostFrameId m_serverMigrateFrameId = InvalidHostFrameId;
|
||||
|
||||
bool m_replayingInput = false; // True if we're replaying inputs under a correction event (use this to suppress effects or audio)
|
||||
bool m_allowMigrateClientInput = false; // True if this component was migrated, we will allow the client to send us migrated inputs (one time only)
|
||||
};
|
||||
}
|
||||
|
||||
@@ -87,9 +87,19 @@ namespace Multiplayer
|
||||
AzNetworking::ConnectionId GetOwningConnectionId() const;
|
||||
void SetAllowAutonomy(bool value);
|
||||
MultiplayerComponentInputVector AllocateComponentInputs();
|
||||
|
||||
//! Return true if we're currently processing inputs.
|
||||
//! @return true if we're within ProcessInput scope and writing to predictive state
|
||||
bool IsProcessingInput() const;
|
||||
|
||||
//! Return true if we're currently replaying inputs after a correction.
|
||||
//! If this value returns true, effects, audio, and other cosmetic triggers should be suppressed
|
||||
//! @return true if we're within correction scope and replaying inputs
|
||||
bool IsReprocessingInput() const;
|
||||
|
||||
void CreateInput(NetworkInput& networkInput, float deltaTime);
|
||||
void ProcessInput(NetworkInput& networkInput, float deltaTime);
|
||||
void ReprocessInput(NetworkInput& networkInput, float deltaTime);
|
||||
|
||||
bool HandleRpcMessage(AzNetworking::IConnection* invokingConnection, NetEntityRole remoteRole, NetworkEntityRpcMessage& message);
|
||||
bool HandlePropertyChangeMessage(AzNetworking::ISerializer& serializer, bool notifyChanges = true);
|
||||
@@ -177,10 +187,11 @@ namespace Multiplayer
|
||||
|
||||
AzNetworking::ConnectionId m_owningConnectionId = AzNetworking::InvalidConnectionId;
|
||||
|
||||
bool m_isProcessingInput = false;
|
||||
bool m_isMigrationDataValid = false;
|
||||
bool m_needsToBeStopped = false;
|
||||
bool m_allowAutonomy = false; // Set to true for the hosts controlled entity
|
||||
bool m_isProcessingInput = false; // Set to true when we are processing input
|
||||
bool m_isReprocessingInput = false; // Set to true when we are reprocessing input (during a correction)
|
||||
bool m_isMigrationDataValid = false;
|
||||
bool m_needsToBeStopped = false;
|
||||
bool m_allowAutonomy = false; // Set to true for the hosts controlled entity
|
||||
|
||||
friend class NetworkEntityManager;
|
||||
friend class EntityReplicationManager;
|
||||
|
||||
@@ -54,6 +54,11 @@ namespace Multiplayer
|
||||
//! @return the HostFrameId taking into account the provided rewinding connectionId
|
||||
virtual HostFrameId GetHostFrameIdForRewindingConnection(AzNetworking::ConnectionId rewindConnectionId) const = 0;
|
||||
|
||||
//! Forcibly sets the current network time to the provided frameId and game time in milliseconds.
|
||||
//! @param frameId the new HostFrameId to use
|
||||
//! @param timeMs the new HostTimeMs to use
|
||||
virtual void ForceSetTime(HostFrameId frameId, AZ::TimeMs timeMs) = 0;
|
||||
|
||||
//! Alters the current HostFrameId and binds that alteration to the provided ConnectionId.
|
||||
//! @param frameId the new HostFrameId to use
|
||||
//! @param timeMs the new HostTimeMs to use
|
||||
|
||||
@@ -72,7 +72,7 @@ namespace Multiplayer
|
||||
const HostFrameId frameTime = GetCurrentTimeForProperty();
|
||||
if (frameTime < m_headTime)
|
||||
{
|
||||
AZ_Assert(false, "Trying to mutate a rewindable in the past");
|
||||
AZ_Assert(false, "Trying to mutate a rewindable value in the past");
|
||||
}
|
||||
else if (m_headTime < frameTime)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user