Best practices for controlling many objects

Options
In a physics game, and with many objects (more than 100) that can be moved by players, what is the best way to control the position of all objects, so that all players have the same view?

I'm new to multiplayer system, so I do not know how to do it the most efficiently and with least data sending.

Answers

  • Hi @dsgames,

    this is hard to say. If you have so many objects it might be a good idea to spread them across multiple clients, so that you avoid one client that needs to control all objects, but have for example four clients whereat each client controls 25 percent of the objects. Another good idea might be, to merge the object's update messages to one custom message, that gets sent across the network, so that you send one message containing more information instead of sending a lot of messages containing less information.

    Physic objects on the Cloud are also interesting to handle because you will have to apply lag compensation to make the scene look good. So besides sending only the position and the rotation of an object, you also need to send its velocity, which a remote client can use, to apply lag compensation. This way the scene looks identical on all clients even if it is not exactly the same.

    As a beginner you should check the documentation pages and guides first and also have a look at the demos included in the PUN package, before starting a bigger project.

    If you are done with that, a look at TrueSync might be also interesting for you.