Guide: Dedicated Server: Difference between revisions

From Vintage Story Wiki
(adjusted hyperlinks)
(added info on adding mods)
Line 1: Line 1:
{{WIP}}
{{WIP}}
{{Messagebox
|title= Note
|text= When <code>(default)</code> appears before a piece of information, it's a reminder that the instructions need to be adjusted if the reader did not use the default settings. <br>
When <code>(example)</code> appears before a piece of information, it's a reminder that if the reader used the example provided earlier, then they should have the outcome displayed at this point.
}}


== Dedicated server on Windows ==
== Dedicated server on Windows ==
Below is a detailed guide for creating a multiplayer server on a computer using Windows operating system.
Below is a detailed guide for creating a multiplayer server on a computer using Windows operating system.


Last verified for
{{Messagebox
Windows 11 Home
|title= Last verified for
version 23H2
|text= Windows 11 Home <br>
version 23H2 <br>
64-bit operating system
64-bit operating system
 
}}
# [[Guide:_Dedicated_Server#install Vintage Story|install Vintage Story]]
# [[Guide:_Dedicated_Server#set data path|set data path]]
# [[Guide:_Dedicated_Server#Configure router/firewall|Configure router/firewall]]
# [[Guide:_Dedicated_Server#launch VintagestoryServer.exe|launch VintagestoryServer.exe]]
# [[Guide:_Dedicated_Server#share IP address with playerbase|share IP address with playerbase]]
# [[Guide:_Dedicated_Server#add server to Multiplayer menu|add server to Multiplayer menu]]


=== Install Vintage Story ===
=== Install Vintage Story ===
When you install Vintage Story for singleplayer, you get more than one program file.  Inside default path %AppData%/Vintagestory should be both Vintagestory.exe and VintagestoryServer.exe.
When you install Vintage Story for singleplayer, you get more than one program file.  Inside default path <code>%AppData%/Vintagestory</code> should be both Vintagestory.exe and VintagestoryServer.exe.


=== Set data path ===
=== Set data path ===
Create a separate data path IF you intend to host and play via the same machine
Create a separate data path IF you intend to host and play via the same machine.


=== Configure router/firewall ===
=== Configure router/firewall ===
Line 37: Line 38:




==== To Do ====
=== Set protections ===
It's highly advisable to put measures in place to prevent people with bad intentions from being able to harm your world.
See [[Guide: Anti-grief protections]]
 
=== Customize world ===
 
=== Add/remove mods ===
Assuming that you set a custom data path (such as <code>%AppData%/VSserverData</code>) and launched the server, there should now be a Mods folder within <code>%AppData%/VSserverData</code>. 
 
Inside <code>%AppData%/VSserverData</code> should also be a serverconfig.json file, which can be edited with a program such as Notepad++.  The ModPaths key indicates where the server should look for mods to load.  For instance,
<code>"ModPaths": [
    "Mods",
    "\\AppData\\VSserverData\\Mods"
  ],/</code>
 
'''Option 1)''' You can download/paste mod zip files into <code>%AppData%/VSserverData/Mods</code>.  This is best done while the server is offline.  Change made will take effect when the server is re-launched.
'''Option 2)''' You can use commands to install/remove mods, or list currently-installed mods.  See [[List_of_server_commands/moddb]]
 
When a player attempts to join your server, they will be prompted to download your list of mods.
Only mods that are tagged as Server-side or Universal will be auto-downloaded in this way.  Client-side mods would need to be manually added by the player to the server-specific subfolder within (default) <code>%AppData%/VintagestoryData/ModsByServer</code>.


Optional) Anti-grief protections
== Gain admin powers ==
Optional) admin powers
See [[List_of_server_commands#Privilege_Control]]
Optional) custom world
Optional) mods


== Dedicated server on Linux ==
== Dedicated server on Linux ==

Revision as of 11:46, 11 July 2024

UnderCon icon.png

This page is under construction.
This page is being created, or is in the process of extensive expansion or major restructuring. Until this notice is removed, please do not translate this page. Expect the content of this page to change significantly.


Note
When (default) appears before a piece of information, it's a reminder that the instructions need to be adjusted if the reader did not use the default settings.
When (example) appears before a piece of information, it's a reminder that if the reader used the example provided earlier, then they should have the outcome displayed at this point.


Dedicated server on Windows

Below is a detailed guide for creating a multiplayer server on a computer using Windows operating system.

Last verified for
Windows 11 Home
version 23H2
64-bit operating system


Install Vintage Story

When you install Vintage Story for singleplayer, you get more than one program file. Inside default path %AppData%/Vintagestory should be both Vintagestory.exe and VintagestoryServer.exe.

Set data path

Create a separate data path IF you intend to host and play via the same machine.

Configure router/firewall

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. only needs to happen before step 4 if you want to advertise to master server

Run VintagestoryServer.exe

Run VintagestoryServer.exe; if you set a new dataPath, instead run the shortcut you made of VintagestoryServer.exe or the batch script. Step 5) If Windows Firewall asks for permission, grant any necessary access.

Share IP address with playerbase

Find your IP address, and give it to the people who will be joining (external IP or local IP)

Add server to Multiplayer menu

Set protections

It's highly advisable to put measures in place to prevent people with bad intentions from being able to harm your world. See Guide: Anti-grief protections

Customize world

Add/remove mods

Assuming that you set a custom data path (such as %AppData%/VSserverData) and launched the server, there should now be a Mods folder within %AppData%/VSserverData.

Inside %AppData%/VSserverData should also be a serverconfig.json file, which can be edited with a program such as Notepad++. The ModPaths key indicates where the server should look for mods to load. For instance, "ModPaths": [

   "Mods",
   "\\AppData\\VSserverData\\Mods"
 ],/

Option 1) You can download/paste mod zip files into %AppData%/VSserverData/Mods. This is best done while the server is offline. Change made will take effect when the server is re-launched. Option 2) You can use commands to install/remove mods, or list currently-installed mods. See List_of_server_commands/moddb

When a player attempts to join your server, they will be prompted to download your list of mods. Only mods that are tagged as Server-side or Universal will be auto-downloaded in this way. Client-side mods would need to be manually added by the player to the server-specific subfolder within (default) %AppData%/VintagestoryData/ModsByServer.

Gain admin powers

See List_of_server_commands#Privilege_Control

Dedicated server on Linux

This describes how to set up the server as a service on Linux systems.
Note: This section only works for x64 processors; if using ARM, please refer to the following section.

Requirements

  • .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 pgrep, screen and wget using your systems package manager.

Setup the server

1. Download the game

Advice: Create a separate directory for Vintage Story as the tar.gz does not contain a subfolder.

 mkdir server && cd server

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).

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

2. Extract tar.gz package

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

3. Make server.sh script executable

chmod +x server.sh

4. 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.

adduser vintagestory

Then change these options for your needs:

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

 VSPATH='<your-vs-directory>'

5. Open the port at the firewall (if needed)

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. Server start and first steps

 ./server.sh start
 
 Wait for the startup to finish, then you can give yourself OP with
 ./server.sh command "/op <youusername>"

7. Connect to your IP/Domain and have fun


Dedicated Servers on ARM64

Note: Please note the ARM64 version is EXPERIMENTAL please report any issues to the 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.

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.