Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to prevent lag with body velocity? While setting owner to server.

Asked by 3 years ago
Edited 3 years ago

Hello,

I am currently working on a game which has objects moving with the help of BodyVelocity, BodyAngularVelocity and BodyPosition. All scripts are run from the server.

However, my worry is that since the owner of the parts is set to nil, there could be some lag encoutered by the users if there many playing. My game will have to handle 25 players.

I have mostly encountered lag while using BodyAngularVelocity to turn an object in a constant velocity. It sometimes stops, then continues. Same with Body Velocity.

My question is, how could I reduce the lag so that the physics rending becomes smoother for all players?

Now, I've thought about running heartbeat and the stepped event so the physics is rendered at each frame but how am I supposed to use that since all I have to do is change the vector3 of any body movers and it takes care of the rest... It's not like I have to move it constantly with a code. All I need is to change the settings of the bodyVelocity or bodyPosition and it moves on its own. Am I missing something? I never played with RunService.

If I don't set the network owner to nil, then the parts will lag even more. I want the objects to move at the same rate for every player.

But my worry is whether or not this would cause a lag if there are 25 players playing together and all physics rendering is run from server. How could I fix it so it doesn't lag?

Your help is much appreciated!

Thanks.

0
As an example, whenever I jump off the part which uses body angular velocity to turn, it stops and moves suddenly. How can this be prevented? DevMaster333 215 — 3y
0
Update: I changed the Max Torque vector 3 of the angular velocity to math.huge and the lag has close to disapeared. Is using Math.huge going to cause a problem? DevMaster333 215 — 3y

Answer this question