The Forest
Недостаточно оценок
The Forest Dedicated Server With SteamCmd [Jan 2023]
От oh so cold
Hey folks,

I was booting up a server again after a long time and I looked at the existing guides, found they were pretty fragmented and some were out of date, hardly using steamcmd. I pieced together a few things from last time and thought I'd put another guide, in case people are trying to get a session in before part 2 comes out for this game ;)

This is for Windows
   
Наградить
В избранное
В избранном
Удалить
Requirements
  • Doesn't require you to leave your game running so your friends can play
  • Doesn't require that dodgy tool in your steam games list, The Forest Dedicated Server
  • Requires steamcmd. Please download this.
  • Requires port forwarding (I will not be including a guide on how to do this since it is router-specific but I will tell you which ports to forward)
Setting up a folder for steamcmd
After getting steamcmd set up, decide where you want your forest game folder.

Path examples (Pick one)

Absolute path
force_install_dir c:\TheForestDedicatedServer\

Up one folder
force_install_dir ..\TheForestDedicatedServer\

In the steam command folder (I suggest this one)
force_install_dir .\TheForestDedicatedServer\

Whichever one you pick, and whatever you name the folder, it is upon you to stay consistent with that through the rest of the guide (and this will affect the later steps when you want to update the server)

Downloading the files

You can log in anonymously into steamcmd, like so

login anonymous

Then you can type

app_update 556450 validate

This may take some time, depending on your internet connection.
Setting up the files
NOTE: You can come back to this section after starting the server if you can't find the config

Okay, so I will be honest here - I am not sure exactly why they've decided to make the config files for this game in a really obscure location in your AppData instead of in the server.

If someone knows a way to get the config to be local to the server folder, I would appreciate it. Nonetheless, we will work around this accordingly.

The Server.cfg file is in
C:\Users\[USER]\AppData\LocalLow\SKS\TheForestDedicatedServer\ds

Important: [USER] should be replaced with your windows user.

Inside this folder you will find the Server.cfg file.

I don't have all day so I won't walk through every little setting here but I will mention the relevant ones for this tutorial. Each setting is carefully commented anyway and should suffice you.

// Dedicated Server Settings. // Server IP address - Note: If you have a router, this address is the internal address, and you need to configure ports forwarding serverIP 192.168.1.172 // Steam Communication Port - Note: If you have a router you will need to open this port. serverSteamPort 8766 // Game Communication Port - Note: If you have a router you will need to open this port. serverGamePort 27021 // Query Communication Port - Note: If you have a router you will need to open this port. serverQueryPort 27016 // Server display name serverName Really Cool Forest Server // Maximum number of players serverPlayers 6 // Enable VAC (Valve Anti-cheat System at the server. Must be set off or on enableVAC off // Server password. blank means no password serverPassword // Server administration password. blank means no password serverPasswordAdmin // Your Steam account name. blank means anonymous serverSteamAccount // Time between server auto saves in minutes - The minumum time is 15 minutes, the default time is 30 serverAutoSaveInterval 15 // Game difficulty mode. Must be set to Peaceful Normal or Hard difficulty Normal // New or continue a game. Must be set to New or Continue initType Continue // Slot to save the game. Must be set 1 2 3 4 or 5 slot 3 // Show event log. Must be set off or on showLogs on // Contact email for server admin serverContact email@gmail.com // No enemies veganMode off // No enemies during day time vegetarianMode off // Reset all structure holes when loading a save resetHolesMode off // Regrow 10% of cut down trees when sleeping treeRegrowMode on // Allow building destruction allowBuildingDestruction off // Allow enemies in creative games allowEnemiesCreativeMode off // Allow clients to use the built in debug console allowCheats on // Use full weapon damage values when attacking other players realisticPlayerDamage off // Allows defining a custom folder for save slots, leave empty to use the default location saveFolderPath forest_saves_dedicated_serv_2023 // Target FPS when no client is connected targetFpsIdle 5 // Target FPS when there is at least one client connected targetFpsActive 60

The most important ones above are the server IP and the ports. These are what you need to forward, and why I didn't list them out earlier because I thought maybe they differ for other people.

I also think that the initType is super important because I ended up playing for 2 hours, and saved several times only for the progress to disappear. Please set this to Continue. I might be mistaken though.

I would also personally recommend that you fill this in, to avoid messing with your other saves.

// Allows defining a custom folder for save slots, leave empty to use the default location saveFolderPath [VALUE HERE]

Replacing [VALUE_HERE] with your location. This doesn't need to be an absolute location.

The save files will be available in the server folder with this name. Call it save_files_2023 for example. Take frequent backups.

The Server IP is what your IP address is on your local network. This is not your public IP address. You can get this by going to command prompt and typing ipconfig. In this lovely printout you will find your local IP address


You want to enter this as the parameter above, as I have.

As for portforwarding, you know the answer. Go to your router page and find the page where you can enter ports to forward. This is crucial for allowing people to connect to your server from outside of your local network.

You should enter the following ports (derived from the config above):


// Steam Communication
serverSteamPort 8766

// Game Communication Port
serverGamePort 27021

// Query Communication Port
serverQueryPort 27016

Open these for both TCP/UDP.
Running the server
I personally prefer to use small scripts to start the server for granularity. I think you should too.

Open up a fresh notepad and type the following content into it, changing the path to the executable as appropriate:

"D:\SteamServers\steamcmd\TheForestServer\TheForestDedicatedServer.exe" -batchmode -nosteamclient

If you don't have a beastly CPU, do this instead:

"D:\SteamServers\steamcmd\TheForestServer\TheForestDedicatedServer.exe" -batchmode -nographics -nosteamclient

Remember when I said earlier that it is upon you to keep track of the name of the server? This is one of those times, so double check.

Now when saving the notepad file, please do not save it as a .txt. Instead do the following. Go to File -> Save As

This is super important, here, make sure you have "all files" selected in the dropdown for file type, then at the end of the file, add .sh, like so:

Save it in the same folder as the file that the script points to ideally, although since we are using the absolute path, it shouldn't matter.

You can now run your server by double clicking this file. Give it a few seconds the first time. Give it even more time if you don't have an SSD.

If you have a really cool and unique server name you should be able to just look it up by name in the dedicated (Internet) list. If not, then worry not, I have a solution for you, check the next section.
Connecting to server by IP
This section is optional if you managed to get your friends to connect with the internet page by finding your server by name

Otherwise, you can do the following.

Find your public IP address. You can do this many ways, like just googling. I personally use http://ipchicken.com to do this for the last 11 years or so.

In Steam, go to the top left, and find the View option. Click it, and in the dropdown, click the Servers section.


Click Add a server. Here, pay attention. Do you remember in the config there was this thing called Game port?. This is what you want to append to your IP address at the end, after a colon. So if my IP address was 11.12.77.89, then I would enter 11.12.77.89:27021 into this section.

Now when I go into game, I should see my server in the favourites tab when I click on multiplayer.
Recommendations before inviting your friends to your server
I recommend that you test the server before you invite your friends on. You don't even need to have portforwarded by this point. Just hop into game and join your server through the Dedicated (LAN) tab on the multiplayer section. Does the password work that you set?

I would advise also figuring out how to enable cheats so you can spawn in a house really fast and see if the save works. Close the server after saving and see if it saved your progress. I won't go over how to enable developer console and enable cheats so you can spawn in a house at the moment but its just a couple of commands.

Have you set a password? You don't want random people joining sometimes so set a nice and easy one, just make sure that you do have one.

Finally is the performance good? If not you might need to upgrade your PC. I feel like forest servers aren't exactly demanding so most people should be okay unless you're chilling on an intel core 2 duo with integrated graphics from 2011.
Updating the server
Updating the server is very similar to what we did in the first step with steamcmd. Just make sure your server is off while doing this to avoid file corruption.

Open steamcmd and like before, do the force_install_dir step before you logged in. I will copy the information from earlier to remind you, just make sure it is consistent with your earlier step.

Absolute path
force_install_dir c:\TheForestDedicatedServer\

Up one folder
force_install_dir ..\TheForestDedicatedServer\

In the steam command folder (I suggest this one)
force_install_dir .\TheForestDedicatedServer\

Now, like before, do

login anonymous

Then you can type this (it looks very familiar, it just had validate before)

app_update 556450

I have a little script I can share with you if you want to speed this up. Change the path to be the path to your dedicated server executable.

@echo off start "" steamcmd.exe +login anonymous +force_install_dir "[PATH_FROM_ABOVE]" +app_update 556450 validate +quit

Make sure PATH_FROM_ABOVE is the same as what you did in the last step (and the first step).

And as before, save this as a shell script (file extension .sh) as we did in the previous step where we made the script to start the server with our command line flags. Run this each time there is an update. Well - if there is any, the new game comes out soon.

Finally, thanks for following the guide. I spun this up in about an hour so there are bound to be mistakes. Please feel free to comment and I will fix them up.

Have fun.
Taking backups (Optional, but strongly recommended)
As mentioned before, you should have changed the folder your forest game saves into in the config section. This is to avoid it muddling with your single player saves/p2p saves.

If you've done this, it is good to back up these save slots in a separate folder every once in a while for your server. Make sure you close the server before you do this.

All you need to do is go into the folder you set up in the config (should be in the server folder, not that weird appdata place), and just copy and paste it into a backups folder and manage this carefully. To restore from a backup just paste the slot back in to the folder you set up in the config.
Комментариев: 5
Kinziplay 24 апр в 13:11 
Спасибо
oh so cold  [создатель] 26 сен. 2023 г. в 4:53 
@MissZaney

Thanks for your comment. Sorry for the late reply.

It has been some time since I've looked at this but if you haven't already got it working, try connecting via IP, entering 127.0.0.1:27021 as the target address. localhost:27021 is the same thing if you want to try that instead.
MissZaney 30 авг. 2023 г. в 5:21 
thx for this guide, its been a while but i just tried it and encountered two problems:
i cant run the .sh files, (i dont know if something else is needed to run this under windows 10) but it loads the server when just using the exe.
But most importantly i cannot connect to the server "server does not seem to be set up correctly", i reset the config but no luck, am i missing something?
montauk198 17 янв. 2023 г. в 10:10 
Wonder if I could do this in linux.
if there is only a exe maybe use wine to run it?
Sami 5 янв. 2023 г. в 9:09 
Amazing Guide! Thank so much, it was extremely helpful and easy to follow :selphinehappy: