Vixen
02b45cc4
csharp
public struct NetworkAnimator

What a remote animator needs in order to animate itself.

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

Remarks

The inputs, not the output. An animator turns a handful of parameters and a state machine position into a pose of every bone, every frame. Sending the pose is sending the result of a calculation the receiver is perfectly capable of doing — sixty bone rotations a frame per character, against a dozen values that change when the player presses something. The saving is not marginal; it is the difference between a networked crowd and a networked pair.

What it costs is a determinism assumption, and it is worth stating rather than discovering. The receiver reproduces the pose only if its animator reaches the same state from the same parameters — so the same clips, the same transitions, the same conditions. That is true of an ordinary state machine driven by gameplay and false of anything driven by local physics, IK against local geometry, or a random number generator. Those want NetworkBones, which is expensive and honest about it.

The state and its time are sent as well as the parameters, and not as a belt-and-braces measure. A late joiner has no history to have derived the current state from, a client whose parameter update was lost has a state machine one transition behind, and neither heals on its own — a state machine's position is a function of every parameter it has ever seen, so a single missed edge is permanent. The state is what makes it self-correcting.

Fields and properties (3)

  • public ushort State

    Which state the first layer's machine is in.

  • public float NormalizedTime

    How far through that state it is, from 0 to 1.

  • public float Speed

    How fast the animator is playing, so a slowed or stopped one looks the same.

Used by (5)

  • NetworkAnimatorApplySystemVixen.Net.Animation
  • NetworkAnimatorCaptureSystemVixen.Net.Animation
  • NetworkAnimatorReplicatorVixen.Net.Animation
  • NetworkAnimatorTestsVixen.Net.Animation.Tests
  • Vixen_Net_Animation_NetworkAnimatorSerializerVixen.Net.Animation