Am I hitting an event cache limit?

I have created a 2-player turn based strategy game, using Unity & Photon Realtime to send custom events back and forth between the players in a room. I am now working on adding the ability to spectate a game, by having additional player(s) join the same room as the 2 players and get fed the cached events. (The spectator then replays those events.)

This is working well in general, but I've run into a very specific and reproduceable problem: if I let my game finish (but the 2 players stay in the room keeping the room alive), and try to add a spectator. The spectator gets ~300-350 events from Photon's event cache and successfully replays all of those events. But then Photon just stops sending me cached events and doesn't send me an error either. There can be about 600-700 cached events in a game. I've implemented IErrorInfoCallback.OnErrorInfo to ensure I'm not missing errors from Photon.

My biggest data point that this is a photon issue - is that I can reduce the size of my events. Currently I'm sending the state of the game in some events for double-checking and this can be hundreds of bytes per event. When I remove this feature, I AM able to receive all of the cached events for that game.

It really feels like I've hit some limit with the Photon event cache. It seems to be related to total event cache size in a room. Is there a way for me to verify that I am hitting a limit here? Shouldn't I be seeing some error back from Photon in this case? Is there a way to raise this limit?


  • Photon Realtime (and PUN, etc) does not support spectating well. It may work with the event cache for small games but ultimately that is meant to store some events players need to get into the current state (not to replay the game).

    When you store a lot of events with lots of data, there is also the potential to flood the send buffer on the server. This will also cause a disconnect (and atm, we can't send a info message about this).

    We didn't have the limits in older versions and so there is no error info yet.
    We could check the server log for this. Mail us to [email protected] and send this description plus the appid and client version you use.

    Is there a way to optimize and aggregate the game's playback info?
  • Ok, thanks Tobias. I emailed [email protected] as you said.

    The next step will be to save/send game state between my clients, but I was hoping that the event cache would provide a cheap and easy way to do it for me. It's honestly not a ton of data, since its a turn based game and consists of 24 turns and only 2 players.