Configuración de un servidor multijugador

From Vintage Story Wiki
This page is a translated version of the page Setting up a Multiplayer Server and the translation is 42% complete.
Other languages:


Configuración básica

Servidor ad hoc

Si quieres una experiencia multijugador temporal, basta con abrir un mundo de un solo jugador y, a continuación, hacer clic en "Abrir a Lan" en el menú de escape. Esto permitirá a los jugadores de tu red local unirse. Si quieres permitir que jugadores de fuera de tu red local se unan, también puedes hacer clic en "Abrir a Internet", que intentará establecer una conexión externa para unirse a tu servidor desde Internet. Esto se hace mediante una técnica llamada UPnP y tiene que estar activada en tu router de internet, que suele estarlo por defecto. En resumen, estimamos que hay alrededor de un 60% de posibilidades de éxito de que "Abrir a Internet" funcione instantáneamente sin problemas. Si no lo hace, tendrás que configurar el llamado "reenvío de puertos" en tu router de Internet, lo que puede ser complicado y frustrante a veces, por desgracia. En ese caso, tendrías que redirigir el puerto TCP 42420 de tu ordenador. (Busca en Google "Reenvío de puertos" con el nombre o modelo de tu router de internet para encontrar ayuda).

Para que este servidor funcione, tu mundo de un jugador tiene que permanecer abierto.


Servidor dedicado

Como alternativa, el juego incluye un programa de servidor dedicado que puedes iniciar y dejar encendido permanentemente sin necesidad de conectarte. Hay varias formas de poner en marcha un servidor dedicado.

Hosting de pago

Los creadores del juego se encargan del alojamiento a través del panel de control integrado del servidor, aún no hay soporte para mods, los servidores se encuentran en Europa central.

Servicios de alojamiento de terceros, sin ningún orden en particular:

Servidores dedicados en Windows

  • Abre la carpeta de aplicaciones del juego, es %appdata%/VintageStory por defecto.
  • Ejecute VintagestoryServer.exe.
  • Si quieres que el servidor sea accesible desde fuera de tu red local (por ejemplo, si alguien no está conectado a la misma red WiFi que tú), es posible que tengas que configurar el reenvío de puertos en tu router de Internet.

Servidores dedicados en Linux

Aquí se describe cómo configurar el servidor como un servicio en sistemas Linux.
Nota: Lo siguiente sólo funciona para procesadores x64, si utiliza ARM consulte la siguiente sección.

Requerimientos
  • .NET Runtime 7.0 Esto debería ser todo lo necesario para ejecutar un servidor Vintagestory. Todo lo demás es sólo por conveniencia para iniciarlo y administrarlo.
  • instalar pgrep, screen y wget utilizando el gestor de paquetes de su sistema.
Configurar el servidor

1. Descargar el juego

Consejo: Crea un directorio aparte para Vintage Story, ya que el tar.gz no contiene ninguna subcarpeta.

 mkdir server && cd server

Ir a http://account.vintagestory.at/downloads
Copie el enlace del paquete más reciente "vs_server_linux-x64_*.*.*.tar.gz" (Linux Server (.tar.gz) en Mostrar otras descargas de Vintage Story)
Descarga con "wget" a través de la consola (Vintage Story versión 1.18.8 en este ejemplo).

 wget https://cdn.vintagestory.at/gamefiles/stable/vs_server_linux-x64_1.18.8.tar.gz

2. Extrae el paquete tar.gz

 tar xzf vs_server_linux-x64_*.*.*.tar.gz

3. Hacer ejecutable el script server.sh

 chmod +x server.sh

4. Editar el archivo server.sh

Por razones de seguridad no debe ejecutar el servidor como usuario root, por lo que por defecto USERNAME se establece en vintagestory. En la mayoría de los sistemas operativos linux puede crear un usuario con el comando adduser.

 adduser vintagestory

A continuación, modifique estas opciones en función de sus necesidades:

 USERNAME='<tu-usuario-de-servidor-de-vs>'
 VSPATH='<tu-directorio-de-servidor-de-vs>'

5. Abra el puerto en el firewall (si es necesario)

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

6. Inicio del servidor y primeros pasos

   ./server.sh start
 
 Espera a que termine el arranque, entonces puedes darte OP con
 ./server.sh command "/op <youusername>"

7. Conéctate a tu IP/Dominio y diviértete


Dedicated Servers on ARM64

Note: Please note the ARM64 version is EXPERIMENTAL please report any issues to the discord

The ARM64 version is available on GitHub

I recommend using the install script located on the GitHub. The following is a step by step guide on how to use the script on a Debian based system (Ubuntu, Debian, Rasbian, etc).

1. Install the required dependencies to use this script by doing apt -y install curl jq

2. Create a new file named arminstall.sh by running vim arminstall.sh or nano arminstall.sh

3. Copy the contents of the arminstall.sh file from GitHub to your newly created file and save it by using :wq with Vim or Ctrl + X, then Y, then Enter with Nano.

4. Make the script executable by running chmod +x arminstall.sh

5. Run the script by doing ./arminstall.sh

6. Start the server by using ./VintagestoryServer or dotnet VintagestoryServer.dll

This will download the latest version of Vintagestory to the current working directory, then replace the needed files to work with ARM.

If at any time you want to update to the latest version of Vintage Story, simply run the script again.


Simple Server start command

If you want to use a custom script or just manually start your server you can run

dotnet VintagestoryServer.dll --dataPath /path/to/data

Or

./VintagestoryServer --dataPath /path/to/data

if you have the DOTNET_ROOT environment variable set.

Updating Servers

If you want to install a newer version, remove all installation files first, or you'll get unforseeable behavior. If you chose a data folder inside the installation folder, make sure to not delete that one, or you'll loose your save games, settings and player data. Download the "Tar.gz Archive/Linux (server only)" file and extract it. If you have a remote installation and only a FTP connection to your server, you will have to unpack it locally and upload each file.

Configuración Básica

Una vez que el servidor está en funcionamiento, es posible que desee echar un vistazo a algunas de las siguientes opciones de configuración. Puede configurar el servidor mientras se está ejecutando a través de comandos o mediante la edición de la serverconfig.json , para lo cual el servidor debe ser detenido en primer lugar. En Windows, este archivo se encuentra por defecto en %appdata%/VintageStoryData/serverconfig.json. En Linux se encuentra en ./data/serverconfig.json del directorio de su servidor (e.g. /home/vintagestory/server/data/serverconfig.json si se configura como se describe aquí)

Protip:
La forma más sencilla de configurar un mundo a tu gusto es crearlo primero en el modo de un jugador, utilizando las opciones avanzadas de creación de mundos, y luego subirlo para utilizarlo como mundo servidor.


Explicación de los valores en serverconfig.json se puede encontrar aquí: Server Config

Éstas son algunas de las configuraciones establecidas por comandos, que normalmente querrías establecer.

  • /serverconfig upnp [0|1]
    Si se establece en uno, el servidor del juego intentará configurar el reenvío de puertos para usted
  • /serverconfig name Peaceful PvE Server
    Configurar el nombre del servidor, visible en el listado público de servidores
  • /serverconfig description Este es un servidor de supervivencia medieval, sólo PvE, todos bienvenidos! <3
    Configurar la descripción de los servidores, visible en el listado público de servidores
  • /serverconfig motd Hola {playername}! Recuerde respetar las normas!
    El mensaje que se muestra a los jugadores cuando se unen
  • /serverconfig password asdaf
    Exija una contraseña a los jugadores para iniciar sesión, si lo desea. Usa /serverconfig nopassword para volver a quitar.
  • /serverconfig advertise (1|0)
    Añadir o no este servidor a la lista de servidores públicos

Por último, puedes configurar un servidor creado con el método "Open to Lan" de la misma forma que los dedicados, pero ten en cuenta que en este caso algunas de las configuraciones son anuladas por el cliente, como la ubicación del archivo de guardado.

Adquisición de derechos de administrador del servidor

Si tiene acceso a la consola del servidor, escriba /op playername. Si no es así, abra el serverconfig.json y sustituya "StartupCommands": null, con "StartupCommands": "/op playername",

En ambos casos, debes sustituir nombre de jugador por tu nombre real de jugador.

Advanced Dedicated Server

Debian with systemd service and rsyslog

If you prefer using systemd instead of screen to run your VS Server, you can follow these Instructions.
We also will setup rsyslog to split all logs into separate files.

Installation

1. create a user

 adduser --shell /bin/bash --disabled-password gameserver

2. create directories

 mkdir -p /srv/gameserver/vintagestory
 mkdir -p /srv/gameserver/data/vs
 mkdir -p /usr/lib/systemd/system

3. Download the game

 cd /srv/gameserver/vintagestory

Goto http://account.vintagestory.at/downloads
Copy the link of the newest "vs_server_linux-x64_*.*.*.tar.gz" package (Linux Server (.tar.gz) under Show other available downloads of Vintage Story)
Download with "wget" via console (Vintage Story version 1.18.8 in this example).

4. Extract tar.gz package

tar xzf vs_server_linux-x64_1.18.8.tar.gz

5. Change owner

You have to set the owner of your gameserver directory to avoid write permission errors

 chown -R gameserver:gameserver /srv/gameserver

6. Create systemd service unit file

Use your favourite tool to create a service unit file (this example uses nano)

 nano /usr/lib/systemd/system/vintagestoryserver.service

Insert the following content

 [Unit]
 Description=Vintage Story Server Unit
 After=network.target
 
 [Service]
 WorkingDirectory=/srv/gameserver/vintagestory
 ExecStart=dotnet VintagestoryServer.dll --dataPath /srv/gameserver/data/vs
 Restart=always
 RestartSec=30
 StandardOutput=syslog
 StandardError=syslog
 SyslogIdentifier=VSSRV
 User=gameserver
 Group=gameserver
 
 [Install]
 WantedBy=multi-user.target

Make sure the new user has access to the dotnet command or replace the command with the full path to where you installed the dotnet runtime (if you picked a custom install). Or you can also use ExecStart=VintagestoryServer --dataPath /srv/gameserver/data/vs if you have the DOTNET_ROOT environment variable set.

7. Create config file for rsyslog

Use your favourite tool to create a rsyslog config file (this example uses nano)

 nano /etc/rsyslog.d/vintagestoryserver.conf

Insert the following content

 if $programname == 'VSSRV' then {
     if($msg contains "Chat") then {
         action(type="omfile" dirCreateMode="0755" FileCreateMode="0644" File="/var/log/vintagestory-server/chat.log")
     } else if($msg contains "verließ") then {
         action(type="omfile" dirCreateMode="0755" FileCreateMode="0644" File="/var/log/vintagestory-server/login.log")
     } else if($msg contains "join") then {
         action(type="omfile" dirCreateMode="0755" FileCreateMode="0644" File="/var/log/vintagestory-server/login.log")
     } else if($msg contains "Server Warning") then {
         action(type="omfile" dirCreateMode="0755" FileCreateMode="0644" File="/var/log/vintagestory-server/warn.log")
     } else if($msg contains "Server Notification") then {
         action(type="omfile" dirCreateMode="0755" FileCreateMode="0644" File="/var/log/vintagestory-server/info.log")
     } else if($msg contains "Server Debug") then {
         action(type="omfile" dirCreateMode="0755" FileCreateMode="0644" File="/var/log/vintagestory-server/debug.log")
     } else if($msg contains "Server Event") then {
         action(type="omfile" dirCreateMode="0755" FileCreateMode="0644" File="/var/log/vintagestory-server/event.log")
     } else {
         action(type="omfile" dirCreateMode="0755" FileCreateMode="0644" File="/var/log/vintagestory-server/other.log")
     }
 }
 # Discard 
 if $programname == 'VSSRV' then ~

8. restart rsyslog / enable service To activate rsyslog and your vintagestory server type these commands

 systemctl restart rsyslog.service;
 systemctl enable vintagestoryserver.service
 systemctl start vintagestoryserver.service

Stop, Start, Disable Server

To manually stop your VS Server use this command

 systemctl stop vintagestoryserver.service

To manually start your VS Server again type

 systemctl start vintagestoryserver.service

To disable the service use

 systemctl disable vintagestoryserver.service

Config

to change your servers configuration, stop the server and edit

 nano /srv/gameserver/data/vs/serverconfig.json

After you saved your changes, start server again.

Restart schedule

If you want your server to restart every day, you can setup a cronjob for this

 crontab -e

insert this line to stop the server at 04:30

 30 4 * * *      systemctl stop vintagestoryserver.service

you could now ececute backup tasks and then start it again with the next line at 04:32 (if you run a backup task plan some more time here)

 32 4 * * *      systemctl start vintagestoryserver

If you just want to restart the server this line instead of the other two should be fine

 30 4 * * *      systemctl restart vintagestoryserver.service

Logging

The rsyslog config splits the output logs into seperate files that you can watch with tail command
For Login/Logout see

 tail -f /var/log/vintagestory-server/login.log

For all chat messages see

 tail -f /var/log/vintagestory-server/chat.log

For all messages containing [Server Warning] see

 tail -f /var/log/vintagestory-server/warn.log

For all messages containing [Server Notification] see

 tail -f /var/log/vintagestory-server/info.log

For all messages containing [Server Debug] see

 tail -f /var/log/vintagestory-server/debug.log

For all messages containing [Server Event] see

 tail -f /var/log/vintagestory-server/event.log

For all other messages see

 tail -f /var/log/vintagestory-server/other.log

Multiple Server Instances

If you want to run multiple instances on the same machine you just have to redo some of the steps above. This is just an example for a second instance:

mkdir -p /srv/gameserver/data/vs2

 nano /usr/lib/systemd/system/vintagestoryserver2.service

Copy from step 6 and change these lines:

 Description=Vintage Story Server 2 Unit
 ExecStart=dotnet VintagestoryServer.dll --dataPath /srv/gameserver/data/vs2
 SyslogIdentifier=VSSRV2

Create rsyslog file and copy code from step 7

 nano /etc/rsyslog.d/vintagestoryserver2.conf

Change VSSRV to VSSRV2 and /var/log/vintagestory-server to /var/log/vintagestory-server2
Before you proceed make a copy of your first server configuration and edit it for your needs (change port!!!)

 cp /srv/gameserver/data/vs/serverconfig.json /srv/gameserver/data/vs2/
 nano /srv/gameserver/data/vs2/serverconfig.json

Now start the service

 systemctl restart rsyslog.service;
 systemctl enable vintagestoryserver2.service
 systemctl start vintagestoryserver2.service

Install cronjob

 crontab -e

Insert

 30 4 * * *      systemctl restart vintagestoryserver2.service

Have Fun!

Advanced setup

Using an SRV Record to point a domain to your server

In some cases, you may not able to get a server with the default port (Multiple instances on the same server, paid hosts...), and you will have to add the port at the end of the server's address in order to connect to it.
But you might want to avoid the need to specify the port (Easier to remember, look cleaner). There is a way to point a domain to your server and avoid the need to add the port : SRV Records

SRV Records allow you to point a domain/subdomain to your instance, while letting the game know the port to use.
How to set up an SRV Records will depend on your domain provider, and you should check on their documentation before making any changes. However, the idea and values remain the same for every provider.

Let's take a server with the following details :

  • Address : play.example.com
  • Port : 50030
  • Owned domain : mydomain.com
  • Desired subdomain : vintagestory.mydomain.com

Your raw SRV Records should look something like this :

 _vintagestory._tcp.vintagestory.mydomain.com.   IN  SRV 10 10 50030 server.example.com.

The underscores and trailing dots are important! Here are some details :

  • _vintagestory define the service, in our case, Vintage Story
  • _tcp define the protocol, Vintage Story use TCP
  • vintagestory.mydomain.com. is the subdomain we want to use. The trailing dot is important!
  • IN SRV Define the record type, don't change this
  • 10 10 are in order the priority and the weight of our record, in our case those are not important, as you are probably not going to load balance a Vintage Story server
  • 50030 is the port our instance is listening on
  • server.example.com. is the target, where the server is located. The trailing dot is mandatory as the target server is not on the same domain as us. If it was the case, you would only need to add the subdomain of the target without the trailing dot

If you wanted to have your record pointing to your domain directly, you would have mydomain.com. instead of vintagestory.mydomain.com.

Here is how to do it for OVH and Hetzner (Don't forget to edit the values to suit your setup !) :

OVH

You will need to go to your DNS zone and add an entry, select the SRV Record type :

  • Sub-domain : _vintagestory._tcp.vintagestory You don't need to add your domain, as their form do it for you.
  • TTL : No need to change this
  • Priority : 10
  • Weight : 10
  • Port : 50030
  • Target : server.example.com.

Hetzner

You will need to create a record from their DNS Console :

  • Type : SRV
  • Name : _vintagestory._tcp.vintagestory.mydomain.com.

Click on the Value field to enter the details :

  • Priority : 10
  • Weight : 10
  • Port : 50030
  • Target : server.example.com.

Wait a few minutes for your record to propagate and then try to use it to connect to the server, using vintagestory.mydomain.com as the address.

You are now all set up to share your server with your custom domain.


Wiki Navigation
Vintage Story Guías[[::Category:Guides| ]]Preguntas más frecuentes (FAQ) Vintage Story Original Soundtrack Versiones Controles
Mecánicas de juego Fabricación Talla Lítica Alfarería Herrería Cocina Temperatura Hambre Minería Estabilidad temporal Energía mecánica Comercio Agricultura Ganadería
Mundo Generación del Mundo Biomas Clima Tormentas temporales
Objetos Herramientas Armas Armadura Ropa Mochilas Materiales Comida
Bloques Terreno Plantas Decorativo Iluminación Functional Minerales
Entidades Entidades hostiles Animales NPCs Jugadores
Miscellaneous List of client commands Lista de comandos del servidor Guia de iniciación de Modo creativo Bot System Cómo utilizar Worldedit Cinematic Camera Adjustable FPS Video Recording ServerBlockTicking