Match Making Best Practice

We are building a 1v1 game wit the following set up:
  • If a player leaves, they can come back after any amount if time until the game ends, thus we have Player TTL set to -1
  • In match making, players create rooms and wait for someone else to join
The problem we have is dead rooms.

1) A player creates a room
2) The room creator leaves before an opponent joins
3) The opponent who joins ends up waiting forever.

Options:

1) Is there a way to change the room and player TTL after the room is created?
2) Set the player/room TTL to 0 and when a match is made, create a NEW room and move both players to that room.
3) If a player waiting for a match to start detects another player goes in active, close and leave the room.

What is the recommended action here, or am I approaching this wrong entirely?

Comments

  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Treadon,

    1) Yes, you can change PlayerTTL and EmptyRoomTTL post room creation. So during matchmaking, you could set it to a 0 or few seconds to allow quick rejoin once the match starts you could set it to -1 or int.MaxValue or another high value that allows timeout and player replacement.
  • Treadon
    Treadon
    edited November 2018
    Hi @JohnTube ,

    Thanks for replying. Can you clarify somethings for EmptyRoomTTL (assuming my player TTL is -1)

    1) If I set it to 0, the room seems to not close immediately.
    2) If I set it to 1, the room seems to close immediately.
    3) If I st it to 300000 the room closes after some time (but seemingly less than 5 minutes).
    4) If I set it to 1, and then later call CurrentRoom.EmptyRoomTTL = 300000, it seems to close immediately when empty.

    How can you change the empty room TTL after the room has been created, it doesn't seem to work?
    What does 0 mean for empty room TTL, it doesn't seem to mean 0ms.

    I should note, the roomTTL and playerTTL are just internal variables, and don't have a setter that does anything, is there an alternate way to change room TTL?

    Thanks.


    *** EDIT ***
    Upon some research I found:

    Hashtable h = new Hashtable();
    h.Add(GamePropertyKey.IsOpen, false);
    h.Add(GamePropertyKey.IsVisible, false);
    h.Add((byte)246, -1);
    h.Add((byte)245, 300000);
    _m._client.OpSetPropertiesOfRoom(h);

    Which does work. You guys should consider adding 246 and 245 to the GamePropertyKey, it would have saved me a lot of time.
  • JohnTube
    JohnTube ✭✭✭✭✭
    Hi @Treadon,

    Thank you for your reports and sorry for the inconvenience.
    What PUN version do you use?