Class TickWriter
Encodes a TICK message block by block. The object model here is the reference encoder the golden vectors are generated with; the engine's own
encoder writes the same bytes straight from cluster data.
public static class TickWriter
- Inheritance
-
TickWriter
- Inherited Members
Methods
BeginBlock(ref WireWriter, byte)
Starts a block; the payload is written next, then EndBlock(ref WireWriter, int).
public static int BeginBlock(ref WireWriter w, byte blockType)
Parameters
wWireWriterThe writer.
blockTypebyteThe block type.
Returns
- int
The mark for EndBlock(ref WireWriter, int).
EndBlock(ref WireWriter, int)
Ends a block, patching its length.
public static void EndBlock(ref WireWriter w, int mark)
Parameters
wWireWriterThe writer.
markintThe value BeginBlock(ref WireWriter, byte) returned.
WriteAcks(ref WireWriter, IReadOnlyList<(ushort Seq, byte Reason)>)
Writes an ACKS block.
public static void WriteAcks(ref WireWriter w, IReadOnlyList<(ushort Seq, byte Reason)> acks)
Parameters
wWireWriterThe writer.
acksIReadOnlyList<(ushort Seq, byte Reason)>Each rejection's sequence and reason.
WriteAggregate(ref WireWriter, CatalogGrid, bool, IReadOnlyList<(uint Cell, uint[] Counts)>)
Writes an AGG block. Cells must be in ascending order.
public static void WriteAggregate(ref WireWriter w, CatalogGrid grid, bool reset, IReadOnlyList<(uint Cell, uint[] Counts)> cells)
Parameters
wWireWriterThe writer.
gridCatalogGridThe grid.
resetboolWhether unlisted cells are now empty.
cellsIReadOnlyList<(uint Cell, uint[] Counts)>Each changed cell's index and its counts, one per grid archetype.
WriteDebug(ref WireWriter, IReadOnlyList<(byte SubType, byte[] Payload)>)
Writes a DEBUG block.
public static void WriteDebug(ref WireWriter w, IReadOnlyList<(byte SubType, byte[] Payload)> subBlocks)
Parameters
wWireWriterThe writer.
subBlocksIReadOnlyList<(byte SubType, byte[] Payload)>Each sub-block's type and payload.
WriteEntities(ref WireWriter, uint, ArchetypePlan, IReadOnlyList<EnterRecord>, IReadOnlyList<SegmentRecord>, IReadOnlyList<StateRecord>, IReadOnlyList<uint>)
Writes a whole ENTITIES block. Each list must be sorted by ascending, distinct netId.
public static void WriteEntities(ref WireWriter w, uint frameTick, ArchetypePlan archetype, IReadOnlyList<EnterRecord> enters, IReadOnlyList<SegmentRecord> segments, IReadOnlyList<StateRecord> states, IReadOnlyList<uint> leaves)
Parameters
wWireWriterThe writer.
frameTickuintThe frame's tick: every segment's start tick must be at or before it, and less than 2¹⁶ ticks older.
archetypeArchetypePlanThe archetype.
entersIReadOnlyList<EnterRecord>Enter records.
segmentsIReadOnlyList<SegmentRecord>Motion segments.
statesIReadOnlyList<StateRecord>State records.
leavesIReadOnlyList<uint>Leaving netIds.
WriteEvents(ref WireWriter, IReadOnlyList<(MessagePlan Type, RecordValues Values)>)
Writes a whole EVENTS block.
public static void WriteEvents(ref WireWriter w, IReadOnlyList<(MessagePlan Type, RecordValues Values)> events)
Parameters
wWireWriterThe writer.
eventsIReadOnlyList<(MessagePlan Type, RecordValues Values)>Each event's type and field values, in emission order.
WriteExt(ref WireWriter, uint, ReadOnlySpan<byte>)
Writes an EXT block.
public static void WriteExt(ref WireWriter w, uint appTypeId, ReadOnlySpan<byte> payload)
Parameters
wWireWriterThe writer.
appTypeIduintThe application's payload type.
payloadReadOnlySpan<byte>The payload.
WriteHeader(ref WireWriter, uint, TickFlags, uint)
Writes the type byte and the frame header.
public static void WriteHeader(ref WireWriter w, uint tick, TickFlags flags, uint periodUs = 0)
Parameters
wWireWriterThe writer.
tickuintThe frame's tick.
flagsTickFlagsThe flags; Period is set when
periodUsis non-zero.periodUsuintThe elapsed interval's period, or 0.
WriteSelf(ref WireWriter, ArchetypePlan, uint, ushort, byte, RecordValues)
Writes a SELF block.
public static void WriteSelf(ref WireWriter w, ArchetypePlan archetype, uint netId, ushort lastSeq, byte ownerMask, RecordValues values)
Parameters
wWireWriterThe writer.
archetypeArchetypePlanThe controlled entity's archetype.
netIduintThe controlled entity.
lastSequshortThe highest drained command sequence.
ownerMaskbyteThe owner groups carried.
valuesRecordValuesTheir fields' values.
WriteSources(ref WireWriter, IReadOnlyList<(ushort RequestId, byte Status, ushort Code)>)
Writes a SOURCES block.
public static void WriteSources(ref WireWriter w, IReadOnlyList<(ushort RequestId, byte Status, ushort Code)> entries)
Parameters
wWireWriterThe writer.
entriesIReadOnlyList<(ushort RequestId, byte Status, ushort Code)>Each entry's request id, status and error code.
WriteStats(ref WireWriter, CatalogPlan, IReadOnlyDictionary<string, double[]>)
Writes a STATS block: every server metric's values, then every session metric's, in index order.
public static void WriteStats(ref WireWriter w, CatalogPlan plan, IReadOnlyDictionary<string, double[]> values)
Parameters
wWireWriterThe writer.
planCatalogPlanThe compiled catalog.
valuesIReadOnlyDictionary<string, double[]>Each metric's values by name, ValueCount of them.