TeleportService:GetAllServers()

If you use teleportservice to create private servers then you’ll need to use database to keep a list off all available servers. This is fundementally impossible to do flawlessly.

Sometimes a server crash and there is no way you can update the server list.

  • Using onClose doesn’t work because the server just crashed!
  • You can’t check if a server is active or not.
  • You can’t check if theres players in any given private server.
  • Basically you can’t do a serverlist that doesn’t eventually include ghost servers.

You should make sure your server never crash - is not a logical counter argument.

  • You can’t make sure your game has 0 bugs
  • You can’t promis that the server is stable.
  • You can’t make sure your game is 100% unhackable.
    If you think you can then don’t bother replying, go back to your software developing utopia.

This is why I suggest a method for easily getting all servers; reserved aswell as normal servers.
The returned list should include basic stuff such as: Playercount, teleport id, gameid, etc.

UPDATE:
As I’ve tried to create my own serverlist using databases I’ve run into a serious issue.
‘If a game requests the same key too many times, then its requests can be throttled or even error.’ -Wiki
This throttling disables all updates of the serverlist once you reach x amount of servers active; effectivily annihilating the last possibility of using databases as a serverlist option.

This makes the need for GetAllServers all the more critical.

50 Likes

Super nice! Would be able to not only get accurate player counts on your game, but to also be able to actually have a well customly deisgned server browser!

6 Likes

Preferably implemented with the Pages class to ensure scalability.

9 Likes

Well I mean there areeeee ways to tell if a server is still active. Have it ping the data store with a time and when another servers looks through the server list and sees that the server hasn’t pinged in for a while just remove it from the list :man_shrugging:

1 Like

That is not a scalable solution. You can’t update a datastore value too often across all servers or it gets throttled.

3 Likes

Doesn’t need to be scalable, is is a solution.

If you’re running at most 3 servers, sure.

Unless you want to explain your solution in more detail.

You wouldn’t be updating it across all servers since not all servers are going to be going through the list and if all servers are still running there is no point in setting anything on the data store.

So they only ping once when they get created?

The server will update it’s value in the server list every x min. That’s not going to be throttled obviously.

You could have an OrderedDataStore with timestamps as values and reserved server ids as keys. They “ping” the datastore by updating their key every x minutes. You can see the latest active servers by bringing up the top n entries.

But this is sloppy and reliable api for getting all available servers is preferable.

9 Likes

Good idea, and I was planning on using it until I’ve stepped on a serious throttling issue.
See the update clause :confused:

1 Like

What is the use case for this functionality? What problem are you trying to solve by getting a list of all the servers? How are you going to use it? Perhaps there may be other ways to solve the same problem without some of the limitations that this solution has. We will be looking into improve teleports and would like to understand what the issues are before we start working on solutions.

Thanks!

The way it’s set up is one key called ServerList.
It’s a table containing sub tables for each server.
serverlist = {}
serverlist[1] = {Name = “Vip server”, Players = 3, Maxplayers = 20, …}
serverlist[2] = {Name = “Normal server”, Players = 20, Maxplayers = 20, …}

  • When a server is created, it adds itself to the serverlist table.
  • Each server is set to update the ‘Players’ value every 120 seconds.
  • If a server shutsdown it will remove itself from the serverlist.

These updates always use this kind of operation:

game:GetService("DataStoreService"):GetGlobalDataStore():UpdateAsync("ServerList", function(oldValue)
	local t = oldValue or {} 
	for i,sett in pairs(t) do
		if sett.ID = SERVER_ID then
			manipulate your server settings here.
		end
	end
	return t
end)

And once enough of servers are active, this table is updated so frequently that it’s being throttled 100% of the time. That’s when nothing gets updated and the whole system collapse.

1 Like

Yes, but why do you need a server list? What are you going to use that list for in your game? What is the problem that you are trying to solve by having the server list?

1 Like

I have custom servers.
Some only want to fight zombies and thats why I got zombie servers.
Some only want to fight eachother, so i got battlestation servers.
Some wants to customize what maps and gamemodes to play, so I got vip servers.
Everyone wants to customize maxplayers, so I got those options too.

Previously I used 1 Place for each setting, 6 different places to update everytime I added something.
But due to frequent connection issues and the will to fully customize your own sever, aswell as the ability to choose what customized server you wanted to play on, i created the new server system.

Heres how it looks now:

4 Likes

Same as OP. I want guildmasters to be able to create private servers for their guild, and when players join the game they’re prompted with a list of all their guilds’ (they can be in multiple) active servers.

1 Like

Honestly, this whole issue could be avoided, atleast temporarily, if there was a function called:
GetPlayersInServer(InstanceId/JobId)

Then the only update needed would be to add and remove servers.

3 Likes

I have a beefy server so it’s nothing for me to send a http request every 5 seconds in every server and send an http request to get a list of all servers. But not everyone has the luxery of being able to pelt millions of requests from roblox games to a dedicated server on a regular basis, and I pay a pretty hefty pricetag for my server, so native support for this would be pretty neat.

1 Like

MeepCity is able to do this using HttpService, but if you have a lot of players it’s only possible with a scalable server setup.

1 Like