public sealed class SyncListReplicator<T> where T : NetworkBehaviour, new()Replicates one kind of NetworkBehaviour's lists.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
The whole list, every time it changes — and that is a correction to what this package used to claim. SyncList`1 keeps a log of operations, and the design note beside it said those ops go on the wire and that the reliable channel's ordering makes per-connection bookkeeping unnecessary. That is true of a broadcast and false of a snapshot, which is why it was never wired up: a snapshot goes to the connections an interest resolver returns, so "everyone receives every op exactly once" is not something this pipeline offers. An object that walks into somebody's interest has to be told the list, not the last op.
Sending the state rather than the events makes every one of those cases disappear. A late joiner, a reconnect, a lost snapshot, an object crossing an interest boundary and a player who was in another scene are all the same thing to a receiver: here is the list. The existing baseline machinery already re-sends until acknowledged and then stops, so nothing new is needed on the wire — the record format was never fixed-width, only the delta path is, and it correctly declines a replicator that declares no lanes.
What it costs is bandwidth proportional to the list on the tick it changes. A hundred-item inventory is a few hundred bytes when somebody picks something up, on a channel that will deliver it, seconds apart. A list changing every tick is a list being used as something it is not — and if one genuinely must be, the shape that fixes it is the one NetworkAnimatorParameters and NetworkBones use: a fixed capacity, which buys back per-element delta encoding at one bit for an element that did not move. That needs a fixed-width element type, which a general SyncList`1 does not have.
The op log is not wasted by this: it still drives Changed, which is what a UI binds to, and locally an op is exactly the notification a caller wants.
Fields and properties (7)
public ComponentTypeId ComponentTypeWhich component this replicates.
public uint TypeIdThe id this type has on the wire: a hash of its full name, computed at build time.
public string TypeNameThe name, for diagnostics and for the bandwidth attribution panel.
public Channel Channelpublic int PriorityBelow SyncVar state, which is smaller and more urgent.
public QueryDescription ChangedQueryA query matching entities with this component, filtered on it having changed.
public ReadOnlySpan<WireLane> LanesNone, which is what tells the server to send whole records rather than differences.
Methods (4)
public SyncListReplicator(BehaviorStore store)Creates a replicator for one behaviour type's lists.
public bool Has(World world, Entity entity)Whether an entity has this component at all.
public void Write(World world, Entity entity, ref BitWriter writer)Encodes an entity's component.
public bool Apply(World world, Entity entity, ref BitReader reader)Decodes a component and puts it on an entity, adding it if it is not there.
Used by (1)
- SyncListReplicationTestsVixen.Net.Engine.Tests