Can you run servers without any players?

I’m really curious,
Can you run a server in a universe without any players inside the server?

I’m working on module which would allow me to update datastores with the least impact on performance, since I’m going to be using a while true do loop to check whether there has been a change, and if there is a change, certain instructions will be executed by the server.

If that isn’t a viable option, could I create an API on roblox which listens for requests from 3rd party servers?

3 Likes

Not really, unless you bind to close for like math.huge seconds. But that requires manual server start. I wouldn’t see why you would want to do that either. Just keep it on the server, and if performance drops, just up the wait() amount…

1 Like

Honestly, this sounds like something that will be able to be resolved by Universe Script. I’d consider waiting until then and then experimenting. Keeping servers open for no players defeats the purpose of roblox.

2 Likes

Not really, unless you bind to close for like math.huge seconds.

BindToClose limits the callback to 30 seconds. If it isn’t finished by then, then the server forcibly shuts down.

To answer OP, no. The moment all players leave in a server, it shuts down immediately.

4 Likes

As for this, not quite. Roblox only allows requests from game servers. However, Roblox doesn’t enforce how long those requests have to take. In my tests with RBXMod I’ve found that Roblox servers are willing to keep a request in flight for more than 10 minutes. This is called long polling (in contrast to continuous, short polling).

1 Like

I don’t believe it shuts down quite immediately. I think the server starts to prepare to shut down when all players are kicked/leave, but there is often a delay between the last player leaving and server shutdown.

Within that window, new clients can connect, but if the server is already in the process of terminating, you will be greeted with a join error.

However, going back to OP’s problem, game servers are tightly controlled by Roblox for many reasons, including this. Game servers are meant to hold players, it would be a huge waste of infrastructure to allow developers to keep servers open for no reason. You cannot just keep a server open without players.

I’m sceptical about this. Again, I don’t think there’s anything developers can do to get around the game server control system, for good reason. If everybody could just keep all their servers open, the platform wouldn’t be a particularly efficient place.

That is exactly the point.

@Unknownstaffmembe, this is the crucial part of the thread.

Roblox servers are not a free hosting provider. Although your solution to data storage would be very cool if it worked (hats off to you on that one), it’s methods like this that Roblox cannot allow.

The servers are game servers, for the enjoyment of players. They are not a free hosting service for the enjoyment of developers.

Sadly, you’re going to have to find another method of data storage.

6 Likes

How does RBXMod work and how do I use it ?
(I can’t really find much information on the website currently)

1 Like

I’m glad you asked! I was hesitant to mention it again for fear of taking over the thread. https://docs.rbxmod.com is the url you are looking for. The new website I’ll probably release today has more information.

Basically right now RBXMods allow you to upload a script and run multiple instances of it independently of Roblox servers. It communicates to Roblox via an async function call which passes arguments and results over the network transparently as JSON. Calls to the RBXMod are stored in a queue so the RBXMod can continue running until it is ready to handle them. Once a handler is assigned, the RBXMod can yield to handle a call. RBXMods currently support a Pages API which allows persistent storage as a replacement for DataStores.

Pages are a cross between a Lua table, a database, and a file. It doesn’t use journaling like databases but has “rows” and “columns”. To add a row you use a table with the appropriate column names, and getting a row returns a table with the column names. It is stored in a custom format which is paged into and out of RAM at the OS’s pleasure for performance (you can have HUGE pages in virtual ram and only pieces will be in physical ram). There is also a flush method to make sure all changes reach physical storage before it returns for stronger guarantees. The docs at https://docs.rbxmod.com has more information on the pages library.

This is what a basic RBXMod which echos back its arguments with a message looks like:

local function handler(...)
  return "Hello, Roblox!", ...
end

RBXMod.SetHandler(handler)

while true do
  RBXMod.Yield()
end

To include pages:

-- Page Page.New(string name, int initNumRows, array columns)
local myPage = Page.New("myPage", 32, {
    Page.Type.String ("Name", 64),
    Page.Type.Number "Score",
    Page.Type.Bool "IsBanned",
})

-- void Page:Set(int index, map values)
myPage:Set(0, {
    Name = "Joe",
    Score = 0,
    IsBanned = true,
})

-- map Page:Get(int index)
local row = myPage:Get(0)
print(row.Name, row.IsBanned)

RBXMods are a replacement solution for private modules, universe scripts (inter-game scripts really), messaging service, and data stores. There is also support for better network access, compiled libraries, and multi-thread / multi-processor / multi-node computing.

2 Likes

Has rbxmods.com been shutdown? No longer works…

Yes, although I’ve graduated and may have free time to start it again. I’ll post here if I bring it up again.

1 Like

Ok thanks for the quick reply…

In 2024, I faced the same problem, I used HTTP POST request with PlayerRemoved, but at the last player I can’t send the request well in time for the server to shut down.
Roblox’s server handling is well done…