Replication Ownership over Actors!

Hi,

So the problem is pretty simple. I have a player that runs around and can go up to a ball, click on it and hold it. The way the player is holding the ball is not by attaching it to the player’s bones or anything, I just want to make it lerp to the players specified “ball handle location” which is defined by an arrow component that is attached to the player’s root component. The first approach was to try and let the server handle the ball and move the ball to the appropriate client that is holding it. This all worked fine and gets replicated correctly but resulted in a very noticable jitter for the holding client. This happens because the client is waiting for the server to tell him where the ball is and then updates it accordingly, this approach becomes a mess when adding latency. So I bought a plugin called smooth sync which handles all the server latency for me, meaning it’ll smooth out the ball movement by interpolating and extrapolating between the ball positions that the player receives from the server. This all works like a charm but now I encountered the worst problem of them all.

Let’s say that the client has a horrible latency (200 ms) and is holding the ball. If the client moves, everything will look fine on his screen, but the truth is, on the server he only starts moving after 200 ms which means that the ball will also only start moving after 200 ms. This is no problem for the other clients since they are seeing what the server sees. But for that client with 200 ms latency, it looks like the ball is waiting 2 seconds before moving with him.

So my question is: “Is there a way to make the ball’s position get decided by the client that is actually holding him and let the server have latency instead of the client?”

Much like when the player jumps it is executed instantly, the client doesnt wait for the server’s response but shows everyone 200 ms later that he jumped.

Thanks in advance,

Scott

Anybody please? :’(

I dont think you need a plugin just for that.
Try the following: use replication for the ball. In the ball actor create a function when the player hold it (use player_owner variable as notify or similiar). When the player click on it, just set the variable reference to your player (you can call it from your player via Server event).
Also, in the ball tick (or timed event) make it lerp to the players specified “ball handle location” if the owner is valid and that’s it.
And when the player drop the ball just unset variable.

Thanks for replying! :slight_smile: What you are describing is one of the many approaches I have tried… It still doesn’t fix the fact that the player (from his point of view) is ahead of the server when moving. Since the ball is tracking the player’s server position, the ball’s movement will still be behind. I would love to show you in discord by sharing my screen if you have time?? (the ball will be more and more behind if the latency increases)

Discord: Scott#3846

Thanks in advance!

Here is a little gif that shows the problem! https://we.tl/t-8RIeigoulp
(it is a completely safe wetransfer link, don’t worry haha)

I did a simulation with a latency of 400 ms (which is very extreme I know, just to show you what I mean!)

Did you test this without sync plugin?
However, if the client have 400ms you can not decrease his latency. Client simply send commands with 400ms delay to the server (but in your case it’s much more than 400ms).

Also, in your .gif I see that the player and the ball also have delay, not just the ball (as you described in your first post).

I remember that I have also huge delay with sync plugin (in some older projects) when AI moves.
Without plugin it works smooth and perfect. I think you need first to solve the player movement delay (and the ball after).