Global Match Making

Global Matchmaking System

Goal:

Ability to create a matchmaking system with a party feature built in, allowing the connection of users from any “lobby” server, not just the server the user is in.

Current Ideas:

  • One idea I had was to use HTTPService and create my own webserver, however I don’t think this is most practical.
  • Another idea I had is to use ROBLOX’s Services - such as the MemoryStoreService - however I cannot find many tutorials or examples online about this, and I’m not sure exactly how to send the teleport data to all the servers with the users in, when they get selected. I’m also not sure how to have a “master” server even if I were to use MessagingService either - how do I ensure two master servers aren’t selected, and how can I deform one after a period of time to ensure it doesn’t become slow?

What I’d like help with:

  1. How this would work. What’s the best services to use for this?
  2. Can you point me in a direction of tutorials, or pre-existing solutions that I can look at the codebase to try and work it out for myself with examples.

Many thanks in advance!

You should look into the post listed below, it’s very helpful and easy!

Is there a way for me to ideally do it custom? For now it’s an amazing solution, however in the future I’d want to scale it in such a way that it’d be easier to have my own code. It may be worth noting that I do NOT require skill based matching, all I need is combining users together globally.

What’s the best way for me doing it without requiring in a module? The best way in my opinion from my research so far is this:

  • Another idea I had is to use ROBLOX’s Services - such as the MemoryStoreService - however I cannot find many tutorials or examples online about this, and I’m not sure exactly how to send the teleport data to all the servers with the users in, when they get selected. I’m also not sure how to have a “master” server even if I were to use MessagingService either - how do I ensure two master servers aren’t selected, and how can I deform one after a period of time to ensure it doesn’t become slow?

However I still got the questions shown in that - namely:

  1. How do I send the teleport data to the users in the queue that were selected.
  2. How do I manage, form, and deform the “master” server?

Hi, creator of the module posted above. Just be aware that it’s in a beta state and I wouldn’t recommend it for full release games just yet! MemoryStore service still has some kinks I’m working out for that module. As for memory queues, they have very little controlability making them basically useless for matchmaking unfortunately at the moment. The biggest flaw with memoryqueues right now is that there is no way to remove an item from a memoryqueue without first reading it and processing it and there is no way to delete one item without reading all items one at a time. I hope they fix those issues soon as memoryqueues are basically the bread and butter for matchmaking but they’re just not in a good enough state to be useable in that way.

For this one I had each server poll for user updates (however, this is inefficient and I’m working on a new design). I store user data inside their own sorted map so that they have data when needed and all another server needs to do is see that they have data.

For this I stored the main job id (which is always unique) in its own sorted map as well. When a server starts, it checks if there is a main job id and if there isn’t, assigns itself as the master server. Every 15 or so seconds, the servers will also see if the master server is still online and not hanging. If it is nothing changes, but if it isn’t a new master server is assigned to keep queues going.

Unfortunately the limits on sorted maps seems quite low and I get Request Failed often (which is something I’m actively trying to fix using caching and the messaging service).

3 Likes

Heya! Thanks for your reply. If I were to make it now (meaning within a week or so, not like urgent-urgent) what would be the best way to approach it, considering the issues you outlined with the queues?

Would I best solution be to create my own web server for it? Or is there a better service that would work for now? Would MessagingService be effective, would a sorted datastore work?

Time isn’t a pressing concern. I would be content with 5-10 seconds for matchmaking to be complete at least, it can happily take longer if it means it’d be more reliable. And reiterating, it doesn’t need to be skill ranked base, just mixing people together.

Many thanks though for your help so far!

2 Likes

I think you can definitely still make use of memorystores if used effectively. I think the reason why my module often sees issues is my complete lack of caching, I make a request to the memory every time something is needed, even if it’s guaranteed to have not changed (a flaw that I recognized a little too late).

I believe that you can utilize the memorystore sorted map for the queue (until memoryqueues actually get more control and messaging service could work as well but I’m not extremely well versed in it myself) adding users to it is still pretty easy and you wouldn’t be bogging down the very low limit of messaging service (which for receiving a message is 10+20*servers per minute meaning that if you have a topic for queuing and you have idk 50 members in 2 servers the queue topic can only receive 50 messages in one minute meaning that if they all queued at the same time you’d hit the limit. It’s unlikely but I think it still might be possible to hit that limit in real cases, it all depends on the game). What makes the memorystore better is the higher limit of 1000+100*users as you can see this is much more scalable as unless one user is queueing over 100 times a minute you should be fine (which is why I was confused when I started to see Request failed errors in my module because I was thinking at most it’d not even be hitting 200 requests per minute, but I must’ve miscalculated something somewhere or roblox is being roblox). I’d still use a memorystore sorted map for storing something as ephemeral like the master game id that might need constant updating if the master server goes offline which wouldn’t work with messagingservice because there’s no way for new servers to see the master job if it’s sent out via message, and datastores can theoretically be used for this same purpose, but memorystores were supposedly built for high-throughput things like this.

As for how I actually do matchmaking, on the master server periodically I get the queue (it’s a little more complicated with how I do it as it involves skill checks and party checks, etc, but since you don’t need that it should be as simple as getting a table of user ids of queued players). When I get the queue I check to see if there are enough players to teleport to a game, I use a NumberRange to define a min and max values for players. If the game isn’t full when players are teleported, I mark that it’s not full and before I do the normal matchmaking I check all non full games to see if there’s any players in queue that are able to go into that game to fill it. Eventually the game will start or fill up in which case it’s no longer accessible and then new games can be made again.

I hope this was helpful and I can always explain it further if you need.

3 Likes

Awesome thanks! I’ll mark this as the solution now and it’ll be an awesome place to start from.

If I have concerns when I begin creating it, I’ll either message you or bring this topic alive/new topic depending on the relatedness!

Many thanks again. :slight_smile:

1 Like