Class CharacterCastBroadcastSerializer
Wire format for CharacterCastBroadcast.
public static class CharacterCastBroadcastSerializer
- Inheritance
-
CharacterCastBroadcastSerializer
- Inherited Members
Remarks
Hand written because a stop carries two fields the receiver never looks at.
ClientCastNameplateDisplay.OnCastBroadcast branches on
Started first and returns having read only the caster id
and the reference id — so ServerTick and
IsConsumable are dead weight on every cast end, and the
generated serializer wrote all five fields unconditionally. That is four to five bytes per
cast per observer on the reliable channel, paid by NPC auto-attacks at one per second each.
Started therefore goes FIRST, as a header bit: it is the
field that says which shape follows, in the style of
AbilityObserverBroadcastSerializers and
AbilityObjectObserverBroadcastSerializers. The consumable bit shares that byte rather
than costing one of its own.
ReferenceID travels packed and in ONE form on both shapes. It is an ability instance id — a database sequence value, and small — except on a consumable, where it is a full-range template hash; splitting the two would need the consumable bit on a stop, which is the byte this format exists to save, and the receiver compares a stop's reference against the start's, so the two must encode identically.
Methods
ReadCharacterCastBroadcast(Reader)
Reads a CharacterCastBroadcast written by the method above.
public static CharacterCastBroadcast ReadCharacterCastBroadcast(this Reader reader)
Parameters
readerReader
Returns
Remarks
A stop comes back with ServerTick 0 and IsConsumable false, which is exactly
what its handler expects: it reads neither.
WriteCharacterCastBroadcast(Writer, CharacterCastBroadcast)
Writes a CharacterCastBroadcast in its shape-dependent form.
public static void WriteCharacterCastBroadcast(this Writer writer, CharacterCastBroadcast value)
Parameters
writerWritervalueCharacterCastBroadcast