Debug overlay for kpbs per entity works

Signed-off-by: AMZN-Olex <5432499+AMZN-Olex@users.noreply.github.com>
This commit is contained in:
AMZN-Olex
2021-07-27 15:49:41 -04:00
parent 8fa3addda3
commit 5ebb096d1a
5 changed files with 138 additions and 38 deletions
@@ -10,7 +10,10 @@
#include "MultiplayerDebugByteReporter.h"
#include <AzCore/Component/EntityId.h>
#include <AzCore/Component/TickBus.h>
#include <AzCore/EBus/ScheduledEvent.h>
#include <AzCore/Interface/Interface.h>
#include <AzFramework/Entity/EntityDebugDisplayBus.h>
#include <Debug/MultiplayerDebugPerEntityInterface.h>
#include <GridMate/Drillers/CarrierDriller.h>
#include <Multiplayer/MultiplayerTypes.h>
@@ -24,8 +27,8 @@ namespace MultiplayerDiagnostics
: public AZ::Interface<MultiplayerIPerEntityStats>::Registrar
{
public:
MultiplayerDebugPerEntityReporter() = default;
~MultiplayerDebugPerEntityReporter() override = default;
MultiplayerDebugPerEntityReporter();
~MultiplayerDebugPerEntityReporter() override;
// main update loop
void OnImGuiUpdate();
@@ -38,10 +41,15 @@ namespace MultiplayerDiagnostics
void RecordPropertySent(Multiplayer::NetComponentId netComponentId, Multiplayer::PropertyIndex propertyId, uint32_t totalBytes) override;
void RecordPropertyReceived(Multiplayer::NetComponentId netComponentId, Multiplayer::PropertyIndex propertyId, uint32_t totalBytes) override;
void RecordRpcSent(Multiplayer::NetComponentId netComponentId, Multiplayer::RpcIndex rpcId, uint32_t totalBytes) override;
void RecordRpcReceived(Multiplayer::NetComponentId netComponentId, Multiplayer::RpcIndex rpcId, uint32_t totalBytes) override;
// }@
void UpdateDebugOverlay();
private:
AZ::ScheduledEvent m_updateDebugOverlay;
AZStd::map<AZ::EntityId, EntityReporter> m_sendingEntityReports{};
EntityReporter m_currentSendingEntityReport;
@@ -50,5 +58,18 @@ namespace MultiplayerDiagnostics
float m_replicatedStateKbpsWarn = 10.f;
float m_replicatedStateMaxSizeWarn = 30.f;
char m_statusBuffer[100] = {};
struct NetworkEntityTraffic
{
const char* m_name = nullptr;
float m_up = 0.f;
float m_down = 0.f;
};
AZStd::fixed_unordered_map<AZ::EntityId, NetworkEntityTraffic, 5, 10> m_networkEntitiesTraffic;
AzFramework::DebugDisplayRequests* m_debugDisplay = nullptr;
};
}