Revision Difference
Dedicated_Server#549077
<cat>Play.Server</cat>
<title>Dedicated Servers</title>
<note>There's no Linux server build yet, there will be one in the future.</note>
# Downloading⤶
You can use [SteamCMD](https://developer.valvesoftware.com/wiki/SteamCMD) to download the dedicated server.
⤶
In a command-line, or by making a .bat file in the same directory as steamcmd.exe:⤶
# Downloading and Launching⤶
You can use [SteamCMD](https://developer.valvesoftware.com/wiki/SteamCMD) to download the s&box dedicated server.
⤶
Once you have that, in a command line, or by making a .bat file in the same directory as steamcmd.exe, run the following:⤶
⤶
```⤶
steamcmd +force_install_dir C:\MyServer\sboxserver +login anonymous +app_update 1892930 validate +quit⤶
```
steamcmd +force_install_dir c:\steamcmd\sboxserver +login anonymous +app_update 1892930 validate +quit⤶
⤶
Alternatively, you can use the default `sbox-server.exe` in your Steam sbox directory.⤶
⤶
Once downloaded, to launch the server, you would typically do something like this in some kind of .bat file (see the next section for more information on how to configure your server):⤶
⤶
```⤶
sbox-server.exe +gamemode facepunch.sandbox +map facepunch.construct +maxplayers 8 +hostname "My Epic Server"⤶
```
⤶
Or you can use the default `sbox-server.exe` in your native sbox directory. Make sure to make a .bat file with the arguments below.⤶
⤶
⤶
# Launching⤶
⤶
As with any Source dedicated server, you can use convars to customize your server settings.⤶
To load a game and a map, specify its organization + ident - you can find them by browsing [asset.party](https://asset.party/)⤶
⤶
Make a .bat file in the newly created `sboxserver` directory, and put this in it:⤶
⤶
## Dealing With Updates⤶
⤶
You will have to re-run steamcmd every time s&box updates in order to update the server to the latest version; players will not be able to join if they are running on a different version of the game to your server.⤶
⤶
This poses a problem since currently s&box updates many times each day. One way around this is to use a .bat script that restarts and re-updates the server at regular intervals:⤶
⤶
```⤶
:loop⤶
C:\MyServer\steamcmd.exe +force_install_dir C:\MyServer\sboxserver +login anonymous +app_update 1892930 validate +quit⤶
start "" C:\MyServer\sboxserver\sbox-server.exe +gamemode facepunch.sandbox +map facepunch.construct +maxplayers 8 +hostname "My Epic Server"⤶
timeout /t 3600 /nobreak⤶
taskkill /im sbox-server.exe⤶
goto loop⤶
```
sbox-server.exe +gamemode facepunch.sandbox +map facepunch.construct +maxplayers 8 +hostname My Epic Server⤶
```⤶
⤶
If you want to load addons for the game, use the `+extensions` convar and separate addons by a semicolon (`;`)⤶
⤶
This script will restart the server every 3600 seconds (every hour).⤶
⤶
The downside of this is that it will forcefully close your server. For most games, this probably doesn't matter. But, if your server was doing I/O operations at the time like saving to file, this could lead to data corruption. One way around this is to manually save the files before killing the server. Overall that looks something like this:⤶
```
sbox-server.exe +gamemode facepunch.sandbox +map facepunch.construct +extensions "gvar.admin_ball;gvar.sbox_radio" +maxplayers 8 +hostname My Epic Server ⤶
:loop⤶
C:\MyServer\steamcmd.exe +force_install_dir C:\MyServer\sboxserver +login anonymous +app_update 1892930 validate +quit⤶
start "" C:\MyServer\sboxserver\sbox-server.exe +gamemode facepunch.sandbox +map facepunch.construct +maxplayers 8 +hostname "My Epic Server"⤶
del C:\MyServer\gamedata-backup\* /s /q⤶
xcopy "C:\MyServer\sboxserver\data\facepunch\sandbox" "C:\MyServer\gamedata-backup" /e /i /y⤶
taskkill /im sbox-server.exe⤶
del C:\MyServer\sboxserver\data\facepunch\sandbox\* /s /q⤶
xcopy "C:\MyServer\gamedata-backup\*" "C:\MyServer\sboxserver\data\facepunch\sandbox" /e /i /y⤶
goto loop⤶
```
⤶
⤶
<note>If you're getting an engine.dll not found error when launching the server you most likely will need to install _CommonRedist/vcredist/2022/VC_redist.x64.exe</note>⤶
⤶
## Shutting Down Gracefully⤶
⤶
You can shut down your server gracefully at any time by typing `quit` into the console.⤶
⤶
# Launch Configuration⤶
⤶
As with any Source dedicated server, when launching you can use convars to customize your server settings.⤶
To load a game and a map, specify its organization and identifier - you can find them by browsing [asset.party](https://asset.party/)⤶
⤶
This is a list of some of the more useful convars.⤶
⤶
| convar | Behaviour | Example |⤶
|---------------|---------------|----------|⤶
| +gamemode | Sets the gamemode. | +gamemode facepunch.sandbox |⤶
| +map | Sets the map. | +map facepunch.construct |⤶
| +maxplayers | Sets server's player limit. | +maxplayers 8 |⤶
| +hostname | Sets the name of the server. | +hostname "My Epic Server" |⤶
| +extensions | Loads addons onto the server. Each addon is separated by a semicolon. | +extensions "gvar.admin_ball;gvar.sbox_radio" |⤶
⤶
<note>If you're getting an engine.dll not found error when launching the server you most likely will need to install _CommonRedist/vcredist/2022/VC_redist.x64.exe</note>⤶
<note>If the command prompt instantly closes when running the .bat you are most likely missing the .net runtime environment, you can get the required v7 version from here: https://dotnet.microsoft.com/en-us/download/dotnet/7.0</note>
# Connecting
Players connect through your server's Steam ID, so there's no need to worry about port forwarding or anything.
⤶
**You can connect to your server via the global server list or the gamemode server list:**⤶
⤶
You can connect to your server via the global server list or the gamemode server list:⤶
<upload src="4a1b3/8dabffbe4044f2d.png" size="25123" name="image.png" />
If you're lost, or you can't find your server, you can use the `connect` command with your server's ID as an argument. You can find the ID by typing `status` in the server's console at any time.
⤶
# Troubleshooting⤶
⤶
Make sure you have updated the server to the latest version. If you have Steam installed on the host machine, make sure it is updated.⤶
If you're lost, or if you can't find your server, you can use the `connect` command with your server's ID as an argument. You can find the ID by typing `status` in the server's console at any time.
⤶
Sometimes it can take a few minutes for your server to appear in the server browser.⤶