AchievementBroadcasts - jimdroberts/FishMMO GitHub Wiki

Description

Defines broadcast structures for character achievement updates, including single and multiple achievement updates. Used for networked communication of achievement progress between client and server.


API Access

Fields

  • public struct AchievementUpdateBroadcast : IBroadcast

    Broadcast for updating a single achievement for a character. Contains the achievement template ID, value, and tier.

    • int TemplateID: Template ID of the achievement to update.
    • uint Value: Current value or progress for the achievement.
    • byte Tier: Current tier or level of the achievement.
  • public struct AchievementUpdateMultipleBroadcast : IBroadcast

    Broadcast for updating multiple achievements for a character at once. Used for bulk updates or synchronization.

    • List Achievements: List of achievements to update.

Basic Usage

Setup

  1. Use these broadcast structs to send and receive achievement updates between client and server.
  2. Populate the fields as required for each achievement update operation (single, bulk, etc.).

Example

// Example 1: Updating a single achievement
AchievementUpdateBroadcast update = new AchievementUpdateBroadcast {
    TemplateID = 3001,
    Value = 10,
    Tier = 2
};
networkManager.ClientManager.Broadcast(update);

// Example 2: Updating multiple achievements
AchievementUpdateMultipleBroadcast bulkUpdate = new AchievementUpdateMultipleBroadcast {
    Achievements = new List<AchievementUpdateBroadcast> {
        new AchievementUpdateBroadcast { TemplateID = 3001, Value = 10, Tier = 2 },
        new AchievementUpdateBroadcast { TemplateID = 3002, Value = 5, Tier = 1 }
    }
};
networkManager.ClientManager.Broadcast(bulkUpdate);

Best Practices

  • Always validate achievement IDs and values before sending or processing broadcasts.
  • Use bulk updates for efficient synchronization of multiple achievements.
  • Keep achievement logic modular and well-documented for maintainability.
  • Use the provided broadcast structs for clear, type-safe network communication.
⚠️ **GitHub.com Fallback** ⚠️