[v2.1.0] MatchmakingService - ON HOLD

Version 2 has been released! Because no features were brought up since I asked, this update mainly just includes the change from teleport data to another memory store for security purposes. Explained here

Version 2.0.0

Changes (breaking):

  • [Removal] Removed all teleport data.

  • [Addition] Added MatchmakingService:GetCurrentGameCode(). This will get the code of the current game, if it is a game server, nil otherwise.

  • [Addition] Added MatchmakingService:GetGameData(code). This replaces the teleport data for game data. This will include the game’s code, rating type and any custom data you apply with ApplyGeneralTeleportData. You can call this without code, if so MMS will use the use GetCurrentGameCode().

  • [Addition] Added MatchmakingService:GetUserDataId(player) (and MatchmakingService:GetUserData(player), accepts player rather than player id). This replaces teleport data for players. Use this to get any data you apply with ApplyCustomTeleportData.

  • [Change] RemoveGame(gameId) is now called automatically on game close and will no longer accept a gameId parameter. This shouldn’t be called anymore, as MMS will handle it for you.

Changes (non-breaking):

  • None

Fixes:

  • [Fix] Custom user data is now applied when teleporting to existing games.

Remember you can still obtain version 1 with local MatchmakingService = require(7567983240).GetSingleton({["MajorVersion"]="v1"}) so that you can choose when to update your games! However, version 1 will not receive any new updates.

5 Likes

For v2.1, can we have the ability to set our own TeleportData? It would help with backward compatibility with Bloxy Kart’s existing Multiplayer system, and all we would need to do is add this into our game.

You can still add custom data, it’s just been moved for security reasons:

https://steven4547466.github.io/MatchmakingService/maindocs/#applying-custom-teleport-data-to-players

https://steven4547466.github.io/MatchmakingService/maindocs/#applying-custom-teleport-data-to-the-game

This also goes over how to retrieve the data. Explanation to why teleport data may be insecure can be found here: [v2.0.3] MatchmakingService - #213 by steven4547466

With it being fully server sided, exploiters can’t modify the data at all (unless, of course, you’re calling a remote function when setting the data which I will say I don’t recommend).

1 Like

Awesome update Steven! Thanks for everything :slight_smile:

This is a bit late, but TeleportData can be made secure easily:

  • Obtain it with Player:GetJoinData()
  • Check if JoinData.SourceGameId == game.GameId
  • When creating the TeleportData on the origin server, add the current os.time() and check on the destination server if os.time() - JoinData.TeleportData.Created < 20

TeleportData is actually nicer to use sometimes, since it doesn’t consume memory.

3 Likes

Some fixes!

Version 2.0.1

Changes (breaking):

  • None

Changes (non-breaking):

  • [Update] Updated OpenSkill to version 1.2.0.

Fixes:

  • [Fix] Fixed GetPlayerParty for users that have found a game.
1 Like

Version 2.0.2

Changes (breaking):

  • None

Changes (non-breaking):

  • None

Fixes:

  • [Fix] Fixed SetPlayerRating from calling a function that no longer exists.
1 Like

Thanks for making this module! This module will be used in Bloxy Kart for its v4.0 update.

I have a few suggestions:
for the FoundGame event, can a parameter be a table of players Usernames, User ID, and Display Name? I kind of want to show an icon of the player when the game is found along with who they will be racing with, and more info (For example, how many wins they have, and what kart they have equipped)?

Also, can there be an option for SetPlayerRange to set on all maps? I don’t want my code to be doubled as long, even though we can still do this:

local RaceMaps = {
	"Under_The_Sea",
	"Small_World",
	"Jurassic",
	"Piggy_Speedway",
	"Sandy_Secrets",
	"Space_Heights",
	"Space_Highway",
	"Eggsburg",
	"Tilted_Road",
	"Space_Turnpike",
	"Grassy_Ventures",
	"Mushroom_Forest",
	"Willis_House",
	"Santas_Village",
} -- Oops, Might of exposed some maps that are in the games code that are unused. Thats ok...

for _, Maps in pairs(RaceMaps) do
	MatchmakingService:AddGamePlace(Maps, 9130693906)
	MatchmakingService:SetPlayerRange(Maps, NumberRange.new(2, 8))
end

Hey, I either have a bug report or I am doing something completely wrong:
I keep getting this error (Map is what is in the TeleportData):

And here is how I am getting the Data:

game.Players.PlayerAdded:Connect(function(player)
	local TeleportData = MatchmakingService:GetUserData(player)
	print(TeleportData)
	game:GetService("ReplicatedStorage").LoadMultiplayerMap:Fire(TeleportData.Map) -- Error happens here.

Here is how I am passing the Data:

MatchmakingFolder.AddToQueue.OnServerEvent:Connect(function(Player, Map)
	local GameData = {Map = Map, Gamemode = "Multiplayer"}
	MatchmakingService.ApplyCustomTeleportData = function(player, gameData)
		return GameData -- Here is where I am putting the Data
	end
	MatchmakingService:QueuePlayer(Player, "Player", Map)
end)

I have been messing with the script above for the past couple of hours, and I am not getting it. I looked in the Module and saw that ApplyCustomTeleportData is not a function, which also makes me believe it is a bug, and it is hidden in MatchmakingService.new(). Would appreciate help!

Thanks in advance!

You could do this by using the game data which is a table with this format:

{
    ["full"] = boolean
    ["skillLevel"] = number
    ["players"] = table<​PlayerId>
    ["started"] = boolean
    ["joinable"] = boolean
    ["ratingType"] = string
    ["map"] = string
    ["createTime"] = number
}

You can iterate over the players table and get their display name/username. I don’t do this natively because that’s a lot of extra bandwidth/api calls for a lot of people that wouldn’t use it

I can look into doing something like this.

2 Likes

If you are on version 2 or later, you can use

MatchmakingService:GetRunningGame(MatchmakingService:GetGameData().gameCode).map

to retrieve the map. This is a little cumbersome though and I can look into a better way to do this that isn’t as long. As for why it’s not working for you right now, I can only assume it’s because a callback function is supposed to be set a single time, not multiple times for every user.

1 Like

Thanks, this solution worked.

1 Like

How can i detect game is removing? And new game is added because i want to create a serverlist that updates instantly. Also how can i pass the game password to the hub if there is a no messaging service?

Currently there is no event for adding or removing games which is fired globally. I can look into adding this next update if you want this functionality. Also there is no real way to password protect servers, that’d be more akin to a server browser, not a matchmaker. A matchmaker finds games without having to search through a server browser based on how many players are in the queue. There is, however, a way to add custom game data which could include a server password, and then to lock the server from joining without being manually added, but this functionality, currently, does not exist in the vanilla service.

1 Like

Hey, im back to report an error. I am still using v1.3.2 because I didn’t know about the new updates and I spent a long time migrating to JoinData which I would now have to revert : (

Screenshot_1
In basically every server I get this error. I’m not sure if this is a roblox error or something to do with MMService.

It started happening about 1 week ago, but now is constant.

The line:

It also happens in every other place where the memorystore is called.

If it happens everywhere memorystore is called I would think that it’s a roblox issue (and you didn’t update so it just came out of no where), however the first think I would try is to open your console in a game then type require(path.to.MatchmakingService):GetSingleton():Clear() where path.to.MatchmakingService is the same way you require it anywhere else.

1 Like

Is this global across all servers?

Yes.

1 Like

Can you send data in and back? What I’m trying to say can we send saved data to another game and bring it back to the original game?

Another question that I have, is this going to be fast? Does this use or can we use the same system TDS uses for matchmaking? Which is where it would get the closest players to you.