Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

alainmcd

[HowTo] Run a Dedicated Server from your PC - without SteamCMD or the Dedicated Server Tool

Recommended Posts

Azedo    4

@alainmcd Thank you very much !!! my server is on <3 thank you <3

question: there is 2 instances of my server, is this normal? I think it is because I'm running both Cave and Overworld Server

 

 

20170412143344_1.jpg

Share this post


Link to post
Share on other sites
ThatOneJosh    2

Been at this for a few hours already. Tried all of the steps given in the thread, but was unsuccessful in hosting a dedicated server with caves. I somewhat pinpointed my problem, but I do not know what is causing it.

Spoiler

2017-05-20.png

When I run the batch file, "RunDSTServer", whether it is with admin permissions or not, I get the first cmd prompt shown. Then a few seconds past and I get a message saying that "Windows cannot find '?dontstarve_dedicated_server_nullrenderer.exe'". After which, a second cmd prompt appears behind the second one successfully running part of the batch code.

With the first cmd failing, but the second one successful, I ran the game, renewed the cluster token, and my friends, including myself, were able to join no problem other than how caves were inaccessible. The caves are there, but are blocked by vines with wood flooring meaning that caves are unavailable in the server at the moment.

What I highlighted in the image is what could potentially be the problem. If I get rid of the line that involves 'shard Caves', the batch file runs fine, but only one cmd will appear. This is as far as I could pinpoint the problem as I have already tried uninstalling the game and verifying the integrity of the game files.

Share this post


Link to post
Share on other sites
alainmcd    889

Hi @ThatOneJosh, welcome to the forums!

Your error message shows there's a special character before dontstarve_dedicated_server_nullrenderer.exe, so Windows is looking for a file with that character in the name. I just tried copying the script from the OP and running it and it still works for me (Windows 8.1). Try this instead:

cd /D "%~dp0"
dontstarve_dedicated_server_nullrenderer.exe -only_update_server_mods
start "My DST Server Master" dontstarve_dedicated_server_nullrenderer.exe -skip_update_server_mods -cluster Cluster_5 -shard Master
start "My DST Server Caves" dontstarve_dedicated_server_nullrenderer.exe -skip_update_server_mods -cluster Cluster_5 -shard Caves

(I removed a space before the filename in the last line. I also removed the -console parameter from the last two lines because they're no longer needed here, but that's completely unrelated to your issue. I've updated the OP to reflect this.)

If it still doesn't work, try replacing the last line with a copy of the second-to-last line and replace in it Master with Caves (twice). Let me know how it works out for you.

Share this post


Link to post
Share on other sites
ThatOneJosh    2

@alainmcd, tried the modifications earlier and that seemed to fix the problem. I had to run it a second time though as the first attempt failed, but it was most likely due to having to many processes up at the time. I closed down everything I did not need to run the server and beyond the first attempt, every other attempt worked. Have not ran it to see if friends can join, but the caves are working as intended. I will inform you if I need additional help beyond this post.

Extremely helpful, thank you very much :encouragement:

Share this post


Link to post
Share on other sites

I followed your steps on a Windows, but I cannot seem to find my own server. It does not appear under LAN or Online, but friends are able to find, connect to, and play on my server via the Online.

Share this post


Link to post
Share on other sites
alainmcd    889

Hi @chrismus_time, welcome to the forums!

Make sure you are logging in, or else you won't be able to join. Also note that it might take a few seconds for your server to show up in the list, even if it's locally hosted. It should always be in LAN for you.

... If it really, really doesn't want to show up (I've never encountered this issue myself), you can always connect via the c_connect console command. Launch DST, log in, open the console, type the code below and press Enter:

c_connect"127.0.0.1"

If you have a password mypassword set, you'll need to specify it:

c_connect("127.0.0.1", nil, "mypassword")

Note that you have to add quotes to your password.

The second parameter is the port of the master server (server_port in your Master server's server.ini file), you won't need to specify it unless you're using something different from the default 10999.

Share this post


Link to post
Share on other sites
alainmcd    889

pause_when_empty is set to true by default. You can edit it in the cluster.ini in your cluster folder, under [GAMEPLAY].

Share this post


Link to post
Share on other sites
alainmcd    889

Care to point out what you find so complicated? Create a world, copy some text to new file, launch server.

Share this post


Link to post
Share on other sites
mooncake    1

Hello! Running into some trouble with mods.

If I host directly from the game via the "Host Game" option, the mods are available and enabled and work fine in game. However, when I launch it as a dedicated server using the RunDSTServer.bat file, none of the mods work and the world appears as an unmodded server on the game list. Any idea why my mods aren't enabled in the dedicated server?

Share this post


Link to post
Share on other sites
alainmcd    889

Hi @mooncake, welcome to the forums!

I just tried it and it works correctly for me, mod info is displayed before joining. I'm not sure what could be going wrong for you, since the server reads the exact same files when hosting, whether it's dedicated or player-hosted. (In fact, it's the same process that hosts the game regardless, at least when you're hosting a world with caves, since the game launches the dedicated server application to actually run the server, though invisible to the player. That's why this works.) Maybe you created a server in a slot other than 5 and didn't change the script to reflect it?

And sorry for the late reply!

Share this post


Link to post
Share on other sites
CrazyDwarf    1

Thanks, @alainmcd. Worked perfectly! Pretty straightforward and no problems. Always had problems trying the other two ways and was not much faithful to this method to work.

Had some doubts abt the first command line, but quick searched it and understood its meaning.

Share this post


Link to post
Share on other sites
alainmcd    889

Hi @CrazyDwarf, welcome around here!

The extra line at the beginning avoids an issue when executing the batch file with admin rights (since it sets the current location to C:\Windows\System32), otherwise it's unnecessary.

I'm glad to hear this helped you, thanks for letting me know!

Share this post


Link to post
Share on other sites
mooncake    1

@alainmcd no worries, I appreciate your taking the time to look into it for me! I figured out how to get the mods working on my dedicated server. Had to go into steamapps\common\Don't Starve Together Dedicated Server\mods\dedicated_server_mods_setup.lua and call the ServerModSetup function for each mod. Not sure why dedicated server mods didn't work right outta the box for me, but I'm just happy they're working now! 

Share this post


Link to post
Share on other sites
alainmcd    889

@mooncake, sounds like you created the batch file in the bin folder of the DST Dedicated Server tool, not DST. But all is fine as long as you get your server running properly.

Share this post


Link to post
Share on other sites
cyfoxe    0

extremely confused :/ im on mac and im lost where u want me to put those directions? you say put 

On 12/22/2016 at 9:41 AM, alainmcd said:

I'm not a Mac user, so your computer might burst into flames it might not work at all. Feedback would be very appreciated.

Copy and save the following text to "~/run_dst_servers.sh":


#!/bin/bash

install_dir="~/Library/Application Support/Steam/SteamApps/common/Don't Starve Together"
cluster_name="Cluster_5"

cd "$install_dir/bin"

run_shared=(./dontstarve_dedicated_server_nullrenderer)
run_shared+=(-cluster "$cluster_name")
run_shared+=(-monitor_parent_process $$)

"${run_shared[@]}" -shard Caves  | sed 's/^/Caves:  /' &
"${run_shared[@]}" -shard Master | sed 's/^/Master: /'

 

where do i find that?? where do i find ~/run_dst_servers.sh

Just a little unclear on how to execute the mac directions :/.. 

Share this post


Link to post
Share on other sites
alainmcd    889

Hi @cyfoxe, welcome to the forums!

You have to create the file. I'll edit the descriptions to make it clearer. Do let me know if you get it to work.

Share this post


Link to post
Share on other sites
FreyaMaluk    4,957

First off, my dear @alainmcd.. this is the quickest and coolest way for a dedi server I've ever seen.. ty so much.. 

I do have some questions tho.. is the 5th cluster "blocked" by the dedi server as long as I continue to use it? 

how can I manage new mods after having created the server?

 

Share this post


Link to post
Share on other sites
alainmcd    889

@FreyaMaluk, glad to hear that.

Yes, if you follow this guide, you are using up your fifth slot. However:

  • You can manage your server (including mods) from the "host" menu through the game, or even host the game regularly**; in both cases I'd strongly suggest only doing so when your server isn't running, or you risk losing progress or even your whole world. OR
  • You can rename your cluster folder from Cluster_5 to whatever you want (and the script accordingly) so it no longer shows up in the "host" menu. You won't be able to manage your world from within the game, obviously. You can still change your mods via the modoverrides.lua file of your servers (Documents\Klei\DoNotStarveTogether\YOURCLUSTER\Master\modoverrides.lua and ...\YOURCLUSTER\Caves\modoverrides.lua).

Also, I think there's a mod that gives you more slots, and it should work nicely.

** I've seen an issue with expiring tokens when "mixed" hosting, specifically creating a world via the game, then hosting the world as a dedicated, then hosting it through the game, then hosting it again via dedicated server. Solution? Create a new cluster token and move it to your cluster folder (see last spoiler in the OP).

re: your questions in the other topic:

  • 1 and 2: You should be covered if you're creating a world with this method. If you're creating a new world with the "official" guide, you'd need to create a worldgenoverride.lua file for your master and one for your caves.
  • 3: I think remote console is enabled by default. If not, go to your cluster folder (Cluster_5 or whatever you chose if you renamed it), open cluster.ini, look for the line "[MISC]" (if there isn't, add it at the end of the file) and add "console_enabled = true" without the quotes. To give other people admin privileges, you have to create an adminlist.txt file in your cluster folder with a list of their KU's (or KO's if it's an offline server) separated by new lines. I imagine you can add comments somehow, but I haven't looked into it, I just copied the file and added the comments to the copied file. Tip: if you create your server for a group, you can allow the group moderators to automatically be admins in your server, regardless of whether the server is public or group-only.
  • 4: I don't know and I don't care. I never play on public servers and I only host private or group-only servers, so the ping not showing up doesn't bother me. Sorry!

Let me know if I'm not clear or detailed enough on anything, or if it's not working for you.

Share this post


Link to post
Share on other sites
BigBBB    2

how to shutdown server, I try c_shutdown(true) but there are still dontstarve_dedicated_server_nullrenderer.exe in task manager

Share this post


Link to post
Share on other sites
Zillvr    1,634

Hello @BigBBB, welcome to the forums. The code is simply:

c_shutdown()

The parenthesis is empty. So input only that into both windows to shut them down. I hope that helps, cheers.

Share this post


Link to post
Share on other sites
alainmcd    889

@BigBBB, welcome! You have to close both windows with c_shutdown() - one is the overworld, the other is the caves.

@Zillvr, c_shutdown() takes an optional argument. If it's false, the server shuts down without saving; any other value triggers a shutdown saving the world. So c_shutdown(true) is valid and does the same as c_shutdown() (or c_shutdown(nil) or c_shutdown("give me all skins") for that matter).

Share this post


Link to post
Share on other sites