Multiplayer: client specific object visibility

Hi,

We’re making a multiplayer game in which the players are in different layers of the same world and they can’t see each other but they can interact with objects and send them back and forth between each world’s layer.

So client A might see a box the client B doesn’t, and when he interacts with it client A doesn’t see it anymore but client B does.

The problem we have at the moment is that the objects are owned by the server (not dedicated) so their visibility is replicated to every client. So if client A is the server and he hides an object for himself, no client will ever si it.

Can I disable the mesh’s visibility replication, is there another workaround? Thanks in advance.

Thanks for your input, what you described is how we implemented it at the moment. The problem we have is that when the server updates it’s layer id and changes it’s local visibility, the visibility is replicated to other clients instead of being locally controlled.

How can we let each client manage it’s own visibility, considering the fact that one of those clients is the server too?

One of the ways i’m thinking this could work would be the following:

  1. Every interactable object, has a number(replicated) that corresponds to the layer it is in.
  2. OnInteract, call server, saying that this object now has new layer number
  3. Objects are replicated using the OnRep (this will give free multicast)
  4. In the OnRep function , you need to check the layer number with clients layer number, and set visible if they match, otherwise hide.
  5. Remember that Server doesn’t receive OnRep, so manually call visibility update function if Role == Role_Authority

hope this helps in any way!

Are yo using C++ or Blueprints? In C++, you can have a bool bIsVisible replicated, but with a a condition of SKIP_OWNER which means, that other people will see the server version of your visibiity(e.g not visible), while you can maintain the object visible locally.