EmptyRoom TTL?

The whole answer can be found below.

Please note: The Photon forum is closed permanently. After many dedicated years of service we have made the decision to retire our forum and switch to read-only: we've saved the best to last! And we offer you support through these channels:

Try Our
Documentation

Please check if you can find an answer in our extensive documentation on PUN.

Join Us
on Discord

Meet and talk to our staff and the entire Photon-Community via Discord.

Read More on
Stack Overflow

Find more information on Stack Overflow (for Circle members only).

Write Us
an E-Mail

Feel free to send your question directly to our developers.

EmptyRoom TTL?

LaundryOnMyAbs
2018-02-07 00:53:43

Is there a limit on how long/ how many ms EmptyRoomTtl can be set? I read that it is 1 hour, but that was from a thread in 2015 and I dont know if its changed. Also, if this is the case, how would I go about making a room timeout infinite? Thanks

Comments

JohnTube
2018-02-07 02:07:48

Hi @LaundryOnMyAbs,

Maximum value for EmptyRoomTTL

  • Photon Cloud 300000 milliseconds (5 minutes)
  • (default config value) self hosted Photon Server 60000 (1 minute)
how would I go about making a room timeout infinite?
You can't. What you can save and load room state using webhooks. See "Persistence Guide".
I read that it is 1 hour
Where did you get this from? Maybe you are referring to AsyncRandomLobby.

LaundryOnMyAbs
2018-02-07 03:00:59

Oh yes, It was AsyncRandomLobby. Thanks you for the info.

LaundryOnMyAbs
2018-02-07 03:14:59

I am currently using playfab as my web service and all the webhook paths are configured (just named, the code doesnt do anything, should it?). I assume the state will automatically be stored when a player disconnects (through the handler.roomclosed cloudscript, is this automatic?)? The persistent guide section "cheat sheet" shows that the room will be removed after all players leave for >EmptyRoomTtl ms, so how is it that I can load the room state from webhooks when EmptyRoomTtl has timed out (do i have to manually set create options to type=2?, or do something in the cloudscript code)? I have set PlayerTTL = -1 and EmptyRoomTtl > 0 (300000) and the room times out after 5 minutes. I know im missing something (probably cloudscript code) but I'm not sure what to do. Any suggestions? Ive read every guide on this stuff in photon documentation (asynch, webhooks, webrpc, persistence) but i'm unsure about the connection between saving state to webhooks and retreiving it after the room has been removed from the photon server. Thanks

JohnTube
2018-02-07 09:19:04

Your CloudScript journey starts now!
I can't recommend enough using TypeScript.

You need to save and load room state using PlayFab's Shared Groups.

  • You save a stripped room state in a Shared Group in RoomClosed, Type="Save"
  • You load the room state from the Shared Group and return it in RoomCreate, Type="Load"

For Photon you just need to rejoin rooms by name.
So you may also want to keep track of rooms list per player using CloudScript as well and optionally Photon WebRPCs (or just ExecuteCloudScript).

I hope this is helpful enough.

LaundryOnMyAbs
2018-02-07 17:36:53

Thank you for the answer! And i have 1 more. I know this relates more to playfabs side of things, but ive read that shared group data only allows 5 key/value pairs to be updated per request. Is saving a state considered 1 update? Or is each key/value property within a state considered 1? If the latter, a state with all completely necessary properties still has at least 15 key/values (given that actornumber =4 and each actor has binary, name, etc). Also, you recommended typescript, is that an option while using playfab? Thanks! I'm making great progress on my game thanks your answers.

JohnTube
2018-02-07 21:17:53

You can save the room state after stripping it and converting it to string in one value of a Shared Group.
So you can have one Shared Group per room (ID is room name) and one Shared Group per player as rooms list (custom format for ID).

Back to top