Ive been making a socketio server for realtime unity games just because and I encountered a problem. In my game each client objects tell the server their state with a simple struct with a couple a fields , nothing big and the server then broadcasts it to the rest of the clients. Since I use redis behind all clusters I had to check on a timestamp I sent with each packet to be sure Im not overwriting updates with old data from another client that happened to arrive a little late. Doing this did improve the problem but still theres something wrong with the way im doing things as it doesnt work as intended (some updates are positions) and , for example, with an object falling , the object goes back up a little every couple of frames. I can tell what the problem is but I dont really know how to fix it. How do I take in to account that if an object is falling no to take data that positions it above the position in the previous packet without making handlers for each physics event and input??
How to order data in packets?
I don't have any formal knowledge in the area of networking and socket programming, but have you considered interpolating values based on time stamp to try and smooth that stutter you are seeing? I feel like that's a thing...
It might help to delay the broadcasting of messages for a short time (like 1ms) to wait for messages with earlier timestamps to come in, and then broadcast messages in proper time-order. This would require time stamps with greater than 1ms precision though.
The problem could be because of how you're sending the data to begin with. For example, if you're sending position updates instead of velocity updates, it might minimize the issue to do velocity updates.
I've only ever made local network multiplayer games, but I always assumed you could always drop packets older than the ones you handled, unless they have critical information.
So if a packet has movement data in it that's old, you can just drop it if you have something newer.