PhotonView "Groups"?

Options
What is the "group" parameter on things like Instantiate() for? The walkthrough documentation says "ignore this for now" and the API reference docs unhelpfully say "The group for this PhotonView" (when the docs aren't even on PhotonView - copied from somewhere else, I guess).

So - what is group and what is its purpose? I imagine this is a way to do things like route RPC calls to a subset of players or types of objects? I'm only guessing, because no docs say anything either way.

Thanks!

Comments

  • I believe the idea is that you could set up some sort of area of interest using the groups, but I don't believe it is implemented at this time.
  • vadim
    Options
    Use PhotonNetwork.SetReceivingEnabled method to enable updates on client for objects created with group != 0. Without that call, updates for such objects will be skipped.
  • Tobias
    Options
    Groups are a simple Interest Management tool. Anything that is sent for a group > 0 will only arrive on clients that are interested in the Group (set via SetReceivingEnabled).
    This does not define what a "group" means in any game but a common use case is to use a group for a specific area in the scene.

    This is one use case:
    http://www.m2h.nl/network-traffic-culling

    There are several problems and those turn "Interest Groups" for PUN into a tricky topic which is hard to explain. We figured we need to explain other topics first, so this is not well documented and I can't help by just summarizing things quickly, sorry.
  • It makes perfect sense actually. Say I have 4 separate "arena arenas" on the same map, and I separate each area by invisible Plane colliders, and then each time a player passes through one of the planes, it would call SetReceivingEnabled to 1, 2, 3, or 4 depending what arena area they just entered. As a result, only players within each arena will get messages about one another.

    Is my logic correct on this Tobias?
  • Tobias
    Options
    Your basic idea is correct but you are missing the point that you only get updates from the Interest Groups that you enabled. This way, you have to make extra sure that you can't ever see the neighboring areas as no player in them would be visible.
    The traffic culling solves this issue nicely by layering groups on top of each other and using them in a clever way to have less updates from objects in far-away areas (groups).
    But the principle is correct as you describe it.