Vixen
02b45cc4
csharp
public sealed class DistanceReplicationRate

Sends distant objects less often.

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

Remarks

What [16](../../../docs/plan/16-networking.md) means by NetworkLOD, and it is the cheapest large saving in the system: a player who can see two hundred objects is usually within arm's reach of three of them. Bands rather than a curve, because the thing being chosen is "one tick in how many" and that is an integer.

The phase is the object's id, not a shared counter. A divider that sent every distant object on the same tick would produce a snapshot that is tiny four ticks out of five and enormous on the fifth — the same total bandwidth arriving in a shape that defeats the budget and the path MTU at once. Spreading them by id costs an integer remainder and makes the load flat.

It is a rate, not a filter, so nothing here can make an object disappear. An object skipped this tick is one whose newest value the connection has not acknowledged, so it goes in the next snapshot it is due in — which is the same thing that happens to a record the budget shed.

Fields and properties (3)

  • public IList<(float Distance, int Divider)> Bands

    The bands, as (distance, one tick in how many), nearest first.

  • public long SkippedCount

    Records skipped because they were not due.

  • public long SentCount

    Records written.

Methods (3)

  • public void SetViewpoint(PlayerId player, in Vector3 at)

    Says where a player is looking from.

  • public bool Forget(PlayerId player)

    Forgets a player who has gone.

  • public bool ShouldSend(World world, PlayerId player, Entity entity, NetworkId id, Tick tick)

    Whether this object's state is worth writing to this connection on this tick.

Used by (1)

  • InterestTestsVixen.Net.Tests