Match game with joined clients

Options
Hi.

I have an array of Transforms that will change during the game, when a client joins an on going game, i want them to have the exact same array as the other clients there are playing. But i don't think i can send it as an RPC, so what should i do to match the joined clients array with the clients there are playing? Anybody got any ideas? im really stuck on this one :(.

Comments

  • Tobias
    Options
    How does the array of transforms get created?
    You can use properties of a room to "save" what objects it needs to create and what's in the array of transforms.
    By the way: if you only need position and or rotation, it might be more effective if you send those instead of a transform (which also has scale).
  • They get created like this:
    public Transform[] cubes;
    
    cubes = new Transform[81];
    
    And they contain some objects that gets destroyed doing gameplay and i need to destroy the same objects for the new client that joined the room. Also each object inside the array has an unique name. Wouldn't it be too much if i had to create 50+ room properties?
  • Tobias
    Options
    PUN usually uses PhotonView component (PB) and PhotonNetwork.Instantiate and PhotonNetwork.Destroy to organize which objects are existing. The PVs also allow you to sync positions - automatically or more customized with your own scripts. With such a setup, you don't have to take care about which objects exist or if they are in any array. They get their very own ID assigned and sync this way. But control is only available to the client that Instantiated a GO.

    Would that fit your needs, too? Seems to be easier to use existing features :)
    How this is used: http://doc.exitgames.com/photon-cloud/M ... o_Tutorial
  • Don't know why i didn't think of that. That could be perfect! Right now they get instantiated by RPC and this would be allot easier and better. Thank you for your help! :)
  • Tobias
    Options
    :D