In this lesson, you will learn why character movement demands a specialized architectural approach compared to standard actor replication.
The Problem with Standard Replication
Up to this point, you have learned how to synchronize variables and trigger logic via RPCs. If you attempted to move a character by simply sending an RPC to the server like MoveForward(float Amount) every frame, your game would feel broken. Why? Because of network latency (ping). If it takes 100ms for your input to reach the server, the server will process your movement 100ms late, making the game feel "mushy" and unresponsive.
Standard actor replication is designed for state consistency, not for high-frequency, time-sensitive interactivity. Character movement is unique because it requires an immediate local response for the player while maintaining server-side authority to prevent cheating.
The Client-Server Movement Model
To solve this, Unreal employs a technique where the client "predicts" its own movement. The flow looks like this:
- Local Prediction: The client immediately executes the movement logic locally so the player sees an instant response.
- Server Authority: The client sends the input data (not the result) to the server.
- Reconciliation: The server calculates the "true" position. If the server’s calculated position deviates significantly from what the client predicted, the server sends a correction back to the client.
If you were to try and build this manually using only basic RPCs, you would quickly encounter "jitter" because the client and server would constantly disagree on the exact frame-time of an action. This is why CharacterMovementComponent exists—it is a specialized, monolithic architecture that handles this complex handshake of timestamping inputs, buffering them, and performing error correction (Reconciliation) automatically.
// Logic conceptually flows like this:
void UCharacterMovementComponent::PerformMovement() {
// 1. Client predicts movement locally
// 2. Client sends inputs to Server via RPC
// 3. Server validates inputs and sets authoritative position
// 4. Server replicates position back to client
// 5. Client reconciles if the distance error is too large
}
By relying on this specialized movement architecture, you ensure the player has a crisp experience while the server retains the final say on where the character actually exists in the world.
Key Takeaway: Character movement requires a custom architecture because standard RPCs are too slow to hide latency; instead, we must use client-side prediction and server-side reconciliation to maintain both responsiveness and authority.