Skip to main content

Servers and routing

Registration​

A game server registers itself with server-service when it starts, with its SERVER_ID, its SERVER_TYPE, its address (SERVER_IP) and its player count, then sends a heartbeat every 500 ms. A server that stays silent for 3 seconds is removed from the registry. When it shuts down, it says so first.

The proxy subscribes to the registry and keeps its own list of servers in step with it. Nothing has to be declared in velocity.toml.

Where a player goes​

  • On login, to a server of the default type (gens).
  • Choosing among servers: only servers that are online and have room count. Among them, one is picked at random among those within 10% of the least loaded, so that every proxy, and every player arriving at the same moment, does not land on the same server.
  • /hub [type] (alias /lobby) sends the player to a server of a type: the default one, or the type they are on. Another type needs graycore.grayservers.admin.
  • /grayserver (aliases /server, /switch), on the proxy, for admins: list shows the servers, connect id <id> and connect type <type> move you.

When a server goes down​

When a player is kicked from a game server, the proxy decides whether to move them to another server instead of disconnecting them:

  • No reason (crash, timeout, network loss): the player did nothing, they are moved.
  • The restart message a server sends on /stop: they are moved.
  • Any other reason (ban, anti-cheat, a staff kick): the kick stands.

A moved player goes to another server of the same type as the one they left, or of the default type when there is none.

When server-service is down​

The proxy keeps using the last list it received for a while: the servers are most likely still there. Past that delay the list is no longer trusted, and players are refused with a message rather than sent to servers that may be gone. The proxy reconnects on its own, waiting longer after each failure.