How to run Valheim Dedicated Server as a Windows Service with FireDaemon Pro

Valheim Dedicated Server Game Screenshot and Logo


TABLE OF CONTENTS

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
HTML

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
HTML

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

FireDaemon Pro Program tab settings for Valheim Dedicated Server


FieldValue
Service NameValheim Dedicated Server
Display NameValheim Dedicated Server
TagGameServer
Startup TypeAutomatic (Delayed Start)
ProgramC:\SteamCMD\steamapps\common\Valheim Dedicated Server\valheim_server.exe
Working DirectoryC:\SteamCMD\steamapps\common\Valheim Dedicated Server
Parameters-nographics -batchmode -name "My server" -port 2456 -world "Dedicated" -password "secret" -crossplay
TypeAlways 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.


FireDaemon Pro Scheduling tab settings for Valheim Dedicated Server

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.


FireDaemon Pro Environment tab settings for Valheim Dedicated Server


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:


ParameterDescription
-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 0Opt 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 900Adjusts the default 30-minute world save interval, in seconds.
-backups 4Adjust how many backup copies of the world database should be kept.
-backupshort 7200Time to wait in seconds before creating the first backup world database.
-backuplong 43200Time 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/hammerAdjust the game difficulty using a preset scenario. (Overrides modifiers and keys).
-modifier Combat veryeasy/easy/hard/veryhardAdjust combat difficulty.
-modifier DeathPenalty casual/veryeasy/easy/hard/hardcoreAdjust death penalties.
-modifier Resources muchless/less/more/muchmore/mostAdjust resource gain multiplier.
-modifier Raids none/muchless/less/more/muchmoreAdjust raid frequency.
-modifier Portals casual/hard/veryhardAdjust portal restrictions.
-setkey nobuildcost/playerevents/passivemobs/nomapActivate 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%
HTML


Open the FireDaemon Pro GUI. Type Ctrl+N to create a new service as follows:


FireDaemon Pro Program tab settings for Update Valheim Dedicated Server


FieldValue
Service NameUpdate Valheim Dedicated Server
Display NameUpdate Valheim Dedicated Server
TagGameUpdate
Startup TypeAutomatic (Delayed Start)
ProgramC:\SteamCMD\steamapps\common\Valheim Dedicated Server\UpdateValheim.cmd
Working DirectoryC:\SteamCMD\steamapps\common\Valheim Dedicated Server
TypeSelf 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.


FireDaemon Pro Scheduling tab settings for Update Valheim Dedicated Server


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:


FireDaemon Pro showing Valheim Dedicated Server and Update Valheim Dedicated Server services running