Nebula
Core

SyncAudienceCodec

The client member sets of an entity's SyncAudience.Custom behaviors, as the authority last evaluated them: [count:byte]{[behaviourIndex:byte][n:ushort]{[clientId:ulong]}}, each set sorted ascending.

generated from the sources
Static class in namespace Nebula · Packages/com.1by3.nebula/Runtime/Core/SyncState.cs
public static class SyncAudienceCodec

The client member sets of an entity's SyncAudience.Custom behaviors, as the authority last evaluated them: [count:byte]{[behaviourIndex:byte][n:ushort]{[clientId:ulong]}}, each set sorted ascending. It rides the spawn (EntitySpawnMsg.Audience) and SyncAudienceMsg. The gateway filters Custom chunks by it and never forwards it to a client.

Fields

MaxMembers

public const int MaxMembers = 256;

The most clients one Custom behavior's audience may name. Past it the authority keeps the lowest session ids and logs a warning once per behavior; a client left out does not receive the state (fail closed). The whole set is sent on every change, 8 bytes a member, so the bound keeps one change to about 2 KB.

Methods

Write

public static void Write(NetworkWriter w, IReadOnlyList<KeyValuePair<byte, ulong[]>> sets);

Write the member sets. Each set must already be sorted; at most MaxMembers of each is written.

Read

public static Dictionary<byte, ulong[]> Read(byte[] block);

Read a block written by Write. Null or empty reads as no sets. Each set comes back sorted.

Contains

public static bool Contains(ulong[] sorted, ulong clientId);

Whether a sorted member set contains clientId.

On this page