Instantiate physics objects with interaction for all players

Hi,
I'm doing a arena based game where multiple network players can interact with physics objects, for instance several asteroids. Every player should see rotation and position of the asteroids, as well as be able to modify their position and rotation. I've tried a few different approaches: PhotonNetwork.Instantiate on OnJoinedRoom, this creates one asteroid for each new player. The player that joins "owns" the newly spawned asteroid, both players can see both asteroids move/rotate, but only the owner can modify it. PhotonNetwork.InstantiateSceneObject, only master owns it. And Thus only master can modify it.

So my question: How can I make every player own the asteroids? Would this be possible with some kind of grouping? Changing the group to anything other than 0 seems to make the objects not instantiate at all.

Comments

  • It's not possible by grouping or otherwise. Letting everyone modify a object is actually a complex issue: If several players decide to move the same object in different positions, they send conflicting commands and the result is undefined. Not a good thing.

    Each player can own his own objects. Alternatively, the master could own and act on behalf of the other players commands. This adds lag, of course but at least the result is clear.

    Currently, we don't support changing ownership of an object but in theory, the current owner could assign a new owner. This could (e.g.) be done by a RPC sent by the current owner. However, the buffered instantiation can't be updated.
  • Thanks for the reply, Tobias. The world of networked games are far more complex than I thought when I first set out on this journey. I'm going to have to rethink how to do this.
  • It's sometimes amazing how complex stuff is that looked so simple.
    Keep experimenting and you get into it after a while. Experience is key.