A problem I’ve noted is that to much information is sent over to the server…
I have a remote event called “Force” that I can fire to add a body force or a body velocity inside a part X seconds. BUT I do this a lot in the local script and I’ve tried using HeartBeat instead of render stepped but it didn’t help a lot, if I could find a way to skip firing a remote event this would make the game less demanding for your computer power. And I’m thinking if there’s a way to make a force inside a client script effect a server part, If anyone has an idea how to please comment on this!
If a player has network ownership of the Part the physics will be calculated by them but still replicated to the server for everyone else to see without the need to use RemoteEvents
This does mean that they’ll have the power to move the part wherever they please if they’re an exploiter, so you’ll still need to check the part’s position on the server to make sure nothing too abnormal is happening
I remember this issue from way back and encountered the same thing. I solved it by treating it as I would a projectile in a very similar scenario. So you’d want to find a start and end goal. Get the relative path between. Visually calculate the object moving on the client and use the server to monitor the path between. This way, if the object somehow manages to out-of-bounds the path, it’s easy to detect whether or not this should happen.
If this is more than one object (like a projectile), I usually only render things that the client can see relative to other clients via a radius. It saves potential performance issues and no one really cares about things they can’t see.
I’ve found a solution but sadly not clientwise and its to instead do the calculations inside the server which means I skip firing a remote event every frame, Sanjay has a good point and for anyone reading you could do what he did but for me it was impossible to get body forces to work inside clients but still simulate physics. Thank you Sanjay and JohhnyLegoKing for spending your time to help me
You can set the network owner of a Part by using the :SetNetworkOwner() method which takes either a Player or nil (nil is equivalent to the server in this case) as its argument. The method will only work when used inside of a server Script though
When the player fires the object you’ll need to use a RemoteEvent to send a signal to the object in order to be able to use SetNetworkOwner, although you won’t be able to do this if the object is being created on the client
So the solution is to set the part there physics are involved to the network owner and then I can add body forces inside that part in the client to affect it?
Since the client will be the network owner, I think creating the body forces in a LocalScript and parenting them to the part it should still start to move and any jittering or stuttering might no longer be a problem
Ok this is weird, the jittering effect is caused by the server view of the player being REALLY REALLY laggy. This is something I have to keep myself away from since the whole game relies on physics