How much of a players data should be synced with the client?

Basically, my game involves multiple values on client and server. In order to make it look smooth, the client immediately sees any change it makes, but will update with the data stored on the server every 5 seconds.

  1. If the player is in a state where they can do something locally, but the server is behind, do I wait a period of time or deny that request?

  2. Is it worth syncing all values? If both client and server run the same code, there shouldn’t be any discrepancies.

1 Like

Easy fix would be to update the server every time the client clicks to get said incremental values. The bandwith will not change due to the firing of remotes, afaik. I think you are overthinking the server to client model setup in Roblox, make sure to write your code how you would logically think it should work and then if you encounter problems try to revist the code to learn from if. If stuck in said process, then contact developers of knowledge to that task or research online for already solved solutions. And yes you should be syncing all the values they have but make sure to do some sort of check on server if you are just processing client inputs. I hope that helps :slight_smile:

1 Like

The only event being fired regularly would be the clicks, but is there reason to update every single time a change is made? I’m not sure how intensive that would be on a users bandwidth. But either way, in order to prevent delays with lag (E.G, player doesn’t need to wait half a second for their value to increment after clicking), the client runs the same logic as the server.

EDIT: But, the server is constantly updating values, perhaps up to 10 times a second. Maybe I’m just really overthinking this and the Roblox engine might be more than capable of this with little network usage.

For me, I have every player’s data in their own folder in ReplicatedStorage. Rather than firing back to the client using a RemoteEvent, I simply change the values in their folder in ReplicatedStorage. The client is automatically linked to the folder, and uses it to fetch their data. I experience no issues with this.

1 Like

Yea it’s more than capable of your remote fires. Make sure as I said before to validate the actions of the client.

The ReplicatedStorage is separate for both the server and client during game sessions. Changes made in ReplicatedStorage by a client during game will not be replicated for the server, so the method you mentioned wouldn’t work.

I don’t use remote events to sync data, I have ‘local data’ in the player instance, which is displayed to the client, and store the servers data in modulescripts in ServerStorage. It then just every 5 seconds makes sure all the client values are the same as the server data ones.

If I updated every single time a value changed, wouldn’t that make it look glitchy for the player? They click > client displays reward and sends it to the server > server validates > server overrides client value. When the server over rides the client value it would theoratically make the server ahead of the client in terms of what is displayed. I might just not like the idea of it, but is this kind of delay fine?

I could eliminate the client handling idling/afking rewards since they most likely won’t notice the difference if their reward/s starts increasing with a delay. This just leaves the problem to the above one.

EDIT: Yeah, really the only thing the client needs to do is estimate reward for clicking and currency changes (E.G gaining currency via selling, or buying an item)

It won’t glitch, there’s not that much latency between the server and client in most cases. If however you are afraid of this occurring, you can change the value on client as soon as they click and then update the server value to reflect their click (the server will only be validating the input and if they are right and changed the value then nothing would practically change for the client but if the server overrides it then the client did something differently then what the server would have preferred.)

I never mentioned changing anything on the client. I use it in all of my games, so I’m pretty sure it works smoothly.

Most players won’t reach rates that will render their inputs useless and if they do the, there will be more problems to work with then the clicks registering. As I don’t believe they will be able to enjoy the game at that point.