Table of Contents

Class AbilityAddBroadcastSerializer

Namespace
FishMMO.Shared
Assembly
FishMMO.Shared.dll

Wire format for AbilityAddBroadcast.

public static class AbilityAddBroadcastSerializer
Inheritance
AbilityAddBroadcastSerializer
Inherited Members

Remarks

Hand written because every id in it but one is a template id. TemplateID and EVERY element of Events is a deterministic 32-bit hash (CachedScriptableObject.AddToCache), full-range by construction, and FishNet's signed-packed form spends FIVE bytes on each where unpacked spends exactly four — a crafted ability carries several events, and the login sync ships the whole ability set in one AbilityAddMultipleBroadcast. ID stays packed: it is a database sequence value and small, and unpacking a long would COST six or seven bytes. The event array's length prefix stays packed too — a count of a handful is one byte.

Fields

MAX_EVENTS

Hard cap on the crafted event ids carried by one AbilityAddBroadcast.

public const int MAX_EVENTS = 64

Field Value

int

Remarks

The same bound, for the same reason, as MAX_LEARNED_EVENTS on the observer form of this message: an ability's event count is its template's baked events plus its AdditionalEventSlots, which is a handful. The cap exists so a malformed or hostile message cannot make the reader allocate an arbitrarily large array before the stream runs out — the count is read straight off the wire and is otherwise unbounded.

MaxAbilities

Upper bound accepted for a crafted-ability array length, against a corrupt stream.

public const int MaxAbilities = 8192

Field Value

int

Remarks

The weakest anchor of the seven bounds added here, and worth being honest about. The other arrays are one entry per authored template and so are bounded, however loosely, by the content in the project. These are crafted ability INSTANCES — each a database row with its own ID — and a player assembles them from combinations of templates, so the count is bounded by nothing in the codebase: no cap on crafting, no cap in the controller, and Constants.Configuration.MaximumPlayerHotkeys (12) bounds only what can be BOUND to a key, not what can be owned.

So this is a clearly-labelled generous ceiling, not a derived limit, and it is set high deliberately: the failure mode of a bound that is too low is that a dedicated player's login sync silently drops the abilities past it, and abilities are the one thing on this list that cost real time to acquire. Eight thousand instances is a long way past any plausible collection and still a trivial allocation, which is the trade this bound is making — it exists only to keep a corrupt length from turning into a multi-gigabyte new AbilityAddBroadcast[...].

If crafted abilities ever gain a real per-character cap, this should be re-anchored to it rather than left as a guess.

Server → client, so the realistic trigger is a mangled or truncated stream rather than a hostile client.

Methods

ReadAbilityAddBroadcast(Reader)

Reads an AbilityAddBroadcast. An empty event array reads back as an empty array, never null.

public static AbilityAddBroadcast ReadAbilityAddBroadcast(this Reader reader)

Parameters

reader Reader

Returns

AbilityAddBroadcast

ReadAbilityAddBroadcastArray(Reader)

Reads an array of AbilityAddBroadcast.

public static AbilityAddBroadcast[] ReadAbilityAddBroadcastArray(this Reader reader)

Parameters

reader Reader

Returns

AbilityAddBroadcast[]

Remarks

A length past MaxAbilities cannot be allocated and cannot be resynchronised past either — and less so here than anywhere else in this file, because each element is variable length (its own event count), so the bytes to skip are not even computable from the rejected count. The array comes back empty. Only the sender's own -1, which is not a length at all, means null.

WriteAbilityAddBroadcast(Writer, AbilityAddBroadcast)

Writes an AbilityAddBroadcast. A null event array travels as length 0.

public static void WriteAbilityAddBroadcast(this Writer writer, AbilityAddBroadcast value)

Parameters

writer Writer
value AbilityAddBroadcast

WriteAbilityAddBroadcastArray(Writer, AbilityAddBroadcast[])

Writes an array of AbilityAddBroadcast.

public static void WriteAbilityAddBroadcastArray(this Writer writer, AbilityAddBroadcast[] value)

Parameters

writer Writer
value AbilityAddBroadcast[]

Remarks

Explicit because the element carries [UseGlobalCustomSerializer]. That attribute tells FishNet the element has a hand-written serializer, and codegen then declines to synthesise one for the ARRAY as well — it emits nothing and says nothing at build time. The gap only appears when a broadcast carrying the array is actually sent, as "Write method not found for AbilityAddBroadcast[]", by which point the send has already failed. A null array is written as length -1 so it round-trips as null rather than as empty.