Debounce movement stop for animations/network

Add a short "moving" hold to reduce flicker when movement briefly stops. Introduces a 300ms stop-hold for both proxy animation sync and local player movement sampling: add chrono include and movingHoldUntil to ProxyAppliedAnimationState, a kProxyMovingStopHoldDuration constant, ApplyMovingHoldState and BuildDebouncedDesiredState in F4TProxyAnimationSync, and replace direct desired-state usage with the debounced version. In main.cpp add kMovementStopHoldDuration, ResolveMovementHoldState, refactor BuildPlayerMovementState, add an overloaded GetPlayerMovementState, and separate debug vs network sampling (with separate movingHoldUntil variables) so logging uses per-frame debug state while network sends use the debounced network state. Also gate diagnostic logging behind a flag. These changes aim to stabilize isMoving/isSprinting transitions and avoid rapid toggles between frames and network updates.
This commit is contained in:
2026-06-04 17:34:16 +12:00
parent feec915f35
commit 2aab83087f
3 changed files with 137 additions and 42 deletions
+2
View File
@@ -2,6 +2,7 @@
#include "F4TRemotePlayerState.h"
#include <chrono>
#include <cstdint>
#include <optional>
#include <string_view>
@@ -34,6 +35,7 @@ namespace F4T::ProxyAnimationSync
bool lastWeaponDrawn{ false };
float lastGraphSpeed{ 0.0F };
float lastDirection{ 0.0F };
std::chrono::steady_clock::time_point movingHoldUntil{};
};
void ResetAppliedAnimationState(ProxyAppliedAnimationState& a_state);