Hi!
Our team is in the process of upgrading a game project from unreal 4.27 to unreal 5.7. We currently have the game running on a modified version of 5.7 & we are fixing regressions.
We have one regression related to custom movement modes. It seems like custom movement modes set on the server no longer replicate to clients correctly.
In our simplest case we run the following code on a player controlled pawn’s movement component:
SetMovementMode(MOVE_Custom, CMOVE_GodMode);
This code executes on the server & the movement mode is updated correctly there. However, the mode change no longer replicate to clients (Like it does in 4.27). “UCharacterMovementComponent::OnMovementModeChanged” is not called for clients. Neither is “UCharacterMovementComponent::PhysCustom”. And so the client & the server end up in different movement modes.
Our upgraded game code (5.7) is not that different from the old one (4.27) in this area. Which leads me to believe something has changed in the engine base classes.
What part(s) might be missing for us to properly replicate our custom movement modes in 5.7?
It’s worth nothing that regular movement modes (like walking, or falling) still replicate fine.
Hi,
After trying this in my own test project, it does seem like the custom movement mode should still replicate in 5.7.
On the server, the change in movement mode will be detected as a client error that needs to be corrected (UCharacterMovementComponent::ServerExceedsAllowablePositionError), and so an “adjustment” will be sent, containing the new movement mode (UCharacterMovementComponent::ServerMoveHandleClientError).
The client should receive this adjustment from the server and apply the new movement mode, calling OnMovementModeChanged from UCharacterMovementComponent::ClientAdjustPosition_Implementation.
You may want to debug these functions to see why the adjustment isn’t being sent/applied as expected.
Thanks,
Alex
Hi,
I followed your suggestion and started with debugging UCharacterMovementComponent::ServerExceedsAllowablePositionError . I found that the server correctly picks up on the change in movement mode. I then tried to connect this to an UCharacterMovementComponent::ClientAdjustPosition call. And then I found that, in our case, the server falls short there because of some custom replication graph changes. Reverting those fixed the issue! And now everything works as expected.
Thank you for the assistance!
Anton
Hi,
Great, I’m glad you were able to track down the source of the issue! If you have any further question or run into any other problems, please don’t hesitate to reach out.
Thanks,
Alex