Slow network causes my plane to lag

The problem:

I have coded a little plane which is controlled using WASD & QE. Currently the plane consists of a single union with a body velocity and body gyro for movement. As filtering is enabled, when a key is pressed, a remote event tells the plane which key, and the plane responds accordingly.

Link: https://www.roblox.com/games/1378846432/Naco88s-Place-Number-396

image

Locally in studio it works seamlessly. However when running it in game, I experienced some lag.

To try and get around this, I tried setting network ownership of the plane union to the player,

Plane:SetNetworkOwner(player)

This seemed to fix the major lag issue in game so I continued.

However, when showing the plane to a friend at college today (on the very slow network) in game, movement still took a few seconds to respond, even though I thought i’d fixed the issue by setting network owner.

My dilemma is, should I be worried? Though it works fine on my decent internet, the fact lag still exists on slower networks is a big issue for me.

Solutions I have thought of

  • I have considered moving the planes locally and constantly sending its position and rotation to everyone else in the server, but this seems a bit hacky and I’m not sure if Roblox can cope with that.

Games like jailbreak and tiny tanks seem to move vehicles locally and replicate them to the server, I know this is also possible with Roblox vehicle seats. So my question is: is there a built in way to do this?

If not, can anyone recommend the best way of coding it in?

Thanks :space_invader:

1 Like

If you have the network owner of a part set to a client, that client is able to move them around with local scripts and have it replicate to the server.
It’s effectively the same as how characters replicate to the server.

So you should move your movement controls into a local script, and not use any remote events. Typically anything controlled by a player’s input (cars, tanks, planes, guns etc.), should have the effect run on the client (and in the case of guns, verified before replicating on the server), to avoid latency becoming noticeable.

2 Likes

I was not aware of this but it quite literally saves my life.

Thanks a lot, that solution was faster than I thought :star_struck:

1 Like