Skip to main content
Dedicated servers let players connect to a persistent game session that runs independently of any player’s client. s&box dedicated servers are distributed via Steam and managed through SteamCMD.

Installation

1

Install SteamCMD

Follow the SteamCMD installation guide from Valve. SteamCMD is the command-line tool used to install and update Steam-based servers.
2

Install the s&box dedicated server

From the directory where you installed SteamCMD, run:
./steamcmd +login anonymous +app_update 1892930 validate +quit
This installs or updates the s&box Server (App ID 1892930).
Add -beta staging to host a server on the staging branch. Note that staging servers may not be joinable by all players.

Running the server

Once installed, the server files are in steamcmd/steamapps/common/Dedicated Server. Create a .bat file to start your server. For example, create Run-Server.bat:
echo off
sbox-server.exe +game facepunch.walker garry.scenemap +hostname My Dedicated Server
This loads the facepunch.walker game with the garry.scenemap map and sets the server title to My Dedicated Server.
You can pass a path to a .sbproj file instead of a package identifier to load a local project on the dedicated server. Connected clients will receive code changes and hot-reload them.

Configuration

Pass configuration as command-line switches when starting the server. Each switch corresponds to a ConVar or ConCmd that runs at startup.
SwitchArgumentsDescription
+game<packageIdent> [mapPackageIdent]The game package to load, and optionally a map package.
+hostname<name>The server title visible to players in the server browser.
+net_game_server_token<token>A token tied to your Steam account that gives your server a stable Steam ID. Visit steamcommunity.com/dev/managegameservers to generate one. Without this, a new Steam ID is generated on every restart.
+net_game_server_token is not required and is only available as an option once s&box is released.

Connection permissions

The host can adjust permissions for individual connections. Set these in your OnActive network event handler.

Spawning objects

By default, any connected client can spawn networked objects. Restrict or allow this with Connection.CanSpawnObjects:
public void OnActive( Connection connection )
{
    // Prevent this connection from spawning objects
    connection.CanSpawnObjects = false;
}

Refreshing objects

By default, only the host can send network refresh updates for a networked object. Allow the object’s owner to send refresh updates as well with Connection.CanRefreshObjects:
public void OnActive( Connection connection )
{
    connection.CanRefreshObjects = true;
}