Skip to content
unreal · events

Typed event busKBVEEvents

A lightweight typed publish/subscribe event bus for KBVE Unreal Engine games — compile-time-typed channels and an MPSC queue for moving Mass worker-thread events onto the game thread, in one header. A companion to UE's GameplayMessageRouter: use GMR for Blueprint-friendly tag-based messaging, and KBVEEvents when performance or compile-time typing matters.

Typed & lock-free

Compile-time-typed channels (TKBVEChannel<TPayload>) dispatch strongly typed payloads with no tag lookups or boxing, while an MPSC queue hands worker-thread events to the game thread.

  • Companion to — UE's GameplayMessageRouter for tag-based Blueprint messaging.
  • Cross-thread — an MPSC queue drains onto the game thread safely.
0.1.0Version
UE 5.4+Engine
Win64 · Linux · MacPlatforms
KBVELicense

What it gives you

Features

Compile-time-typed channels

Strongly typed payloads dispatched through TKBVEChannel with no tag lookups or boxing.

Handle-based subscriptions

Subscribe returns an FKBVEEventHandle; cancel via Unsubscribe or let the owning UObject GC, since channels prune stale weak refs before each dispatch.

Synchronous game-thread dispatch

Publish invokes callbacks on the calling thread under an FCriticalSection so the channel itself never tears.

Lock-free cross-thread path

TKBVEMpscQueue lets any thread enqueue POD payloads that a single game-thread bridge drains and publishes safely.

Integration

Usage

TKBVEChannel<FMyPayload> Channel;
FKBVEEventHandle Handle = Channel.Subscribe(Owner,
[](const FMyPayload& Payload) { /* game-thread callback */ });
Channel.Publish(FMyPayload{ /* ... */ });
Channel.Unsubscribe(Handle);
// From a worker: enqueue, then drain on the game thread.
TKBVEMpscQueue<FMyPayload> Queue;
Queue.Enqueue(FMyPayload{ /* ... */ });
Queue.Drain([&](const FMyPayload& P) { Channel.Publish(P); });

Questions

Frequently asked

What is KBVEEvents?

It is a lightweight typed publish/subscribe event bus for Unreal Engine games, using compile-time-typed channels (TKBVEChannel) and an MPSC queue (TKBVEMpscQueue) for worker-to-game-thread events.

When should I use KBVEEvents instead of GameplayMessageRouter?

Use UE's GameplayMessageRouter for Blueprint-friendly tag-based messaging; reach for KBVEEvents when performance or compile-time typing matters.

Is it safe to publish from a worker thread?

Publish invokes callbacks synchronously on the calling thread, so it is game-thread by default. For cross-thread events, a worker enqueues a POD payload on the MPSC queue and a game-thread bridge drains it and publishes safely.

Discuss on the forum

Questions, fixes and notes on this page live in the KBVE forum.