Hi. I’m trying to make a ninja-rope swing movement mode for a custom CharacterMovementComponent that can be smoothly networked and predicted client side.
Creating the actual movement has been simple but networking it has been bothersome. The movement is basically Phys_Falling constrained to a circle using a pivot and rope length. The player can launch, cut and resize ropes at any time, see the link below of the mechanic working in single player.
What I need:
I need to create movement for the rope swing and teach the server about it so I get smooth prediction and corrections. (FSavedMove?)
The movement requires a pivot and a length for the rope, both adjustable at any moment by the player.
I need to replicate this in such a way that simulated proxies can accomplish the same motion.
What I’ve tried:
My first attempt was setting the rope movement mode, pivot and length locally and on server using RPCs. When set on the server they are replicated back to the local player to ensure consistency. This leads to smooth movement on server but jerky movement locally as the replicated variables for pivot and length are old by the time they reach the client. Also prediction does not know how to predict my constrained movement.
Next I tried FSavedMove using this tutorial https://wiki.unrealengine.com/Networking/Replication and UnrealTournaments code as inspiration. This seems to be the best way to go at the moment but I’m having a hard time trying to utilize my rope length and pivot location, most information I can find just deals with setting flags with little info on setting and utilizing additional variables in a way that can be replayed and predicted. Also from what I can see the server movement code seems to deal primarily with acceleration so I’m unsure how to incorporate my rope constraint into prediction. As such I’m getting a lot of jerky corrections from the server as soon as I introduce lag.
If anyone has any insight into how I should approach this I would be grateful. In baby steps if possible.
I’ve also created an answerhub post here: https://answers.unrealengine.com/questions/319451/networking-custom-movementmode-ninja-rope-swing.html