Setting up a Multiplayer Server

From Vintage Story Wiki
Revision as of 14:19, 22 February 2020 by Tyron (talk | contribs) (→‎Ad-hoc Server)

Basic Setup

Ad-hoc Server

If you want a temporary multiplayer experience it is enough to open a single player world and then in the escape menu click "Open To Lan". This will then allow players in your local network to join. If you want players to join that are outside your local network, you can then also click "Open To Internet" which will attempt to set up that external players can connect to your server. This is done by a technique called UPnP and that has to be enabled on your internet router, which it often is by default. In short, we estimate there's about a 60% success chance that 'Open To Internet' works instantly without issues. If it doesn't you would need to set up a thing called "port forwarding" on your internet router, which can be tricky and frustrating at times, unfortunately. You would need to forward TCP Port 42420 in that case.

For this server to work, your single player world has to stay open

Dedicated Server

Alternatively the game ships with a dedicated server program that you can start and leave on permanently without needing to log in yourself.

Dedicated Servers on Windows

  • Enter the games application folder, by default that is in %appdata%/VintageStory
  • Start VintagestoryServer.exe
  • You might need to set up port forwarding on your router if the server should be accessible from beyond your local network


Dedicated Servers on Linux

This describes how to set up the server as a service

Requirements CentOS 7 (RHEL, Fedora, ...)

1. EPEL/screen/wget/curl Install

yum -y install epel-release screen wget curl

2. Mono Install

 yum -y install yum-utils
 rpm --import "http://keyserver.ubuntu.com/pks/lookup?op=get&search=0x3FA7E0328081BFF6A14DA29AA6A19B38D3D831EF"
 yum-config-manager --add-repo http://download.mono-project.com/repo/centos/
 yum -y install mono mono-devel
Requirements Ubuntu (Debian, Mint, ...)

1. screen/wget/curl Install

sudo apt install -y screen wget curl

2. Mono Install

 sudo apt install -y mono-complete mono-utils


3. Add the port to the firewall

firewalld

 firewall-cmd --permanent --zone=public --add-port=42420/tcp
 firewall-cmd --reload

iptables

 iptables -A INPUT -p tcp -m tcp --dport 42420 -j ACCEPT

4. Download the game

Goto http://account.vintagestory.at/downloads
Copy the link of the newest "vs_server_*.*.*.tar.gz" package
Enter in the console "wget" and parse the link

Hint: Make for VS a own directory the tar have no subfolder

5. Open TarGZ package

tar -xzf vs_server_*.*.*.tar.gz

6. Make the server.sh executeable

 chmod 755 server.sh

7. Edit server.sh file

For security reasons you should not run the server as root user, so by default USERNAME is set to vintagestory. On most linux operating systems you can create a user with the command adduser

 USERNAME='<your-vs-server-username>'
 VSPATH='<your-vs-directory>'

8. Server start and first steps

 ./server.sh start
 # Wait for startup then you can give you OP
 ./server.sh command "/op <youusername>"

9. Connect to you IP/Domain and have fun

Requirements Alpine (Advanced, no support)

1. Install mono

As mono is in testing in Alpine, the testing URL (http://dl-cdn.alpinelinux.org/alpine/edge/testing) will have to be uncommented out in

  /etc/apk/repositories

after, run

  apk update
  apk add mono mono-dev

2. Install tmux

  apk add tmux

3. Certificates

  apk add ca-certificates

then run

  cert-sync /etc/ssl/certs/ca-certificates.crt

to update the certs.


4. Simplified Start Script

Download and extract the server into a location as normal, then put this into a script:

  #!/bin/ash
  mono VintagestoryServer.exe  --dataPath ./data

This script will just run the server, putting the world save files into the same folder the server is extracted to. As an advanced user, you don't need to worry about having the dependancies, checking for new versions, or installing the server or save files under different users and locations.

Run the script in a tmux session.

The rest of the normal advice applies (firewalling etc)

Basic Configuration

Once your server is up and running you might want do look over some of the following configuration options. You can configure the server while its running through commands or by editing the serverconfig.json, for which the server needs to be off. On windows, by default, this file, is located in %appdata%/VintageStoryData/serverconfig.json

Here are some of the configurations set by commands, that you'd typically want to be setting.

  • /serverconfig name Peaceful PvE Server
    Set up the server name, visible in the public server listing
  • /serverconfig description This is a medieval survival server, PvE only, everyone welcome! <3
    Set up the servers description, visible in the public server listing
  • /serverconfig motd Hi {playername}! Please remember to follow the rules!
    The message shown to players when they join
  • /serverconfig password asdaf
    Require a password for players to log in, if desired. Use /serverconfig nopassword to remove again.
  • /serverconfig advertise (1|0)
    Whether or not add this server to the public server listing

Lastly, you can configure a server that was created with the 'Open To Lan' method in the same way as you do for dedicated ones, be aware though, in that case a few of the configurations are overridden by the client, such as the save file location.