[Unity Pun] How to handle big amount of objects?

Hello, I would like to seek advise on how to handle big amount of game objects that need to be synced over network.

We have an app to load a big building (imagine a 50 storey hotel). The building consists of hundreds of small rooms. Each room has properties like sofa, tv, tables, chairs etc. We need to sync the properties, for example user-A move the chair-a, all others user should be able to see the chair-a is moving its position and rotation.

Whats the best way to handle such amount of game objects?

1. The easiest way is to spawn each of the interactable properties using PhotonNetwork.Instantiate (each will have its photonview), using photon transform follow component to sync its position and rotation. However, is this even possible? Is there any limits of how many objects can be spawned in a scene? Will this cause massive lag?

2. RPC/Event Method. Whenever user-a do an action, send an event/rpc to all users and update its position and rotation.

We are using, 100 CCU plan, 500 Msg/s per Room.

Please advise.
Thanks.

Answers

  • Hi @zaki,

    1. [...]


    This isn't a good idea. Although the limit of PhotonViews per client is 1000 per default, this doesn't mean that you should use them all. Instead you should avoid having too many PhotonViews at all, since they might cause a lot of messages and network traffic.

    2. [...]


    This is a better idea. Let me give you some additional input, which came into my mind while reading this topic. My approach would be to add a certain manager to each floor of the building. This manager handles the synchronization of the objects which can be moved. Therefore the manager has an overview about all objects on his floor. The objects in this case have an unique ID each. When a player now moves object A to position B, he notifies the manager which then synchronizes those changes with the other players. This can be done with RPCs or by using the RaiseEvent function. In both cases, the manager creates a message which has the performed action as content, for example: Object A moved to position B.
  • Hello @Christian_Simon ,

    Thanks for the reply. I will try that out.
Sign In or Register to comment.