The matchmaking feature offered by Nakama is great. However, due to the requirement that all players waiting for a match must remain online/connected, the matchmaking feature can’t be applied to games where:
the number of players are too low for there to be a high probability of 2 players wanting to play with the same settings at one time
play as truly passive. (This one is especially important, since passive games like Words With Friends should have equally passive matchmaking )
My current approach is to roll my own matchmaking, but this will get complex and substandard once more varied game settings are possible.
Are there any suggesting on what I can do? Could I somehow keep the matchmaking ticket alive even after a user has disconnected?
No, there’s currently no way to keep the matchmaker ticket alive if the user disconnects. This is intentional to fit the design of this feature and its integration with the realtime match system, so it’s not likely to change soon.
It’s also to avoid another category of problem such as what happens when the user chooses to matchmake, goes offline, is matched into a game, and then never returns to play for some reason. This is a poor experience for the other players in that match.
You’ll need a different solution for your use case, but you’re targeting low enough matchmaking throughput and 2-player matches as you say so there are a number of solutions you can use that leverage the storage feature.
Register an RPC function for players to call when they want a match, this would:
List storage objects in a particular collection looking for players that are also matchmaking. Each matchmaking entry would be a single object in this collection likely keyed on a timestamp. The listing would be ordered from oldest to newest player entry, to make sure matchmaking is effectively a FIFO queue.
If enough players are found in the listing then remove their storage object and form the match, notify the players etc.
If not enough players are found, write a new storage object for the current player to wait for a match.
You can build on this idea to refine the matchmaking for skill levels and other criteria if needed.
I’m creating a turn-based, you-don’t-have-to-always-be-online game, think chess or Words With Friends. The possibility of a player never returning mid-game is a problem that I have to handle anyway. So the idea that the matchmaker is somehow helping me avoid this problem by not being an option doesn’t make sense to me. Every game is different. Every game decides what good user experience is.
Thanks, this is precisely what I’m doing. I asked the question just in case I could avoid continuing down this path.
I think it’ll do for now. If my game happens to get some degree of success then I’ll revisit in future; maybe Open Match will be relevant by then.
Agreed, it’s up to you to decide what your user experience should be. The matchmaker doesn’t prevent this problem so much as not enable it as much as it is able to. If users are online at matchmaking time it makes it less likely they won’t ever even show up for the match itself, or fail to do so in a timely fashion. And if a user does fail to join or goes offline at the exact moment the match is formed then the remaining user is quickly made aware and can search again on the spot.
Nothing except your own game design can prevent (or at least minimise) this problem, so you’re on the right track!