[v2.1.0] MatchmakingService - ON HOLD

You’ll have to show me some of your code because that doesn’t happen to me when using the latest version. Preferably in private messages so that we don’t continue to bump the topic.

1 Like

I’ve released 1.2.0 with a small change, and a fix:

Version 1.2.0

Changes (breaking):

  • None

Changes (non-breaking):

  • [Addition] Added MatchmakingService.FoundGame signal which is fired when a player finds a game and is going to be teleported. It is fired with the arguments userId, gameCode, gameData. More info.

  • [Addition] Added MatchmakingService:SetFoundGameDelay(newValue) which will delay players teleporting to their game for the number of seconds provided so that you can show a UI, etc.

  • [Change] SetPlayerInfo now accepts a teleportAfeter parameter which is the unix timestamp milliseconds after which the player will teleport.

  • [Change] Changed all error calls to warn calls to prevent code execution from stopping.

Fixes:

  • [Fix] GetRunningGames will properly return up to max games.
3 Likes

How would I be able to get all the players in a queue for a map?

https://steven4547466.github.io/MatchmakingService/maindocs/#getting-the-queue

1 Like

Came back to here after a few months and finally implemented it into my game. I have found a few issues however.

  • Finding a match seems to be desynced between 2 servers. If one server finds the match with the other server, server 1 will correctly begin the teleport while server 2 isn’t up to speed with this until a few seconds later. I’d like to note that this is a minor problem and not too much of an issue.

  • The FoundGame signal does not seem to be connecting properly, and instead of returning a connection it returns a function. Of course, doing :Disconnect() on a function just errors. I had to end up forking the module and swapping Signal:Create() to Instance.new(“BindableEvent”) and using .Event to make this work.

  • FoundGame doesn’t seem to be firing all the time, and would sometimes only be firing for one server and not the other server. I fixed this by making it fire right before the teleport happens. This only works in my scenario because there is only one group of players to teleport, so I don’t have to worry about who I fire it for.

After both of these challenges I was able to get it perfectly up and running, just using a modified version.

I’m not sure if there’s anything I can do about this.

If you wish to disconnect a listener from a signal you have to use Signal:Disconnect(Listener) because of the way it’s set up. i.e.:

local listener = MatchmakingService.PlayerRemovedFromQueue:Connect(function(...)
	print(...)
end)

MatchmakingService.PlayerRemovedFromQueue:Disconnect(listener)

However I don’t believe I’ve documented this anywhere, so I will add that soon.

This is a mistake on my part and I will fix that asap so that it fires for all servers.

Version 1.2.1

Changes (breaking):

  • None

Changes (non-breaking):

  • None

Fixes:

  • [Fix] FoundGame should now fire properly on all servers, not just the main handler.
3 Likes

Wow, that was a quick response. I tested the new version you just pushed out and it seems to have fixed that problem, and I swapped my code to using the new :Disconnect() and it seems to have fixed that problem too.

Thank you, its all working fine now.

1 Like

Great to hear, thanks for the feedback!

1 Like

Version 1.3.0

Changes (breaking):

  • None

Changes (non-breaking):

  • [Addition] Added DisableGlobalEvents to the options table when using GetSingleton. Setting this to true will disable PlayerAddedToQueue and PlayerRemovedFromQueue from firing for users not in the server and will save you messaging service quota.

Fixes:

  • None
2 Likes

Testing out the update and it wouldn’t matchmake. I then un-queued and got this error.
image
(I download each new version when I want to so that it won’t auto-update)

Update: I found another error with it.

ServerStorage.Modules.MMService:408: attempt to perform arithmetic (add) on nil and number
ServerStorage.Modules.MMService, line 408

I’ll look into it asap. The update shouldn’t have caused this though, odd. Maybe an oversight. Thanks for the report

Line 408 is an end (however prob just an extra few lines), are you sure you’re up to date? As for the other error does it happen all the time?

This was on version 1.2.1

408: if mainJobId == nil or mainJobId[2] + 30000 <= now then

I’m not sure if this was fixed in the newest version or not.

Ah, I see I made an oversight with the most recent update. I’ll push a fix for it immediately.

Also, I found another bug in the latest version (1.3.0).

ServerStorage.Modules.MMService:239: attempt to index nil with 'DisableGlobalEvents'
ServerStorage.Modules.MMService, line 239

I did not pass in anything for GetSingleton(), so I think it expected a table.

That’s what I’m fixing right now. I was unable to reproduce the other bug at line 544 can you give me more details about it?

Version 1.3.1

Changes (breaking):

  • None

Changes (non-breaking):

  • None

Fixes:

  • [Fix] Fixed a bug that would prevent global events from working if you passed nothing into GetSingleton.

  • [Fix] Fixed a bug that would happen if the main job was set to an empty table.

  • [Fix] Fixed a bug that would happen if the last players in queue were removed from queue while MMS is finding a game.

  • [Fix] Fixed GetRunningGames with max > 200.

I’m actually unable to reproduce it again. I just now tested passing in a table and no errors occurred.
It seemed to happen right after I removed players from the queue, but I have no other info.

It may be possible that they were removed from queue in the time the service was about to put them in a game. I’ll add a preventative check so it doesn’t happen in the future. I’ll just rebase it into 1.3.1. Thanks for the reports.

EDIT: Oh I see what happened, the queue was obtained but there was no one in it so it tried to index nil.

The fix has been rebased into 1.3.1

1 Like