CrimsonCommon · Lesson 5 of 7

Broadcast & Listen for Messages

Beginner4 minRuntime

Before you start

  • Completed: Enable the Plugin
  • A gameplay tag to use as a message channel (e.g. Message.Score.Changed)
Video coming soon

Chapters

Why a message bus

UCrimsonMessageSubsystem is a tag-routed message bus: a sender broadcasts a payload struct on a channel tag, and anything can listen on that tag — no delegate wiring, no hard references between the two. It's how Crimson plugins notify each other without depending on each other.

Broadcast and listen

Broadcast with the Broadcast Message node from the subsystem, passing your channel tag and payload struct. Listen with the async Listen for Crimson Messages node — it stays active and fires its output pin every time a matching message arrives:

Broadcast Message on a channel tag; the Listen for Crimson Messages async node receives it.

In C++, get the subsystem and broadcast a struct on a channel tag; register listeners with a member function — that overload is weak-object-safe, so a destroyed listener just stops receiving:

cpp
// Broadcast
FMyScoreMessage Msg;
Msg.Points = 50;
UCrimsonMessageSubsystem::Get(this)->BroadcastMessage(TAG_Message_Score_Changed, Msg);
// Listen (member-function overload is weak-object-safe)
UCrimsonMessageSubsystem::Get(this)->RegisterListener(
TAG_Message_Score_Changed, this, &UMyScoreWidget::OnScoreMessage);

Match modes

Listeners choose ECrimsonMessageMatch: ExactMatch receives only the exact channel tag, while PartialMatch also receives child tags — listen on Message.Score partially and Message.Score.Changed reaches you too.

Local only — never networked
Messages are local to one game instance and never cross the network. To notify clients about a server event, replicate the state (or use an RPC) and broadcast the message locally on each machine.