How to run Valheim Dedicated Server as a Windows Service with FireDaemon Pro
TABLE OF CONTENTS
- Introduction
- Download, Install, and Update SteamCMD
- Download and Valheim Dedicated Server
- Download and Install DirectX
- Download, Install, and Run FireDaemon Pro
- Setup the Valheim Dedicated Server FireDaemon Pro Windows Service
- Additional Optional Parameters
- Setup a Scheduled FireDaemon Pro Service to Update Valheim Dedicated Server
Introduction
Valheim is a brutal exploration and survival game. You can set up and run the Valheim Dedicated Server component as a Windows service with FireDaemon Pro. You can also use FireDaemon Pro to schedule updates to the dedicated server.
Download, Install, and Update SteamCMD
Download SteamCMD. Unpack the contents of the ZIP file into C:\SteamCMD. Then open an elevated Command Prompt (WIN+X and choose Command Prompt (Admin) or Terminal (Admin)), then copy/paste:
cd /D C:\SteamCMD :: This updates SteamCMD .\steamcmd +quit
Download and Valheim Dedicated Server
At the same Command Prompt, copy/paste the following to download and install the Valheim Dedicated Server. The dedicated server is installed in C:\SteamCMD\steamapps\common\Valheim Dedicated Server:
:: This command downloads the Valheim Dedicated Server component from Steam .\steamcmd +login anonymous +app_update 896660 validate +quit
Download and Install DirectX
Download and install DirectX End-User Runtime from Microsoft.
Download, Install, and Run FireDaemon Pro
Download and install FireDaemon Pro. Once the installation is complete, double-click the FireDaemon Pro icon on your desktop to launch the FireDaemon Pro GUI.
Setup the Valheim Dedicated Server FireDaemon Pro Windows Service
In the FireDaemon Pro GUI, type Ctrl+N to create a new service per the screenshots below, then click the "tick" button to install the service. The FireDaemon Pro service will be installed, and the Valheim Dedicated Server should now be running.
Basic Service Configuration and Parameters
Field | Value |
---|---|
Service Name | Valheim Dedicated Server |
Display Name | Valheim Dedicated Server |
Tag | GameServer |
Startup Type | Automatic (Delayed Start) |
Program | C:\SteamCMD\steamapps\common\Valheim Dedicated Server\valheim_server.exe |
Working Directory | C:\SteamCMD\steamapps\common\Valheim Dedicated Server |
Parameters | -nographics -batchmode -name "My server" -port 2456 -world "Dedicated" -password "secret" -crossplay |
Type | Always Running Program |
Restart Schedule
Restarting the Valheim Dedicated Server at least twice a week is necessary to ensure memory is freed and to avoid client-server/sync issues.
Environment Variable
Create an environment variable called SteamAppId with the value 892970. This is necessary for Steam queries to work correctly and for the cross-play function.
Additional Optional Parameters
The Parameters passed to the Valheim Dedicated Server in the first screenshot above are usually enough. Additional optional Parameters are summarised in the table below:
Parameter | Description |
---|---|
-savedir ".\data" | Adjusts the server data directory. Can be relative to the server installation directory using ".\", or an absolute path. (Useful to keep world data out of lesser-known "AppData\LocalLow"). |
-public 0 | Opt out of listing the server publicly. Players would need either the IP address + port or a game join code to find the server, though a password should still be set alongside this. |
-logFile ".\data\logs\%FDDATE%.log" | Copy the server's output to a text file, though the file will be overwritten on each server start. |
-saveinterval 900 | Adjusts the default 30-minute world save interval, in seconds. |
-backups 4 | Adjust how many backup copies of the world database should be kept. |
-backupshort 7200 | Time to wait in seconds before creating the first backup world database. |
-backuplong 43200 | Time to wait in seconds before creating each subsequent backup world database after the first. |
-instanceid "1" | When hosting multiple servers on the same address, specify any unique instance ID (number or string) so that each server gets a different PlayFab ID. |
-preset casual/easy/normal/hard/hardcore/immersive/hammer | Adjust the game difficulty using a preset scenario. (Overrides modifiers and keys). |
-modifier Combat veryeasy/easy/hard/veryhard | Adjust combat difficulty. |
-modifier DeathPenalty casual/veryeasy/easy/hard/hardcore | Adjust death penalties. |
-modifier Resources muchless/less/more/muchmore/most | Adjust resource gain multiplier. |
-modifier Raids none/muchless/less/more/muchmore | Adjust raid frequency. |
-modifier Portals casual/hard/veryhard | Adjust portal restrictions. |
-setkey nobuildcost/playerevents/passivemobs/nomap | Activate world modifier options. (Each option must be its own "-setkey" parameter). |
Setup a Scheduled FireDaemon Pro Service to Update Valheim Dedicated Server
Create a batch file called UpdateValheim.cmd in the folder C:\SteamCMD\steamapps\common\Valheim Dedicated Server containing the following lines:
:: Script to stop, update, and start the dedicated server :: Adjust paths and service name as required @echo off set FDCLI="C:\Program Files\FireDaemon Pro\firedaemoncli" set FDSVC="Valheim Dedicated Server" set FDSTOP=control stop set FDSTART=control start :: Stop the FireDaemon Pro service %FDCLI% %FDSTOP% %FDSVC% :: Change directory to SteamCMD cd /D C:\SteamCMD :: Update the dedicated server .\steamcmd +login anonymous +app_update 896660 validate +quit :: Start the FireDaemon Pro service %FDCLI% %FDSTART% %FDSVC%
Open the FireDaemon Pro GUI. Type Ctrl+N to create a new service as follows:
Field | Value |
---|---|
Service Name | Update Valheim Dedicated Server |
Display Name | Update Valheim Dedicated Server |
Tag | GameUpdate |
Startup Type | Automatic (Delayed Start) |
Program | C:\SteamCMD\steamapps\common\Valheim Dedicated Server\UpdateValheim.cmd |
Working Directory | C:\SteamCMD\steamapps\common\Valheim Dedicated Server |
Type | Self Completing Task |
Then, create a schedule via the FireDaemon Pro Scheduling tab per the screenshot below to update the Valheim Dedicated Server. Click the "+" button to create a new schedule. Note that your dedicated server will be shut down for the duration of the update. Change the Start Time of the schedule to a time that suits you. You can also create multiple schedules. Click the "tick" button, the service will be installed, and the batch file will be scheduled to be run at the time nominated in the schedule.
And that's it! You should now have two FireDaemon Pro services set up and running. One runs the Valheim Dedicated Server, the second runs the update script periodically. Your FireDaemon Pro GUI should look similar to the following once both services are installed: