Vixen
02b45cc4
csharp
public record class NetworkSimulationProfile

How bad the network is pretending to be.

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

Remarks

The delays and losses apply to what the endpoint holding the profile sends, so Latency is one way. Wrapping both ends of a connection — the usual case in a test — gives a round trip of twice it.

Loss and duplication only ever touch channels whose contract permits them (MayDrop, MayDuplicate). A simulation that dropped a Reliable payload would not be simulating a bad network, it would be simulating a broken transport, and the layer above is entitled to assume that never happens.

Fields and properties (9)

  • public static NetworkSimulationProfile Perfect

    A perfect wire. What the simulation does when it is switched on but told to do nothing.

  • public static NetworkSimulationProfile Lan

    Two players on one switch.

  • public static NetworkSimulationProfile Broadband

    Ordinary home broadband to a regional server. The profile a development build should run with by default: netcode written on localhost is netcode that breaks on release day.

  • public static NetworkSimulationProfile Mobile

    A phone on a good day.

  • public static NetworkSimulationProfile Awful

    A phone on a train. Not a plausible target — a deliberate stress case.

  • public TimeSpan Latency

    The one-way delay added to everything sent.

  • public TimeSpan Jitter

    How far either side of Latency a delay may land, drawn uniformly. This is also where reordering comes from: two unordered payloads with different draws arrive in whichever order their draws put them, which is what really happens and is not worth modelling separately.

  • public double LossChance

    The chance, from 0 to 1, that a droppable payload is thrown away instead of sent.

  • public double DuplicateChance

    The chance, from 0 to 1, that a duplicable payload is sent twice, the copy drawing its own jitter.

Used by (6)

  • LocalMatchMultiplayer
  • HarnessVixen.Net.Tests
  • NetworkSimulationVixen.Net
  • NetworkSimulationTestsVixen.Net.Tests
  • SessionTestsVixen.Net.Tests
  • SimulatedTransportConformanceTestsVixen.Net.Tests