Network Ownership teleportation

If an object is moving at relatively fast speeds, and the network ownership is with different clients in the game, there is bound to be disparity in the position of the object between different clients views due to latency.

My question, if I were to transfer the network ownership suddenly, the object would obviously appear to teleport. Is there any way to mitigate this?

2 Likes

why not let the client handle the object’s movement

  • exploiters?
  • they would need to calculate the movement, one ought to reduce the strain on the client
  • how would this work with other clients?

depending on what they’re trying to move, clients can render whatever object he wants to move independently while achieving the same goal. It is better to calculate the movements on the client instead of the server

If you don’t mind the potential risk of exploiters being able to influence physics, just set the objects network owner to a single client.

This will make physics really smooth for that one player.
As long as network owner doesn’t change, other players should be able to predict the physics on their clients, pretty sure this was added into Roblox not long ago.

Experiment and see what works for you, consider this a starting point.
You can improve and make it less exploitable later, focus on the implementation and getting it working first.

I’ll give some context perhaps. It’s a ball, in a football (soccer) game.

I can’t give network ownership to only one player, I want it to be relatively smooth for everyone ingame, without having input lag or such. I don’t care about exploits.

Had this idea, but seen touch football do it and the discrepancy between each client is far too massive for my liking.

In that case you will likely always have some input lag.

The average player will maybe have about 100 - 200 milliseconds of lag which is like 1/10th of a second to reach the server and another 1/10th of a second for others to see it assuming everyone has roughly equal ping.

If everyone had about 100 ms ping, you could theoretically update the ball’s position like 20 times a second which is faster than you think and acceptable (ping is the time it takes for info to go back and forth, not just forward and the ball only has to replicate forward when it’s moving on the server).

I don’t know if setting the network owner to nil will do anything since that might set it to automatic.

You could utilize Roblox’ new shapecast (thicc raycasts) and script a simple ball projectile that just rolls and moves around on the server (no physics but through teleporting super short distances, multiple times per second).

On the client you can use TweenService or manually implement a method to predict and smoothly interpolate/animate the ball as it moves around which might not always be 100% accurate but should be good enough in most common cases.

1 Like

I don’t want to separate client simulation and server simulation for the inaccuracy, the accuracy is needed.

I just need some way to make it so that the network ownership change (currently the person who last hit the ball has network ownership) isn’t too rough.

There will always be some inaccuracies no matter how much you try to eliminate that problem.
It’s the nature of online multiplayer with latency.

Most important part is that the ball moves if the player hits it and thinks they hit it.
Don’t worry about it being a few inches off from what other players see because this happens all the time in games but is cleverly disguised with visuals and rough predictions and estimations.

You’d have to make your game singleplayer to eliminate all of these issues which would ruin the point of a multiplayer game in the first place.

Roblox physics already seem to be working fine for most things. It’s about as good as physics in multiplayer can get without being computationally expensive and causing other problems.

(Don’t quote me on that, some engines do have better physics but I’m not here to compare physics engines right now, this is Roblox we’re talking about.)

I don’t want to change the approach I have atm, I only want to mitigate the network ownership change being too rough, there surely has to be a way that makes it better?

Unfortunately as far as I know, no.
Changing network ownership will always have a bit of a hitch.

But since it results in the ball teleporting back a short distance, you could try teleporting it forward to make it a bit more seamless.
But you will always have a hitch or some choppiness unless everyone has a perfect online connection with little to no ping.

Changing network ownership will always have a bit of a hitch.

Ofcourse, I don’t plan on removing that hitch entirely, because it’s not possible, I only want to ‘ease’ it somewhat, make it a bit better.

1 Like

Bump

You just want to “ease” the ball’s movement when the ownership changes?

Try measuring ping by sending messages back and forth between the server and client, use that ping to teleport the ball forward a X amount of studs so the hitch is less noticeable.

If you want to take the extra mile, make the real ball invisible and use a “fake ball” that has no collision and simply always moves and interpolates to the real ball’s location.

1 Like

The interpolation would look wacky. I could already disable hits before network ownership change, interpolate it and then enable hits again, but feel it’ll just look weird, the ball will basically look like it’s moving on its own.

Try measuring ping by sending messages back and forth between the server and client, use that ping to teleport the ball forward a X amount of studs so the hitch is less noticeable.

I don’t understand what you mean by this

You interpolate the fake ball to the real ball’s location in a RenderStepped event using RunService.
You can of course adjust how fast it interpolates and it shouldn’t look yanky.

You can measure ping by firing a remote event to the server and waiting for the server to fire one back to the client.
Measure the time it takes from the moment you send it and end the timer the moment you receive the signal.

The time it took for the signal to travel back and forth, that’s your ping.

The ball randomly moving to the player who hit it would look weird (distances are pretty big on pings of >200)

Bump

Hello, did you find a solutions to the problem ?