NamingBroadcasts - jimdroberts/FishMMO GitHub Wiki

Description

Defines broadcast structs for updating, assigning, and looking up names in the FishMMO naming system. These broadcasts are used for networked communication regarding entity names, such as characters or guilds, and support both assignment and reverse lookup operations.


API Access

Fields

  • public NamingSystemType Type

    Type of the naming system (e.g., character, guild).

  • public long ID

    ID of the entity being named or found by name.

  • public string Name

    Name to assign to the entity (NamingBroadcast) or original name of the entity (ReverseNamingBroadcast).

  • public string NameLowerCase

    Lowercase version of the name for case-insensitive lookup (ReverseNamingBroadcast only).


Basic Usage

Setup

  1. Ensure all broadcast structs implement the IBroadcast interface from FishNet.
  2. Use NamingBroadcast to assign or update names for entities.
  3. Use ReverseNamingBroadcast to look up entities by name in a case-insensitive manner.
  4. Populate all required fields before sending the broadcast over the network.

Example

// Example 1: Assigning a name to a character
NamingBroadcast assign = new NamingBroadcast {
    Type = NamingSystemType.Character,
    ID = 12345L,
    Name = "HeroName"
};
// Send assign broadcast over the network

// Example 2: Looking up an entity by name
ReverseNamingBroadcast lookup = new ReverseNamingBroadcast {
    Type = NamingSystemType.Guild,
    NameLowerCase = "guildname".ToLower(),
    ID = 67890L,
    Name = "GuildName"
};
// Send lookup broadcast over the network

Best Practices

  • Always use the lowercase version of names for lookups to ensure case-insensitive matching.
  • Populate all required fields before sending a broadcast to avoid incomplete data issues.
  • Use the correct broadcast struct for the intended naming operation (assignment or lookup).
⚠️ **GitHub.com Fallback** ⚠️