Skip to content

Instantly share code, notes, and snippets.

@CoffeePirate
Last active October 21, 2024 03:40
Show Gist options
  • 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 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" "$@"

@lenderber
Copy link

@RedstoneWizard08, Hi. Did anything go beyond testing? Was there a test run of the server in docker?

@RedstoneWizard08
Copy link

RedstoneWizard08 commented Jun 29, 2024

I don't remember. It's been a few months. I'll test again, but I think it worked.

@daantimmer
Copy link

For the life of me, I can't get this to work:

FROM ubuntu:24.04

ENV DEBIAN_FRONTEND=noninteractive \
    TZ=America/Los_Angeles

RUN apt-get update && apt-get -y install \
    bash \
    curl \
    git \
    gzip \
    lib32gcc-s1 \
    sudo \
    tar \
    wget \
    wine \
    winetricks \
    xz-utils \
    && rm -rf /var/lib/apt/lists/*

# SteamCMD
WORKDIR /usr/share/steamcmd
RUN curl -fsSL "https://steamcdn-a.akamaihd.net/client/installer/steamcmd_linux.tar.gz" | tar -zxvf - \
    && chmod a+rx steamcmd.sh linux32/* \
    && chmod -R a+rwx /usr/share/steamcmd \
    # # Server
    && ./steamcmd.sh +force_install_dir ./server +login anonymous +app_update 298740 +quit \
    && mv /usr/share/steamcmd/server /server

WORKDIR /server
# Dependencies
RUN winetricks -q dotnet40 || true

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

I had to install wine and winetricks which was missing. used the normal steamcmd isntead of the custom one. As I saw no issues with it. Also merged RUN commands, as per linter.

When I run the last CMD I get:

root@cb8a0d3def06:/server# wine "/server/DedicatedServer64/SpaceEngineersDedicated.exe" -console
it looks like wine32 is missing, you should install it.
multiarch needs to be enabled first.  as root, please
execute "dpkg --add-architecture i386 && apt-get update &&
apt-get install wine32:i386"
0044:err:winediag:nodrv_CreateWindow Application tried to create a window, but no driver could be loaded.
0044:err:winediag:nodrv_CreateWindow L"The explorer process failed to start."
0044:err:systray:initialize_systray Could not create tray window
0044:err:ole:StdMarshalImpl_MarshalInterface Failed to create ifstub, hr 0x80004002
0044:err:ole:CoMarshalInterface Failed to marshal the interface {6d5140c1-7436-11ce-8034-00aa006009fa}, hr 0x80004002
0044:err:ole:apartment_get_local_server_stream Failed: 0x80004002
0024:err:ole:com_get_class_object class {079aa557-4a18-424a-8eee-e39f0a8d41b9} not registered
0024:err:ole:com_get_class_object no class object {079aa557-4a18-424a-8eee-e39f0a8d41b9} could be created for context 0x1
0024:err:ole:com_get_class_object class {079aa557-4a18-424a-8eee-e39f0a8d41b9} not registered
0024:err:ole:com_get_class_object no class object {079aa557-4a18-424a-8eee-e39f0a8d41b9} could be created for context 0x1
0024:err:mscoree:CLRRuntimeInfo_GetRuntimeHost Wine Mono is not installed
0044:err:ole:start_rpcss Failed to open RpcSs service

Yet, I was under the impression that the SEDS required a 64bit environment?

@userx14
Copy link

userx14 commented Sep 18, 2024

Maybe checkout this wine installation script from mmmaxwwwell for setting up the wineprefix:
https://github.com/mmmaxwwwell/space-engineers-dedicated-docker-linux/blob/v2/install-winetricks
I also needed dotnet48 and vcrun20XX, but can't comment on docker setups though, as I now run this on nixos as a flake.
Most likely 0024:err:mscoree:CLRRuntimeInfo_GetRuntimeHost Wine Mono is not installed is caused by these missing.

The wine32 thing just sounds like some warning one could ignore. I always use a 64bit wineprefix for space engineers and it works with the most recent version.

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