Choosing between Persistent and non-persistent game rooms

Hi!
I'm currently adding in asynchronous support into our game with users having the option to toggle 'real time' (where players who drop can come back in X minutes before their role is taken over by someone else) or 'asynchronous' where roles are permanent and anyone can take their turn at any time.

I've setup the backend webhooks and have the client functioning mostly. But I can't seem to find a clean way to split this functionality. It seems it's all or nothing on photon's end? All game rooms are sent to my web service. If I add in logic to the backend to ignore 'real time' games it may cause errors on the server it seems like.

I'm considering just saving all games to the web service, but since real time ones have PlayerTTL > 0 they'll expire quickly and just having client UI hide games with these values.

Is there a toggle somewhere I'm missing or is "IsPersistent" truly app wide?

Comments

  • JohnTubeJohnTube mod
    edited July 2016
    HI @onealexleft,

    Thank you for choosing Photon!

    Your are asking very interesting and good questions! I like that.

    If I add in logic to the backend to ignore 'real time' games it may cause errors on the server it seems like.


    No it's safe to do so as long as you don't try to re-join that room or let other players async. join it. To make it safer, make sure to close room and set it to invisible once all players have joined. If you use "AsyncRandomLobby" then that's another story.

    In general, "IsPersistent" webhooks setting is "truly app wide" as you mentioned, so it's "persist" all or nothing.

    BUT... you may play with the TTL values to get around it. The following information is available in this Room Persistence Guide CheatSheet.

    For your "realtime rooms" you should follow this rule: 300.000ms >= EmptyRoomTTL >= PlayerTTL >= 0. This way, all players expire and room becomes empty before EmptyRoomTTL. You will receive GameClose Type="Close" instead of Type="Save" webhook.
  • JohnTube said:


    For your "realtime rooms" you should follow this rule: 300.000ms >= EmptyRoomTTL >= PlayerTTL >= 0. This way, all players expire and room becomes empty before EmptyRoomTTL. You will receive GameClose Type="Close" instead of Type="Save" webhook.

    Ah, thanks for that bit! Right now we have a total of a minute for the player to 'expire' in a room before their role is given to someone else. I suppose I can set the emptyRoomTTL to go to 1.5minutes (currently set to 0) so games won't linger on the web service with zero players.
Sign In or Register to comment.