Download

Networking ninja rope movement

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.

http://www.youtube.com/watch?v=HZ5-rudEAtc&feature=youtu.be

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

Thanks.

Bump. Cleaned up my post to be more concise about my issue. Any thoughts anyone?

Hmmm, for the feel of it, you should probably let the client do what it wants and just use the server to sanity check that what its doing is reasonable. I guess it depends on what gameplay you’re going to have in multiplayer if that is a reasonable thing to do.

Its probably going to be hard to do any reasonable interpolation between the client side and the delayed client info replicated via the server in any meaningful way. Sure, you can predict the movement by calculating the arc and perhaps try and reconcile the current position by changing the arc length (so basically calculate the expected position both for client and for update from server, then try and shorten/lengthen the arc length so that the client version comes more into keeping with the server version). But you still have the issue of firing/not firing the rope in the first place.

We got round it for our games by being turn based. So we didn’t have to reconcile the discrepancy on the client side (server essentially multicast the clients version to all other connections).

Thanks for the reply zoombapup.
So you think I should make the local client authoritative over it’s position and on the server make a reasonable assumption whether a move is possible?
I’ve been doing something like this by sending the local clients position to the server via reliable RPC every frame just to keep the project moving in the meantime but I figured this would get bandwidth expensive quite fast with many players.
I think you’re correct, there’s no way to predict input in movement like this. I’ll try the client authoritative thing and see how I can optimize the data I’m sending and smooth some bits out with simple prediction.
I’ll check back in with my results.

On a sidenote when you said “our games” i did a quick google of your name. You worked on Worms! I guess its pretty clear where my inspiration i coming from then. :slight_smile: I’m still missing the old days of roping in WA.

Thanks again!

Yeah, roping was a big part of WA, certainly one of the best mechanics in the game. So I always wanted to make a roping game as an indie but never could bring myself to do it :slight_smile:

I wouldn’t worry too much about the bandwidth. On the early worms games I was doing some testing and we got a single player’s turns at less than could be carried by a 2400 baud modem :slight_smile: so I’m guessing its really not going to stress a modern network connection. Of course we didn’t have to do that in real-time (so we could buffer part of the turn before starting the replay of it), but I doubt it’d be too huge in comparison with 100’s of players firing missles and bullets at each other.

Good luck with the project!

Could you please share a few screenshots on how you did the movement in the first place? Trying to make my own roping but it’s just not working out