Guides/Don’t Starve Together Dedicated Servers

A Dedicated Server is an optimized version of Don't Starve Together that has been designed to be run for longer periods of time, with none of the graphical overhead.You can host one yourself as shown or rent one from a Game Server provider that will host the server for you. A list of Game Server Providers for Don't Starve Together can be found here : Citadel Servers

The server is available through Steam and SteamCMD on both Windows and Linux.

Requirements
You must own a copy of Don’t Starve Together to host an online Dedicated Servers, however a single copy of Don’t Starve Together can host many Dedicated Server instances.

Dedicated Servers do not use the same punch-through technology that our client hosted servers use. You must add proper port forwarding for your server to be reachable by game clients. The server uses UDP traffic on port 10999 by default.

To create a reliable/performant Dedicated Server experience you will want to ensure that your system has the following properties:
 * Internet (Upload) = 8Kbytes / player / s
 * Ram =  around 65Mbytes/player
 * CPU?
 * VCRedist_2008 (x86)

Downloading the Software
We currently offer two methods of downloading our server.

Downloading through SteamCMD:
Learn more about SteamCMD here: https://developer.valvesoftware.com/wiki/SteamCMD

On Windows:
login anonymous force_install_dir C:\path\to\directory app_update 343050 validate

On Linux (Debian):
sudo dpkg --add-architecture i386 # If running a 64bit OS sudo apt-get update sudo apt-get install lib32gcc1   # If running a 64bit OS

sudo apt-get install lib32stdc++6 # If running a 64bit OS sudo apt-get install libgcc1     # If running a 32bit OS sudo apt-get install libcurl4-gnutls-dev:i386 sudo useradd -m steam chmod a+rw `tty` # Note those are backticks, not single quotes sudo su - steam mkdir ~/steamcmd cd ~/steamcmd wget http://media.steampowered.com/installer/steamcmd_linux.tar.gz tar -xvzf steamcmd_linux.tar.gz ./steamcmd.sh login anonymous force_install_dir /home/steam/steamapps/DST (or whatever absolute path you want) app_update 343050 validate quit cd /home/steam/steamapps/DST/bin/ screen -S "DST Server" ./dontstarve_dedicated_server_nullrenderer  /!\  If your server run Debian stable (debian 7 / Debian Wheezy), you will not be able to launch the server because of the old libc version. The error will be : ./dontstarve_dedicated_server_nullrenderer: /lib/i386-linux-gnu/i686/cmov/libc.so.6: version `GLIBC_2.15' not found (required by ./dontstarve_dedicated_server_nullrenderer) Here is a hacky workaround (using the git repo https://github.com/dgibbs64/linuxgameservers/tree/master/Insurgency/dependencies ) mkdir ~/dst_lib && cd ~/dst_lib wget https://github.com/dgibbs64/linuxgameservers/raw/master/Insurgency/dependencies/libc.so.6 wget https://github.com/dgibbs64/linuxgameservers/raw/master/Insurgency/dependencies/libpthread.so.0 wget https://github.com/dgibbs64/linuxgameservers/raw/master/Insurgency/dependencies/librt.so.1 And to run the server : cd /home/steam/steamapps/DST/bin/ screen -S "DST Server" bash -c 'LD_LIBRARY_PATH=~/dst_lib ./dontstarve_dedicated_server_nullrenderer'

The server will start, then you can do CTRL-A D to throw it to the back ground. If you want to see it again, just type: screen -x DST

On Linux (Gentoo x64):
To run dedicated server you should enable Multilib system without emul packages, read official manual how to make it.

After your system update you have to add follow lines into /etc/portage/package.use: net-misc/curl curl_ssl_gnutls -curl_ssl_openssl abi_x86_32 and rebuild your curl with emerge -av curl After curl merge would be successfull you would probably need to link your /usr/lib32/libcurl.so.4 to /usr/lib32/libcurl-gnutls.so.4 to make don't starve together work. ln -s /usr/lib32/libcurl.so.4 /usr/lib32/libcurl-gnutls.so.4 && ldconfig

Downloading through Steam (Only on Windows or “Desktop Linux” = requires a GUI):
If you own Don’t Starve Together, the Dedicated Server download will appear in the ‘tools’ subsection of your library.

Windows
Create a .bat file (for example updateddst.bat) -- this is just a text file -- with the contents: steamcmd +login anonymous +force_install_dir D:\Servers\DST\ +app_update 343050 validate +quit Where D:\Servers\DST\ is an example of where you might have your Don't Starve Together Dedicated Server install

Linux
To create an update script, stop the server and type: $ vim /home/steam/steamcmd/update.sh Then add this to it and don't forget to change your game path if it is different: ./steamcmd.sh +@ShutdownOnFailedCommand 1 +@NoPromptForPassword 1 +login anonymous +force_install_dir /home/steam/steamapps/DST +app_update 343050 validate +quit Make it executable: $ cd /home/steam/steamcmd $ chmod +x update.sh When you want to update your server, type this (while in /home/steam/steamcmd/): $ ./update.sh
 * 1) !/bin/sh

Configuration
By now you should have two different directories:

The steam directory where you have your executable server file, "dontstarve_dedicated_server_nullrenderer.exe" on Windows and "dontstarve_dedicated_server_nullrenderer" on Linux. The directory should look like that:

Windows: C:/DontStarve/bin/dontstarve_dedicated_server_nullrenderer.exe Linux: /home/steam/steamapps/DST/bin/dontstarve_dedicated_server_nullrenderer

The second directory is where you have all your server settings. Those are the default directories:

On Windows: Documents/Klei/DoNotStarveTogether/ On Linux: ~/.klei/DoNotStarveTogether/ Note that if you will be playing Don't Starve Together from the same computer you are hosting the dedicated server on, you should use a different configuration directory for the dedicated server. This can be done by using the launch option "-conf_dir myDSTserver", which will change it to use this folder: Documents/Klei/myDSTserver/

The main method for configuring your dedicated server is through the settings.ini file. If the "setting.ini" file is not there, you will have to make it with a text editor of your choice.

On Windows: Documents/Klei/DoNotStarveTogether/Settings.ini On Linux: ~/.klei/DoNotStarveTogether/settings.ini

Settings are divided by different categories,  make sure to put your changes under the appropriate category:

[network]
default_server_name = Your unique server name default_server_description = A very nice server description server_port = 10999 server_password = password max_players = 1 .. 64 pvp = true | false game_mode = endless | survival | wilderness Snapshots allow you to full roll back a server to an older state. This feature is pretty new and has been observed to cause problems on some servers. I have been disabling this on most of my servers right now. enable_snapshots = [true | false] The auto saver creates a save at the start of each day, which will be resumed from when your server restarts. enable_autosaver = [true | false] Tick rate determines the quality of your server. A higher tick rate consumes more bandwidth and CPU, but can result in smooth gameplay for clients. tick_rate = 30 [ 10 | 15 | 30 | 60 ] A time in milliseconds that we should wait before dropping a non responsive client. connection_timeout = 8000 Which save slot should the dedicated server load server_save_slot = 1..5 When no admin is present, vote kick allows users to vote to kick players that are disrupting the game. enable_vote_kick = [true | false] When the dedicated server is empty, pause the sim. This is especially useful for private dedicated servers, when you want to resume where you left off with a group of friends. Defaults to false. pause_when_empty = [ true | false ]

[account]
Enable LAN only server: dedicated_lan_server = [ true | false ]

Command Line Options
Command line options override settings.ini options.

Force the server to use a specific port -port [1024 .. 65535] Force the server to run at a specific tick rate -tick [15 .. 60] Force the maximum number of players allowed in the server. -players [1 .. 64] Enable a command line console input mechanism. Allows you to execute privileged lua directly in the server window. -console Force the server into lan mode. The server will not require token authentication, and will not appear in the server listings. Only users on the same network will be able to join. -lan Force the server to load save and settings data from an alternative directory. Note that this is the directoryname, not the path. For example, a directory name of "DoNotStarveServerDirectory" would translate into a path of ~/.klei/DoNotStarveServerDirectory. -conf_dir DoNotStarveServerDirectory Setting the root directory of persistent storage. E.g. on Windows this defaults to your user documents folder / klei. This is used in conjunction with conf_dir to generate the path where files are stored. -persistent_storage_root 

Server Tokens
In order to run a public Dedicated Server, you are required to enter your “server token”. This token proves ownership of Don’t Starve Together and allows us to moderate servers that violate our terms of service.

To generate a server token, do the following:

Run Don’t Starve Together (the actual game, not the server you are trying to set-up. You need to log into steam). Click Play Multiplayer.

Press tilde (~) (or ù on Azerty keyboards) to open the developer console and type: TheNet:GenerateServerToken This command will generate the server token under the name "server_token.txt". The server token is written to your server_token.txt file located in:

On Windows: /My Documents/Klei/DoNotStarveTogether /server_token.txt On Linux: ~/.klei/DoNotStarveTogether/server_token.txt On Mac OS X: ~/Documents/Klei/DoNotStarveTogether/server_token.txt    Add your server_token.txt file to your custom configuration directory in order to authenticate the log-in credentials. 

Do not simply copy & paste the contents of this file from one machine to another. Move the actual file from one machine to another. If the file contains a carriage return or line ending at the file, you will receive an authentication error. 

If your server is hosted on a machine without a GUI, like a ubuntu server, a good way to put your server token information in your server would be to put it in the "settings.ini" file under the [account] section. server_token = [insert your server token]

Running
After setting your server, you can run it with this command:

 Windows: dontstarve_dedicated_server_nullrenderer.exe [-conf_dir ] Linux: ./dontstarve_dedicated_server_nullrenderer [-conf_dir ] Please note that on Linux you MUST change your current directory to be that of the dedicated server executable.

For example, you will run your server with something like this (linux): ./dontstarve_dedicated_server_nullrenderer -conf_dir DoNotStarveTogether ##if you kept the default directory##                                                                                     ##or## ./dontstarve_dedicated_server_nullrenderer -conf_dir MyDstServer ##with a custom directory##  '       ' ' ' ' ' 

Multiple Servers on the Same Machine
 If you wish to run multiple servers on the same machine, or have your server co-exist with the client, you will want to launch your server with an alternative configuration directory using the -conf_dir command line parameter.

 To use an alternative configuration directory, you can launch the server (or client) with this command line argument (on Steam you can do this under Properties -> Set Launch Options): -conf_dir DoNotStarveServerDirectory  This would change your configuration directory to "Documents/Klei/DoNotStarveServerDirectory/" (or "~/.klei/DoNotStarveServerDirectory" on Linux). You will then have a unique set of save slots, log.txt and settings.ini files.

Customizing the World Map
To generate a custom map with a dedicated server, you have to create a lua file in your configuration directory (which one?) named "worldgenoverride.lua". This file should return a table containing a key "override_enabled" assigned to true or false, and other keys containing tables of settings. An example of this is: return { override_enabled = true, misc = { season="shortboth", world_size="huge", season_start="summer" }, resources = { flint="never", grass="never", sapling="never", trees="never" } } Here is the table of options and their potential settings animals={ --options are "never", "rare", "default", "often", "always" alternatehunt="default", angrybees="default", beefalo="default", beefaloheat="default", bees="default", birds="default", butterfly="default", frogs="default", hunt="default", penguins="default", perd="default", pigs="default", rabbits="default", tallbirds="default" }, misc={ boons="default", --options are "never", "rare", "default", "often", "always" branching="default", --options are "never", "least", "default", "most" day="default", --options are "onlyday", "onlydusk", "onlynight", "default", "longday", "longdusk", "longnight" lightning="default", --options are "never", "rare", "default", "often", "always" loop="default", --options are "never", "default", "always" season="default", --options are "onlysummer", "onlywinter", "default", "longsummer", "longwinter", "longboth", "shortboth" season_start="summer", --options are "winter", "summer" touchstone="default", --options are "never", "rare", "default", "often", "always" weather="default", --options are "never", "rare", "default", "often", "always" world_size="default" --options are "default", "medium", "large", "huge" }, monsters={ --options are "never", "rare", "default", "often", "always" chess="default", deerclops="default", hounds="default", krampus="default", liefs="default", lureplants="default", merm="default", spiders="default", tentacles="default", walrus="default" }, resources={ --options are "never", "rare", "default", "often", "always" flint="default", flowers="default", grass="default", marshbush="default", meteorshowers="default", meteorspawner="default", reeds="default", rock="default", rocks="default", sapling="default", trees="default" }, unprepared={ --options are "never", "rare", "default", "often", "always" berrybush="default", carrot="default", mushroom="default" }

'''To customize the world from the Don't Starve Together graphical client for your dedicated server, you can follow the following steps. This is the legacy method.'''

Creating the Map
To create a custom map for a dedicated server, launch the Don't Starve Together client and select the option to Host Server on the server selection screen. Take note of which slot you generate the world in, as you will need to set its number in the dedicated server's settings.ini. Then you can select the option to Edit World on the right.

On the Edit World options screen, select the world options for the new world you wish to run as a dedicated server. It is not necessary to save your settings as a preset, though you may do so if you wish to reuse the settings later. When finished, select the option to Apply the settings.

Back on the server creation screen, enter a world name and description. This is required, but note that these settings are overridden in the persistent server's settings.ini file, so enter any legal values. The server will briefly appear in Klei's server selection screen, so please do not choose a vulgar or obscene name. Once ready, select the Create Server option on the left.

You will then see the Generating World screen while the map is generated, and next be placed on the character selection screen. At this point, the map is generated and there is no need to actually play on it, so select the option to Disconnect and confirm the option to shut down the server (Do it!) when prompted. You may now exit the Don't Starve Together graphical client.

In your Don't Starve Together directory, which is Documents\Klei\DoNotStarveTogether\save on Windows, or ~/.klei/DoNotStarveTogether/save on Linux, there will now be a file named saveindex, and a folder named server_temp. Copy both of these servers into the configuration directory for the dedicated server (or leave them in the same directory if you are not using -conf_dir (this is not recommended!)).

In dedicated server's settings.ini, ensure that the server_save_slot parameter in the [Network] section matches up with the save slot number you will use. For example, if you are using slot 2, you should have this in your settings.ini file: [Network] server_save_slot = 2

Mods
Dedicated servers support mods now too, and can be automatically installed via dedicated_server_mods_setup.lua in the main mods directory. (Note: this file is currently missing from the build and has to be created manually. It should appear after the next update). This file is run on boot and will download any mods or collection of mods that are setup in the file. An example of this file would be. ServerModSetup("345692228") ServerModSetup("346968521") ServerModSetup("352373173") The mods only update when the version changes on the Workshop, so server boot times should be reasonable and only pickup mod changes as they get posted to the Workshop. These mods will be downloaded and installed to your mod folder, but they aren't enabled by default.

There are two command line options for controlling how the dedicated_server_mods_setup.lua is used. They are meant to be used by hosts that are running several dedicated servers on a single machine. -skip_update_server_mods - skips the download of any mods or collections in the file -only_update_server_mods - quits once the downloads are finished.

To enable mods on dedicated servers, there are two ways. The first is to force enable the mods. To do this you will need to modify the file modsettings.lua to force enable the mods you desire. For example this would enable three mods from the workshop. ForceEnableMod("workshop-345692228") ForceEnableMod("workshop-346968521") ForceEnableMod("workshop-352373173")  To ensure that clients will be able to download the corresponding mods from the Workshop, you must not change the mod directory names.

The second option is using a modoverrides.lua file. Dedicated servers can now enable mods and set mod configurations via a file in the configuration directory named “modoverrides.lua” (\Documents\Klei\DoNotStarveTogether\modoverrides.lua). An example of the contents of this file is return { ["workshop-350811795"] = { enabled = true }, ["workshop-387028143"] = { enabled = true }, ["workshop-361336115"] = { enabled = true, configuration_options = {            hunt_time = 6, }    },     ["workshop-336882447"] = { enabled = true } } Note, dedicated servers (and normal clients) can override the mod config options to non-valid options using this method. In this example, 6 is not a normal option for the hunt_time in the Hunt game mode mod.

Administration
Dedicated servers can be remotely administered through the game client.

 The user who generated the server token is automatically granted administrator privileges.

An administrator has the ability to kick and ban users in the game, as well as to execute arbitrary lua on the server.

WARNING: Only grant administrator rights to those who you would trust with full access to your server / machine. We may add a moderator mode with reduced powers in the future.

 If you wish to provide administrator to additional users, you need to add an adminlist.txt file to your save directory:

On Windows: Documents/Klei/DoNotStarveTogether/Save/ On Linux: ~/.klei/DoNotStarveTogether/Save/   In this directory add the user identifiers for the users you wish to grant admin to. List the KU_’s one per line. 

As an admin, you may issue a remote command to your server by doing the following:
 * connect to the world through the game client
 * open the developer console (~)
 * press left CTRL to enter remote execution mode (REMOTE: appears to the left)
 * The command you enter will be executed on the server, assuming you have sufficient administrator rights
 * For a full list of console commands, see Don't Starve Together Commands

Is it possible to run my dedicated server in LAN mode?
Yes,  LAN mode can be configured in settings.ini by adding this line under the [account] heading: dedicated_lan_server = true '''Please remember LAN servers do not appear in the online server listings. '''

Is it possible to host multiple servers on a single (powerful) machine?
Yes, in order to host multiple servers you will want to have multiple configurations.

You can launch a server with a different configuration directory by passing in this command line option: -conf_dir 

For example, if you enter "-conf_dir MyDedi" then it will use the folder "Documents/Klei/MyDedi" for all saving, loading, and configuration that is normally stored in "Documents/Klei/DoNotStarveTogether".

===  Which save slot does the dedicated server use?'  '  === By default, 1. You can override the slot through the settings.ini option: [network] server_save_slot = [1..5]  

Troubleshooting
In C:\Users\Mark\Documents\Klei\DoNotStarveTogether\save\ delete survival_1. When you restart a new world will be generated
 * If you ran the dedicated server before you put a token in the settings.ini you may need to delete your world data.  Shutdown the server or client,


 * If your server is running correctly, but you still can’t see it.  Confirm it’s listing here:

=
http://my.jacklul.com/dstservers/ You will have to manually update the listing at the bottom of the page ===== If it’s still not visible from inside the game client, it’s because the client can’t ping your server. Did you make sure to forward UDP traffic on port 10999 to your machine

If you get the error Account Failed (6): "E_EXPIRED_TOKEN" you’ll want to verify that you saved the settings.ini file with the server token after you closed the game client, or your change will get overwritten. Also, make sure that there are no extra characters at the end of the file, even invisible ones.