public readonly record struct PlayerMoveInputWhat a player is doing on one tick, on the wire.
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 AxisThe movement axes, each in [-1, 1], at eight bits.
public static QuantizeRange YawThe look yaw, over a whole turn, at ten bits.
public static QuantizeRange PitchThe look pitch, over the range a player may aim through, at ten bits.
public Vector2 MoveSideways and forwards, each from -1 to 1.
public float LookYawWhich way the player is looking, in radians.
public float LookPitchHow far up they are looking, in radians.
public MoveButtons ButtonsWhat is held.
Methods (6)
public static PlayerMoveInput From(in MoveIntent intent)The input a player's intent encodes to.
public MoveIntent ToIntent()The intent this input decodes to.
public static MoveIntent Round(in MoveIntent intent)An intent put through the wire's precision without going near a wire.
public PlayerMoveInput Roundtrip()This input as it would arrive at the far end.
public void Write(ref BitWriter writer)Writes this input.
public static bool TryRead(ref BitReader reader, out PlayerMoveInput value)Reads one.
Used by (5)
- PlayerInputQuantizeSystemVixen.Net.Engine
- PlayerInputQuantizeSystemTestsVixen.Net.Engine.Tests
- PlayerMoveInputTestsVixen.Net.Engine.Tests
- PredictedPlayerMovementVixen.Net.Physics
- PredictedPlayerMovementTestsVixen.Net.Physics.Tests