Important
PredictedMovement offers several shells usually with a derived UCharacterMovementComponent and ACharacter which form a single net predicted movement state.
Note
For BP users the single-cmc branch contains a feature-rich ACharacter you can use right away.
Get the Demo content from Releases
Check out the Demo content in the plugin's content folder or read more about it here.
Similar functionality as crouching. Also supports change in radius. Has a lock timer, to prevent early exit from prone.
Compatible with crouching, and should switch properly between Crouch➜Prone, Stand➜Prone, Prone➜Crouch, etc.
A shell intended for switching to / from a strafe mode, however the actual functionality is not implemented as it is project-dependent. This is useful for duplicating into your own movement states, e.g. Aiming Down Sights
It makes you sprint by changing your movement properties when activated.
Net predicted stamina and drain state. It also includes a correction mechanism.
Modifiers are similar to states such as sprinting, however instead of a single on/off state, they contain multiple levels, e.g. Boost Level 1-5.
Included Modifiers: Boost, Snare, SlowFall. The single-cmc branch includes also Slow and Haste (boost, but only affects Sprint).
Modifiers come in three formats: Local Predicted, Local Predicted + Corrections, and Server Initiated. Read about the differences here.
Furthermore, Server Initiated modifiers include a functional and production tested client authority solution, that allows limited/partial location authority for the client when the server applies a Modifier to your character, to prevent problematic de-sync. You can read about this here.
The included modifiers can be duplicated to achieve plenty of other effects.
single-cmc includes Stroll, Walk, Run, Sprint gait modes as well as AimDownSights.
Stroll was added for the sake of NPCs who are not doing anything, but you don't want them to remain completely stationary.
I use PredictedMovement in my own projects, here you can see the character sprinting, consuming stamina, strafing, and proning with high latency (>220ms) and p.netshowcorrections 1. As you can see, there is no desync. This was from version 1 of PredictedMovement and it has only improved since.
- Update for UE5.7
- Add missing const for
UStaminaMovement - gitignore Content
- Removed Git LFS - now using Releases for Content
single-cmcIsStaminaRecovered()marked asvirtual
- Fix pre-processor macro for
DrawStaminaValuescvar (fixes packaging error)
- Replace native ptr with TObjectPtr
- BP Exposed
SetStamina(),AddStamina(),SetMaxStamina(),AddMaxStamina(),SetStaminaDrained()- These will run outside of prediction and will make you de-sync if used during gameplay critical situations
- AimDownSights/sprint don't modify other's input on
single-cmc
- Add further missing templates for clang
- Specify template type as
NotifyModifierChanged<uint8>instead of inferring for the sake of clang
- Improve base eye height handling on
single-cmc
- Movement Modifiers recreated from scratch
- Supports
LocalPredicted,ServerInitiated, but alsoLocalPredicted_WithCorrection
- Supports
- Client Authority overhauled, now handles client corrections fully
single-cmcbranch added with full BP support and demo content
- Change from
uint32:1touint8:1
- Movement Modifiers added
- Supports Local Predicted & Server Initiated modifiers
- Boost, SlowFall, Snare included by default
- Client Authority solution added
- For Server Initiated modifiers in particular
CanSprintInCurrentState()no longer checksIsSprintWithinAllowableInputAngle()IsSprintWithinAllowableInputAngle()exposed for BP (ASprintCharacter) and should be checked individually for when considered sprinting- Additional function added
IsSprintingInEffect()that checks bothIsSprintingAtSpeed() && IsSprintWithinAllowableInputAngle() - e.g.
if (IsSprintingAtSpeed())becomesif (IsSprintingInEffect())
- Additional function added
- The goal is to not have it completely exit/re-entry sprinting state repeatedly when the angle continues to fail the check momentarily
- Exposed
MaxInputAngleSprintwhich was previously 50.f
- Movement Abilities updated to use push model for replication
- Wiki added
- Version number follows Unreal format 1.0.5.2 > 1.5.2
- Added System/PredictedMovementVersioning.h for improved pre-processor support
- Added helper comments to StaminaMovement.h
- Pre-processor macros for OnClientCorrectionReceived to support 5.3
- Replaced ClientHandleMoveResponse with OnClientCorrectionReceived
- Fixed a bug causing SimulatedProxy to factor ProneLock incorrectly, causing it to become stuck in Prone
- Moved prone lock definitions to the .cpp
- Initialize a few uninitialized properties
- Add
UE_INLINE_GENERATED_CPP_BY_NAMEto all relevant .cpp
- SprintMovement added option (
bUseMaxAccelerationSprintingOnlyAtSpeed) for usingMaxAccelerationSprintingwhenIsSprintingAtSpeed()is false
- Added NetworkStaminaCorrectionThreshold and exposed via UPROPERTY()
UStaminaMovement::ServerCheckClientErroradded by PR from vorixo
- Remove
bForceIWYU
- Changed
FSavedMove_Character_Prone::PrepMoveForto useSuperinstead ofFSavedMove_Character
- Removed
IsSprintingAtSpeed()check forUSprintMovement::GetMaxSpeed()
- Prone lock timer implemented properly (with prediction instead of timer handle) to fix desync
- Can no longer jump while prone
- Remove ground checks for sprint and strafe movement properties (walking off a ledge shouldn't momentarily change to normal speed, etc)
- ClientHandleMoveResponse use LogNetPlayerMovement instead of LogTemp
- Minor readability change to ClientHandleMoveResponse and a helpful comment
- Add export macro and remove final for StaminaMoveResponseDataContainer
- Expose stamina as protected
- Change ObjectInitializer property name from OI
- Fixed incorrect information in comment for recovering stamina
- Removed accidental include
- Removed stamina inheritance from sprint
- Fixed CanSprint() being used unnecessarily, CanSprintInCurrentState is utilized properly here
- Moved sprint input checking to virtual func
IsSprintWithinAllowableInputAngle - Sprint checks 3D velocity on ground, replaced magic number with UPROPERTY
VelocityCheckMitigatorSprinting - Moved implementations out of headers
- Greatly improved comments
(Thanks to cedric & vori for the code review)
- Fixed issue where stamina corrections were being overwritten
- Added Stamina
- Initial Release