ChangeGroup and setting Interest Group order

Options
juaxix
juaxix ✭✭
Hello, I am trying to use interests groups. Here it is what I do:
- Raise an event with interest group = 0 and receiver group = 1 (all including local player)
- I can see that the event is coming to the local player, and other players

Now, setting the interest group = 1 and doing the changeGroups ( nullptr, new byte[1]{1} ) , it does not work.
What is the correct order? I have tried everything, sending the event multiple times, changing the group, in different orders, but could not get the event for the local player. I am not using caching for this event.

Any clue?
Thanks

Comments

  • Kaiserludi
    Options
    Hi @juaxix.

    Combining interest groups and receiver groups is not supported.
    Let me quote the API reference on setInterestGroup() at https://doc-api.photonengine.com/en/cpp/current/a05602.html#a432e532572990df1b66c978f571d2cff on this:
    If you set this option to anything else than NULL, then any value that might have been passed for setEventCaching() will be ignored.
    The options setTargetPlayers(), setInterestGroup() and setReceiverGroup() provide alternative ways of specifying the receivers of an event and can not be combined with each other.
    If getTargetPlayers() evaluates to !NULL, then the value for the target players gets used and the values for the other 2 options get ignored.
    Otherwise, if getInterestGroup() evaluates to !0, then the value for the interest group gets used and the value for the receiver group gets ignored.
    Else the value for the receiver group gets used.

    As you can see, you should either set the interest group or the receiver group, but not both.
    If you set both of them to non-default values, then the value for the receiver group gets ignored.

    This makes sense if you think about it:
    Setting interest groups would be pointless, if still everyone would receive the event that is supposed to only be received by the specified interest group.

    However that still does not explain why the sending client isn't receiving its own event although it is subscribed to that interest group.

    This is caused by known limitation in the server: currently only other players inside the same interest groups will receive the events that are sent to that group, but not the sender itself, even if it is subscribed as well.
    We have an internal change request for this, but such a change is unlikely to happen before Photon 6 (if it will happen at all - it still is discussed if we want to change that).

    For now, as a workaround you would need to call opRaiseEvent() two times with the same payload:
    One time with the interest group and a second time with the target players containing the local players player number (but not any other player numbers aside from the one of local player, so that other subscribed clients don't receive the message twice.)