Skip to content

Valheim BepINex

A brutal exploration and survival game for 1-10 players, set in a procedurally-generated purgatory inspired by viking culture incl the Plugin Framework BepInEx

egg-valheim-bepinex.json

updated

Ports

Add an allocation on the node for each port.

  • Game 2456
  • Query 2457

Install

Installer image
ghcr.io/ptero-eggs/installers:debian
Steam app
896660
Steam login
not required
Install script
114 lines

Image

  • valheim image ghcr.io/ptero-eggs/games:valheim

Panel features

  • steam_disk_space

    The Panel tells the user when SteamCMD does not have enough disk space.

Startup

The Panel runs this command to start the server. It replaces each variable in the command with the value of that variable.

17 variables

Startup command

export DOORSTOP_ENABLED=1; export DOORSTOP_TARGET_ASSEMBLY=./BepInEx/core/BepInEx.Preloader.dll; export LD_LIBRARY_PATH="./doorstop_libs:./linux64"; export LD_PRELOAD="libdoorstop_x64.so:$LD_PRELOAD"; export LD_LIBRARY_PATH="./linux64:./linux64"; export SteamAppId=892970; ./valheim_server.x86_64 -nographics -batchmode -name "My Server" -port 2456 -world "Dedicated" -password "secret" -public 1 -saveinterval 1800 -backups 4 -backupshort 7200 -backuplong 43200 $( [[ 0 -eq 1 ]] && echo " -crossplay ") > >(sed -uE "/^\(Filename:.*Line:[[:space:]]+[[:digit:]]+\)$/d; /^([[:space:]]+)?$/d") & trap "kill -2 $!; wait;" 15; wait $!

Dotted values come from the server settings. These values are examples.

  • Name that appears in server browser.

    SERVER_NAMEUsers can edit

    required|string|max:60

  • Server password.

    PASSWORDUsers can edit

    required|string|min:5|max:20

  • Name to load if switching between multiple saved worlds.

    WORLDUsers can edit

    required|string|max:20

  • PUBLIC_SERVERUsers can edit

    required|boolean

  • AUTO_UPDATEUsers can edit

    required|boolean

  • Enable crossplay support

    ENABLE_CROSSPLAYUsers can edit

    required|boolean

  • SRCDS_BETAIDUsers can edit

    max:30

  • SRCDS_BETAPASSUsers can edit

    max:30

  • Change how often the world will save in seconds. Default: 1800 (30 minutes).

    BACKUP_INTERVALUsers can edit

    required|numeric|min:0

  • Sets how many automatic backups will be kept. The first is the 'short' backup length, and the rest are the 'long' backup length. When default values are used means one backup that is 2 hours old, and 3 backups that are 12 hours apart. Default: 4.

    BACKUP_COUNTUsers can edit

    required|numeric|min:0

  • Sets the interval between the first automatic backups in seconds. Default: 7200 (2 hours).

    BACKUP_SHORTTIMEUsers can edit

    required|numeric|min:0

  • Sets the interval between the subsequent automatic backups in seconds. Default: 43200 (12 hours).

    BACKUP_LONGTIMEUsers can edit

    required|numeric|min:0

  • Remove unwanted outputs from the console.

    CONSOLE_FILTERUsers cannot see

    string

  • Valheim steam app id for auto updates.

    SRCDS_APPIDUsers can see

    nullable|numeric

  • Required to load server libraries.

    LD_LIBRARY_PATHUsers cannot see

    required|string

  • STOPUsers cannot see

    required|string|max:20

  • Enter the Dependency String name for a ModPack to automatically be installed NOTE: If the modpack Updates, you will need to update this variable with the new Dependency String. This is done to allow Old Versions to be used. CHANGING THIS REQUIRES A SERVER REINSTALL

    V_MODPACKUsers can edit

    string|nullable

Wings

Stop command
^C (SIGINT)
Running when the console shows
Game server connected

Readme

Valheim BepInEx

Author & Contributers

Name Github Profile Buy me a Coffee
gOOvER https://github.com/gOOvER ko-fi

Valheim

A brutal exploration and survival game for 1-10 players, set in a procedurally-generated purgatory inspired by viking culture. Battle, build, and conquer your way to a saga worthy of Odin’s patronage! https://store.steampowered.com/app/892970/Valheim/

BepInEx

BepInEx is a general purpose framework for Unity modding. BepInEx includes tools and libraries to

  • load custom code (hereafter plugins) into the game on launch;
  • patch in-game methods, classes and even entire assemblies without touching original game files;
  • configure plugins and log game to desired outputs like console or file;
  • manage plugin dependencies.

BepInEx is currently one of the most popular modding tools for Unity on GitHub.

This pack is preconfigured and usable for Valheim modding. In particular, the changes from base BepInEx releases are:

  • Added preconfigured BepInEx.cfg with console enabled.
  • Added unstripped Unity + Mono BCL DLLs for current versions of the game. See this issue comment for more info.
  • Updated Doorstop configuration and BepInEx to allow to load unstripped DLLs without having to overwrite game DLLs.
  • Added scripts necessary to run both game and dedicated server on Linux machines

Automatic Mod Downloading

Mods can be downloaded from modpacks automatically by entering the "dependency string" for the modpack from https://valheim.thunderstore.io/

Server Ports

Port default
Game 2456
Query 2457

Updating

Because the DOORSTOP_CORLIB_OVERRIDE_PATH=./unstripped_corlib; has been removed from the startup with the latest update of this egg. If your server is already running, update the startup manually.

Changes

  1. Update startup command for Valheim BepInEx (#246)

    · Daniel Barton · 041390a

  2. Add steamcmd based eggs

    · Daniel Barton · 60ef9fb

All changes on GitHub

Problem with this egg?

Open an issue on GitHub. Include your Panel and Wings versions.

Install script 114 lines bash in ghcr.io/ptero-eggs/installers:debian Show
#!/bin/bash
# Valheim Installation Script
#
# Server Files: /mnt/server
# Image to install with is 'debian:buster-slim'
apt -y update
apt -y --no-install-recommends --no-install-suggests install wget

## just in case someone removed the defaults.
if [ "${STEAM_USER}" == "" ]; then
    echo -e "steam user is not set.\n"
    echo -e "Using anonymous user.\n"
    STEAM_USER=anonymous
    STEAM_PASS=""
    STEAM_AUTH=""
else
    echo -e "user set to ${STEAM_USER}"
fi

## download and install steamcmd
cd /tmp
mkdir -p /mnt/server/steamcmd
curl -sSL -o steamcmd.tar.gz https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz
tar -xzvf steamcmd.tar.gz -C /mnt/server/steamcmd
cd /mnt/server/steamcmd

# SteamCMD fails otherwise for some reason, even running as root.
# This is changed at the end of the install process anyways.
chown -R root:root /mnt
export HOME=/mnt/server

## install game using steamcmd
./steamcmd.sh +force_install_dir /mnt/server +login ${STEAM_USER} ${STEAM_PASS} ${STEAM_AUTH} +app_update ${SRCDS_APPID} ${EXTRA_FLAGS} +quit

## set up 32 bit libraries
mkdir -p /mnt/server/.steam/sdk32
cp -v linux32/steamclient.so ../.steam/sdk32/steamclient.so

## set up 64 bit libraries
mkdir -p /mnt/server/.steam/sdk64
cp -v linux64/steamclient.so ../.steam/sdk64/steamclient.so

echo "-------------------------------------------------------"
echo "installing BepInEx and Selected ModPacks..."
echo "-------------------------------------------------------"
if ! api_response=$(curl -sfSL -H "accept: application/json" "https://thunderstore.io/api/experimental/package/denikson/BepInExPack_Valheim/"); then
        fatal "Error: could not retrieve BepInEx release info from Thunderstore.io API"
fi

download_url=$(jq -r  ".latest.download_url" <<< "$api_response" )
version_number=$(jq -r  ".latest.version_number" <<< "$api_response" )

if [ ! -z "$V_MODPACK" ]
then
#Modpack Name dashes to slashes for URL
V_MODPACK=$(echo "$V_MODPACK" | sed 's/-/\//g')

#Extract dependencies from ModPack JSON data
V_MODPACK_DEPENDENCIES=$(curl -sfSL -H "accept: application/json" "https://thunderstore.io/api/experimental/package/${V_MODPACK}" | jq -r '.dependencies[]')
fi

cd /mnt/server
#echo $download_url
wget --content-disposition $download_url
unzip -o denikson-BepInExPack_Valheim-${version_number}.zip
cp -r /mnt/server/BepInExPack_Valheim/* /mnt/server

if [ ! -z "$V_MODPACK" ]
then
#Delete Old Mods
rm -rf /mnt/server/BepInEx/plugins/*

#Download and extract the modpack dlls files
for V_MODPACK_DEPENDENCY in $V_MODPACK_DEPENDENCIES; do
  #ignore bepinex
  if [[ "$V_MODPACK_DEPENDENCY" == *"denikson-BepInExPack_Valheim"* ]]; then
    continue  # Skip this dependency
  fi
  
  #replace dashes with slashes for url
  V_MODPACK_DEPENDENCY_WITH_SLASH=$(echo "$V_MODPACK_DEPENDENCY" | sed 's/-/\//g')
  
  #download dependencies
  wget -O "$V_MODPACK_DEPENDENCY.zip" "https://thunderstore.io/package/download/$V_MODPACK_DEPENDENCY_WITH_SLASH"

  #Set the destination directory and ensure it exists
  destination_directory="/mnt/server/BepInEx/plugins"
  if [ ! -d "$destination_directory" ]; then
    mkdir -p "$destination_directory"
  fi

  #Extract DLL files from the ZIP and delete the zip file
  unzip -j "$V_MODPACK_DEPENDENCY.zip" "*.dll" -d "$destination_directory"
  
  #Cleanup
  rm $V_MODPACK_DEPENDENCY.zip
done
fi

##cleanup
echo "-------------------------------------------------------"
echo "cleanup files..."
echo "-------------------------------------------------------"
rm -fR BepInExPack_Valheim
rm -fR icon.png
rm -fR denikson-BepInExPack_Valheim-*
rm -fR manifest.json
rm -fR README.m

#rm -fR start_*

echo "-------------------------------------------------------"
echo "Installation completed"
echo "-------------------------------------------------------"