Download

responsive knock-back in multiplayer game

We are working on a multiplayer game, and would like to have responsive knockback for some weapons/attacks between 2 clients. For example Overwatch Lucio’s sound wave ability where he pushes enemies away.

Getting the knockback working is not a problem, we have that using LaunchCharacter. The problem is making it responsive so it happens immediately for the attacking client when there is latency.

The first option we tried is doing it just on the server, which causes a round trip delay before the knockback happens and does not feel responsive even with latency of PktLag=100.

We also tried applying the knock back immediately on the client, which is responsive but has the undesirable result of the victim having jankey movement when their position is corrected to the server. If the latency is low enough < 100 it’s not terrible but with lag of 200 or more it becomes pretty noticeable. Also calling LaunchCharacter also seems to work differently on clients in that the character is launched much farther then on the client which may be part of the problem.

I’ve tried playing around with the networking settings in the character movement component like increasing the smoothing update distances but it’s not a huge improvement. There is a variable in CharacterMovement called bIgnoreClientMovementErrorChecksAndCorrection, but that doesn’t seem to help.

Any thoughts on how to improve responsiveness with this?

2 Likes

I think this is an instance where you can’t really do anything about network latency. Usually you’d do some client prediction, but in this case that’s not going to work because everyone connected needs the correct location of the character and the server dictates that. There may be a way to disable the character location sync, but i’ve never tried. If you decide to do that though, the client that initially did the push back will see this character fly immediately, but then on said client screen he will be in a completely different location from where everyone else sees him and that is obviously a problem.

It’s not all hopeless though, there are some tricks you can use to improve depending on your situation. In my example I have a projectile that is client predicted and uses some catch up methods to hit the target at the same time across other clients and server. When the projectile hits the target, it lifts it. The same thing could be done for launching your character. If the range is close, and you need it to instantly push… I haven’t thought of this one yet.

[video]https://i.gyazo.com/31ac012259732db552c0d5165305bbb8.mp4[/video]

As you can see in this clip, when i get close it takes a bit longer to respon. I have the pktlag set at 180.

Have you tried simulating it locally (instant response) and in the server-side to catch up the final location?

The server correcting the final location is inevitable, but at least if you simulate it locally the first feedback will be immediate.

Demeese - I think if it was a projectile that would help hide the latency, but for something like a melee, the result needs to be instant. I think in theory I’d like to temporally disable the network sync so the feedback is instant and then somehow lerp it to the correct position and renable sync.

Gbr - I have tried simulating it locally and the result is immediate, the problem is that gets quickly lerped to the server position and looks bad. I think a part of the problem may be that the LaunchCharacter function appears to work slightly differently on the server, so when it lerps to the server position, it ends up being different then the client.

I’m still looking into it, will post if I come up with a better solution.

@FrankForce

Have you figured out how to do this / found a solution to this problem yet?
I’m having the same issue and would like to know if you have a way to work around it

This isn’t a simple thing to fix. The crux is you eventually have to correct the client to the server. Assuming the knock back force is a fixed impulse, you should be able to start it on the client, then when you receive the server’s view, softly adjust the client in flight to be closer/at the servers desired destination.