UCharacterMovementComponent::VerifyClientTimeStamp
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: virtualENGINE_API
Description
Runs on the server to check that an incoming client move timestamp is valid and has not already expired, also handling a timestamp reset if a large gap is detected.
Caveats & Gotchas
- • Has a side effect: ServerData.CurrentClientTimeStamp can be reset by this call, so don't assume it's read-only.
- • A timestamp reset is triggered when the gap exceeds MinTimeBetweenTimeStampResets / 2, which exists because timestamps are floats that lose precision over long play sessions.
- • Returning false means the move is discarded as stale; overriding this without understanding the reset logic can cause legitimate moves to be silently dropped.
Signature
virtual bool VerifyClientTimeStamp(float TimeStamp, FNetworkPredictionData_Server_Character & ServerData) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| TimeStamp | float | The client-reported move timestamp to validate. | — |
| ServerData | FNetworkPredictionData_Server_Character & | The server's prediction data for this client, which may have its CurrentClientTimeStamp reset as a side effect. | — |
Return Type
bool Example
Override to add custom timestamp logging C++
bool UMyCharacterMovementComponent::VerifyClientTimeStamp(float TimeStamp, FNetworkPredictionData_Server_Character& ServerData)
{
const bool bIsValid = Super::VerifyClientTimeStamp(TimeStamp, ServerData);
if (!bIsValid)
{
UE_LOG(LogTemp, Warning, TEXT("Rejected stale client timestamp: %f"), TimeStamp);
}
return bIsValid;
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?