RealDocs

APlayerState::SetCompressedPing

function Engine Since 4.0
#include "GameFramework/PlayerState.h"
Access: public Specifiers: ENGINE_API

Description

Sets the replicated compressed ping value directly. Normally managed by UpdatePing and RecalculateAvgPing; call this only if you are replacing the ping averaging system.

Caveats & Gotchas

  • The engine's automatic ping averaging (RecalculateAvgPing) runs once per second and will overwrite any value set here unless you also disable or override that machinery.
  • Values are clamped to uint8 range (0–255), meaning the maximum expressible ping is 1020 ms — callers must divide by 4 before passing.

Signature

void SetCompressedPing(const uint8 NewPing)

Parameters

Name Type Description Default
NewPing const uint8 Compressed ping value where actual milliseconds = NewPing * 4.

Return Type

void

Example

Inject a simulated ping value in a test environment C++
// Simulate 100 ms ping in an automated test
APlayerState* PS = TestController->GetPlayerState<APlayerState>();
PS->SetCompressedPing(25); // 25 * 4 = 100 ms

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.