Skip to content
Go back
en

What I Did to Make a Valheim Dedicated Server × Crossplay Server More Stable and Robust

Published:

I have run a multiplayer server in a Valheim Dedicated Server × Crossplay environment before, so this is a memo of what I did at the time to make the server more stable and robust.

What the -crossplay Option Does

When you add -crossplay to Dedicated Server, the backend becomes PlayFab instead of Steamworks.

This setting is originally meant for playing across multiple platforms, but it has the following advantages when running a Dedicated Server.

  • You can host a server without configuring router Port Forwarding or explicitly opening ports (a Crossplay feature)
  • Players can join through the in-game Join Code / server list, making it easier for participants (you do not need to hand out an IP address)

In my server’s case, everyone was a Steam user, but I still kept -crossplay ON for the advantages above.

Add the -crossplay option to your startup bat file as shown below. Change the server name and password as needed.

valheim_server -nographics -batchmode -name "My server" -port 2456 -world "Dedicated" -password "secret" -crossplay

Making the Server More Stable and Robust

Here is a summary of what I did. I gradually tried settings starting from ones that seemed less likely to depend on PC specs, so I recommend trying them from the top. I do not recommend trying everything at once, because if something goes wrong, it becomes harder to isolate the cause.

Add /abovenormal to the Launch Options

This raises the process priority above “Normal.” I think most people run the Valheim client and server on the same PC at the same time, so this gives the server a slight priority boost.

start "" /abovenormal valheim_server -nographics -batchmode -name "My server" -port 2456 -world "Dedicated" -password "secret" -crossplay

Add -savedir/-logFile to the Launch Options

If possible, it is best to place the folders that store save data and log files on a fast SSD. (For example, an SSD installed in a CPU-connected M.2 slot.) I also recommend excluding those folders from virus scanning by Windows Defender or similar tools, because a scan may run every time a save or log write happens and make the server heavier.

Use folders that are easy for you to recognize.

start "" /abovenormal valheim_server -nographics -batchmode -name "My server" -port 2456 -world "Dedicated" -password "secret" -crossplay -savedir "C:\Users\hogehoge\AppData\LocalLow\IronGate\Valheim" -logFile "C:\Users\hogehoge\AppData\LocalLow\IronGate\Valheim\server.log"

Add Settings to boot.config

Add Unity memory allocator options in the memorysetup-* family to boot.config under Valheim dedicated server/valheim_server_Data/. The goal is to test whether increasing allocation blocks (initial reservations) can reduce spikes at specific timings or reduce fragmentation.

Copy-and-paste Presets

These are the settings I actually tried while gradually strengthening the values.

Procedure:

  1. Copy the existing boot.config as a backup (for example, boot-backup.config)
  2. Edit boot.config and add the settings introduced below
  3. Restart the server
  4. Check that the settings were applied in the [UnityMemory] Configuration Parameters - Can be set up in boot.config list in the startup log

Note: Be careful not to overwrite settings configured by default, such as gfx-threading-mode and build-guid. Only add the memorysetup-* lines.

Preset 1

Start here as a trial (modest increase in always-on memory usage)

Append this to the end of boot.config:

memorysetup-main-allocator-block-size=33554432
memorysetup-thread-allocator-block-size=33554432
memorysetup-cache-allocator-block-size=8388608
memorysetup-typetree-allocator-block-size=4194304
memorysetup-temp-allocator-size-main=8388608
memorysetup-job-temp-allocator-block-size=4194304
memorysetup-job-temp-allocator-block-size-background=2097152
memorysetup-allocator-temp-initial-block-size-main=524288
memorysetup-allocator-temp-initial-block-size-worker=524288
memorysetup-temp-allocator-size-background-worker=65536
memorysetup-temp-allocator-size-job-worker=524288
memorysetup-temp-allocator-size-preload-manager=524288

Preset 2

This should be enough for most people.

Append this to the end of boot.config:

memorysetup-main-allocator-block-size=67108864
memorysetup-thread-allocator-block-size=67108864
memorysetup-cache-allocator-block-size=16777216
memorysetup-typetree-allocator-block-size=8388608
memorysetup-temp-allocator-size-main=16777216
memorysetup-job-temp-allocator-block-size=8388608
memorysetup-job-temp-allocator-block-size-background=4194304
memorysetup-allocator-temp-initial-block-size-main=1048576
memorysetup-allocator-temp-initial-block-size-worker=1048576
memorysetup-temp-allocator-size-background-worker=131072
memorysetup-temp-allocator-size-job-worker=1048576
memorysetup-temp-allocator-size-preload-manager=1048576

Preset 3

For people who want to strengthen it further. Because this increases constant memory consumption, it may actually make things worse if your PC specs do not have enough headroom, such as when RAM is limited.

Append this to the end of boot.config:

memorysetup-bucket-allocator-block-size=33554432
memorysetup-bucket-allocator-block-count=3
memorysetup-main-allocator-block-size=134217728
memorysetup-thread-allocator-block-size=134217728
memorysetup-cache-allocator-block-size=33554432
memorysetup-typetree-allocator-block-size=16777216
memorysetup-temp-allocator-size-main=33554432
memorysetup-job-temp-allocator-block-size=16777216
memorysetup-job-temp-allocator-block-size-background=8388608
memorysetup-allocator-temp-initial-block-size-main=2097152
memorysetup-allocator-temp-initial-block-size-worker=2097152
memorysetup-temp-allocator-size-background-worker=262144
memorysetup-temp-allocator-size-job-worker=2097152
memorysetup-temp-allocator-size-preload-manager=2097152

  • Hytale Dedicated Server Settings to Make It More Stable and Less Laggy
  • What I did to improve brief connection dropouts and freezes in Marvel Rivals and VALORANT
  • [Deadlock] How to Set a Maximum FPS Limit
  • VALORANT Won't Launch After Enabling a WSL2 Environment
  • What I Did When My Network Started Stuttering After Enabling 3D V-Cache

Previous Post
How to Play Hytale Multiplayer with Hamachi
Next Post
How to Change Your Money Forward Subscription Payment Method While Keeping Account Connections