Movement mode being overridden by MOVE_Falling (Networked)

I’m trying to create a new multiplayer-friendly custom movement mode for climbing on ledges. I got this to work by changing the movement mode to MOVE_Flying and using multicast functions to begin the new mode, but I ran into issues with multiplayer – simulated clients with net lag would not know to start the ledge getup animation, jitters/lag, etc.

I figured the appropriate way to begin to solve this would be to add a custom movement mode and remove the multicast bits, but I’m having a lot of trouble. It works on the authority if I don’t run a dedicated server, but on any Simulated proxy or Autonomous proxy (when using dedicated server), the custom movement mode is being “corrected” to MOVE_Falling a frame after calling SetMovementMode(MOVE_Custom, LedgeMode). So on the autonomous proxy, it’s only in my ledge mode for one frame, and the simulated proxies are always in MOVE_Falling.
The change to falling is done in CharacterMovementComponent::ApplyNetworkMovementMode.

Things I’ve tried:

  • Multicast and server functions to change character state (doesn’t work well with lag)

  • disabling gravity, setting gravity scale to 0

  • set move mode to MOVE_Flying (feels hacky and inconvenient, is still changed to MOVE_Falling when networking (So I guess my problem isn’t just with custom movement modes))

Things I figure I should avoid:

  • Multicast and server RPCs (don’t work well with responsive character movement with net lag)

  • Changing source code (I am building from source but there’s got to be a better way)

  • brute force changing my movement state every frame or something (wouldn’t work well with simulated proxies)

This is my first time starting a networked game from scratch, so if I’ve said anything dumb please correct me :stuck_out_tongue:

I think I figured this one out. Even though the comments in CharacterMovementComponent say that custom movement modes are automatically replicated, that doesn’t mean that the server will agree that the movement mode should be changed. So in my case, I needed to set the mode on client, then on the server when it detects the movement mode has been changed (in ServerMove), it marks a boolean I call “bClientWantsLedgeGetup”. Then in UpdateCharacterStateBeforeMovement, if that bool is true, I run the ledge getup check logic (still on the server) and if it succeeds, set the movement mode on the server.

I hope this helps anyone with similar confusion! As far as I know there isn’t any documentation on custom movement modes in network play.

Thank you!!! I had looked everywhere for a solution to this, this worked for me.

1 Like