Vixen
02b45cc4
csharp
public readonly record struct PlayerMoveInput

What a player is doing on one tick, on the wire.

Read the guide page for this →

Remarks

MoveIntent, quantized. The two are deliberately separate types and not one: MoveIntent is a component in Vixen.Engine, which may not reference Vixen.Net at all, and a component that had to implement a networking interface would drag the whole of it into every game that has a player and no server.

Small is the whole point. InputLog`1 sends the newest input and the few before it, every tick, so this is the one payload that goes out more often than a snapshot. Fifty-two bits: two axes at eight, two angles at ten, and the buttons whole.

The quantization is not a loss the prediction has to tolerate — it is what makes the prediction agree. The client sends this, the server decodes it, and both then run the same movement rules over the same decoded numbers. A client that predicted with its full-precision intent and sent a rounded one would mispredict by the rounding on every single tick, on a perfect connection, and it would look like jitter. Round is what a client applies to its own intent to stay in step.

Fields and properties (7)

  • public static QuantizeRange Axis

    The movement axes, each in [-1, 1], at eight bits.

  • public static QuantizeRange Yaw

    The look yaw, over a whole turn, at ten bits.

  • public static QuantizeRange Pitch

    The look pitch, over the range a player may aim through, at ten bits.

  • public Vector2 Move

    Sideways and forwards, each from -1 to 1.

  • public float LookYaw

    Which way the player is looking, in radians.

  • public float LookPitch

    How far up they are looking, in radians.

  • public MoveButtons Buttons

    What is held.

Methods (6)

Used by (5)

  • PlayerInputQuantizeSystemVixen.Net.Engine
  • PlayerInputQuantizeSystemTestsVixen.Net.Engine.Tests
  • PlayerMoveInputTestsVixen.Net.Engine.Tests
  • PredictedPlayerMovementVixen.Net.Physics
  • PredictedPlayerMovementTestsVixen.Net.Physics.Tests