Network Pool Manager

Options
Recently I do a research on performance optimization on mobile platform game.
There are a lot of forum and website discussed that Instantiate() and Destroy() is very expensive function which are consume a lot of CPU memory. Therefore, Instantiate & Destroy might cause the performance problem on mobile platform.

I would like to ask whether PhotonNetwork.Instantiate() has the same issue ? If it does, about how many of the Game Object instantiate using network is allowed to maintain the performance of the mobile platform.

Besides, I do found the Pool Manager which will solve the performance issue of Instantiate & Destroy, so I think isn't possible to use the Pool Manager with the manually instantiate?

Any advise will be appreciate.

Comments

  • dreamora
    Options
    It has the same issues.

    And the problem is not the amount but the amount per time as Instantiate / Destroy trigger the OS memory alloc and dealloc calls which is what causes the costs. It has nothing to do with the engine etc.

    And its possible to use the pool manager and do it that way. all you have to do is replicate what photons convenience methods do, registering the photonviews etc
  • Tobias
    Options
    The Pool Manager? Where can we read more about that?
    You could probably integrate the Pool Manager in PUN, replacing the (few) places where the engine's Instantiate and Destroy are called.
  • Tobias
    Options
    Ah, interesting!
    PUN 1.18 now keeps loaded resources in memory, ready for instantiation. That doesn't avoid the instantiation overhead, so a game object pool might be pretty useful.
    Did someone here implement this into PUN before?
  • 2Kin
    Options
    No, because the state of the players seems hard to reset... without speaking of re-allocate the ViewID (etc).
    But it's definitely not to PUN to implement this.
  • Tobias
    Options
    Hm? I thought the pool would be used to keep instantiated game objects?
    If you just replace PUN's Instantiate and destroy calls, that should be doable. In worst case, a reset for the PV would be needed.
    What am I missing?
  • Hey,

    I just found this, is there anybody who used it? :)

    https://doc-api.photonengine.com/en/pun/current/interface_i_pun_prefab_pool.html

    Cheers!