WARNING: This has not been tested with multiple servers as studio does not have the MessagingService enabled, HOWEVER, the logic does work in a live server and has shown to work properly. If you encounter any issues my contact info can be found at the bottom of this post!
Included:
Easy, comprehensive matchmaking module that can easily be expanded.
Commented with simplicity while highlighting key points.
Print status toggle to see whats going on in the console logs.
This module is NOT intended for production level projects in its current state
This module can easily be used. To demo this module for yourself, place this CHECK SOLUTION into PlayerGui.
The module is NOT for production level games and is meant to act as a demo for the new MessagingService.
To initialize the module on the server, all that is needed is to require it. The module will return the two remotes that it creates, however these are not needed for the server.
Dictionary:
Included below is a list of helpful words to guide you through the language used in this product.
isDedicatedServer: If true, the current server is the games dedicated matchmaking host server.
printStatus: Toggle that allows you to switch on/off print statements to see what the module is doing on the console log.
matchmakingServerId: The PlaceId of the game that players will be put into when the match begins. This can be changed however you like as well as the matchmaking logic conditions.
serversActive: List of servers that are active. All servers will hold this list in case a re-host is needed.
queue: Queue of all players waiting for their match. When a re-host is needed, this queue will be lost and all servers will be notified that the queue was interrupted. This will allow you to easily tell players to rejoin the queue. Changing this to auto-queue players is discouraged because of how many queue request would be sent simultaneously. Still very possible to do however.
startQueue: Holds the functionality of the matchmaking system for starting matches from the queue. The logic loop is meant to be configured by yourself for your particular needs.
TO:DO
Add functionality to try and create a dedicated server if creation fails SEE LINE 221
Add functionality to retry DataStore connection if search for DedicatedServer fails SEE LINE 228
Interesting approach to cross-server-matchmaking, I really wish Roblox would add some sort of “universe server” that would be only one instance of a server, so it’s not a bunch of Roblox servers handling matchmaking at once.
DataStoreService is definitely not an efficient way of doing this, and it’s no coincidence they fulfil the same function, up until this point everyone has been using datastores, when MessagingService is much more reliable and efficient. Datastores are an extremely hacky and buggy method of communicating between servers.
True. It’s worth noting that someone could’ve implemented a third-party function library that fulfils the very same purpose and entirely utilises DataStoreService. Rate limits and latency cases may apply … but still.
I’ve tried DataStores for this approach in the past and it is completely UNUSABLE. Two big issues out of many are that the DataStore throttling that occurs basically ruins it and DataStore:GetAsync() cache makes sending data almost useless.
Aye; RĹŤblox have done good work for implementing this feature. Someday, RĹŤblox could allow these messages to be interacted with outside the game instance using web sockets and/or HTTP pooling. It might not be a certainty though.
Can you explain what do you mean by production level games? I am guessing games with a high player count…?
Also since it has been updated, is it safe to use this in games with atleast 1k to 2k players? (Not like I am ever going to have this many players but just asking)
Although a thousand bites differ somewhat from the 976B (as you mentioned, interesting post by the way!), I doubt that those few bytes (akin to a few characters in the data) were enough to trigger these “bugs”.
Thinking back at the original post I answered, I don’t know if the data limit was at fault anyway. Well, thanks for sharing that link, I’ll remember that for the future!