Matchmaking seats reservation

Hello everyone. Faced the following problem:

I use an authoritative server and RPC function to search or create a match. Each room is limited to 4 people and each room should be as full as possible. Each match join I update the label with a new playersCount.

Inside RPC function I search for matches where there are empty slots. Describing the flow:

The player calls the RPC function and calling match list with empty slots query. For example, it finds a match where there are 3 out of 4 players. Next, the server responds to the client with room_id, the player starts connecting to the room. The problem is that while the server responds to the client and the client connects to the room, other clients also see this room free for connection. As a result, it happens that a lot of people start connecting to one room at once.

Is it possible to somehow implement a seat reservation or take into account in the match the players who are already connecting to this room? Thanks.

Hi @kutsme welcome :wave:

I use an authoritative server and RPC function to search or create a match. Each room is limited to 4 people and each room should be as full as possible. Each match join I update the label with a new playersCount.

When you say authoritative server do you mean Unity/Unreal headless instances or do you mean authoritative match handlers in Nakama?

Hi! I mean authoritative match handlers in Nakama.

@novabyte Any ideas? This is a pretty serious blocker for me :frowning:

Maybe anyone can help?

Have you taken a look at nakama-unreal repository? More specifically, check this out: party_rpc.go

I took this project as a basis, but it works on invites, not on filling rooms.

Exactly, when I read your scenario, you indicated that

The player calls the RPC function and calling match list with empty slots query. For example, it finds a match where there are 3 out of 4 players. Next, the server responds to the client with room_id, the player starts connecting to the room. The problem is that while the server responds to the client and the client connects to the room, other clients also see this room free for connection. As a result, it happens that a lot of people start connecting to one room at once.

So what came to my mind was something like this: I assumed that you are creating something lobby-like. So when a player calls MatchList with his required spot as the query, the server can reserve his userID in something like an invitation list inside that match’s state or a map in lobby’s state, besides sending him the match ID. So next time another player calls MatchList with the exact needed spots, the lobby looks at the empty spots + length of invitation list to find the appropriate match. This could act as the notion of reservation for the room. you can also periodically check for expired invitations in your Lobby’s loop, i.e, if the invited player cannot or does not want to connect, he is removed from the invitation list and the match is exposed to the next person who queries it.
Of course, I think providing a little bit of your code would be helpful (to at least me) to get what you want to achieve.

Hi, thanks for your the help. I did something like that temporarily. I plan to do it through mutexes similar with the source code of the native matchmaker :slight_smile:

This is too simple let me try to explain!

in label you may add “roomState” = “open/Close”

When matchJoinAttempt run you add players = player+1
and in matchjoinattempt First Check player <= player +1

// Inshort you have to add 1 player as a Buffer after proccessing/login you minus buffer value

1 Like

Hi, thanks for your response. But while just created room is empty - dozens of players can connect to it at the same time (before buffer created)

you have to set default values in matchinit

Could you give an example and describe the flow of the first connection? With initial default values.