Syncing non humanoid character across all clients

I have created non humanoid custom character that is created and controlled in a local script. I now want to sync this character so that it can be viewed by all players in the game and I was wondering what the best method to do this was.

  1. I first tried sending the position and orientation of the parts to the server using remote events and updating a replica of the character in the servers workspace. This works however to make it smooth I have to send a lot of remote events which ends up sending a lot of data. A lot of data is also sent back to the other clients from the server and gets worse the more players that join which is not ideal.

  2. My second attempt was to keep all characters in the server workspace and use SetNetworkOwner on all the parts of the character. This worked and used much less data but now I have a problem where parts of the character randomly move up and down as seen in video below:

Does anyone how I can either:
a) Reduce the amount of data sent and received in my first method (currently sending the position and orientation of each part in a array)
b) Fix the parts moving about in the second method
c) A different solution to my problem

Any help is greatly appreciated

Update for anyone that find this post and has the same problem I’ll write my solution:

Each client sends a array of the parts cframes every 0.1 seconds. These go to the server and straight to every other client. This client then lerps each part between the current position and the updated one. Obviously this isnt perfect but its a good starting point

What you’re describing is a classic problem that all multiplayer games deal with in some way. You should look up “multiplayer network interpolation” to learn more about the topic. Valve has some really good documentation showing how they do it in their multiplayer games.

A common way to solve the problem you’re describing is by using packets of data, where clients frequently send and receive packets of data to and from the server. The packets of data usually contain important info (like player inputs) that the client has made since the last time it was able to communicate with the server.

What you could do is have the clients constantly recording their inputs/positions or whatever, and then however often you’d like, send those packets to the server to then be sent to all the other clients. The other clients would then playback those packets of information. Depending on how often you send those packets, there will obviously be a delay in when a player performs an action and when all of the other player’s see that action, but that’s a hurdle that is impossible to 100% overcome when using the internet.

So basically, do what you’re doing in your first method, but instead of sending one frame at a time, lump many frames together in a single transmission.

1 Like

Thanks, was hoping there would be a simple built in solution but guess it never that easy :slight_smile: