Course contentsShow
← Unreal Engine Game Development
Lesson 120 of 8802. The Gameplay FrameworkFree lesson

Broadcasting Match Events to Clients

You will trigger multicast events from the GameState to notify all players when specific match milestones or scoring events occur.

In this lesson, you will learn how to use Multicast RPCs within the GameState to instantly notify every connected player when a major match event, such as a team scoring a point, occurs.

The Role of GameState in Broadcasting

When a significant gameplay event happens—like a "Match Over" announcement or a global score update—the GameState is the perfect hub for broadcasting this information. Because the GameState exists on the server and is replicated to all clients, it acts as the "source of truth." However, simply updating a variable isn't always enough to trigger a "one-time" event, like playing a victory sound effect or popping up a notification widget. This is where a Multicast function becomes essential.

Implementing the Multicast

A Multicast function is a special type of Remote Procedure Call (RPC) that the server triggers, which then forces every connected client to execute the same logic simultaneously.

In your GameState class, you define a function marked with NetMulticast. When the server calls this function, it effectively sends a message to every player: "Execute this code right now."

// Inside your AMyGameState header
UFUNCTION(NetMulticast, Reliable)
void Multicast_AnnounceGoalScored(int32 TeamID);

// Inside your AMyGameState source
void AMyGameState::Multicast_AnnounceGoalScored_Implementation(int32 TeamID)
{
    // This logic runs on the Server AND every connected Client
    PlayGoalCelebrationEffect();
    UpdateUIAnnouncement("Team Scored!");
}

Why Multicast?

Unlike variable replication, which keeps data in sync over time (like a player’s current health), a Multicast is an event-based notification. It is ideal for things that don't need to be saved as a state, but rather need to be "felt" or "seen" by the players the moment they happen.

By routing these events through the GameState, you ensure that the server maintains authority over when the event occurs, while every client receives the signal to display the appropriate feedback to the player. This keeps your game feel consistent across the entire network.

Key Takeaway: Use Multicast RPCs in the GameState to trigger one-time visual or audio notifications that should be experienced by every player simultaneously when a global gameplay event occurs.