Sign In Register

How can we help you today?

Start a new topic

How to create a realtime match "lobby" then make it discoverable to other players until a Max Players value is reached?

I'm currently trying to create a simple, standard game lobby where one person "hosts" a match then others can discover and join that lobby until it is full. A realtime session is created for the lobby so players can chat or communicate in other ways while they all wait for other players to join. From the documentation, tutorials, forums, etc I'm seeing a few answers that suggest this should work with matchmaking by using Drop In/Drop Out, Manual match players, and Accept Min. Players. After hours of head-scratching I've run into a dead end and hoping you can point me in the right direction. My issue, it seems, is that as soon as a match is made it is no longer discoverable as a pending match. This makes sense, but then how then do I allow the match to fill up with more "Drop In" players?


For my example I have a match with the following settings and threshold:


Settings:

Min Players = 2

Max Players = 3

Realtime = ON

Realtime Script = (None)

Drop in/Drop Out = ON

Player disconnect delay (seconds) = default

Expire in seconds = default

Manually match players = ON


Threshold:

Period (seconds) = 3600

Type = Absolute

Min = 0

Max = 0

Accept Min. Players = ON

Steps:
1) Player 1 creates a MatchmakingRequest with matchData that has a { "hosted" : true } entry. 

2) Player 2 creates a MatchmakingRequest with a customQuery returning all {"matchData.hosted" : true } pending matches.

3) Player 2 creates a FindPendingMatchesRequest and locates Player 1's hosted match.

4) Player 2 creates a JoinPendingMatchRequest and a match is created between Player 1 and Player 2.

5) Player 3 then follows the same steps as Player 2 but FindPendingMatchesRequest yields no results even though the match is not full.


Weirdly enough, if Player 2 drops out then Player 3 can discover and join the match. Then Player 2 can rejoin as a "Drop In" player. I guess my main question here is how do I create a realtime match then make it discoverable/joinable to other players until a Max Players value is reached?


Thanks,

Joshua


1 person has this question
1 Comment

I'm realizing now that for my purposes I'll need to do some more complicated custom matchmaking (even more than this example requires). The default flow of matchmaking doesn't allow a match to be discoverable after it exits the "Pending" stage. It seems like my best approach might be the following:

1) Player 1 sends a MatchMakingRequest with a match config that is created with only 1 player and also sets matchData.maxPlayers to the desired number of players.

2) The match is immediately created for Player 1 and a MatchFoundMessage is sent.

3) In Cloud Code the MatchFoundMessage is briefly intercepted and a "hosted match" with necessary runtime match details is stored in Game Data.

4) Player 2 creates a FindHostedMatches Event and all applicable matches are returned in a list with details necessary for them to join.

5) Player 2 then creates a JoinHostedMatch Event which loads Player 1's match, adds them, and updates the currentPlayer value for the match.

6) Player 3 then goes through the same flow as Player 2 and can enter the match which currently has currentPlayers == 2 and maxPlayers == 3.

7) Player 4 creates a FindHostedMatches Event but doesn't find the same match as above because currentPlayers >= maxPlayers.


I'm having some luck with this flow so I'll go with it for now unless anyone has a better suggestion.


Thanks,

Joshua

Login to post a comment