FCharacterPrediction
- Module
- Networking
- Header
#include "Networking/Replication/CharacterPrediction.h"- Namespace
Mowo
Properties
| Type | Name | Description |
|---|---|---|
static constexpr uint16_t | kInputSprint | ReplicationInputBody::buttonMask bits the step understands. Default 1 << 0. |
static constexpr uint16_t | kInputCrouch | Default 1 << 1. |
static constexpr uint16_t | kInputJump | Default 1 << 2. |
static constexpr uint16_t | kInputJumpHeld | The jump button's level (variable-height jumps), beside the edge above. Default 1 << 3. |
static constexpr float | kPredictionGravity | Gravity used by the predicted integration — matches CharacterControllerComponent's default (-9.81 m/s²). The full model reads cc.gravity; prediction has no controller so it uses the default. Default -9.81f. |
Public functions
| Returns | Name | Description |
|---|---|---|
Vec3 | StepVelocity | The shared velocity half of one input step: planar velocity at walkSpeed × sprint/crouch (air-controlled when airborne), jump raising vertical velocity when grounded. |
void | Step | One deterministic move step through the Walking model: planar velocity at walkSpeed × sprint/crouch (air-controlled when airborne), jump sets vertical velocity, gravity integrates it, position advances, and a flat-ground clamp re-grounds on landing. |
void | Reconcile | Snap to the server's authoritative position + move state, then replay every pending input with clientTick > ackTick through Step. |
Function details
StepVelocity
static Vec3 StepVelocity(const Vec3& current, bool grounded, const CharacterMovementComponent& mm, const ReplicationInputBody& input, float dt, bool* outJumped)The shared velocity half of one input step: planar velocity at walkSpeed × sprint/crouch (air-controlled when airborne), jump raising vertical velocity when grounded. Step integrates it against the flat plane; FCharacterNetDriver's replay integrates it through the REAL Jolt character step instead — both intents come from here so the two paths agree on what an input means.
Step
static void Step(TransformComponent& tc, FMoveState& state, const CharacterMovementComponent& mm, const ReplicationInputBody& input, float dt)One deterministic move step through the Walking model: planar velocity at walkSpeed × sprint/crouch (air-controlled when airborne), jump sets vertical velocity, gravity integrates it, position advances, and a flat-ground clamp re-grounds on landing.
Reconcile
static void Reconcile(TransformComponent& tc, FMoveState& state, const CharacterMovementComponent& mm, const Vec3& authoritativePos, const FMoveState& authoritativeState, uint32_t ackTick, const std::vector<FPendingInput>& pending, float dt)Snap to the server's authoritative position + move state, then replay every pending input with clientTick > ackTick through Step.