Room TTL not kicking in

First off, sorry for the flurry of questions. Our large budget project was supposed to get outside help on photon for release date concerns and that fell through so I am winging things.. Anyhow

Our design is such that we want a room to stay open if players leave so they can come back and pick up where they left off. I would prefer not to try to save the state off. So I was pretty happy when I saw room TTL which sounded like it would do exactly what I wanted. I have tried to set this value 2 ways. First in the plugin on create room, before i do info.continue I am getting the game state, modifying room and player ttl, then setting it. The change is visible in the debugger afterwords but if i test having the only player in the room leave and then restart and come back, it makes a fresh room for them. Then I thought I would try doing it in PUN in the room options(Not ideal since this is client trusted but worth testing). In this scenario the TTL values I see in GetGameState are all 0s. Is there some other step I am missing to control how this value is used. I would be happy if I could default these for all games to some value and it never be changeable.

Comments

  • ZigzaTom
    ZigzaTom
    edited May 2018
    Update, I noticed in PUN client it was saying the max RTL is 60k and i had it at 120k. Changing that to 60k worked. However when I did this only on the plugin using the above method, it went back to destroying the room immediately. To avoid users having control over this value, I would prefer to make the plugin control it. I did see a post where it was advised to use the properties to change things like is visible, but the constant list for these properties did not contain RTTL or PTTL.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @ZigzaTom,

    The RoomTTL limit on Photon Cloud is 5 minutes: 300000 milliseconds.
    For the self-hosted Photon Server, the default value is 1 minute: 60000 milliseconds but you could increase this value in the config file under "deploy/Loadbalancing/GameServer/bin/Photon.LoadBalancing.dll.config":
    <Photon.LoadBalancing.GameServer.GameServerSettings>
    <setting name="MaxEmptyRoomTTL" serializeAs="String">
            <value>60000</value>
    </setting>
    </Photon.LoadBalancing.GameServer.GameServerSettings>
    But you should know, Photon rooms were not meant to be kept running for a very long time. So we do not guarantee anything if you keep them running for long hours.

    I think you are setting room property in the wrong way from the plugins.
    Are you changing the request or the game state directly?
  • I only want to hold the room open for a few minutes to give people a chance to reboot their phone or whatever and reconnect. As to how I am setting the timeout in the plugin.


    public override void OnCreateGame(ICreateGameCallInfo info)
    {
    Utils.DebugLog(info.UserId + " on OnCreateGame:" + PluginHost.GameId);
    SerializableGameState state = PluginHost.GetSerializableGameState();
    state.EmptyRoomTTL = 60000;//1 minutes before giving up on an empty game
    state.PlayerTTL = 0;
    PluginHost.SetGameState(state);