You will run into a race condition then.
What do you mean ? Explain more pls
Assume you have 40 servers, after seconds from the Main Server dying 39 servers unorderly checked for current server, at least 2 will assume there are none thus the do the same job. Moreover, your game will break. This is called a race condition.
To Order them I tried using another ServerQueue Because queues are ordered, but I couldn’t manage to to solve the problem that when a server gets down I have to remove it from the queue because there is no way to find it’s ID to do the method
Queue:RemoveAsync(ID)
I wish :AddSync returned an ID it would help alot
They won’t because it use UpdateAsync
what uses :Updatesync? wym
wwww
Is there a way to delay the teleport for a few seconds? I’d like to give everyone a 5 second heads-up when they’re about to be teleported.
Yep there is
matchmakingservice:SetFoundGameDelay(newValue)
This service is kind of confusing to be honest. Like the example above.
What’s with the if winner == 1 then 1 else 2, if winner == 2 then 1, else 2
??
i agree thats very confusing and kinda stupid
he could have done something like this on the backend to avoid such things as these
(this is just example)
--whatever "t1" is i dont know and i dont care cuz i never used this community resource ever in my life
function MatchmakingService:UpdateRatings(ratingType,winner,t1)
local win=winner[1]
if win==2 then
win=1
elseif win~=1 then
win=2
end
--do whatever this function is supposed to do
end
then we use the function like this after update:
function EndGame(winner)
MatchmakingService:UpdateRatings(gameData.ratingType, {winner}, {t1, t2})
for i, v in game:GetService("Players"):GetPlayers() do
-- You can teleport them back to the hub here, I just kick them
v:Kick()
end
end
is it possible to connect SetFoundGameDelay to a function? I want to fire a remote to anyone being teleported giving them a 5 second countdown before the teleport starts.
would something like this work?
MatchmakingService:SetFoundGameDelay(5, function(player, gameCode)
print("Match found for "…player.Name)
ShowMatchFoundMsg:FireClient(player)
end)
I believe there are signals you can connect to in the module, I use that but not sure if it still exists in v3. Read the source code, you’ll probably see it in there I forgot lol
I found this, but when using it in combination with SetFoundGameDelay, it also delays the FoundGame function by the same number. I wanna check when the player has found a match, send a remote to them, wait 5 seconds, then start the teleport
I believe that the event you are referring to is in V3, are you using that or V2? (The versions are wildly different in my testing, and I believe both versions need a ton of repeat-until-pcall-success wrapping so that it doesn’t break other scripts on error)
Depending on player count, you might find it easier to process things like this with an external server (completely up to you though, also this is just based off personal experience with using external servers for a lot of things Roblox can’t do). Using an external server would be quite a bit slower (I think), but with the Open Cloud Messaging Service API it would still be pretty quick. I made a module that handles the whole HTTP/Messaging Service stuff if you are looking into that.
I’m not sure, I’m mainly just following the documentation
Also it’s worth mentioning my game is in an extremely early prototype-state, so not everything is wrapped in a pcall, but I am working on it.
I’m not too interested in using an external server, since I believe it goes outside the scope of the game.
Thanks for the advice though!
By pcalls, I meant the module needs them because in my testing there was a lot (I mean a LOT) of errors that were just service errors. Otherwise, good luck!
Any progress on it? Sorry for the bump. Btw I was a bit confused on how to add custom player data to teleport
Hi! You’d use ApplyGeneralTeleportData
for general game teleport data and ApplyCustomTeleportData
for players
local MatchMakingService = require(ServerStorage.Modules.MatchMakingService).GetSingleton()
-- Modules
local TableUtil = require(ReplicatedStorage.Modules.TableUtil)
local GameData = require(ServerStorage.GameData)
--- Variables
MatchMakingService.ApplyGeneralTeleportData = function(map)
local GameData = TableUtil.Copy(GameData, true)
return GameData
end
MatchMakingService.ApplyCustomTeleportData = function(Player)
return {}
end
on the game server, you’d use MatchMakingService:GetGameData()
for game data and MatchMakingService:GetUserData(Player)
for players respectively
I would love to know if this module will be updated someday, especially now that hash maps are released