๐ก Signal Bridge
Short Description
The Signal Bridge is a high-performance, tag-driven messaging system that routes data payloads between C++ and Blueprints, with integrated networking support.
Long Description
The Signal Bridge allows different parts of your game to communicate without having direct references to each other. By using FGameplayTag as addresses and FInstancedStruct as payloads, you can dispatch signals from a server that automatically propagate to relevant clients based on configurable access rules. It is the primary way Gorgeous Core handles UI updates, gameplay events, and cross-module synchronization.
๐ Features
- Decoupled Messaging: Components communicate via tags, not direct pointers.
- Networking Integrated: Automatically routes signals from Server to Client (and vice-versa) using
AccessRules. - Payload Flexible: Send any data structure using Unreal's
FInstancedStruct. - Scoped Listening: Listen globally or filter signals for a specific
AActor. - Access Control: Restrict signals to specific player controllers or use "OwningControllerOnly" policies.
๐ Usage Examples
FMyPayload Payload;
Payload.Message = TEXT("Hello World");
USignalBridgeBlueprintFunctionLibrary::Dispatch(GetWorld(), MyTag, FInstancedStruct::Make(Payload));
Use the Dispatch Signal node with a gameplay tag. The payload pin will automatically adapt to the structure you provide.
GetSignalBridgeStorage
Resolves the underlying storage object for the Signal Bridge. Useful for advanced manipulation of the signal registry.
| Parameter Name | Type | Description |
|---|---|---|
WorldContextObject |
UObject* |
Context for world resolution. |
bRequireNetworking |
bool |
If true, ensures the storage has an active networking mixin. |
RegisterSignal
Configures the networking and access rules for a specific gameplay tag. This must be called (typically on the server) before a signal can be routed across the network.
| Parameter Name | Type | Description |
|---|---|---|
Tag |
FGameplayTag |
The tag to configure. |
Rules |
FGorgeousSignalBridgeAccessRules_S |
Networking rules (e.g., ServerToClient, Multicast). |
Requester |
AGorgeousPlayerController* |
Optional controller for owner-restricted signals. |
Listen
Subscribes a delegate to receive signals for a specific tag.
| Parameter Name | Type | Description |
|---|---|---|
Tag |
FGameplayTag |
The tag to listen for. |
Controller |
AGorgeousPlayerController* |
The controller context for the listener. |
Delegate |
FSignalBridgeEventDelegate |
The event to fire when the signal is received. |
Dispatch
Sends a signal and its payload to all registered listeners. If networking rules allow, the signal will be sent across the network.
| Parameter Name | Type | Description |
|---|---|---|
Tag |
FGameplayTag |
The address for the signal. |
Payload |
FInstancedStruct |
The data to send. |
Clear
Removes all listeners for a specific tag on a controller.
| Parameter Name | Type | Description |
|---|---|---|
Tag |
FGameplayTag |
The tag to clear. |
Controller |
AGorgeousPlayerController* |
The target controller context. |
๐ Signal Flow
sequenceDiagram
participant S as Server Logic
participant SB as Signal Bridge (Server)
participant N as Network
participant CB as Signal Bridge (Client)
participant C as Client Logic
S->>SB: Dispatch(Tag, Payload)
SB->>SB: Check Access Rules
SB-->>CB: Send RPC (ServerToClient)
CB->>C: Execute Delegate
Best Practices
- Tag Hierarchy: Use hierarchical tags (e.g.,
Signal.UI.Inventory.Update) to allow for future broad-spectrum listeners. - Rule Consistency: Ensure
RegisterSignalis called with identical rules on both client and server if bidirectional communication is needed. - Payload Size: Keep signal payloads small. For large data transfers, prefer using AutoReplication on Object Variables.
Troubleshooting
- Signals Not Received: Verify that the tag used in
Dispatchexactly matches the one inListen. - Networking Blocked: Check the
AccessRuleson the server to ensure the signal is permitted to reach the target client. - Memory Leaks: Ensure you call
Clearwhen a listener object (like a widget) is destroyed.