Instantiate/Destroy when joining late in the game

Hi, sorry a bit of a newb question I'm afraid.

I have a game which is designed to be a drop-in / drop-out multiplayer where a lot of AI monsters are spawned and destroyed.

Am I right in thinking that it is bad to use PhotonNetwork.InstantiateSceneObject and PhotonNetwork.Destroy to manage the AI spawning/destroying, because these will just create a ton of unneeded buffered messages for newly joined players to instantiate and destroy AI that are no longer in the game? Or does the Destroy call remove the buffered instantiate (and itself) from the list of buffered messages that are recieved by subsequent joining players?

Comments

  • Hi,
    Or does the Destroy call remove the buffered instantiate (and itself) from the list of buffered messages that are recieved by subsequent joining players?
    This is correct. Do make sure you are using PhotonNetwork.Destroy on the owner of that object (or by the masterclient). Note that a regular Destroy(GameObject.Destroy from Unity) does of course not remove the buffered instantiation call.

    So if you spawn and delete every minute or so, there is no performance impact for new clients as they'll never even 'hear' about these actions.
  • Leepo wrote:
    Hi,
    Or does the Destroy call remove the buffered instantiate (and itself) from the list of buffered messages that are recieved by subsequent joining players?
    This is correct. Do make sure you are using PhotonNetwork.Destroy on the owner of that object (or by the masterclient). Note that a regular Destroy(GameObject.Destroy from Unity) does of course not remove the buffered instantiation call.

    So if you spawn and delete every minute or so, there is no performance impact for new clients as they'll never even 'hear' about these actions.

    That's great news, thanks :)