Download

Set velocity not working in network. Thrusters just don't work.

Hey guys, I need some help again.

I have been trying to figure out how to set a velocity over the network for hours now. Searching on the web and what not. I did figure out finally that I had to set the movement mode to falling to apply a jump like motion, but even that doesn’t work on the client side. I was using launch character as a basic way to do things, but it was doing the same thing that is happening now with set velocity. On the client side, when I hit the jump button, the screen kinda flickers a bit like it tried to move, but the server put it back. I’ve set replicate to true, as well as replicate movement. I’m really not sure what is going on. Also, I’d like to have a kind of hover ability, so I wanted to add a thruster to hold the player up in the air. Whether I set it to active through the blueprint or the checkbox, nothing happens. Nothing happens on server or client side, it’s just not… thrusting. Any ideas?

16e9446398afa301cfbf0f06d7cfb42b86d4460d.png

I’d really appreciate the help. I’m a complete noob when it comes to unreal engine. I know that I could just use the jump command to jump, but I’d also like to add a sort of grappling hook to the game, and jumping with set velocity is only the start really with regards to that. If I can get the basic jump working, I should be able to get everything else working just fine. Thanks again if you can help. T_T Unreal is being a pain to me.

Maybe try making a Custom Event, set it to run on server and then call that event when the key is pressed.

So no other help besides events. -_- Guess I get to figure out all that now.

First I would suggest checking out this blog on networking in blueprints (particularly part 3), if you haven’t already: https://www.unrealengine.com/blog/blueprint-networking-tutorials

When setting up abilities for networking, you need to trigger the event on both the client and the server. The reason you said the client seems to “flicker” briefly is because the server disagrees with their positioning (outside a small error tolerance), so it corrects them back to the server authoritative position. To prevent this, you need to trigger the ability on the server as well as client.

The suggestion to trigger it as an event on the server is mostly correct… that will work, but you will get some lag on the client until the correction comes back from the server. This is the opposite of the problem you are seeing, because in this case the server is moving but the client is not, but since the server is the authority, the client will get corrected with a new position and velocity, and it will appear that the ability worked fine.

It’s up to you whether to try to locally simulate the change on the client as well as on the server. I usually try to do it when it’s done as a result of user input, since any delay there is very noticeable.

Also as a side note, the “Jump” function has networking built in to do this for you, while LaunchCharacter does not. Other simple actions such as movement (using AddMovementInput) and Crouch handle networking automatically.

Also, one thing that is useful for identifying this issue and for debugging it is to use this console command while running the game:

p.NetShowCorrections 1

on both the server and client (client is more important). This will print to the log when an error correction occurs, and draw the incorrect position as a red capsule, and the corrected one in green.

Thanks for the further explanation and suggestions. It’s not specifically for the jumping, as much as just adding a velocity. Jumping was just a simple way to test it. The goal in the end will be to do a grappling hook type of thing to swing around with, as well as something kind of like a hovering. I’d rather do it with velocity than a manual set position to get better physics.

We’ll see how well it turns out in multiplayer when things are all said and done. Thanks to everyone for the help.