Cross Server Matchmaking

I’ve been looking around trying to find a way to make a cross server matchmaking system.

I want players in different servers to be able to click a button that places them in a big queue, and then have it that servers are created to put the players at the top of the queue into that reserved server until it is full and then restart this process.

My question is, how do I make 1 server reserve a single server, then use MessagingService to collect from different servers a list of all players and then send these players to that 1 server.

The issue I face is that since MessagingService isn’t instant (1 second), how can I make a list that would always be accurate? Like if two players queue at the same time, one would overwrite the other.

And how can I make sure that only one server will reserve a server and teleport them? If they all have the same script won’t they all try and create a server at the same time?

I can’t find any guides to matchmaking systems using MessagingService.
Thanks.

3 Likes

Maybe you can use this for creating a “Reserve”:

This will clone a place and return a ID to use with teleport service. Seems like a hacky solution so I’m not sure if there is better.

as for the queue you could figure out a hacky solution so only one server handles the queuing and updating what players is currently in its server. then the other servers will just update telling what players are in their server. so then the server handling the queue will know exactly when a queue is full

1 Like

Thanks for the part about creating a reserve.

What I am thinking might work, is that it will simply keep trying to add you to the list until it is confirmed, this might mean you end up with longer queue times but hopefully is a solution.

Then I am thinking I can have 1 server be the handler for creating all the servers. I can use MessagingService to ensure there is only one, and if the handler server ever closes, it simply switches to another server.

Another idea I’ve had is when you click to join a match. It PublishAsyncs to servers to see if there are any servers already waiting for players, if so it sets that to your target serverId and keeps waiting till full. If there aren’t any servers waiting for players, it creates a server that then waits for players.

Would this be a better system?

-Player clicks ‘play’
-PublishAsync to servers to find vacant spot in queue
-Server with vacancy PublishAsyncs it’s JobId for the Reserved Server that it has made and accounts for the extra player (so it doesn’t overfill)
-Original server with player in it grabs the JobId that has come through and teleports them to that server (and will simply wait in the ReserveServer for all players to connect)

1 Like

thats a good idea I didn’t think of that. That is also a pretty good idea, as for if its a better system or not I’m not 100%. I think they could both work well if implemented right.

1 Like