Setting up a Multiplayer Server: Difference between revisions

From Vintage Story Wiki
m
clarification
(update to 1.18.8 net7)
m (clarification)
 
(31 intermediate revisions by 7 users not shown)
Line 4: Line 4:


=== Ad-hoc Server === <!--T:2-->
=== Ad-hoc Server === <!--T:2-->
<!--T:129-->
If you want a temporary multiplayer experience it is enough to open a single player world, then click on "Open to Lan" in the escape menu. This will allow players in your local network to join.
If you want a temporary multiplayer experience it is enough to open a single player world, then click on "Open to Lan" in the escape menu. This will allow players in your local network to join.
If you want to allow players outside of your local network to join, you can then also click "Open to Internet" which will attempt to set up an external connection to join your server from the internet. This is done by a technique called UPnP and 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 so called "port forwarding" on your internet router, which can be tricky and frustrating at times, unfortunately. You would need to forward TCP Port 42420 to your computer in that case. (Google 'Port forwarding' with the name or model of your internet router to find help.)
If you want to allow players outside of your local network to join, you can then also click "Open to Internet" which will attempt to set up an external connection to join your server from the internet. This is done by a technique called UPnP and 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 so-called "port forwarding" on your internet router, which can be tricky and frustrating at times, unfortunately. You would need to forward TCP Port 42420 to your computer in that case. (Google 'Port forwarding' with the name or model of your internet router to find help.)


<!--T:3-->
<!--T:3-->
Line 12: Line 14:


=== Dedicated Server === <!--T:4-->
=== Dedicated Server === <!--T:4-->
Alternatively the game ships with a dedicated server program that you can start and leave on permanently without needing to log in yourself.
 
<!--T:130-->
As an alternative, the game ships with a dedicated server program that you can start and leave on permanently without needing to log in yourself.
There are several ways to get a dedicated server up and running.
There are several ways to get a dedicated server up and running.


==== Paid hosts ==== <!--T:5-->
==== Paid hosts ==== <!--T:5-->
Some commercial hosting services offer paid server hosting. Currently Vintage Story hosting is offered by [https://www.vintagestory.at/store/product/7-30-days-simple-server-hosting/ the developers of the game], [https://pingperfect.com/ PingPerfect], [https://citadelservers.com/ Citadel Server], [https://www.creeperhost.net/ Creeperhost], [https://www.akliz.net/games/vintage-story Akliz] and [https://www.g-portal.com/en/gameserver/rent-a-vintage-story-server GPortal], [https://hosthavoc.com/game-servers/vintage-story Host Havoc].
 
See [[List of server hosting providers]]


==== Dedicated Servers on Windows ==== <!--T:6-->
==== Dedicated Servers on Windows ==== <!--T:6-->
* Open the game's application folder, it is <code>%appdata%/VintageStory</code> by default.
 
* Run <code>VintagestoryServer.exe</code>.
To keep your multiplayer server's settings from interfering with your single-player settings, use a custom --dataPath argument. 
* You might need to setup port forwarding on your internet router if you want the server to be accessible from outside of your local network (for example, anyone who isn't on the same WiFi as you).
 
'''Shortcut method:'''
# Navigate to the location where you will store the server's data, such as a new VintagestoryServer folder created in <code>C:\Users\YourUsername\AppData\Roaming</code>
# Create a folder for the server's data and give it a clear name, such as VSserverData
# Open that folder and copy the entire path from the address bar of File Explorer.  (example: <code>C:\Users\YourUsername\AppData\Roaming\VintagestoryServer\VSserverData</code>)
# Open the game's application folder, it is <code>%appdata%/VintageStory</code> by default.
# Create a shortcut of <code>VintagestoryServer.exe</code>.  This can usually be accomplished through the right-click menu; google instructions specific to your operating system version if needed.
# Open the Properties of the new shortcut.  This can usually be accomplished through the right-click menu.
# Click in the Target field of the shortcut's Properties, then go to the very end of what's written there.  Add one space, then <code>--dataPath=</code>, then Paste the folder path you copied earlier, in quotes.  The entire contents of the Target field should now be something like this: <code>"C:\Users\YourUsername\AppData\Roaming\Vintagestory\VintagestoryServer.exe" --dataPath="C:\Users\YourUsername\AppData\Roaming\VintagestoryServer\VSserverData"</code>
* Optional: you can move/copy the shortcut, to your desktop and/or your new VintagestoryServer folder
 
'''Batch script method''' (functionally equivalent to the shortcut method above):
# To create a batch script, simply create a blank text document and rename it with the .bat file extension. 
# You can edit it by right clicking and selecting edit.  Then just type <code>%appdata%/Vintagestory/VintagestoryServer.exe --dataPath "[PATH]"</code>  replacing [PATH] with the desired path for the server's data, then save and close. 
Running the script will run the server with the alternate datapath, and will generate its own collection of config files there.  This is functionally equivalent to the modified link.
 
<!--T:131-->
Next:
* Run the ''shortcut you made'' of <code>VintagestoryServer.exe</code> or the batch script.
* If Windows Firewall asks for permission, grant any necessary access.
* You might need to forward port 42420 on your internet router if you want the server to be accessible from outside of your local network (for example, anyone who isn't on the same WiFi as you). The process for this varies significantly; google instructions for your specific router model.
 
===== Using Windows on a virtual machine =====
 
There are some reports that LAN connection to a Vintage Story server running inside a Windows virtual machine (VM) can be slow, even when internet (WAN) connections have normal performance. This may depend on VM solution and network drivers.  If this affects you, a suggested workaround is to use the Paravirtualized network adapter (virtio-net) for network adapters. The drivers are located [https://docs.oracle.com/en/virtualization/virtualbox/6.0/user/nichardware.html here].
 
----
----


==== Dedicated Servers on Linux ==== <!--T:7-->
==== Dedicated Servers on Linux ==== <!--T:7-->
This describes how to set up the server as a service on Linux systems.
 
<!--T:132-->
This describes how to set up the server as a service on Linux systems.<br>
<span style="color:#E16100">Note: ''This section only works for x64 processors; if using ARM, please refer to the following section.''</span><br>


===== Requirements ===== <!--T:8-->
===== Requirements ===== <!--T:8-->


<!--T:109-->
* [https://dotnet.microsoft.com/en-us/download/dotnet/7.0 .NET Runtime 7.0] This should be all needed to run a Vintagestory server. Everything else is just for convenience to start and manage it.
* [https://dotnet.microsoft.com/en-us/download/dotnet/7.0 .NET Runtime 7.0] This should be all needed to run a Vintagestory server. Everything else is just for convenience to start and manage it.
* install <code>pgrep</code>, <code>screen</code> and <code>wget</code> using your systems package manager.
* install <code>pgrep</code>, <code>screen</code> and <code>wget</code> using your systems package manager.


 
===== Setup the server ===== <!--T:110-->
===== Setup the server =====


<!--T:17-->
<!--T:17-->
Line 99: Line 132:


<!--T:34-->
<!--T:34-->
'''8. Connect to your IP/Domain and have fun'''
'''7. Connect to your IP/Domain and have fun'''
----
----


==== Simple Server start command ====
==== Dedicated Servers on ARM64==== <!--T:117-->
 
<!--T:128-->
<span style="color:#E16100">Note: ''Please note the ARM64 version is EXPERIMENTAL please report any issues to the [https://discord.com/channels/302152934249070593/1128220205181587516 discord ]''.
 
Currently (in game version 1.19.3 - 1.19.4, February 2024) no ARM64 .NET7 version of the '''Harmony''' patching library is available. Therefore coded mods which use Harmony will not work on an ARM64 server.  If a beta of the Harmony library becomes available in future, server owners can try installing it for themselves.</span>
 
<!--T:118-->
The ARM64 version is available on [https://github.com/anegostudios/VintagestoryServerArm64 GitHub ]
 
<!--T:119-->
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).
 
<!--T:120-->
1. Install the required dependencies to use this script by doing <code>apt -y install curl jq</code>
 
<!--T:121-->
2. Create a new file named <code>arminstall.sh</code> by running <code>vim arminstall.sh</code> or <code>nano arminstall.sh</code>
 
<!--T:122-->
3. Copy the contents of the <code>arminstall.sh</code> file from GitHub to your newly created file and save it by using <code>:wq</code> with Vim or <code>Ctrl + X</code>, then <code>Y</code>, then <code>Enter</code> with Nano.
 
<!--T:123-->
4. Make the script executable by running <code>chmod +x arminstall.sh</code>
 
<!--T:124-->
5. Run the script by doing <code>./arminstall.sh</code>
 
<!--T:125-->
6. Start the server by using <code>./VintagestoryServer</code> or <code>dotnet VintagestoryServer.dll</code>
 
<!--T:126-->
This will download the latest version of Vintagestory to the current working directory, then replace the needed files to work with ARM.
 
<!--T:127-->
If at any time you want to update to the latest version of Vintage Story, simply run the script again.
----
 
==== Simple Server start command ==== <!--T:111-->
 
<!--T:133-->
If you want to use a custom script or just manually start your server you can run  
If you want to use a custom script or just manually start your server you can run  
  dotnet VintagestoryServer.dll --dataPath /path/to/data
  dotnet VintagestoryServer.dll --dataPath /path/to/data
Line 118: Line 191:


<!--T:54-->
<!--T:54-->
Once your server is up and running you might want to look over some of the following configuration options. You can configure the server while its running through commands or by editing the [[Server Config|serverconfig.json]], for which the server needs to be stopped first.
Once your server is up and running you might want to look over some of the following configuration options. You can configure the server while its running through commands or by editing the {{ll|Server Config|serverconfig.json}}, for which the server needs to be stopped first.
On windows, by default this file is located at '''%appdata%/VintageStoryData/serverconfig.json'''.
On windows, by default this file is located at '''%appdata%/VintageStoryData/serverconfig.json'''.
On Linux it's located at '''./data/serverconfig.json''' of your server directory (e.g. ''/home/vintagestory/server/data/serverconfig.json'' if setup like described here)
On Linux it's located at '''./data/serverconfig.json''' of your server directory (e.g. ''/home/vintagestory/server/data/serverconfig.json'' if setup like described here)
Line 156: Line 229:


===Debian with systemd service and rsyslog=== <!--T:60-->
===Debian with systemd service and rsyslog=== <!--T:60-->
<!--T:134-->
If you prefer using systemd instead of screen to run your VS Server, you can follow these Instructions.<br>
If you prefer using systemd instead of screen to run your VS Server, you can follow these Instructions.<br>
We also will setup rsyslog to split all logs into separate files.<br>
We also will setup rsyslog to split all logs into separate files.<br>


==== Installation ==== <!--T:61-->
==== Installation ==== <!--T:61-->


<!--T:64-->
<!--T:64-->
Line 167: Line 241:


<!--T:65-->
<!--T:65-->
'''3. create directories'''
'''2. create directories'''
   mkdir -p /srv/gameserver/vintagestory
   mkdir -p /srv/gameserver/vintagestory
   mkdir -p /srv/gameserver/data/vs
   mkdir -p /srv/gameserver/data/vs
Line 173: Line 247:


<!--T:66-->
<!--T:66-->
'''2. Download the game'''
'''3. Download the game'''
   cd /srv/gameserver/vintagestory
   cd /srv/gameserver/vintagestory


Line 185: Line 259:


<!--T:69-->
<!--T:69-->
'''3. Extract tar.gz package'''
'''4. Extract tar.gz package'''


   <!--T:70-->
   <!--T:70-->
tar xzf vs_server_linux-x64_1.18.8.tar.gz
tar xzf vs_server_linux-x64_1.18.8.tar.gz


'''4. Change owner'''
<!--T:112-->
'''5. Change owner'''


<!--T:71-->
<!--T:71-->
Line 197: Line 272:


<!--T:72-->
<!--T:72-->
'''5. Create systemd service unit file'''
'''6. Create systemd service unit file'''


<!--T:73-->
<!--T:73-->
Line 221: Line 296:
   WantedBy=multi-user.target
   WantedBy=multi-user.target


<!--T:113-->
Make sure the new user has access to the <code>dotnet</code> 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 <code>ExecStart=VintagestoryServer --dataPath /srv/gameserver/data/vs</code> if you have the <code>DOTNET_ROOT</code> environment variable set.
Make sure the new user has access to the <code>dotnet</code> 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 <code>ExecStart=VintagestoryServer --dataPath /srv/gameserver/data/vs</code> if you have the <code>DOTNET_ROOT</code> environment variable set.


<!--T:74-->
<!--T:74-->
'''6. Create config file for rsyslog'''
'''7. Create config file for rsyslog'''


<!--T:75-->
<!--T:75-->
Line 251: Line 327:
   # Discard  
   # Discard  
   if $programname == 'VSSRV' then ~
   if $programname == 'VSSRV' then ~
'''7. restart rsyslog / enable service'''
 
<!--T:136-->
'''8. restart rsyslog / enable service'''
To activate rsyslog and your vintagestory server type these commands
To activate rsyslog and your vintagestory server type these commands
   systemctl restart rsyslog.service;
   systemctl restart rsyslog.service;
Line 390: Line 468:


====Hetzner==== <!--T:106-->
====Hetzner==== <!--T:106-->
<!--T:135-->
You will need to create a record from their DNS Console :
You will need to create a record from their DNS Console :
* Type : <code>SRV</code>
* Type : <code>SRV</code>
Confirmedusers, editor
1,052

edits