Avorion Wiki
Tag: Visual edit
No edit summary
Tag: Visual edit
Line 1: Line 1:
 
[[Category:Tutorials]]
 
[[Category:Tutorials]]
   
 
Usually a server is started up internally whenever you start up a public singleplayer game or go to the "Host Game" window in Multiplayer. People can connect to you then. However, if you want to run a dedicated server, things are a little more complicated.
 
Usually a server is started up internally whenever you start up a public singleplayer game or go to the "Host Game" window in Multiplayer (for newer versions only). People can connect to you then. However, if you want to run a dedicated server, things are a little more complicated.
 
   
 
The following setups assume that the game is installed in "C:\Program Files\Avorion". If you installed the game in another folder, you must replace those paths with the paths on your system.
 
The following setups assume that the game is installed in "C:\Program Files\Avorion". If you installed the game in another folder, you must replace those paths with the paths on your system.
Line 16: Line 15:
   
 
If these preconditions are not met, the server might not work properly and people might not be able to connect.
 
If these preconditions are not met, the server might not work properly and people might not be able to connect.
 
 
 
== Setting up the server ==
 
== Setting up the server ==
   
=== Starting the server (Windows) ===
+
=== Starting the server (Windows) '''What you’ll need:''' ===
   
 
[[Category:Technical]]
 
[[Category:Technical]]
 
 
'''What you’ll need:'''
 
   
 
: • Steam CMD: [http://media.steampowered.com/installer/steamcmd.zip SteamCMD.zip]
 
: • Steam CMD: [http://media.steampowered.com/installer/steamcmd.zip SteamCMD.zip]
Line 149: Line 143:
   
 
This file should only be edited when the server is not running, as the server will overwrite its settings in the file on shutdown.
 
This file should only be edited when the server is not running, as the server will overwrite its settings in the file on shutdown.
  +
  +
=== Multithreading ===
  +
The server supports several settings for multithreading:
  +
* Worker Threads
  +
* Generator Threads
  +
Worker threads are the threads that update the simulation and do the main work. They will run the server.
  +
  +
Generator threads generate new or load old sectors as the players progress and explore the galaxy.
  +
  +
=== General Recommendations for Multithreading Settings ===
  +
In the following, hardware concurrency means the amount of threads that your machine can run at the same time. E.g.: A 4 core Intel CPU with hyperthreading has a hardware concurrency of 8, while a e.g. 6 core AMD without hyperthreading has a hardware concurrency of 6. You can look up your hardware concurrency in your task manager on windows, with htop on linux.
  +
  +
It's recommended to have as many worker threads as your hardware concurrency.
  +
  +
It's recommended to have at least 2 generator threads, but never as many as your hardware concurrency, since they might starve the worker threads, which leads to the simulation staggering, which leads to lagging. If you're running a large server with lots of players who like to explore, you can increase the amount of generator threads to decrease hyperspace calculation time. Generator threads will only run for a short time each, while generating a new sector or loading an old one from disk. It can't be predicted for how long they will run, sometimes it can be a few seconds, sometimes up to minutes.
  +
  +
==== Examples for different machines: ====
  +
Machine: 4 core Intel CPU with Hyperthreading (hardware concurrency of 8):
  +
* 8 Worker Threads
  +
* 2 - 4 Generator Threads (for 5 - 15 players)
  +
Machine: 8 core Intel CPU with Hyperthreading (hardware concurrency of 16):
  +
* 16 Worker Threads
  +
* 4 - 8 Generator Threads (for 10 - 20 players)
  +
Machine: 6 core CPU without Hyperthreading (hardware concurrency of 6):
  +
* 6 Worker Threads
  +
* 2 - 3 Generator Threads (for 5 - 10 players)
  +
Machine: 16 core CPU with Hyperthreading (hardware concurrency of 32)
  +
* 32 Worker Threads
  +
* 8 Generator Threads
   
 
== Log File ==
 
== Log File ==

Revision as of 14:35, 5 September 2017


Usually a server is started up internally whenever you start up a public singleplayer game or go to the "Host Game" window in Multiplayer. People can connect to you then. However, if you want to run a dedicated server, things are a little more complicated.

The following setups assume that the game is installed in "C:\Program Files\Avorion". If you installed the game in another folder, you must replace those paths with the paths on your system.

Requirements

There are several requirements that must be met before setting up a server. Especially if you want to play over the Internet.

  • Basic knowledge of the command line
  • Administrator rights are required for the setup
  • Make sure you're not behind a firewall. If you are, make sure that the server software is listed as exception. Providing a tutorial for that is not possible, it depends on your firewall.
  • Firewalls come in many different sizes and shapes. Your router has one. Your virus scanners may have one.
  • The UDP and TCP ports that will be used for the game must be forwarded to the machine that runs the game. Default ports are 27000, TCP and UDP for game traffic 27003 (UDP) for queries, 27020 and 27021.

If these preconditions are not met, the server might not work properly and people might not be able to connect.

Setting up the server

Starting the server (Windows) What you’ll need:

• Steam CMD: SteamCMD.zip
• Server Installer - Naggerknife's Server Installer.zip
• Virus scan of the Server Installer - VirusTotal Scan
• 7-Zip or WinRar to open ZIP files - 7-Zip or WinRAR


Installing SteamCMD:

1. Create a folder for SteamCMD.
2. Download SteamCMD.zip.
3. Extract the contents of “SteamCMD.zip” into the folder just created.
4. Run steamcmd.exe to install the rest of the needed files.


Obtaining Avorion Server Files:

1. Download “Naggerknife’s Server Installer.zip”
2. Extract the contents of the zip file into the SteamCMD folder we created earlier.
3. Now open up “avorion_installer.txt” and look for the line saying “force_install_dir”.
4. Change “C:\AvorionServer” to your desired location.
5. After you have edited “force_install_dir” save the file.
6. Run “Naggerknife’s Server Installer.bat” and let it do its magic.


Running your new server:

1. Navigate to the install folder you designated above.
2. There are two files in here you need to know. Launcher.bat & Server.bat
3. Right click Server.bat and click edit.
4. Go ahead and change “avorion_admin” to your 64bit SteamID to make sure you are the admin of the server. Also here you can change the name of your galaxy by editing “avorion_galaxy” to the name of your galaxy. Then make sure to save that.
• If you want to change where server files are installed you can add --datapath C:\PATHERE to this same file.
5. Run “Server.bat” and your server should be up and running! Check below for instructions to edit server options.


Stopping the server:

1. NEVER stop the server by closing the console. It will cause save issues.
2. ALWAYS use /save in-game then follow up with /stop to stop the server.


Editing server options:

1. Make sure the server is not running. These changes will not take effect unless server is offline.
2. Navigate to the %appdata%/Roaming/Avorion/NAMEOFYOURGALAXY/ OR where you set the location of the server files to go above.
3. Right click on “server.ini” and then click edit. In here you will see the options for your server. Once your done save the file then start your server again to apply changes. (Server)


List of known admin commands: (Enter these at in-game chat)

/save - saves the world
/stop - stop the server
/help - displays all available commands


Updating your server: (Server must not be running for this to work)

1. Go back to your SteamCMD folder we made earlier.
2. Make sure the avorion_installer.txt file is pointing to the location of your server files. Shouldn't matter unless you changed it for some reason.
3. Run Naggerknife’s Server Installer again and it willl update the files then just run the server like normal. Do this every time there is an update.


Incase anything is broken check out this GoogleDoc

Starting the server (Linux)

SteamCMD is required for this, you can find information on SteamCMD here: https://developer.valvesoftware.com/wiki/SteamCMD

You can use SteamCMD to download the Avorion server files like this(this assumes you have followed the link above):

  • Start SteamCMD

# cd ~ && ./steamcmd

  • Login anonymously

Steam> login anonymous

  • Set the folder where you want the files to go

Steam> force_install_dir /enter/path/here/

  • Download the server files

Steam> app_update 565060 validate

  • Exit SteamCMD

Steam> quit

  • Change your directory to the path you chose

# cd /enter/path/here

  • Run the server

# ./server.sh

You can find the server files(server.ini, logs, admin.xml, etc) here ~/.avorion/galaxies/avorion_galaxy

If you're using ssh you can always use screen to keep the server running in the background, you can find more on screen here: https://wiki.archlinux.org/index.php/GNU_Screen

Further settings

The server will create a settings.ini file and a few others, concerning blacklists, whitelists or user groups when it is started up. The files are located in the galaxy folder of the server. More detailed settings can be changed in there.

This file should only be edited when the server is not running, as the server will overwrite its settings in the file on shutdown.

Multithreading

The server supports several settings for multithreading:

  • Worker Threads
  • Generator Threads

Worker threads are the threads that update the simulation and do the main work. They will run the server.

Generator threads generate new or load old sectors as the players progress and explore the galaxy.

General Recommendations for Multithreading Settings

In the following, hardware concurrency means the amount of threads that your machine can run at the same time. E.g.: A 4 core Intel CPU with hyperthreading has a hardware concurrency of 8, while a e.g. 6 core AMD without hyperthreading has a hardware concurrency of 6. You can look up your hardware concurrency in your task manager on windows, with htop on linux.

It's recommended to have as many worker threads as your hardware concurrency.

It's recommended to have at least 2 generator threads, but never as many as your hardware concurrency, since they might starve the worker threads, which leads to the simulation staggering, which leads to lagging. If you're running a large server with lots of players who like to explore, you can increase the amount of generator threads to decrease hyperspace calculation time. Generator threads will only run for a short time each, while generating a new sector or loading an old one from disk. It can't be predicted for how long they will run, sometimes it can be a few seconds, sometimes up to minutes.

Examples for different machines:

Machine: 4 core Intel CPU with Hyperthreading (hardware concurrency of 8):

  • 8 Worker Threads
  • 2 - 4 Generator Threads (for 5 - 15 players)

Machine: 8 core Intel CPU with Hyperthreading (hardware concurrency of 16):

  • 16 Worker Threads
  • 4 - 8 Generator Threads (for 10 - 20 players)

Machine: 6 core CPU without Hyperthreading (hardware concurrency of 6):

  • 6 Worker Threads
  • 2 - 3 Generator Threads (for 5 - 10 players)

Machine: 16 core CPU with Hyperthreading (hardware concurrency of 32)

  • 32 Worker Threads
  • 8 Generator Threads

Log File

The server will create log files when it is started up. The log files are located in the galaxy folder. They're called "serverlog [Date].txt". This logfile contains a lot of data concerning the activities on the server, such as a full chat log, or when which player logged in.

Finding Errors

Should your server not run properly, there are multiple options for checking what's wrong.

Log File

The log file does not only contain game-relevant data, but also a lot of technical data, such as connection problem diagnosis. You may want to check the log file for errors concerning the server.

Tracing

This option will make the server print a lot more output, but it may also hurt performance a lot. To enable this, start the server with the additional command line options -t all.

bin\AvorionServer.exe --datapath "C:\MyAwesomeGalaxy" --admin AwesomeUser -t all

Your server will now emit a lot more information while running, which may help you to debug any problems arising with it.

Remember: This will hurt performance of the server and should only be used for debugging purposes.