SceneBroadcasts - jimdroberts/FishMMO GitHub Wiki

Description

Defines a set of broadcast structs for scene management and transitions in FishMMO. These broadcasts are used for client-server communication regarding scene validation, loading, unloading, teleports, and channel selection, each implementing the IBroadcast interface for network messaging.


API Access

Fields

  • public List UnloadedScenes

    List of scenes that have been unloaded by the client (ClientScenesUnloadedBroadcast only).

  • public string SceneName

    Name of the scene to load or unload (SceneLoadBroadcast and SceneUnloadBroadcast).

  • public string FromTeleporter

    Name of the teleporter the character is coming from (CharacterSceneChangeRequestBroadcast only).

  • public string TeleporterName

    Name of the teleporter the character is going to (CharacterSceneChangeRequestBroadcast only).

  • public List Addresses

    List of available channel addresses for scene selection (SceneChannelListBroadcast only).

  • public ChannelAddress Channel

    Selected channel address for the scene (SceneChannelSelectBroadcast only).


Basic Usage

Setup

  1. Ensure all broadcast structs implement the IBroadcast interface from FishNet.
  2. Use the appropriate broadcast struct for the specific scene management operation (e.g., loading, unloading, teleporting).
  3. Populate all required fields before sending the broadcast over the network.

Example

// Example 1: Requesting to load a scene
SceneLoadBroadcast load = new SceneLoadBroadcast {
    SceneName = "Dungeon01"
};
// Send load broadcast over the network

// Example 2: Sending a list of available scene channels
SceneChannelListBroadcast channelList = new SceneChannelListBroadcast {
    Addresses = new List<ChannelAddress> { /* ... */ }
};
// Send channelList broadcast over the network

Best Practices

  • Always populate all required fields before sending a broadcast.
  • Use the correct broadcast struct for the intended scene operation to ensure proper handling on the receiving end.
  • Keep broadcast structs minimal and only include necessary data for network efficiency.
⚠️ **GitHub.com Fallback** ⚠️