Handling players in same Photon Room but different Scenes

Options
Hi everyone,

In our game, it's possible for players to be in the same room but different scenes. For example, if we have 4 players in the room, one player might be in the "camp" area, while the others are in the forest area (a different scene than the camp scene), while the other two might be in a cave area (yet another scene). It's kind of like in Diablo II, where one person could be in the camp, while another in an area far away.

I know this is a long shot, but is there any way for Photon Unity to support this? We use photonnetwork.instantiatesceneobject and photonnetwork.destroy in our game to instantiate and destroy mobs, but if the players are in different scenes, we get a lot of errors because the game is trying to network-instantiate or destroy a mob that doesn't belong in that scene.

As I understand it, photonnetwork.automaticallysyncscene will not work in our case, because that'll cause all clients to sync to the same scene, whereas in our game we actually want to allow clients to be in different scene while still connected in the same room.

Does anyone have any ideas on how to achieve this, like maybe a way to "block" all scene object instantiation and destroying, unless the players are in the same room? I've tried looking online and through the forum messages to see if anyone was doing this, but surprisingly couldn't find anyone else in the same situation. I do understand that this might not be the intended use model for Photon Unity, but I'm just wondering if I'm missing anything, or doing anything wrong on my side.

Thanks, and as always I really appreciate the support!

regards,
William

Comments

  • Tobias
    Options
    Provided you stick to low(ish) number of players, you can load any scene on any client, if you need to.
    The server (and not even the other clients) take note whatever you load or display.

    Be aware that the positions are world-coordinates, unless you do something about that. So your dungeon scene can't overlap the town or else someone who's in a house might walk through your monsters.
    You are right about LoadLevel and automaticallysyncscene. Don't use it in this case.

    Be aware that Unity discards anything on load!
    In some cases, you might be better off by using one scene but loading/unloading assets on demand (by position or some indicator, maybe).

    You might want to take a look at Interest Groups as described in this article:
    http://www.m2h.nl/network-traffic-culling
  • Thanks, Tobias! Yeah you confirmed what I had thought, which is good so we know where to focus our efforts.

    The network culling article you pointed to was quite useful; I've bookmarked that page and will use it too. We're testing 3 player and 4 player scenarios now, and it's really important to keep network traffic low.

    Thanks again - much appreciated!

    regards,
    William