Egg Repository

Pterodactyl Community Egg Repository

Subnautica

Subnautica is an open world survival action-adventure video game developed and published by Unknown Worlds Entertainment. In it, players are free to explore the ocean on an alien planet, known as planet 4546B, after their spaceship, the Aurora, crashes on the planet's surface. Note: NitroxMod version >=1.7.0.0 is required

Read Me

Subnautica: Nitrox Mod

Subnautica is an open world survival action-adventure video game developed and published by Unknown Worlds Entertainment. In it, players are free to explore the ocean on an alien planet, known as planet 4546B, after their spaceship, the Aurora, crashes on the planet's surface. The multiplayer function is provided by the mod "Nitrox". This mod is still in alpha version and therefore not yet fully stable.

NOTE

To download the base game, you will need to authenticate against Steam. Because of the normally active Steamgaurd protection, it is important to enter the Steamgaurd code. Once the initial installation is complete, you will need to enter the Steamguard code that will be emailed to you and then reinstall the server.

This will only work if you receive Steamguard codes via mail. The Authenticator app is not supported.

NOTE 2

NitroxMod version >=1.5.0.0 is required for this egg

Server Ports

The nitrox server requires only the default Server port.

Portdefault
Serverany
Yolks
NameTag
ghcr.io/ptero-eggs/yolks:dotnet_9ghcr.io/ptero-eggs/yolks:dotnet_9
Variables and Startup

Startup Command

export HOME=/home/container/subnautica; ./nitrox/NitroxServer-Subnautica

Variables

APP ID

The ID corresponding to the game to download.

Environment Variable: APPID
Default Value: 264710
User Viewable:
User Editable:
Steam-Username

Your Steam-Account SUername

Environment Variable: STEAM_USERNAME
Default Value:
User Viewable:
User Editable:
Steam-Password

Your Steam Account Password

Environment Variable: STEAM_PASSWORD
Default Value:
User Viewable:
User Editable:
Steam-GuardCode

Yout Steam Guard Code

Environment Variable: STEAM_GUARDCODE
Default Value:
User Viewable:
User Editable:
Nitrox Version

Which version of Nitrox to install and use. Use the version e.g. 1.5.0.1 or latest for the newest release

Environment Variable: NITROX_VERSION
Default Value: latest
User Viewable:
User Editable:
Auto Save Interval

Time between auto saves specified in milliseconds

Environment Variable: SAVE_INTERVAL
Default Value: 120000
User Viewable:
User Editable:
Disable Auto Save

Disables Auto Save: False / True

Environment Variable: SAVE_DISABLE
Default Value: False
User Viewable:
User Editable:
Save Name

The save name for the server.

Environment Variable: SAVE_NAME
Default Value: world
User Viewable:
User Editable:
Server Password

Password neccessary for connecting to the Server

Environment Variable: SUBNAUTICA_PASSWORD
Default Value:
User Viewable:
User Editable:
Admin Password

If specified, players must provide this password to gain access to administrator commands on the server.

Environment Variable: SUBNAUTICA_ADMIN_PASSWORD
Default Value: PleaseChangeMe
User Viewable:
User Editable:
Game Mode

Game Mode setting: SURVIVAL, FREEDOM, HARDCORE, CREATIVE

Environment Variable: SERVER_MODE
Default Value: SURVIVAL
User Viewable:
User Editable:
Auto Portforward via UPnP

If set to true, the server will try to open port on your router via UPnP

Environment Variable: PORTFORWARD_ENABLE
Default Value: False
User Viewable:
User Editable:
Serializer Mode

Switch between savegame formats. Possible values: PROTOBUF, JSON

Environment Variable: SERIALIZER_MODE
Default Value: JSON
User Viewable:
User Editable:
Subnautica Installation Path

Leave this as is

Environment Variable: SUBNAUTICA_INSTALLATION_PATH
Default Value: /home/container/subnautica
User Viewable:
User Editable:
XDG Config Home

Leave this as is

Environment Variable: XDG_CONFIG_HOME
Default Value: /home/container/.config
User Viewable:
User Editable:
Install Script
#!/bin/bash
# Installation Script
#
# Install dependencies
dpkg --add-architecture i386
apt update
apt -y --no-install-recommends install curl jq unzip libstdc++6 ca-certificates libsdl2-2.0-0:i386

## Get latest Nitrox-Mod build
## get release info and download links
GITHUB_PACKAGE="SubnauticaNitrox/Nitrox"
VERSION=${NITROX_VERSION}
MATCH="Nitrox"

LATEST_JSON=$(curl --silent "https://api.github.com/repos/${GITHUB_PACKAGE}/releases/latest")
RELEASES=$(curl --silent "https://api.github.com/repos/${GITHUB_PACKAGE}/releases")

# arch detection
_arch=$(uname -m)
case "${_arch}" in
  x86_64|amd64) ARCH_TAG="linux_x64" ;;
  aarch64|arm64) ARCH_TAG="linux_arm64" ;;
  *) ARCH_TAG="linux_x64" ;;
esac

select_asset_url() {
  local json="$1"
  local arch_tag="$2"
  url=$(echo "$json" | jq -r --arg arch "$arch_tag" '.assets[] | select(.name != null) | select((.name | test($arch; "i"))) | .browser_download_url' | head -n1)
  if [ -z "$url" ]; then
    url=$(echo "$json" | jq -r '.assets[] | select(.name | test("linux"; "i")) | .browser_download_url' | head -n1)
  fi
  if [ -z "$url" ]; then
    url=$(echo "$json" | jq -r '.assets[0].browser_download_url')
  fi
  printf "%s" "$url"
}

if [ -z "${VERSION}" ] || [ "${VERSION}" == "latest" ]; then
  RELEASE_JSON="${LATEST_JSON}"
  DOWNLOAD_URL=$(select_asset_url "$RELEASE_JSON" "$ARCH_TAG")
else
  RELEASE_JSON=$(echo "${RELEASES}" | jq -c --arg VERSION "$VERSION" '.[] | select(.tag_name == $VERSION)' )
  if [ -z "$RELEASE_JSON" ]; then
    echo "Requested Nitrox version ${VERSION} not found, defaulting to latest"
    RELEASE_JSON="${LATEST_JSON}"
  fi
  DOWNLOAD_URL=$(select_asset_url "$RELEASE_JSON" "$ARCH_TAG")
fi

if [ -z "$DOWNLOAD_URL" ] || [ "$DOWNLOAD_URL" == "null" ]; then
  echo "Could not determine Nitrox download URL. Dumping available assets for debugging:"
  echo "${RELEASE_JSON}" | jq '.assets[] | {name: .name, url: .browser_download_url}'
  exit 1
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

chown -R root:root /mnt
export HOME=/mnt/server


## Install game using steamcmd
GUARDCODE="${STEAM_GUARDCODE}"
if [ -z $GUARDCODE ]
then
    echo ""
    echo "### You did not specify a Steam Guardcode"
    echo "### A new one should be send to you shortly"
    echo "### Enter it in the startup-config after this installation is finished and reinstall the Server"
    sleep 10
    timeout 60 ./steamcmd.sh +login ${STEAM_USERNAME} ${STEAM_PASSWORD} +quit
    exit 1
fi

[ ! -d "$HOME/subnautica" ] && mkdir $HOME/subnautica
./steamcmd.sh +set_steam_guard_code ${STEAM_GUARDCODE} +login ${STEAM_USERNAME} ${STEAM_PASSWORD} +@sSteamCmdForcePlatformType windows +force_install_dir $HOME/subnautica +app_update ${APPID} ${EXTRA_FLAGS} validate +quit
status=$?

if [ $status -ne 0 ]
then
    echo ""
    echo "### The Download was not successful"
    echo "### Probably the entered Guardcode was wrong"
    echo "### A new one should be send to you shortly"
    echo "### Enter it in the startup-config after this installation is finished and reinstall the Server"
    sleep 10
    sleep 10
    timeout 30 ./steamcmd.sh +login ${STEAM_USERNAME} ${STEAM_PASSWORD} +quit
    exit 1
fi


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

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

## Download and extract Nitrox
[ -d "$HOME/nitrox" ] && rm -rf "$HOME/nitrox"
mkdir -p "$HOME/nitrox"
cd "$HOME/nitrox"

curl -sL "$DOWNLOAD_URL" -o Nitrox.zip
unzip -q Nitrox.zip
rm Nitrox.zip

# move contents from the first directory (e.g., linux-x64) to here
FIRST_DIR=$(find . -mindepth 1 -maxdepth 1 -type d | head -n 1)
if [ -n "$FIRST_DIR" ]; then
  mv "$FIRST_DIR"/* "$HOME/nitrox"/
  rm -rf "$FIRST_DIR"
fi

## make everything inside nitrox executable
chmod -R +x "$HOME/nitrox" || true

## create config directory
mkdir $HOME/.config


## Create path files to Subnautica Install-Dir. Needed for versions pre 1.6.0
echo "/home/container/subnautica" > $HOME/path.txt


## Create config
if [ -e $HOME/server.cfg ]; then
    echo "server settings exists"
else
    echo "writing server default settings"
    cat <<EOT > $HOME/server.cfg
    # Server settings can be changed here
    # Set to true to Cache entities for the whole map on next run. 
    # WARNING! Will make server load take longer on the cache run but players will gain a performance boost when entering new areas.
    CreateFullEntityCache=False
    # Leave blank for a random spawn position
    Seed=
    ServerPort=11000
    # Measured in milliseconds
    SaveInterval=120000
    # Command to run following a successful world save (e.g. .exe, .bat, or PowerShell script). 
    PostSaveCommandPath=
    MaxConnections=100
    InitialSyncTimeout=300000
    DisableConsole=False
    DisableAutoSave=False
    SaveName=world
    ServerPassword=
    AdminPassword=PleaseChangeMe
    # Possible values: SURVIVAL, FREEDOM, HARDCORE, CREATIVE
    GameMode=SURVIVAL
    # Possible values: PROTOBUF, JSON
    SerializerMode=JSON
    # Possible values: NONE, PLAYER, MODERATOR, ADMIN, CONSOLE
    DefaultPlayerPerm=PLAYER
    #
    # Default player stats below here
    DefaultOxygenValue=45
    DefaultMaxOxygenValue=45
    DefaultHealthValue=80
    DefaultHungerValue=50.5
    DefaultThirstValue=90.5
    # Recommended to keep at 0.1f which is the default starting value. If set to 0 then new players are cured by default.
    DefaultInfectionValue=0.1
    # If set to true, the server will try to open port on your router via UPnP
    AutoPortForward=False
EOT
fi
Installation Imageghcr.io/ptero-eggs/installers:debianInstallation Entrypointbash