Vixen
02b45cc4
csharp
public sealed class SyncStateReplicator<T> where T : NetworkBehaviour, new()

Replicates one kind of NetworkBehaviour's state.

No guide page documents this yet — the page shows what the code says about itself.

Remarks

An ordinary IComponentReplicator, which is the point. Behaviour-held state joins the pipeline at the same place a [Replicated] struct does, so it gets the same delta encoding, the same per-connection baselines, the same priority shedding and the same per-field bandwidth attribution — none of which is implemented twice. The lane layout comes from the module, and the module's fields declared theirs.

The component it watches is SyncStateVersion rather than anything holding the values: the values are in managed fields the ECS cannot see, so what the change versions track is the fact that they moved. Write then asks the behaviour itself.

A client creates the behaviour when the first record about it arrives. The server decides an object has one; the client finds out by being told, which is the same rule NetworkId follows and for the same reason.

Fields and properties (7)

  • public ComponentTypeId ComponentType

    Which component this replicates.

  • public uint TypeId

    The id this type has on the wire: a hash of its full name, computed at build time.

  • public string TypeName

    The name, for diagnostics and for the bandwidth attribution panel.

  • public Channel Channel
  • public int Priority

    What to shed last. Higher goes first.

  • public QueryDescription ChangedQuery

    A query matching entities with this component, filtered on it having changed.

  • public ReadOnlySpan<WireLane> Lanes

    The fixed-width fields Write produces, in the order it produces them.

Methods (4)

  • public SyncStateReplicator(BehaviorStore store)

    Creates a replicator for one behaviour type.

  • 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)

  • SyncStateTestsVixen.Net.Engine.Tests