Cached event not received

Options
Hello, i've stumbled upon this problem and i'm not sure whether it's my fault or bug.

I am using photon realtime. I send request to master client (checking if i can purchase something) and when i receive confirmation i send new RaiseEvent with caching options (want to let everyone know about my purchase) .. but, no other player receive that event, and strangely when i call that caching event on MasterClient, he sends it and receives it right back in OnEventCall (but nobody else)

void CacheBuyPowerUp(PowerUpType puType, int team) {
RaiseEventOptions eventOptions = RaiseEventOptions.Default;
eventOptions.CachingOption = ExitGames.Client.Photon.EventCaching.AddToRoomCache;

Hashtable data = new Hashtable();
PowerUpType[] pus = new PowerUpType[1];
pus[0] = puType;
data.Add("powerUps", pus);
data.Add("team", team);

PhotonNetwork.RaiseEvent((byte)EventCode.CacheBuyPowerUp, data, true, eventOptions);
}

There is the code. i really don't know what is going wrong. Thanks

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    edited March 2016
    Options
    Hi @Marek,
    [...] and strangely when i call that caching event on MasterServer [...]
    Photon events are room events that can happen only on GameServer, i.e. when joined to a room.

    Please verify that you're properly doing event caching using this checklist from Cached Events doc:
    Events will not be added to cache if any of the following conditions is met:
    • RaiseEventOptions.Receivers == ReceiverGroups.MasterClient.
    • RaiseEventOptions.TargetActors != null.
    • RaiseEventOptions.InterestGroups != 0.
    If that's the case, can you please clearly state what made you say that cached events are not being sent properly to rejoined actors or late joining ones? What's the unexpected behavior here?
  • Marek
    Options
    As you can see i'm using RaiseEventOptions.Default; which defaults to Receivers == RecerverGroups.Other .. i dont specify TargetActors so its null and i'm not setting interest groups.
    Well already joined players don't receive that event nor later joining ones.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    Please check my updated answer about trying to send events on MasterServer.

    Also are you sure that clients that should receive the events are joined to the same room? How many actors in the room when you try raising events? Did you try sending events when other actors are joined without caching them?
  • Marek
    Options
    [...] and strangely when i call that caching event on MasterServer [...]
    That was typo sorry, i meant when i call CacheBuyPowerUp() on MasterClient.
    MasterClient receives that cached event right after raising it.

    Yup players are in same room. Well tested with 2 and 3 actors. I'll try with caching disabled and let you know.


  • Marek
    Options
    Uh well .. .found the problem.
    I use RaiseEventOptions eventOptions = RaiseEventOptions.Default;
    and then change some vairables in eventOptions .. even RaiseEventOptions.Defaults is set as readonly .. it changes .Default variables to my settings .. so because of previous events which specify receiver == MasterClient and another one which specify targetActor its not working propertly!
    I think this should not be possible;

    So recap:
    (everywhere i use eventSettings = RaiseEventSettings.Default)
    I raise event with target actor
    I raise another event with Receivers = MasterClient
    then i try send caced event but RaiseEventSettings.Default have Receivers==MasterClient and targetActor = e.g. 1
  • JohnTube
    JohnTube ✭✭✭✭✭
    Options
    so problem solved?
  • Marek
    Marek
    edited March 2016
    Options
    Yes, but still, shouldn't .Default be unchangeable? I thought it's something like Vector3.zero; .. just shortcut for new Vector3(0,0,0); -> new RaiseEventOptions();
  • Tobias
    Options
    Instead of sending one event, you send 3? One of those is buffered??
    Why?
    If you send to everyone, cached, then the Master Client, the target player and everyone else is getting the event anyways!

    Using RaiseEventOptions.Default and then changing the values is not recommended.
    You can use new RaiseEventSettings() and then change that instance's values.
  • Marek
    Options
    Well yes, 3 is redundant (in ideal case), however, i have 2 teams, 2 players in each team .. they collectively buy powerups, so i have to be sure when one buys powerup1 his teammate is unable to buy it, and i need to ask masterClient if i can buy it so there wont happen any "roundtrip issues" like when we click buy button at same time. .. Still its just few events in lobby, not something i will be doing in game 30times a second.
  • Tobias
    Options
    Then I'm reassured it's not a problem. Thanks for the insight.