Reserved servers - a few questions

My plan is to implement a matchmaking system through the use of reserved servers. And this is how it works.
First I publish the game and run a simple script. The script creates a reserved server and prints out the code generated when ReserveServer()* was called (the first part of the tuple). From my understanding the code that I receive is UNIQUE THROUGH TIME and the server always exists and is always running. I then store this code in a global variable and update my game. This way I create a matchmaking server ONCE, and use it forever. I don’t have to check if a matchmaking server exists, then create one if it doesn’t, then send a message to all other servers that I have created a new matchmaking server, then I have to make sure there are no duplicates…

What I want to know is:

Does a reserved server run even if it has no players in it?
This would enable the reserved server to behave like a matchmaking server.

Does a reserved server run even when the entire game has 0 active players?
So I don’t have to create a new matchmaking server when a player finally joins.

Can I manually shut off a reserved server?
Let’s say that a game was matched. What I want to do is to reserve a server with a map, teleport all players there and when the game is done I wan’t to delete the server because I don’t need it any more.

Basically, does a reserved server run forever, so that I can use it like a matchmaking hub.

*
local code, privateServerId = TeleportService:ReserveServer(game.PlaceId)
-- The "code" is unique through time, not the "privateServerId"
3 Likes

I’m not too sure what this “unique through time” phrasing means, but the code generated and returned for ReserveServer is unique per call. Time has nothing to do with the uniqueness of the code, it will be different for every call of ReserveServer.

Instances are not considered alive when there are no players in it. To be in an alive state, there must be at least one player in the server. This also answers question 2: no players, not alive. Reserved servers cannot be manually closed. Just discard the code and that’s that.

Reserved servers behave exactly like regular servers however are removed from automatic matchmaking and require a special code and server-side method of joining. To effectively delete a server, you discard information on it and forget about it. Roblox can issue codes and instance ids at no cost. ReserveServer allows you to access a detached server.

Unfortunately, Roblox does not at this time support dedicated servers which is what you seem to be searching for. You wouldn’t be able to use a closed server as a master server that can control game functions across places and servers. There was plan of scripts to run at a game level which would be akin to a dedicated server (or one itself), however this continually gets delayed presumably because the scope of the project exceeds their capacity or capabilities right now.

3 Likes

What I meant by “unique through time” was that the reserved server always exists, it may not be active, but it’w there.

I did an experiment. I created a baseplate and made a script that creates a reserved server, it also printed the “code” that I was talking about, but it doesn’t teleport you to the server. I then uploaded the game, entered it, and sure enough, a long pseudorandom code was presented, I copied it.
Then I opened the studio and edited the script. I deleted the line where a reserved server was created and I added a line which teleports you to the reserved server, for the code argument I pasted the long pseudorandom code from before. I updated the game. And went to play it.
And sure enough, without creating a reserved server I managed to get teleported into one. I also did a check if the server is reserved server.
However I haven’t checked if any changes were saved, I’m going to do that now. Perhaps I could generate a random number [1, 1000000] only when a server is created and then print it when a player joins. I should be getting the same number whenever I join the game and get teleported into the reserved server. Now I’m excited to try it.

1 Like

The code and private server id generated by ReservedServer will always exist but the server itself will not be alive when there are no players in it.

I don’t really understand what you did for your experiment, what the point of it was or what relevance it has to your topic, but sure, if you’ve worked something out and it isn’t an unsupported hack, great.

Changes do not save to reserved servers. Places cannot be saved unless they were created by CreatePlaceAsync and have the appropriate API ticked off in the configure page.

5 Likes

Yup, it doesn’t save. Oh well, guess I’m going to have to wait for universe scripts that were promised back in 2018. :confused:

2 Likes

I mean, you could use MessagingService to communicate between servers.

1 Like

Server-server communication wasn’t the point of this thread and MessagingService isn’t what you need if you’re looking to save anything, especially changes to a place.

I’m not exactly sure where universe scripts would’ve helped in the original problem other than making a dedicated central server for the sake of facilitating matchmaking, which would be infinitely easier to work with than MessagingService because with the latter it’s a bit harder to establish a dedicated server.

1 Like

Oops, I went out of topic. I was just saying there was this thing called MessagingService. Sorry.

1 Like