ServerSelectBroadcasts - jimdroberts/FishMMO GitHub Wiki
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.
-
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).
- Ensure all broadcast structs implement the
IBroadcast
interface from FishNet. - Use
RequestServerListBroadcast
to request the list of available servers from the server. - Use
ServerListBroadcast
to send the list of available servers to the client. - Use
WorldSceneConnectBroadcast
to connect to a specific world scene server by address and port.
// 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
- 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.