Steamforge Communication System Specification - wwestlake/Steamforge GitHub Wiki

Steamforge Communication System Specification

Overview

The Communication System enables structured message passing between actors in the world via components that interact with a central CommunicationCenter. It supports both private (1:1) and group (1:*) channels with full control by channel creators.

This system is implemented in C++ and is exposed to Blueprints to support both code- and designer-driven workflows.

Goals

  • Enable robust in-game communication among actors.
  • Support channel-based and private messaging.
  • Leverage Unreal Engine's GameInstanceSubsystem for global persistence.
  • Provide Blueprint-accessible messaging interfaces.
  • Exclude lore or guild logic from the C++ layer.

Key Components

UCommunicationCenter (GameInstanceSubsystem)

Role: Central registry and router for all communication components and channels.

Responsibilities:

  • Register/unregister UCommComponent instances.
  • Route private and channel messages.
  • Manage channel creation, membership, and ownership.

BlueprintCallable Functions:

UFUNCTION(BlueprintCallable)
void RegisterComponent(UCommComponent* Component);

UFUNCTION(BlueprintCallable)
void UnregisterComponent(UCommComponent* Component);

UFUNCTION(BlueprintCallable)
FCommChannelID CreateChannel(FCommChannelDefinition ChannelDef);

UFUNCTION(BlueprintCallable)
bool SendMessage(const FCommMessage& Message);

UFUNCTION(BlueprintCallable)
bool BroadcastMessage(const FCommChannelID& ChannelID, const FCommMessage& Message);

Internal State:

TMap<FName, UCommComponent*> RegisteredComponents;
TMap<FCommChannelID, FCommChannel> ChannelRegistry;

UCommComponent (ActorComponent)

Role: Attached to any actor to enable communication functionality.

Responsibilities:

  • Automatically register/unregister with UCommunicationCenter.
  • Send private or broadcast messages.
  • Join/leave channels.
  • Handle incoming messages via Blueprint events.

BlueprintCallable Functions:

UFUNCTION(BlueprintCallable)
void SendPrivateMessage(FName TargetID, const FCommMessage& Message);

UFUNCTION(BlueprintCallable)
void SendChannelMessage(FCommChannelID ChannelID, const FCommMessage& Message);

UFUNCTION(BlueprintCallable)
void JoinChannel(FCommChannelID ChannelID);

UFUNCTION(BlueprintCallable)
void LeaveChannel(FCommChannelID ChannelID);

BlueprintImplementableEvent:

UFUNCTION(BlueprintImplementableEvent)
void OnMessageReceived(const FCommMessage& Message);

Internal State:

FCommMetadata Metadata;
TSet<FCommChannelID> SubscribedChannels;

Data Structures

FCommMessage

USTRUCT(BlueprintType)
struct FCommMessage
{
    GENERATED_BODY();

    UPROPERTY(BlueprintReadWrite)
    FName SenderID;

    UPROPERTY(BlueprintReadWrite)
    FName TargetID; // Optional if using channels

    UPROPERTY(BlueprintReadWrite)
    FCommChannelID ChannelID; // Optional if private

    UPROPERTY(BlueprintReadWrite)
    FString Payload;

    UPROPERTY(BlueprintReadWrite)
    ECommMessageType MessageType; // Enum

    UPROPERTY(BlueprintReadWrite)
    FDateTime Timestamp;
};

FCommChannelDefinition

USTRUCT(BlueprintType)
struct FCommChannelDefinition
{
    GENERATED_BODY();

    UPROPERTY(BlueprintReadWrite)
    FName OwnerID;

    UPROPERTY(BlueprintReadWrite)
    FString ChannelName;

    UPROPERTY(BlueprintReadWrite)
    bool bIsPrivate;
};

FCommChannel

USTRUCT(BlueprintType)
struct FCommChannel
{
    GENERATED_BODY();

    UPROPERTY(BlueprintReadWrite)
    FCommChannelDefinition Definition;

    UPROPERTY(BlueprintReadWrite)
    TSet<FName> MemberIDs;
};

Channel Ownership Rules

  • Only the owner of a channel (as defined in FCommChannelDefinition) can:
    • Add/remove members
    • Delete the channel
    • Broadcast on private/protected channels

Message Routing Logic

  • Private Message: Uses TargetID for 1:1 routing.
  • Channel Message: Uses ChannelID to broadcast to all members.
  • CommunicationCenter validates permissions, existence, and routing targets.

Multiplayer Considerations

  • Implement server-authoritative messaging for multiplayer.
  • Secure routing through APlayerController/APlayerState identity.
  • Future replication support for channel membership and message history.

Exclusions

  • No lore-related content.
  • No guilds or guild-specific logic.
  • No persistent dialogue trees in C++.

Next Steps

  • Implement message serialization.
  • Add latency or throttling support (optional).
  • Expand message types to include commands, data, or function calls.
  • Integrate gameplay systems (e.g., NPCs, AI events) with communication hooks.
⚠️ **GitHub.com Fallback** ⚠️