Changing charactermovement variables in multiplayer

Hello,

I have a question regarding the best practices for dynamically changing UCharacterMovementComponent properties for AI characters in a multiplayer environment.

I’m looking to adjust several movement parameters at runtime to alter the behavior of our AI, for example, to make them move more cautiously in certain situations or sprint in others. The specific properties I’m focused on are:

  • MaxWalkSpeed
  • BrakingFrictionFactor
  • BrakingDecelerationWalking
  • MaxAcceleration

I should also note that for MaxAcceleration, my approach is to override the GetMaxAcceleration() function in my custom Character Movement Component subclass and return a value based on game logic, rather than setting the variable directly.

My core question is about replication and authority. When I change these values (either by setting them directly or by changing the return value of an overridden function like GetMaxAcceleration()), is it sufficient for these changes to exist only on the server? Or do I need to ensure that the new values are explicitly replicated and set on the clients as well for the smoothest experience?

For instance, if the server lowers an AI’s MaxWalkSpeed, will the client’s predictive movement and smoothing behave correctly if its local CharacterMovementComponent is still using the old (higher) value? I am concerned this might cause network corrections, jittering, or other visual artifacts as the server constantly overrides the client’s simulated position.

My goal is to ensure the AI movement remains as smooth as possible for all players while following best practices for network efficiency and avoiding client-side corrections.

Thank you for your time and insights.

[Attachment Removed]

Hey there! Extrapolation of the location of simulated proxies like NPCs on clients just uses the last replicated velocity. For sim proxies all velocity changes are computed server-side and replicated down, so there is no need to replicate over velocity-affecting properties.

If you do want to predict acceleration for sim-proxies client-side, for example to predict gravity-based acceleration on the client, have a look at ACharacter::ShouldReplicateAcceleration(). You can set the cvar p.EnableCharacterAccelerationReplication = 1 on the server to replicate acceleration over and let clients apply it predictively. I would hold off on that until you’re seeing net corrections that are caused by clients extrapolating with an outdated velocity that could have been predicted.

In general, the question to your questions is that not replicating over velocity-changing values is fine for sim proxies.

[Attachment Removed]