Table of Contents

Struct CharacterDialogueChoiceData

Namespace
FishMMO.Database.Data
Assembly
FishMMO-DB.dll

One character's persisted "already chosen" bitmask for a single dialogue template.

public struct CharacterDialogueChoiceData
Inherited Members

Remarks

Why a bitmask and not a row per choice. A dialogue template can track at most DialogueTemplate.MaxTrackedChoices (16) choices, and both the server session and the wire format (DialogueStartBroadcast.CachedChoices) already carry that state as a single short. A row-per-choice table would store the same 16 bits as up to 16 rows of roughly 40 bytes each — a ~300x expansion of a value that is read and written whole, never queried by individual bit — and every read would have to fold the rows back into the mask the caller actually wants. The mask is stored as it is used.

Volume. One row per character per caching template, so the table is bounded by (characters x templates with CacheDialogueChoices enabled) — not by the number of conversations held, which is what an event-log shape would have grown with. Rows are only ever created for templates that opt in.

When dialogue assets change. The bit index comes from DialogueTemplate.GetChoiceBitIndex, which counts choices positionally in authoring order. Appending a node or a choice at the end is safe: existing bits keep their meaning. Inserting or deleting a choice in the middle, or reordering nodes, shifts every later bit, so a stored mask would then describe different choices than the ones the player made — the failure mode is a one-time reward appearing already-taken, or an exhausted one becoming available again. That is an authoring-time hazard, not something the store can detect, so the service exposes ResetTemplateAsync for content to be re-cut deliberately.

When a template is removed. Its rows are left in place. A template ID that does not resolve on this process is not evidence the asset was deleted — scene servers load different content sets, and a load failure looks identical — so deleting on a lookup miss would quietly destroy live players' one-time-choice history during a partial content rollout. An orphaned row costs two bytes and is invisible; that is the cheaper mistake.

Constructors

CharacterDialogueChoiceData(long, int, short)

Initializes a dialogue choice mask.

public CharacterDialogueChoiceData(long characterID, int templateID, short choices)

Parameters

characterID long

Character that made the choices.

templateID int

Dialogue template ID.

choices short

Bitmask of choices already taken.

Fields

CharacterID

Character that made the choices.

public readonly long CharacterID

Field Value

long

Choices

Bitmask of choices already taken in this template. Bit N corresponds to the Nth choice in authoring order, as computed by DialogueTemplate.GetChoiceBitIndex.

public readonly short Choices

Field Value

short

TemplateID

Dialogue template ID (a CachedScriptableObject ID).

public readonly int TemplateID

Field Value

int