feat(hud): F3 debug overlay — FPS, frame time, worst frame, state
A top-left readout for performance work: smoothed FPS and frame time, the worst frame in a rolling two-second window, the active view, player speed, a frame counter and the player's position in metres from the project origin. - F3 toggles it, through the console variable gigline.Debug so a packaged build can be checked without a rebuild (IA_ToggleDebug). - On automatically for -perf and -qaselftest, so a performance capture never depends on pressing a key first; off in the built demo, because a player should not see an FPS counter over Hollywood Boulevard. - The first two seconds are a warm-up window excluded from the worst-frame figure. Without it the readout showed "worst 400 ms" for a healthy run: the startup shader and streaming hitches dominated the rolling maximum. Measured cost on the self-test route at 1440p: 2.64 to 2.77 ms average, about 5 %, still 6x the floor. The release-check number stays the overlay-off run; the overlay-on series is committed beside it as Docs/perf/0.2.0-walk-frametimes-overlay.csv. Docs: controls (F3 row, overlay section, switch table), release checks (cost row), architecture building block view (HUD and input list).
This commit is contained in:
1 parent
12272d6b96
commit
bc2e9c3b8e
12 files changed
+904
-8
No files matched your search
@@ -15,6 +15,7 @@
|
||||
#include "Engine/World.h"
|
||||
#include "TimerManager.h"
|
||||
#include "Containers/Ticker.h"
|
||||
#include "HAL/IConsoleManager.h"
|
||||
#include "Kismet/GameplayStatics.h"
|
||||
#include "Misc/CommandLine.h"
|
||||
#include "Misc/Parse.h"
|
||||
@@ -132,6 +133,8 @@ AGigLineCharacter::AGigLineCharacter()
|
||||
TEXT("/Game/Input/IA_Jump.IA_Jump"));
|
||||
static ConstructorHelpers::FObjectFinder<UInputAction> ResetF(
|
||||
TEXT("/Game/Input/IA_Reset.IA_Reset"));
|
||||
static ConstructorHelpers::FObjectFinder<UInputAction> DebugF(
|
||||
TEXT("/Game/Input/IA_ToggleDebug.IA_ToggleDebug"));
|
||||
static ConstructorHelpers::FObjectFinder<UInputAction> CamF(
|
||||
TEXT("/Game/Input/IA_ToggleCamera.IA_ToggleCamera"));
|
||||
static ConstructorHelpers::FObjectFinder<UInputAction> PauseF(
|
||||
@@ -146,6 +149,7 @@ AGigLineCharacter::AGigLineCharacter()
|
||||
JumpAction = JumpF.Object;
|
||||
ResetAction = ResetF.Object;
|
||||
ToggleCameraAction = CamF.Object;
|
||||
ToggleDebugAction = DebugF.Object;
|
||||
PauseAction = PauseF.Object;
|
||||
|
||||
if (!MappingContext || !MoveAction || !MoveBackAction || !StrafeAction || !StrafeLeftAction
|
||||
@@ -257,6 +261,28 @@ void AGigLineCharacter::BeginPlay()
|
||||
// with `-thirdperson` so a capture can show the walk clip mid-stride: an idle
|
||||
// shot cannot prove the animation set, and a still cannot show a stride.
|
||||
bWalkForever = FParse::Param(FCommandLine::Get(), TEXT("walk"));
|
||||
|
||||
// `-perf` starts the overlay on: the performance capture and any manual frame
|
||||
// check should not depend on someone pressing F3 first. The built demo has
|
||||
// neither switch, so the counter stays hidden for players.
|
||||
if (FParse::Param(FCommandLine::Get(), TEXT("perf")) || FParse::Param(FCommandLine::Get(), TEXT("qaselftest")))
|
||||
{
|
||||
if (IConsoleVariable* Var = IConsoleManager::Get().FindConsoleVariable(TEXT("gigline.Debug")))
|
||||
{
|
||||
Var->Set(1, ECVF_SetByConsole);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void AGigLineCharacter::ToggleDebugOverlay()
|
||||
{
|
||||
static IConsoleVariable* Var = IConsoleManager::Get().FindConsoleVariable(TEXT("gigline.Debug"));
|
||||
if (Var)
|
||||
{
|
||||
const bool bNowOn = Var->GetInt() == 0;
|
||||
Var->Set(bNowOn ? 1 : 0, ECVF_SetByConsole);
|
||||
UE_LOG(LogTemp, Log, TEXT("GigLine: debug overlay %s"), bNowOn ? TEXT("on") : TEXT("off"));
|
||||
}
|
||||
}
|
||||
|
||||
void AGigLineCharacter::SetReviewWalk(bool bEnable)
|
||||
@@ -658,6 +684,10 @@ void AGigLineCharacter::SetupPlayerInputComponent(UInputComponent* PlayerInputCo
|
||||
{
|
||||
Input->BindAction(ToggleCameraAction, ETriggerEvent::Started, this, &AGigLineCharacter::ToggleCamera);
|
||||
}
|
||||
if (ToggleDebugAction)
|
||||
{
|
||||
Input->BindAction(ToggleDebugAction, ETriggerEvent::Started, this, &AGigLineCharacter::ToggleDebugOverlay);
|
||||
}
|
||||
if (JumpAction)
|
||||
{
|
||||
Input->BindAction(JumpAction, ETriggerEvent::Started, this, &AGigLineCharacter::StartJump);
|
||||
|
||||
Reference in new issue
Block a user