visit
Disclaimer: I'm neither affiliated with nor sponsored by Radxa/Allnet, the manufacturer/distributor of the Rock Pi X. I bought the Rock Pi X with my own money and I'm writing purely to share my experience of running a dedicated server on it.
This model makes perfect sense for a sandbox game as the very definition of aĀ sandboxĀ implies isolation from outside influences, with each player generating their own world and/or joining other worlds. Without isolation Valheim is not much different from your typical MMORPG.
The only catch here is that when the host quits the game, all other players in the server areĀ immediately disconnectedĀ andĀ will not be able to rejoinĀ the same world unless theĀ host is online and in game. This makes for a less than fun experience, especially given that it is getting increasingly difficult to find a common time slot among friends to play together with the unpredictability of work schedules during these uncertain times brought about by none other than our best friend,Ā COVID-19.
Asynchronous collective progress
With a dedicated server, players can decouple their gaming schedules from each other, and play whenever they want and still contribute to theĀ collective progressĀ of a shared world. For example, I can just enter the game and dedicate an hour just to chop down an entire forest of trees for the sole purpose of relieving stress and yet in doing so, I can use the wood obtained to replenish the stockpile at base which was used earlier for building walls.
This element ofĀ asynchronousĀ collective progress, in my opinion, is what makes Valheim really fun and probably one of the main reasons behind Valheim's meteoric success thus far. It takes the stress of coordinating schedules among friends away from the game and gives each player the opportunity to still play as a team, even if no one could agree on a time to play together.
Performance decoupling
Another benefit is that the dedicated server decouples the performance of the server from the performance of your computer. For instance, if you happen to have a less than average computer, hosting a Valheim game may result in other players bottlenecking at your computer's network connection or CPU resources.With a dedicated server, your computer is now freed of the burden of computing world changes for other players just needs to focus onĀ yourĀ game experience. On top of all that, the enjoyment of all other players won't be diminished when you are experiencing performance issues.
Though that is still not a valid excuse for not getting a better-specced computer, but at the very least whenever there seems to be some lag with the dedicated server, you can now share the pain with the other players and pin the blame on the server. šDisaster-recovery
Regardless of whether you are a solo-player or prefer multiplayer with friends, disaster-recovery is an important aspect of every service that's at least semi-critical. Imagine putting in ~2 hours a day per player, in a server of 6 people, building a base, a dock, a castle, accumulating resources, all over several weeks, only to lose all that progress when the host's computer dies. That's easily 180 man-hours lost!With a dedicated server, depending on the implementation that you choose to deploy, one can schedule backups of the game world, and at any time, restore the state of the world to a specific backup. Personally, I schedule backups every 15 minutes, so that the maximum loss of is limited to 15 minutes, and I keep the backups for up to 24 hours, just in case something goes horribly wrong.Hardware
None other than the Rock Pi X!Specs for the Rock Pi X
| Aspect | Rock Pi X |
|----------|----------------------------------------------|
| CPU | Intel Atom x5-Z8300 Cherry Trail (Quad core) |
| Cores | 4x 1.44GHz with Turbo Boost to 1.84GHz |
| Memory | 4GB LPDDR3-3200 |
| Ethernet | Gigabit |
| Storage | eMMC (32GB/64GB) |
| USB | - 1x USB 3.0 (OTG/Host) |
| | - 3x USB 2.0 |
| Power | USB-PD |
| Item | Cost (SGD) | Cost (USD)* |
|------------------------|------------|-------------|
| Rock Pi X (32GB eMMC) | S$100.86 | US$75.00 |
| Heatsink | S$10.75 | US$7.99 |
| 45W USB-PD Power Brick | S$10.75 | US$7.99 |
| USB-C to USB-C Cable | S$6.71 | US$4.99 |
| Shipping | S$17.55 | US$13.04 |
| Total | *S$146.60* | *US$109.01* |
* SGD/USD exchange rate is 0.746268 as of the time of writing
I chose the Rock Pi X as it is the cheapestĀ amd64/x86Ā Single-board computer (SBC) on the market with storage and memory included. I did take a look at the ODROID H2+ but beside the fact that it'sĀ perpetually out of stock, it costs quite a bit more with all components included. In fact, the total cost of an Odroid H2+ setup is enough to buy myselfĀ 2 Rock Pi XĀ setups!
If you're still unconvinced, here's the cost breakdown for an Odroid H2+:| Item | Cost (SGD) | Cost (USD)* |
|-----------------------|------------|-------------|
| Odroid H2+ | S$158.58 | US$118.00 |
| 15V 4A Power Supply | S$12.63 | US$9.40 |
| Samsung 8GB SO-DIMM | S$48.38 | US$36.00 |
| Samsung 8GB SO-DIMM | S$48.38 | US$36.00 |
| ^Shipping | S$40.32 | US$30 |
| Samsung 960 Evo 250GB | S$63.00 | US$46.88 |
| Total | *S$371.30* | *US$276.28* |
* SGD/USD exchange rate is 0.746268 as of the time of writing
^ This shipping costs WAY too much in my opinion
Another reason why I chose the Rock Pi X is itsĀ size. The Rock Pi X, unlike many x86 SBCs, adopts the Raspberry Pi form factor, which saves a ton of space. As an added bonus, the form factor means that it fits in my old GeauxRobot Raspberry Pi cluster case, recycled from my old retired cluster, theĀ .
I know, I know, by now you must be wondering why didn't I just go for cloud VMs?I did consider the option of running Valheim on a cloud virtual machine but it turned out to be pretty pricey as well.
Based on theĀ Ā inĀ , it appears that the dedicated server requires at leastĀ 2 vCPUĀ andĀ 3GB RAM. I searched across the 3 major cloud service providers for the best prices available and the table below shows what I've found.
| Item | AWS | Azure | GCP |
|----------------------|-----------------------|------------------------|------------------------|
| Instance Type | t4g.medium | A2 v2 | e2-custom-2-4096 |
| vCPUs | 2 | 2 | 2 |
| Memory | 4 GiB | 4 GiB | 4 GiB |
| Instance Class | Spot | Low Priority | Preemptible |
| **Compute Subtotal** | **US$9.29 (S$12.49)** | **US$13.87 (S$18.65)** | **US$16.41 (S$22.07)** |
| Storage Type | EBS SSD (gp2) | Standard SSD | Zonal standard PD |
| Storage Capacity | 32GiB | 32GiB | 32GiB |
| Storage Subtotal | *US$3.84 (S$5.16)* | *US$2.40 (S$3.23)* | *US$1.41 (S$1.90)* |
| Monthly Total | *US$13.13 (S$17.66)* | *US$16.27 (S$21.88)* | *US$17.82 (S$23.96)* |
* SGD/USD exchange rate is 0.746268 as of the time of writing
In an attempt to further reduce the cost of the VMs, I've even lowered the virtual machine's instance class toĀ Spot/LowĀ Priority/Preemptible, depending on the cloud provider, but they all mean the same thing:
You are sold leftover compute capacity of physical servers that nobody really wants to buy, at a deep discount (~70%).
However, at any point in time, if the leftover capacity is no longer available, your VM will be terminated to give way to users who pay the full-price for the compute capacity.
This means, in exchange for a discount, you pay in terms of uncertainty of the availability of your servers. For a dedicated game server it's generally fine, though it is rather concerning as ValheimĀ , so if your VM terminates while you and your friends are playing, you may stand to lose up to 20 minutes of progress, which may sound trivial but will turn out to beĀ rather frustratingĀ if it happens frequently.
From the table above, we can see that AWS offers the cheapest VMs for the required specs. But if we were to opt out ofĀ SpotĀ instance class and go forĀ On-Demand, which is the standard class of VMs with no risk of termination, the price jumps toĀ US$34.79 (S$46.79)Ā per month! To put things into perspective, that means in about 3 months of incurred cloud costs, you can already purchase a Rock Pi X.
Assuming that the instance class is not an issue for you, then the breakeven point is pushed to around 8 months of cloud bills. To me, I foresee myself playing this game beyond 8 months, plus, I'm a huge fan of self-hosting on-premise so I opted for the Rock Pi X in the end.As for Docker, I followed the to set up Docker'sĀ apt repository, and installing viaĀ
apt install
.Docker image and configuration
As for image choice, I choseĀ Ā for its simplicity in configuration but there are other alternatives worth considering such asĀ Ā which is more feature-packed. I'd suggest checking out both of them and choosing what suits you best.Last but not least, here's theĀ
docker run
Ā command forĀ mbround18/valheim-docker
Ā along with my environment variable configuration:docker run -d \
--name valheim-server \
-p 2456-2458:2456-2458/udp \
-e NAME="My Valheim Server" \
-e WORLD="My World" \
-e PASSWORD="mysupersecurepassword" \
-e PUID=1000 \
-e PGID=1000 \
-e TZ=Asia/Singapore \
-e AUTO_UPDATE=1 \
-e AUTO_UPDATE_SCHEDULE="5 8 * * *" \
-e AUTO_BACKUP=1 \
-e AUTO_BACKUP_DAYS_TO_LIVE=1 \
-e AUTO_BACKUP_PAUSE_WITH_NO_PLAYERS=1 \
-e WEBHOOK_URL="//discordapp.com/api/webhooks/1234567/somejumbleofalphanumeric-dash_underscore" \
-v ./valheim/saves:/home/steam/.config/unity3d/IronGate/Valheim \
-v ./valheim/backups:/home/steam/backups \
-v ./valheim/server:/home/steam/valheim \
mbround18/valheim-docker
-
PUID
/PGID
: I set this toĀ 1000Ā as that is the default UID and GID of the first user you create during installation of Debian. This is to ensure that you don't run into permission issues with volume mounts.AUTO_UPDATE
/AUTO_UPDATE_SCHEDULE
: I've enabled auto updates and set the server to update atĀ 8:05AMĀ which is a time when all players are guaranteed to be not offline (when everyone's either working or sleeping). The time specified by the cron expression here depends on the correct setting of the timezone inĀ TZ
AUTO_BACKUP
/AUTO_BACKUP_PAUSE_WITH_NO_PLAYERS
: I set the server to perform an auto-backup at a default frequency of every 15 minutes and to pause auto-backups when there are no players. This reduces disk writes from backups by up toĀ 75%Ā as in any given day the server will only see active players in ~6 out of 24 hours and in the time when there are no players, the world remains frozen in the exact same state so there is no need for further backups.WEBHOOK_URL
: I set this to my Discord channel's Webhook URL which allows for server status notifications in the channel, giving my friends some visibility into whether the server is running.Port-forwarding
I configured port-forwarding on my router for source portsĀ
2456
,Ā 2457
Ā andĀ 2458
Ā to the Rock Pi X's internal IP address, for the same destination ports. Each router has a different interface so you'll have to search for help with this one if you have never tried it.There are 2 ways to connect to the server, via Steam server browser or in-game server browser, but there's anĀ even fasterĀ way that's not very well documented, which is specifying the server via theĀ launch options.
1. Go to Valheim in Steam, click onĀ SettingsĀ (indicated by the Gear icon)
2. UnderĀ Launch Options, enter the following, replacing the IP address with your dedicated server's:
+connect server.static.public.ip:2457
3. On launching the game, you'll only need to enter the password in the in-game prompt and you're good to goKnown issues (Fixed)
- Multiplayer network desync issues []
- Poor terraforming performance []
Resource utilization
I've taken measurements of the game's resource utilization withĀ htopĀ and computed the averages below.CPU (Idle): 0.6CPU (Load): 1.5RAM: ~2.2GBWith the 4 cores and 4GB of RAM, the game still leaves quite a bit of headroom.Current state
I've since joined the Rock Pi X into my arm64 cluster, Leviathan (post on it to come) and migrated the dedicated server into my K3s Kubernetes cluster so that it leverages the existing distributed block storage.I find that using Kubernetes is great if you already self-host multiple apps, but not so much if you're just intending to run a Valheim server, hence I did not recommend it in the instructions earlier.If you intend to dive head first into the rabbit hole ofĀ , thenĀ absolutely yes. I'd highly recommend this as your first project as it's relatively straightforward and the roadblocks you may face will help you in debugging other apps. The motivation behind this project and the sense of satisfaction you'll get when it all works out will help drive you forward in this endeavor.
Hosting a Valheim dedicated server will be a good litmus test for whether self-hosting in general is really something you'd like to do in the longer term.Till next time, have fun and good hunting!