I'm modding a FPS game by adding a 2 player co-op multiplayer to an otherwise completely single player game.
One game instance acts as the host and I try to implement the synchronization of the gamestate as host-authority. The host does a full game state sync every 3 seconds, and inbetween, the host and client mostly exchange small diffs.
The client mostly asks the host to perform certain activities, such as building, adding and removing to/from chests both players can see and interact with.
For example, the player wants to add an item to a chest, so it puts the item into the chest locally, then sends a request to the host so the host does it too on its end. However, if there is a full game state sync right at the same time, the host doesn't know about the item yet, and makes the client remove the item from the chest the client just added. Of course, a bit later the host confirms the original request-to-add and both client and server see the item correctly in their inventory. The item flickers in-and-out for the client which looks confusing.
(There is a reverse problem of this where the client removes an item, the host full sync puts it back, then the acknowledgement removes it again.)
How can I work around this?
What I thought but haven't tried yet is to set a flag on the chest/item on the client so if a full sync comes between the request and acknowledgement, it is ignored by the client with respect to that particular chest/item.