RealDocs

ACharacter::ServerMovePacked_Validate

function Engine Since 4.20
#include "GameFramework/Character.h"
Access: public

Description

Validation function for the ServerMovePacked RPC. Returns true if the incoming data is acceptable; returning false kicks the client from the session.

Caveats & Gotchas

  • The default implementation returns true unconditionally. Override this to add anti-cheat checks against the packed data, but keep validation lightweight — it runs every movement update.
  • Returning false from a _Validate function does not crash the server; it invokes UNetDriver's anti-cheat handler and disconnects the client.

Signature

bool ServerMovePacked_Validate(const FCharacterServerMovePackedBits& PackedBits)

Parameters

Name Type Description Default
PackedBits const FCharacterServerMovePackedBits& The packed move bitstream to validate.

Return Type

bool

Example

Basic payload size validation C++
bool AMyCharacter::ServerMovePacked_Validate(const FCharacterServerMovePackedBits& PackedBits)
{
    // Reject suspiciously large payloads
    if (PackedBits.DataBits.Num() > 1024)
    {
        return false;
    }
    return true;
}

Version History

Introduced in: 4.20

Version Status Notes
5.6 stable

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.