ServerSelectBroadcasts - jimdroberts/FishMMO GitHub Wiki

Description

Defines a set of broadcast structs for server selection and connection in FishMMO. These broadcasts are used for requesting the server list, sending available servers to the client, and connecting to a world scene server, each implementing the IBroadcast interface for network messaging.


API Access

Fields

  • public List Servers

    List of available world servers (ServerListBroadcast only).

  • public string Address

    IP address or hostname of the world scene server (WorldSceneConnectBroadcast only).

  • public ushort Port

    Port number for the world scene server (WorldSceneConnectBroadcast only).


Basic Usage

Setup

  1. Ensure all broadcast structs implement the IBroadcast interface from FishNet.
  2. Use RequestServerListBroadcast to request the list of available servers from the server.
  3. Use ServerListBroadcast to send the list of available servers to the client.
  4. Use WorldSceneConnectBroadcast to connect to a specific world scene server by address and port.

Example

// Example 1: Requesting the server list
RequestServerListBroadcast request = new RequestServerListBroadcast();
// Send request broadcast over the network

// Example 2: Sending the server list to the client
ServerListBroadcast serverList = new ServerListBroadcast {
    Servers = new List<WorldServerDetails> { /* ... */ }
};
// Send serverList broadcast over the network

// Example 3: Connecting to a world scene server
WorldSceneConnectBroadcast connect = new WorldSceneConnectBroadcast {
    Address = "world1.fishmmo.com",
    Port = 7777
};
// Send connect broadcast over the network

Best Practices

  • Always populate all required fields before sending a broadcast.
  • Use the correct broadcast struct for the intended server selection or connection operation.
  • Keep broadcast structs minimal and only include necessary data for network efficiency.
⚠️ **GitHub.com Fallback** ⚠️