AbilityReconcileData - jimdroberts/FishMMO GitHub Wiki

Description

Reconcile data for ability state, used for network prediction reconciliation. Encapsulates ability ID, remaining time, resource state, and network tick for synchronizing ability state corrections across the network in FishMMO.


API Access

Fields

  • public long AbilityID

    The ID of the ability.

  • public float RemainingTime

    The remaining cooldown or active time for the ability.

  • public CharacterAttributeResourceState ResourceState

    The resource state associated with the ability.

  • private uint _tick

    Internal network tick value for prediction reconciliation.

Methods

  • public AbilityReconcileData(long abilityID, float remainingTime, CharacterAttributeResourceState resourceState)

    Initializes a new instance of the AbilityReconcileData struct. abilityID: long - Ability ID. remainingTime: float - Remaining time. resourceState: CharacterAttributeResourceState - Resource state.

  • public void Dispose()

    Disposes the reconcile data (no-op).

  • public uint GetTick()

    Gets the network tick value. Returns: uint - The tick value.

  • public void SetTick(uint value)

    Sets the network tick value. value: uint - Tick value.


Basic Usage

Setup

  1. Use AbilityReconcileData as the data structure for network-predicted ability state reconciliation.
  2. Populate the struct with ability ID, remaining time, and resource state when sending reconciliation data.
  3. Use GetTick and SetTick to synchronize network prediction ticks as required by FishNet's prediction system.

Example

// Example 1: Creating and using AbilityReconcileData
var reconcileData = new AbilityReconcileData(abilityID, remainingTime, resourceState);
reconcileData.SetTick(currentTick);

// Example 2: Accessing reconcile data fields
long id = reconcileData.AbilityID;
float time = reconcileData.RemainingTime;
CharacterAttributeResourceState state = reconcileData.ResourceState;

Best Practices

  • Always set the network tick value when using reconcile data for prediction to ensure synchronization.
  • Use clear and consistent values for AbilityID and RemainingTime to avoid ambiguity in state reconciliation.
  • Dispose is a no-op but should be called if required by interface contracts.
  • Integrate with FishNet's prediction and reconciliation systems for robust networked ability handling.
⚠️ **GitHub.com Fallback** ⚠️