In this lesson, you will learn how to distinguish between the authoritative server and the visual-only client to ensure a synchronized multiplayer experience.
The Authority Hierarchy
In Unreal Engine’s networking model, the Server acts as the single source of truth for the game state. It is the only entity that runs the authoritative simulation, manages game logic, and validates player actions. The Client, conversely, is a "dumb terminal" in its simplest form—it is responsible for rendering the scene, gathering user input, and displaying the state as dictated by the server.
The Flow of Truth
Think of the server as the "Master Simulation" and the client as a "Projected View." When a player presses a button to activate a Gameplay Ability, the client doesn't simply change its own state. Instead, it sends an RPC (Remote Procedure Call) to the server requesting the action. The server validates if the player is allowed to perform that action (e.g., checking if they have enough mana or if they are currently stunned via Gameplay Tags) and then processes the logic.
Once the server updates its internal state, it replicates the results back to the clients. You can check your current role in code using the GetLocalRole() function:
if (GetLocalRole() == ROLE_Authority)
{
// This code runs only on the server.
// Apply Gameplay Effects, modify health, or finalize Ability state.
}
else
{
// This code runs on the client.
// Predict visuals or play local feedback cues.
}
Why this distinction matters
If you attempt to modify a gameplay-critical variable—such as Health or AbilityCooldown—directly on the client without going through the server, the client will eventually be "snapped" back to the server's version of reality during the next replication cycle. This is known as Network Correction. Your goal as a developer is to ensure that the client-side experience feels snappy through prediction while ensuring that the server remains the final arbiter of what is "actually" happening in the game world.
Key Takeaway: The server is the authoritative source of game state, while the client acts as a high-fidelity visual representative that constantly reconciles its state with the server's truth.