mirror of
https://github.com/Ed94/Cog.git
synced 2026-06-13 08:02:23 -07:00
CogEngine: Fix and improve Plot window
CogEngine: Fix and improve the Plot window - Fix ImPlot assert - Improve UI CogSample: - Add Inputs and AnimNotify plot events - Fix ability system warning
This commit is contained in:
@@ -2,7 +2,9 @@
|
||||
|
||||
#include "CogSampleAbilitySystemComponent.h"
|
||||
#include "GameFramework/GameState.h"
|
||||
#include "GameFramework/PlayerState.h"
|
||||
#include "Modules/ModuleManager.h"
|
||||
#include "Net/UnrealNetwork.h"
|
||||
|
||||
#if ENABLE_COG
|
||||
#include "CogAll.h"
|
||||
@@ -25,6 +27,13 @@ ACogSampleGameState::ACogSampleGameState(const FObjectInitializer & ObjectInitia
|
||||
AbilitySystemComponent->SetReplicationMode(EGameplayEffectReplicationMode::Minimal);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void ACogSampleGameState::GetLifetimeReplicatedProps(TArray<FLifetimeProperty>& OutLifetimeProps) const
|
||||
{
|
||||
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
|
||||
DOREPLIFETIME(ThisClass, _ServerFramerateRaw);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------------------------------
|
||||
void ACogSampleGameState::BeginPlay()
|
||||
{
|
||||
@@ -66,9 +75,52 @@ void ACogSampleGameState::Tick(float DeltaSeconds)
|
||||
#if ENABLE_COG
|
||||
|
||||
extern ENGINE_API float GAverageFPS;
|
||||
extern ENGINE_API float GAverageMS;
|
||||
FCogDebugPlot::PlotValue(this, "Frame Rate", GAverageFPS);
|
||||
FCogDebugPlot::PlotValue(this, "Frame Time", GAverageMS);
|
||||
|
||||
constexpr float smoothing = 10.0f;
|
||||
|
||||
_ClientFramerateSmooth = _ClientFramerateSmooth >= 0.0f
|
||||
? FMath::FInterpTo(_ClientFramerateSmooth, GAverageFPS, DeltaSeconds, smoothing)
|
||||
: GAverageFPS;
|
||||
|
||||
_ServerFramerateSmooth = _ServerFramerateSmooth >= 0.0f
|
||||
? FMath::FInterpTo(_ServerFramerateSmooth, _ServerFramerateRaw, DeltaSeconds, smoothing)
|
||||
: _ServerFramerateRaw;
|
||||
|
||||
if (GetLocalRole() != ROLE_Authority)
|
||||
{
|
||||
FCogDebugPlot::PlotValue(this, "Frame Rate Client Raw", GAverageFPS);
|
||||
FCogDebugPlot::PlotValue(this, "Frame Rate Client Smooth", _ClientFramerateSmooth);
|
||||
FCogDebugPlot::PlotValue(this, "Frame Rate Server Raw", _ServerFramerateRaw);
|
||||
FCogDebugPlot::PlotValue(this, "Frame Rate Server Smooth", _ServerFramerateSmooth);
|
||||
|
||||
if (const ULocalPlayer* LocalPlayer = GetWorld()->GetFirstLocalPlayerFromController())
|
||||
{
|
||||
if (const APlayerController* PlayerController = LocalPlayer->PlayerController)
|
||||
{
|
||||
if (const APlayerState* PlayerState = PlayerController->GetPlayerState<APlayerState>())
|
||||
{
|
||||
FCogDebugPlot::PlotValue(this, "Ping", PlayerState->GetPingInMilliseconds());
|
||||
}
|
||||
|
||||
if (const UNetConnection* Connection = PlayerController->GetNetConnection())
|
||||
{
|
||||
FCogDebugPlot::PlotValue(this,
|
||||
"Packet Loss In",
|
||||
Connection->GetInLossPercentage().GetAvgLossPercentage() * 100.0f);
|
||||
|
||||
FCogDebugPlot::PlotValue(this,
|
||||
"Packet Loss Out",
|
||||
Connection->GetOutLossPercentage().GetAvgLossPercentage() * 100.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
FCogDebugPlot::PlotValue(this, "Frame Rate Raw", GAverageFPS);
|
||||
FCogDebugPlot::PlotValue(this, "Frame Rate Smooth", _ClientFramerateSmooth);
|
||||
}
|
||||
|
||||
|
||||
if (CogWindowManager != nullptr)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user