Table of Contents

Class TickWriter

Namespace
Typhon.Protocol
Assembly
Typhon.Protocol.dll

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

w WireWriter

The writer.

blockType byte

The 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

w WireWriter

The writer.

mark int

The 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

w WireWriter

The writer.

acks IReadOnlyList<(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

w WireWriter

The writer.

grid CatalogGrid

The grid.

reset bool

Whether unlisted cells are now empty.

cells IReadOnlyList<(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

w WireWriter

The writer.

subBlocks IReadOnlyList<(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

w WireWriter

The writer.

frameTick uint

The frame's tick: every segment's start tick must be at or before it, and less than 2¹⁶ ticks older.

archetype ArchetypePlan

The archetype.

enters IReadOnlyList<EnterRecord>

Enter records.

segments IReadOnlyList<SegmentRecord>

Motion segments.

states IReadOnlyList<StateRecord>

State records.

leaves IReadOnlyList<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

w WireWriter

The writer.

events IReadOnlyList<(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

w WireWriter

The writer.

appTypeId uint

The application's payload type.

payload ReadOnlySpan<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

w WireWriter

The writer.

tick uint

The frame's tick.

flags TickFlags

The flags; Period is set when periodUs is non-zero.

periodUs uint

The 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

w WireWriter

The writer.

archetype ArchetypePlan

The controlled entity's archetype.

netId uint

The controlled entity.

lastSeq ushort

The highest drained command sequence.

ownerMask byte

The owner groups carried.

values RecordValues

Their 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

w WireWriter

The writer.

entries IReadOnlyList<(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

w WireWriter

The writer.

plan CatalogPlan

The compiled catalog.

values IReadOnlyDictionary<string, double[]>

Each metric's values by name, ValueCount of them.