Skip to content

About

Game Message Router is a typed, Gameplay Tag based event bus for Unreal Engine. It provides fast local messaging and an explicit multiplayer transport for arbitrary reflected USTRUCT payloads in Blueprint and C++.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Game Message Router

Game Message Router is a typed, Gameplay Tag based event bus for Unreal Engine. It provides fast local messaging and an explicit multiplayer transport for arbitrary reflected USTRUCT payloads in Blueprint and C++.

The local API follows the useful messaging pattern demonstrated by Lyra, but the plugin is standalone: it has no Lyra dependency and does not require custom GameMode, GameState, or PlayerController base classes.

The problem

Gameplay systems often need to communicate without owning direct references to each other. A typical project starts with casts, interfaces, event dispatchers, or subsystem calls, then accumulates several recurring problems:

  1. Hard coupling — senders must know which object receives an event and how to find it.
  2. Inconsistent payloads — every dispatcher or interface needs a separate signature.
  3. Fragile lifetime management — listeners can disappear, travel to another world, or be removed during a callback.
  4. No generic networking — a UGameInstanceSubsystem is not replicated and cannot own RPCs.
  5. RPC ownership restrictions — clients cannot call Server RPCs on arbitrary replicated actors.
  6. Unsafe client events — a generic client-to-server channel needs sender identity, allowlists, rate limits, and validation.
  7. Blueprint friction — a generic message node is not useful unless its payload pin becomes the selected structure type.

The solution

The plugin separates local routing from network transport.

Responsibility Implementation Lifetime
Typed local dispatch UGameMessageSubsystem Game instance
Multiplayer transport UGameMessageNetworkSubsystem World
RPC ownership bridge AGameMessageReplicator One per player
Generic network payload FGameMessageNetworkPacket + FInstancedStruct One message
Blueprint typed output Dedicated async K2 node Listener lifetime

This separation is intentional. A local broadcast never silently becomes network traffic, and a received network message enters the same local router used by normal listeners.

Local flow

Sender
  -> Gameplay Tag + USTRUCT payload
  -> UGameMessageSubsystem
  -> exact and/or parent-channel listeners

Client-to-server flow

Client
  -> Send Game Message To Server
  -> client-owned AGameMessageReplicator
  -> Server RPC
  -> policy and rate-limit validation
  -> server UGameMessageSubsystem
  -> server listeners

Server-to-client flow

Server
  -> Send To Client / Send To All Clients
  -> target player's AGameMessageReplicator
  -> Client RPC
  -> client UGameMessageSubsystem
  -> client listeners

Features

  • Gameplay Tag channels.
  • Exact channel or channel-and-children matching.
  • Any reflected USTRUCT payload.
  • Blueprint and C++ APIs.
  • Synchronous local delivery on the game thread.
  • Strongly typed wildcard payload output in Blueprint.
  • Reliable and unreliable network messages.
  • Client to server, server to all clients, and server to one client delivery.
  • Automatic owner-only replication bridges.
  • Sender PlayerController context for messages received from clients.
  • Client channel allowlists and global channel blocklists.
  • Per-client rate limiting.
  • Configurable payload and startup queue limits.
  • Listener priority and one-shot listeners in C++.
  • Safe listener mutation during dispatch through snapshots.
  • Standalone, listen server, dedicated server, and PIE support.

Requirements

  • Unreal Engine 5.7 or 5.8.
  • Gameplay Tags enabled in the project.
  • Payload values must be reflected USTRUCT types.

The runtime module has no platform-specific dependency.

Installation

  1. Copy the plugin directory to:

    <YourProject>/Plugins/GameMessageRouter
    
  2. Enable Game Message Router in Edit > Plugins.

  3. Restart the editor when requested.

  4. Define message channels in Project Settings > Gameplay Tags.

  5. Review networking policy in Project Settings > Plugins > Game Message Router before accepting client messages.

Blueprint: local messages

Send

  1. Create a Blueprint Structure such as ST_InventoryChanged.
  2. Add a Gameplay Tag such as Message.Inventory.Changed.
  3. Call Broadcast Game Message (Local).
  4. Pass the tag and structure value.

Listen

  1. Add Listen For Game Messages.
  2. Select the channel and payload structure.
  3. Choose Exact Channel or Channel And Children.
  4. Read the typed Payload output when On Message Received fires.
  5. Enable Trigger Once when only the first matching message is needed.

The listener also outputs Context:

  • Local — produced by a local broadcast.
  • Server — received from the server by a client.
  • Client — received from a client by the server.
  • Context.Sender — the sending client's PlayerController; only set on the server for client-originated messages.

Blueprint: network messages

Node Valid caller Destination Notes
Send Game Message To Server Client or authority Server On authority, dispatches locally
Send Game Message To All Clients Authority Every connected client Standalone dispatches locally
Send Game Message To Client Authority One PlayerController Requires a valid target player
Is Game Message Network Ready Any — Useful for UI; startup sends can be queued

Every network send explicitly selects Reliable or Unreliable delivery.

How networking works

UGameInstanceSubsystem cannot replicate, so the plugin does not attempt to put RPCs on the message router itself.

On authority, UGameMessageNetworkSubsystem automatically creates one transient AGameMessageReplicator for each PlayerController. The actor is owned by that controller and only relevant to its owner. This satisfies Unreal's RPC ownership rules:

  • the owning client can call Server RPCs on its bridge;
  • the server can call Client RPCs for that specific player;
  • broadcasting iterates the server's per-player bridges.

The payload is stored in FInstancedStruct. Unreal's native FInstancedStruct::NetSerialize transmits the structure type and its reflected data. When the RPC arrives, the transport creates an FGameMessageContext and forwards the payload into the receiver's local UGameMessageSubsystem.

No actor needs to be placed in a level, and projects do not need to inherit from plugin framework classes.

Networking security

Network transport identifies the sending connection; it does not make client data trustworthy. Server listeners must still validate permissions and gameplay rules.

Before shipping a multiplayer project:

  1. Create a dedicated client-request root, for example Message.ClientRequest.
  2. Add it to AllowedClientToServerChannelRoots.
  3. Block server-only or sensitive roots through BlockedNetworkChannelRoots.
  4. Validate ownership, ranges, cooldowns, current state, and object references in the server listener.
  5. Tune MaxClientMessagesPerSecond for the project.
  6. Disable bAllowClientToServerMessages if clients never need to send router messages.

Important: an empty AllowedClientToServerChannelRoots allows every non-blocked channel. This is convenient for prototyping but should be reviewed before release.

Default settings:

Setting Default Purpose
bEnableNetworking true Enables the transport
bAllowClientToServerMessages true Allows client-originated messages
MaxClientMessagesPerSecond 30 Per-player server-side rate limit
MaxMessageStructSize 65536 Coarse fixed-size payload guard
bQueueClientMessagesUntilReady true Queues sends while the bridge replicates
ClientMessageQueueCapacity 32 Maximum queued startup messages
ClientMessageQueueTimeoutSeconds 5.0 Queued message lifetime

The structure-size setting checks the fixed memory size of the USTRUCT. Unreal's RPC limits still apply to dynamic strings, arrays, maps, and nested data.

C++ setup

Add the module to your .Build.cs file:

PrivateDependencyModuleNames.AddRange(
    new[]
    {
        "GameMessageRouter"
    });

Include the APIs you use:

#include "GameMessageSubsystem.h"
#include "GameMessageNetworkSubsystem.h"

Define a payload

USTRUCT(BlueprintType)
struct FInventoryChangedMessage
{
    GENERATED_BODY()

    UPROPERTY(BlueprintReadWrite)
    int32 NewCount = 0;
};

Broadcast locally

FInventoryChangedMessage Message;
Message.NewCount = 3;

UGameMessageSubsystem::Get(this).BroadcastMessage(
    InventoryChangedTag,
    Message);

Register a listener

Store the handle as a member and unregister it during owner teardown:

ListenerHandle = UGameMessageSubsystem::Get(this).RegisterListener<FInventoryChangedMessage>(
    InventoryChangedTag,
    [this](FGameplayTag ActualChannel, const FInventoryChangedMessage& Payload)
    {
        HandleInventoryChanged(Payload.NewCount);
    },
    EGameMessageMatch::ExactMatch);

// EndPlay, Deinitialize, or equivalent teardown:
ListenerHandle.Unregister();

Handles are explicit tokens. Copying or destroying a handle does not automatically unregister its listener.

Receive sender context

ListenerHandle = UGameMessageSubsystem::Get(this).RegisterListenerWithContext<FInventoryChangedMessage>(
    InventoryChangedTag,
    [this](
        FGameplayTag ActualChannel,
        const FInventoryChangedMessage& Payload,
        const FGameMessageContext& Context)
    {
        if (Context.Origin == EGameMessageOrigin::Client)
        {
            ValidateClientRequest(Context.Sender, Payload);
        }
    });

Send over the network

UGameMessageNetworkSubsystem* Network =
    GetWorld()->GetSubsystem<UGameMessageNetworkSubsystem>();

// Client -> server.
Network->SendToServer(
    InventoryChangedTag,
    Message,
    EGameMessageReliability::Reliable);

// Authority -> all clients.
Network->SendToAllClients(
    InventoryChangedTag,
    Message,
    EGameMessageReliability::Unreliable);

// Authority -> one client.
Network->SendToClient(
    TargetPlayerController,
    InventoryChangedTag,
    Message,
    EGameMessageReliability::Reliable);

Channel matching

Given these channels:

Message.Combat
Message.Combat.Damage
Message.Combat.Heal
  • An Exact Channel listener on Message.Combat only receives Message.Combat.
  • A Channel And Children listener on Message.Combat also receives Message.Combat.Damage and Message.Combat.Heal.
  • ActualChannel always contains the channel used by the sender.

Delivery guarantees and limitations

  • Local delivery is synchronous and game-thread only.
  • Reliable messages are ordered on each player's actor channel.
  • Unreliable messages may be dropped.
  • Late joiners do not receive earlier messages.
  • Messages are transient events, not persistent replicated state.
  • The plugin does not provide replay, storage, request responses, or delivery acknowledgements.
  • Do not use router messages for bulk data, save games, continuous transforms, or authoritative state.

Use replicated properties, RepNotify, or Fast Arrays for persistent state. Use Game Message Router to announce events, deliver commands, and decouple reactions to state changes.

Lyra migration notes

The plugin preserves the central Lyra-style concepts—Gameplay Tag channels, typed structures, exact/partial matching, and listener handles—but adds explicit networking and standalone packaging.

Important differences:

  • Local messages are never automatically replicated.
  • Multiplayer delivery uses UGameMessageNetworkSubsystem.
  • The Blueprint factory is named ListenForGameMessages.
  • Listeners can inspect message origin and client sender context.
  • Client-to-server policy is configurable.
  • This is not a binary drop-in replacement for Epic's module.

Troubleshooting

A client message never reaches the server

  • Check Is Game Message Network Ready.
  • Verify bEnableNetworking and bAllowClientToServerMessages.
  • Check the allowed and blocked channel roots.
  • Confirm the payload is a reflected USTRUCT.
  • Look for LogGameMessageRouter rate-limit or validation warnings.

A parent listener does not receive a child channel

Use Channel And Children / EGameMessageMatch::PartialMatch on the listener.

A client does not receive a server message

Call the client send functions on authority. For targeted delivery, pass the server's valid PlayerController for that connection.

A late-joining client missed an event

This is expected. Router messages are not retained. Replicate the underlying state and use the message only as a notification.

Additional documentation

Verified builds

  • Unreal Engine 5.7.4 — UnrealEditor and UnrealGame, Win64.
  • Unreal Engine 5.8.0 — UnrealEditor and UnrealGame, Win64.

About

Game Message Router is a typed, Gameplay Tag based event bus for Unreal Engine. It provides fast local messaging and an explicit multiplayer transport for arbitrary reflected USTRUCT payloads in Blueprint and C++.

Topics

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages