Skip to content

Instantly share code, notes, and snippets.

@CoffeePirate
Last active March 24, 2024 22:03
Show Gist options
  • Star 32 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save CoffeePirate/102e789310719cad6457 to your computer and use it in GitHub Desktop.
Save CoffeePirate/102e789310719cad6457 to your computer and use it in GitHub Desktop.
A quick guide how to setup Space Engineers Dedicated server on a Linux box with Wine

Ubuntu 14.04/14.10 SpaceEngineers Dedicated Server

Here's a quick guide how to run SpaceEngineers Dedicated Server on Ubuntu with Wine

Requirements

  • A copy of Space Engineers
  • A Windows box
  • A Linux box running Ubuntu 14.04 or 14.10 (It'll probably work on other distros, YMMV)

Step #1: Install & configure Wine1.6 and dependencies

sudo apt-get update
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ubuntu-wine/ppa
sudo apt-get update
sudo apt-get install wine1.6
winetricks -q dotnet40
rm -r ~/.wine
WINEARCH=win32 wine wineboot

Step #2: Copy necessary files to Linux box

Server binaries

There are multiple ways for transfering files, easiets would probably be using SCP, WinSCP works well for that. You'll want to transfer the DedicatedServer.zip file found in

[Steam install directory]\steamapps\common\SpaceEngineers\Tools

Unpack the zip somewhere inside

~/.wine/drive_c/users/$(whoami)/

World and config files

The easiest way to do this is to just generate them locally and copy them over to the server, this can be done by using the dedicated server tool on your windows box, the tool is located in

[Steam intall directory]\steamapps\common\SpaceEngineers\Tools\DedicatedServer\SpaceEngineersDedicated.exe
  1. Select the Default profile
  2. Set up the world
  3. Save the config
  4. Start to generate the world.

The files will be stored in

C:\Users\{USERNAME}\AppData\Roaming\SpaceEngineersDedicated\Default

Edit the SpaceEngineers-Dedicated.cfg and copy it with the Saves folder to the following directory on your Linux box

~/.wine/drive_c/users/$(whoami)/Application\ Data/SpaceEngineersDedicated

Step #3: Tweaks

You'll have to change the <LoadWorld> tag so it point to the correct directory.

If the Save folder is located in

~/.wine/drive_c/users/$(whoami)/Application\ Data/SpaceEngineersDedicated/Saves/Created 2015-03-30 2331

the <LoadWorld> tag must look like this, where {username} is the same as $(whoami)

<LoadWorld>C:\Users\{username}\Application Data\SpaceEngineersDedicated\Default\Saves\Created 2015-03-30 2331</LoadWorld> 

You still need to use windows paths.

Step #4: Run it

  1. Go to the directory where you have the dedicated server files
  2. wine SpaceEngineersDedicated.exe -console

Notes:

  • There will be a lot of messages regarding xserver, ignore them
  • Errors like fixme:shell:URL_ParseUrl failed to parse L"System.Core" are okay, ignore them.
  • Be sure to run 32bit, wine doesn't like the 64bit one.
  • There is a small bug where after stopping the server you will no longer see what you're typing into the console.
  • This guide is based on the guide I found over at Keen Software House Forums created by AdamAnt
@userx14
Copy link

userx14 commented May 20, 2021

Wasnt this for GUI purpose? wont work with other apllications either.

Yes X server is part of the GUI. If you install the Server version of Ubuntu you will not have X server or a window manager installed.
This shouldn't have something to do with you using a VM.

But in order to install the dotnet stuff with winetricks you probably need an X server + windows manager to click through the dialogs.

I guess you have three options:

  • temporary install xserver and a window manager on Ubuntu Server
  • use a remote xserver solution like x2go (which will also install xserver)
  • use a different vm-image with GUI like a normal Ubuntu or Debian to create the wine drive, then copy the resulting wine-drive to your headless vm.

@userx14
Copy link

userx14 commented Sep 21, 2021

Tested working on the most recent version (1.199.025)

But the most recent wine version 6.X breaks networking and when trying to connect I get

Peer2Peer_SessionRequest [xxxx]
Peer2Peer_ConnectionFailed [xxxx], Timeout

Using an older wine version (5.1~buster) fixed this for me.
With the latest version one has to change AppData\Roaming -> \Application Data
in SpaceEngineers-Dedicated.cfg and LastSession.sbl

@tvwenger
Copy link

I also recently tried this with the latest wine 6.X and was unable to get it to work. Instead, I use a docker container which works flawlessly with wine 6.X.

https://github.com/mmmaxwwwell/space-engineers-dedicated-docker-linux

@Crazygamer212
Copy link

will it be possible to create a custom linux server or does space engineers have the server architecture closed source with no docs

@userx14
Copy link

userx14 commented Oct 1, 2023

@Crazygamer212 there is an old version of the source code, including the dedicated server, on github. But it is no longer updated, see: https://blog.marekrosa.org/2017/08/statement-on-space-engineers-github.html

@RedstoneWizard08
Copy link

RedstoneWizard08 commented Jan 2, 2024

By the way, theoretically this should work on arm64, I am still testing it:

FROM ubuntu:23.04

ENV DEBIAN_FRONTEND=noninteractive \
    TZ=America/Los_Angeles

RUN apt-get update && \
    apt-get -y install \
        git \
        curl \
        wget \
        bash \
        sudo \
        tar \
        gzip \
        xz-utils

# Pi Apps
RUN git clone --recursive https://github.com/Botspot/pi-apps /usr/share/pi-apps
RUN sed -i 's/error "Pi-Apps is not designed to be installed as root! Please try again as a regular user."/echo -e "\\e[93mPi-Apps is not designed to be installed as root! Things may break!\\e[39m"/g' /usr/share/pi-apps/install
RUN /usr/share/pi-apps/install
RUN sed -i 's/error "Pi-Apps is not designed to be run as root! Please try again as a regular user."/echo -e "\\e[93mPi-Apps is not designed to be run as root! Things may break!\\e[39m"/g' /usr/share/pi-apps/gui
RUN sed -i 's/error "Pi-Apps is not designed to be run as root! Please try again as a regular user."/echo -e "\\e[93mPi-Apps is not designed to be run as root! Things may break!\\e[39m"/g' /usr/share/pi-apps/manage
RUN /usr/share/pi-apps/manage install Box64
RUN /usr/share/pi-apps/manage install Box86
RUN /usr/share/pi-apps/manage install "Wine (x64)"

# SteamCMD
RUN mkdir -p /usr/share/steamcmd
WORKDIR /usr/share/steamcmd
RUN curl -fsSL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar -zxvf -
COPY steamcmd-2.sh /usr/share/steamcmd/
RUN chmod a+rx steamcmd.sh steamcmd-2.sh linux32/*
RUN chmod -R a+rwx /usr/share/steamcmd
RUN ln -sf /usr/share/steamcmd/steamcmd-2.sh /usr/local/bin/steamcmd

# Server
RUN steamcmd +force_install_dir ./server +login anonymous +app_update 298740 +quit
RUN mv /usr/share/steamcmd/server /server
WORKDIR /server

# Dependencies
RUN winetricks -q dotnet40 || true

# Startup
CMD [ "/usr/local/bin/wine", "/server/DedicatedServer64/SpaceEngineersDedicated.exe", "-console" ]

The only change with steamcmd-2.sh from the original steamcmd.sh is this:

3c3
< STEAMROOT="$(cd "${0%/*}" && echo $PWD)"
---
> STEAMROOT="$(dirname "$(realpath "$0")")"
34,35c34
<   : "${DEBUGGER_ARGS=}"
<   $DEBUGGER -x "$ARGSFILE" $DEBUGGER_ARGS --args "$STEAMEXE" "$@"
---
>   $DEBUGGER -x "$ARGSFILE" "$STEAMEXE" "$@"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment