NetAnimationStateComponent
The replicated animation state of a networked character — UE's replicated-montage plus the handful of graph parameters a remote AnimInstance would otherwise derive from replicated movement.
- Module
- Networking
- Header
#include "Networking/Components/NetAnimationStateComponent.h"- Namespace
Mowo- Reflection
- Reflected by MowoHeaderTool
The server samples the animator into the MREPLICATED mirror below every tick (FAnimationNetDriver::ServerPublish); the mirror rides the ordinary field-delta streams — ids and flags reliably, the montage playhead and the float parameters unreliably, the way health and position already do — and a client writes it back onto its ghost's animator. Names are authored on the component and never on the wire: both ends load the same prefab, so a float slot means the same parameter on both.
Montage identity is a NAME and the wire carries its hash. A montage ASSET (.montage) supplies that name itself and the sample registers it on both ends automatically; a montage still living in a model's .manimmeta sidecar has to be registered by hand (RegisterMontage) because nothing about it names it to the other end. Either way a montage that was never registered plays locally and replicates nothing — the sample logs it once.
Properties
| Type | Name | Description |
|---|---|---|
static constexpr uint32_t | kMaxFloatParams | Default 4. |
static constexpr uint32_t | kMaxBoolParams | Default 32. |
std::vector<std::string> | floatParamNames | |
std::vector<std::string> | boolParamNames | |
float | montageSnapThreshold | A remote montage playhead that drifts less than this is nudged toward the server's; past it the montage is re-seeked outright. Default 0.25f. |
float | montageSmoothingRate | Default 8.0f. |
float | montagePredictionWindow | How long an owner-predicted montage keeps playing while the server has not confirmed it. Past this the client assumes the server refused it. Default 0.5f. |
uint32_t | stateId | Default 0. |
uint32_t | montageId | Default 0. |
uint32_t | montageSerial | Bumped on every start, restart and stop, so a client that already plays this montage can tell a restart from a redundant resend. Default 0. |
uint32_t | montageSection | Default 0. |
uint32_t | boolParams | Default 0. |
float | montagePosition | Default 0.0f. |
float | playRate | Default 1.0f. |
float | floatParam0 | Default 0.0f. |
float | floatParam1 | Default 0.0f. |
float | floatParam2 | Default 0.0f. |
float | floatParam3 | Default 0.0f. |
const Montage* | sampledMontage | Server sample: what the animator played last tick, so a pointer change or a playhead rewind reads as a start / restart. Default nullptr. |
float | sampledPosition | Default 0.0f. |
bool | unregisteredMontageWarned | Default false. |
uint32_t | appliedMontageSerial | Client apply. Default 0. |
uint32_t | appliedStateId | Default 0. |
float | lastSeenMontagePosition | Default -1.0f. |
float | serverPositionAge | Default 0.0f. |
bool | montageResolveWarned | Default false. |
bool | predictedMontagePending | Owner prediction: a montage the owning client started locally and is waiting for the server to confirm. Default false. |
uint32_t | predictedMontageId | Default 0. |
float | predictedMontageAge | Default 0.0f. |
std::vector<std::pair<uint32_t, const Montage*>> | montageTable |
Public functions
| Returns | Name | Description |
|---|---|---|
uint32_t | HashName | FNV-1a over the name; 0 is reserved for "none", so a name that hashes to it is nudged. |
uint32_t | HashName | |
void | RegisterMontage | |
const Montage* | FindMontage | |
uint32_t | FindMontageId | |
float | GetFloatParam | |
void | SetFloatParam | |
bool | GetBoolParam | |
void | SetBoolParam |
Function details
HashName
static uint32_t HashName(const char* name)FNV-1a over the name; 0 is reserved for "none", so a name that hashes to it is nudged.
HashName
static uint32_t HashName(const std::string& name)RegisterMontage
void RegisterMontage(const char* name, const Montage* montage)FindMontage
const Montage* FindMontage(uint32_t id) constFindMontageId
uint32_t FindMontageId(const Montage* montage) constGetFloatParam
float GetFloatParam(uint32_t index) constSetFloatParam
void SetFloatParam(uint32_t index, float value)GetBoolParam
bool GetBoolParam(uint32_t index) constSetBoolParam
void SetBoolParam(uint32_t index, bool on)