Suggestion :
I know it will change a lot of your current code but for the v3 a great thing would be a way to control the queue and pools.
I will take the example of Dead By Daylight :
In dead by daylight you have 2 teams : killer and survivors and you choose before the game start in which team you want to be in and then the matchmaking create game with 1 killer and 4 survivor…
A way to control player « role »would be really cool…
(Sorry for my English if you need better explanation just ask me)
I’ll see what I can do, that does add a lot of complications.
Yeah i do understand but it will open this module to a larger community I think…
I think should add extra parameter on QueuePlayer and QueueParty
It would be, but it also requires the way maps are added to be changed, and how the matchmaking loop works.
My current idea for that which was what initially popped into my head would require something like this:
MatchmakingService:SetMapRoles(map, roles)
(like SetPlayerRange
, and AddGamePlace
)
where roles
is (dbd example):
{
{
["RoleName"]="Survivor";
["Minimum"]=1; -- Minimum of this role for a game to be made
["Maximum"]=4; -- Maximum of this role allowed in the game
},
{
["RoleName"]="Killer";
["Minimum"]=1; -- Minimum of this role for a game to be made
["Maximum"]=1; -- Maximum of this role allowed in the game
}
}
And in this case the game would be made with 1 killer and 1 survivor, but you’d be able to control when it starts so that the full 4 survivors can join. Like how in dbd, you’re on the menu waiting for other survivors to join.
This would override SetPlayerRange
, which is basically the same thing, but only one role.
Then QueuePlayer
would have a new argument added role
. This will require a lot of internal changes to support, but it is a good idea, so I’ll look into it and see if I can make it happen
Yes that would be really great , hope you can make it even if it’s hard and need to change a lot of how your service works
Version 3.0.0-beta.2
Changes (breaking):
- [Addition] Added a new role system to allow developers to assign players roles while in queue. This would allow them to queue on different teams. For example, in dead by daylight, you can queue as killer or survivor. This new system allows you to mimic that.
- [Addition]
SetMapRoles()
. Allows you to set the map roles to a table with this format (example):
{
["Killer"] = { -- Key is the role name
Min=1;
Max=1;
};
["Survivor"] = {
Min=1;
Max=4;
};
}
-
-
SetPlayerRange
is unchanged, but is now only applicable if therole
parameter is not used when queuing
-
- [Change]
QueuePlayerId
,QueuePlayer
,QueuePartyId
,QueueParty
,AddPlayerToGame
,AddPlayerToGameId
,AddPlayersToGame
, andAddPlayersToGameId
now accept arole
parameter. If not provided, then it will use the old system without roles, but the backend adds a role calledMMS_NO_ROLE
for the sake of convenience in the queue. - [Change]
GetQueueCounts
structure has changed to{map: {ratingType: {role: count}}}
.
Changes (non-breaking):
- [Addition] Added signal
GameCreated(gameData, serverId, reservedCode)
which is fired when a server for a game is reserved. This only works in the game which is currently handling the matchmaking loop (otherwise known as the main job). - [Addition] Added the
RunningGamesJoinable
property with the corresponding methodSetRunningGamesJoinable()
. Defaults totrue
, iffalse
, the matchmaking loop will skip running games and not use any memory queue rate limit units on them. This means that when a game is created by the serivce, it will never be joinable to the service, even if you manually set it to joinable. If you use this, it is recommended to set the minimum and maximum players to the same value so that only full games will be made since they are no longer able to be joined afterwards.
Fixes:
- None
Great update Steven you added that feature so fast didn’t expect it to be real…It will save so much times for me
Edit : for the queue party it should be a table that contain role no or instead you can make a call back function
Were you able to test it? I don’t have a way to test the service anymore really. I knew that it worked fine with one role, but I never was able to test with multiple at the same time.
As for queueing parties with different roles, I’ll have to look into it. Due to the way parties work, cross queue partying is very difficult to get working, and we’re working with quite limited memory space, so any properties I have have to be worth the extra space they take.
I didn’t tested party but I tested QueuePlayer and it does have some problems.
First the return of QueuePlayer never return true even if the player successfully queued and some times same player get queued twice don’t know if it’s link to what I said before
I’m going to look into this, but my roblox and studio are completely broken for some reason and every usage of memory store service is failing even if it’s the first request.
yes me too , seems like memory store is down right now
Version 3.0.0-beta.3
Changes (breaking):
- None
Changes (non-breaking):
-
[Change]
RemovePlayerFromQueueId
,RemovePlayerFromQueue
,RemovePlayersFromQueueId
, andRemovePlayersFromQueue
now have another parameter calledupdateAttribute
, this will default to true. The only proper use for this is to remove players from the queue but still have the service check if they found a game. Used internally to remove players from the queue after they found a game, but still teleport them. -
[Change]
Clear
will now print how many times the memory stores were used, effectively telling you how much of your rate limit you used. -
[Change] Added various logs which will be removed on release.
Fixes:
-
[Fix] Fixed the
MMS_QUEUED
attribute being removed after finding a game, which caused players to never be teleported. -
[Fix]
AddPlayersToGameId
will now default the role toMMS_NO_ROLE
properly.
I will try ASAP and will test different things but okay
okay i just tried and it seems to work way better and now QueuePlayer return true.
Found a little error on SetMapRoles()
it says trying to compare nil > number
so i changed your code by that :
Edit : found a bug like some times it just don’t bring player together and can’t create games here is my code
i start a test with 4 player to try it but it work with 2 players (1 survivor,1killer)
Ah yup, thanks for catching that. I still treated it as a single value.
Hm. I’ll look into this.
@fouroul94 I can’t seem to get the same issue as you for the 4 players, all of my fake players were going to be teleported.
It should be noted that studio is not capable of making teleports, so they won’t actually be teleported. I added some more logs on my end to ensure the players would be teleported. I pushed those changes to the github if you want them, but they don’t warrant another release at the moment since they’re just logs
yeah i tested it on studio but the service just don’t create games
That’s odd, here’s what my logs say in studio when I create a game with 4 players:
12:42:51.507 added - Server - Matchmaker:54
12:42:52.022 true - Server - Matchmaker:55
12:42:52.022 added - Server - Matchmaker:54
12:42:52.440 true - Server - Matchmaker:55
12:42:52.441 added - Server - Matchmaker:54
12:42:52.756 true - Server - Matchmaker:55
12:42:52.756 added - Server - Matchmaker:54
12:42:53.090 true - Server - Matchmaker:55
12:42:54.105 ▶ {...} - Server - MainModule:734
12:42:54.106 ▶ {...} - Server - MainModule:734
12:42:54.273 Players to teleport: - Server - MainModule:957
12:42:54.273 {} - Server - MainModule:958
12:42:57.573 ▶ {...} - Server - MainModule:734
12:42:57.573 ▶ {...} - Server - MainModule:734
12:42:57.573 WE GOT ENOUGH TO MAKE GAME!!! - Server - MainModule:831
12:42:57.573 ▼ {
["Killer"] = ▼ {
[1] = -1
},
["Survivor"] = ▼ {
[1] = -2,
[2] = -3,
[3] = -4
}
} - Server - MainModule:832
12:42:57.574 GAME DATA CREATED - Server - MainModule:853
12:42:57.574 Adding to non-joinable - Server - MainModule:882
12:42:57.671 GAME DATA ADDED - Server - MainModule:889
12:42:57.723 Added game - Server - MainModule:903
12:42:58.130 Removed from queue - Server - Matchmaker:34
12:42:58.130 -2 Map 1 ranked 0 Survivor - Server - Matchmaker:35
12:42:58.130 Removed from queue - Server - Matchmaker:34
12:42:58.130 -3 Map 1 ranked 0 Survivor - Server - Matchmaker:35
12:42:58.130 Removed from queue - Server - Matchmaker:34
12:42:58.130 -4 Map 1 ranked 0 Survivor - Server - Matchmaker:35
12:42:58.130 Removed from queue - Server - Matchmaker:34
12:42:58.130 -1 Map 1 ranked 0 Killer - Server - Matchmaker:35
12:43:01.623 Found game - Server - Matchmaker:39
12:43:01.623 -1 TEST ▶ {...} - Server - Matchmaker:40
12:43:01.739 Found game - Server - Matchmaker:39
12:43:01.739 -2 TEST ▶ {...} - Server - Matchmaker:40
12:43:01.872 Found game - Server - Matchmaker:39
12:43:01.872 -3 TEST ▶ {...} - Server - Matchmaker:40
12:43:01.990 Found game - Server - Matchmaker:39
12:43:01.990 -4 TEST ▶ {...} - Server - Matchmaker:40
12:43:02.073 Players to teleport: - Server - MainModule:957
12:43:02.073 ▼ {
["TEST"] = ▼ {
[1] = Player1,
[2] = Player2,
[3] = Player3,
[4] = Player4
}
} - Server - MainModule:958
12:43:02.075 APPLYING CUSTOM DATA - Server - Matchmaker:21
12:43:02.075 Player1 - Server - Matchmaker:22
12:43:02.076 ▶ {...} - Server - Matchmaker:23
12:43:02.077 APPLYING CUSTOM DATA - Server - Matchmaker:21
12:43:02.077 Player2 - Server - Matchmaker:22
12:43:02.078 ▶ {...} - Server - Matchmaker:23
12:43:02.078 APPLYING CUSTOM DATA - Server - Matchmaker:21
12:43:02.078 Player3 - Server - Matchmaker:22
12:43:02.080 ▶ {...} - Server - Matchmaker:23
12:43:02.080 APPLYING CUSTOM DATA - Server - Matchmaker:21
12:43:02.080 Player4 - Server - Matchmaker:22
12:43:02.081 ▶ {...} - Server - Matchmaker:23
12:43:02.082 APPLYING GENERAL DATA - Server - Matchmaker:28
12:43:02.082 ▶ {...} - Server - Matchmaker:29
12:43:02.123 Teleporting: - Server - MainModule:977
12:43:02.123 ▼ {
[1] = Player1,
[2] = Player2,
[3] = Player3,
[4] = Player4
} - Server - MainModule:978
Now, studio can’t teleport like I said, but the last lines is where they would’ve been teleported if it was a regular game.
You can also see that after the “WE GOT ENOUGH TO MAKE GAME!!!” line, there’s 1 player under killer, and 3 under survivor, which is what we expect and the user ids are correct, -1 being the killer in my case since I used the following code:
local MatchmakingService = require(game.ServerStorage.MainModule).GetSingleton()
task.wait(5)
MatchmakingService:SetMapRoles("Map 1", {
Killer = {
Min=1;
Max=1;
};
Survivor = {
Min=3;
Max=3;
}
})
MatchmakingService:AddGamePlace("Map 1", 7584483307)
MatchmakingService.ApplyCustomTeleportData = function(player, gameData)
print("APPLYING CUSTOM DATA")
print(player)
print(gameData)
return {Hi=1}
end
MatchmakingService.ApplyGeneralTeleportData = function(gameData)
print("APPLYING GENERAL DATA")
print(gameData)
return {Bye=1}
end
MatchmakingService.PlayerRemovedFromQueue:Connect(function(...)
print("Removed from queue")
print(...)
end)
MatchmakingService.FoundGame:Connect(function(...)
print("Found game")
print(...)
end)
while #game.Players:GetPlayers() < 4 do
task.wait(1)
end
local roles = {[-1]="Killer",[-2]="Survivor",[-3]="Survivor",[-4]="Survivor"}
for _, p in ipairs(game.Players:GetPlayers()) do
print("added")
print(MatchmakingService:QueuePlayer(p, "ranked", "Map 1", roles[p.UserId]))
end
your code seems to work idk why mine didn’t worked