S&box Wiki
Home
/
Edit Dedicated Servers
View
Edit
History
No Category
Developer Overview
The Project System
Publishing To Asset Party
Getting Started With Hammer
Mapping Basics
Mapping Entities
Advanced Mapping Techniques
Getting Started with Modeldoc
Animgraph & Animation
Physics
Modeldoc Nodes
Advanced Modelling
UI Basics
Styles & Stylesheets
Razor Templates
Game Menus
Materials
Built In Shaders
Shaders
Shader Reference
Sounds & Audio
Particles
Getting Started
Making Games
Input
Networking
Physics
Rendering
Editor & Tools
VR
Misc
Playing Guides
Console Commands & Variables
Dedicated Server
Log in to edit
Dedicated Servers
<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 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 ``` <warning> Until the public branch is updated, you'll need to download the server files from the staging branch, to do so run the following: </warning> ``` steamcmd +force_install_dir C:\MyServer\sboxserver +login anonymous +app_update 1892930 -beta staging 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 +game facepunch.walker facepunch.flatgrass +hostname "My Epic Server" ``` ## 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 -beta staging validate +quit start "" C:\MyServer\sboxserver\sbox-server.exe +game facepunch.walker facepunch.flatgrass +hostname "My Epic Server" timeout /t 3600 /nobreak taskkill /im sbox-server.exe goto loop ``` 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. The only guaranteed way to prevent this is to make sure your gamemode is not doing any I/O at the time the process is killed. Since you know your server is going to be restarting every hour or so, you could do this by implementing a `TimeSince` that stops I/O operations during the last minute. ## Shutting Down Gracefully You can shut down your server gracefully at any time by typing `quit` into the console. ## Troubleshooting Occasionally, the dedicated server might crash unexpectedly. You might want to check the following: - Make sure the server is up to date following the steps above. - Check `/logs/Log.log` for clues. - Update the s&box editor and re-upload the gamemode to asset.party. Sometimes updates to s&box require the gamemode to be rebuilt. If all else fails, file a bug report, preferably with logs. # 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 [sbox.game](https://sbox.game/) This is a list of some of the more useful convars. | convar | Behaviour | Example | |---------------|---------------|----------| | +game | Sets the game and map. | +game facepunch.walker facepunch.flatgrass | | +hostname | Sets the name of the server. | +hostname "My Epic Server" | |+net_game_server_token | Allows you to set a token for your server that ensures that you will always have the SteamID. Visit Visit https://steamcommunity.com/dev/managegameservers to generate a token associated with your Steam Account. | +net_game_server_token <token> | <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 To connect to a server from in game, you may use the console command `connect <ip>:27015`, where `<ip>` is your server's public IP address. If you're connecting from the same machine that is hosting the dedicated server, you may use the loopback address like `connect 127.0.0.1:27015`. # Hosting Unreleased Content It seems to be the case that you can host dedicated servers for gamemodes that are not public on [sbox.game](https://sbox.game/). This is useful because it means you can host your gamemode whilst stopping it from showing up in the games list. The downside to this is that it presumably means that other people can host your unreleased content with a dedicated server too. Although, in practice, no one is likely to care enough to do this.
S&box Wiki
Development
Developer Overview
6
Editor Overview
General FAQ
System Requirements
The s&box wiki
Troubleshooting
Useful Links
The Project System
4
Adding Assets
Creating a Game Project
Project Settings Window - Games
Project Types
Publishing To Asset Party
2
Uploading assets
Uploading projects
Hammer
Getting Started With Hammer
3
Getting Started With Hammer
Making Your First Map
Mapping Resources
Mapping Basics
7
Cordons
Hotspot Materials
Selection Sets
Standard Mapping Dimensions
Tool Materials
Tools Visualisation Modes
Using Entities That Require a Mesh
Mapping Entities
2
Creating a Door
Light Entities
Advanced Mapping Techniques
8
Collaborating With Prefabs and Git
Instances
Prefabs
Quixel Bridge Plugin
Tilesets
Tilesets-Advanced
Tilesets-Proxies
VIS Optimizations
Models & Animation
Getting Started with Modeldoc
7
Automatic Model Setup
Breakpieces
Creating a Model
Guide to Models
Importing Rust Weapons
LODs
ModelDoc FAQ & best practices
Animgraph & Animation
4
Animations without Animgraph
AnimEvents, AnimGraph Tags, Attachments
Animgraph
Delta Animations
Physics
3
Cloth Physics
Collisions, Physics & Surface Types
Jiggle Bones
Modeldoc Nodes
1
Custom ModelDoc nodes
Advanced Modelling
6
Bodygroups
Citizen
First Person
IKChains and Stride Retargeting
Morphs
Vertex Normals
User Interface
UI Basics
7
Custom Fonts
Embedding Websites
Enabling Pointer Events
Events and Input
Localization
UI Basics
UI with Components
Styles & Stylesheets
1
Video Backgrounds
Razor Templates
4
A Razor Overview
Aliases and SetProperty Attributes
Generic Components
Templates
Game Menus
1
Making a Custom Pause Screen
Materials & Shaders
Materials
5
Guide to Materials
Material Attributes
Material Resources
Texture Settings
Using Dynamic Expressions
Built In Shaders
2
Foliage Shader
Glass Shader
Shaders
4
Compute Shaders
Constant Buffers
Material API
Shading Model
Shader Reference
5
Anatomy of Shader Files
Getting rid of Tex2D macros
Shader Reference
Shader States
Texture Format Cheat-Sheet
Other Assets
Sounds & Audio
3
Guide to Sounds
Sound Events
Soundscapes
Particles
5
Creating animated sprites
Creating your first particle effect
Understanding Particle Editor
Using custom sprites
Using particle systems from C#
Coding
Getting Started
5
Cheat Sheet
Learning Resources
Setting up Rider
Setting up Visual Studio
Setting up Visual Studio Code
Making Games
2
Components
GameObjects
Input
4
Commands
ConVars
Input System
Speech Recognition
Networking
7
Auth Tokens
Http Requests
Lobby System
Networked Types
Networking Basics
RPCs
WebSockets
Physics
5
Collisions
Hitboxes
Joints
Traces
Triggers
Rendering
3
Render Tags
RenderHooks
Scenes
Editor & Tools
7
Creating a Tool
Custom Asset Types
Guide to Widgets
Hammer API
Hammer Gizmos
Hotload Performance
Widget Docking
VR
3
Getting Started
VR Input
VR Overlays
Misc
13
Asset Types
Attributes and Component Properties
Backend API
Cloud Assets in code
Code Accesslist
CPU Performance Profiling
DisplayInfo
FileSystem
Mounting assets at runtime
package/find
Setting Up A Navigation Mesh
Threaded Tasks
TypeLibrary
Playing
Playing Guides
3
Default Keybinds
Proton
s&box on macOS (Experimental)
Console Commands & Variables
1
Launch Arguments
Dedicated Server
1
Dedicated Servers