FPhysicsBodyReplication
Per-body replication state: a bandwidth-lean wire format with delta against a baseline the receiver already holds, and the client-side correction that pulls a predicted body onto the authoritative one. The server replicates the bodies it owns; the owner-predicted ones are reconciled, not overwritten.
- Module
- Physics
- Header
#include "Physics/PhysicsSnapshot.h"- Namespace
Mowo
Public functions
| Returns | Name | Description |
|---|---|---|
FPhysicsBodyState | Quantize | What a state looks like after one trip through the wire's fixed point (1 mm, 0.01 m/s, 16-bit orientation components) — compare a received state against this, never against the unquantised original. |
void | Encode | Writes every state, each field only when it differs from the same-key baseline entry; a key with no baseline entry carries all fields. |
bool | Decode | Rebuilds the states a packet carried, applying each onto its baseline entry. |
float | Reconcile | Moves local toward authoritative and returns the position error it started from. |
Function details
Quantize
static FPhysicsBodyState Quantize(const FPhysicsBodyState& state)What a state looks like after one trip through the wire's fixed point (1 mm, 0.01 m/s, 16-bit orientation components) — compare a received state against this, never against the unquantised original.
Encode
static void Encode(const std::vector<FPhysicsBodyState>& states, const std::vector<FPhysicsBodyState>* baseline, std::vector<uint8_t>& out)Writes every state, each field only when it differs from the same-key baseline entry; a key with no baseline entry carries all fields.
Decode
static bool Decode(const std::vector<uint8_t>& packet, const std::vector<FPhysicsBodyState>* baseline, std::vector<FPhysicsBodyState>& out)Rebuilds the states a packet carried, applying each onto its baseline entry. False on a truncated or malformed packet; out is then unspecified.
Reconcile
static float Reconcile(const FPhysicsBodyState& local, const FPhysicsBodyState& authoritative, const FPhysicsReconcileSettings& settings, FPhysicsBodyState& corrected, bool& snapped)Moves local toward authoritative and returns the position error it started from. snapped is set when the thresholds sent it straight there.