Does a variable replicates if its changed on client?

if say the client version of the actor somehow got out of sync and changed value of a replicated variable on the client then, will the server correct it next tick by sending the correct value automatically?

replicated variable can’t be set by the client, only the server can send them.
if they are out of sync, they have to wait the next update …

1 Like

Hey Commander Shepard,

Replication will only be triggered if set by the Authority (server).

Here is more information on UE4 networking:

So if by any means the client modifies a variable intentionally or unintentionally how long it would stay as incorrect? or when would server correct it?

Until variable was “Set” on server.

In fact, don’t forget that players can always cheat on their client version …
All important logic must be server side, and the server must check values sent by the client …

In my opinion, client shouldn’t set replicated variable on their end … And of course if there is a timeout, the client version won’t be updated.

The character class included try to predict next movements in this case, but I don’t know how they do that. Maybe a look in the code can help you

yes sir! I know that part.

The thing bugging me is if say the server version does not changes for a long time would that mean the client’s version that was locally changed will not be corrected for long time as well?

Like is there a mechanic in place so that whenever a client changes replicated variable locally , it would ask server to verify if its the correct one next tick rather than waiting indefinitely for it to change on server and hence get the next update after a indefinite time has passed

I know it can be made manually for specific variables as part of project’s mechanic but I was wondering if it was part of engine networking features

I think you are misunderstanding , I’m not talking about how logical changing var on client is instead What I’m talking about is what happens after the client has changed a replicated variable.

Ignore the why did it change it , its not relevant to my question at all.

Say a bool is true on server but client set it to false locally then if the server value never changes to false from true in the game will the client value ever be corrected?

That’s right. If the client changes a value and the server doesn’t know it changed it, the client and server will be out of sync.

The UE4 networking framework is setup where the server is the “authority”, meaning it holds all the “correct” values for all replicated variables. If you want to make sure that all the clients and server are in sync, have the client tell the server that it wants to change something, then on the server have some logic (if needed) to see if the value needs to be changed. If it does, have the server (authority) change the value based on the clients request and then since the variable is replicated, it will be replicated to the other client(s).

If you haven’t seen already, here is the documentation on UE4 networking:

Not rude or anything, but only the first paragraph of your comment is relevant to what I am asking about ,rest I know.

So the question is and I again say The question is how long will server and client will be out of sync? does the client ever ask server for correct value as part of UE4 replication?

Is the one and only condition for server to replicate a variable to client is change of its value on server?

Most important of all
Will the server ever try to correct the client version of the variable even if the value never changes on server?

Hope you understand what I’m asking.

this is top result on google so im putting it out there:

If the client changes a replicated variable, that variable will forever remain out of sync until the server decides to change it.

1 Like