Typed event busKBVEEvents
A lightweight typed publish/subscribe event bus for KBVE Unreal Engine games — compile-time-typed channels, pooled payloads, and a lock-free SPSC handoff for moving Mass worker-thread events onto the game thread. 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 — a lock-free MPSC queue drains onto the game thread safely.
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
An MPSC queue lets a worker enqueue POD payloads that a 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);Questions
Frequently asked
What is KBVEEvents?
It is a lightweight typed publish/subscribe event bus for Unreal Engine games, using compile-time-typed channels (FKBVEChannel), pooled payloads, and a lock-free SPSC queue 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.
