OFFICIAL: Hosting a Dedicated Server

Getting Started

Server SelectionWithout the rendering aspects the performance requirements for N:FC are fairly modest. My initial tests of the dedicated server build used an awful $15 Hostwinds VPS with 1 core and 2 GB of RAM. We were able to complete a few 3v3 test games using this server without significant issues, but if you want your players to enjoy themselves you should go for something better.

At the minimum you will want 2 CPU cores. The game is mostly single-threaded due to Unity limitations, but some of our long-running processes like pathfinding are done on as separate thread as each pathfinding task can take several seconds to complete on the more complex maps. With only one core you will experience momentary freezes whenever a pathfinding task is in progress, such as when each lifeboat launches and calculates an escape route.

We were able to make do with 2GB of RAM in an initial test but I recommend you have at least 4 for the server.

To help you calculate your needs with an example, the official servers run on a VPS with a 6 core Ryzen 5900X with 16 GB of RAM. We have two of these servers and each runs 3 instances of the game. Network traffic can peak at 10Mbps outbound, with negligible inbound traffic.

Getting the BinariesCurrently the server build is NOT available in a convenient way. We are still in the process of making the server tool downloadable anonymously via Steam, and coordinating with hosting providers to make "one-click" hosting available. Once these are available this section will be updated.

In the meantime, please contact me via the ModMail bot on our official discord to get access to the server build.

Host Setup

This section will cover the configuration of your new server.

Once you have found a VPS provider that you would like to use and have purchased your server (or set up one on a spare computer you have lying around for some reason) you will need to configure it. The server build is currently Linux only to save on server costs, as a Windows OS can add as much as $10 a month to a server rental. I run the official servers on CentOS, but you can use any flavor you like.

If your provider does not provide an easy FTP interface you will need to set up an FTP service on your server. If you've decided to use CentOS, you can follow this guide for easy setup: https://unixcop.com/how-to-install-and-configure-an-ftp-server-on-centos-9-stream/

I also HIGHLY recommend you configure a firewall if the OS installation did not have it by default. I'll cover the ports you need to open later. For those of you who have never run a server facing the public internet before, you will be amazed at how often your server will be hammered by malicious actors looking to turn your gaming server into a bitcoin miner. You can follow this guide here: https://www.fcgid.com/how-to-install-firewalld-on-centos-stream-9/

If you are running your server out of your home or some other NAT'd network you will need to remember to set up port forwarding on your router for the ports we'll cover later.

Finally, it is not recommended to run the game as Root for security reasons, so you should create a new user with limited permissions that will serve as the executing user.

Server Setup

This section will cover setting up the N:FC dedicated server instance. Keep in mind that you can run multiple instances on a single server if its specs are high enough.

Uploading the BuildOnce you have the server binaries you will need to upload them to your server. Once the Steam tool anonymous download is enabled, you can skip this step.

The easiest way to do this, once you've configured your FTP service, is to download FileZilla and upload the entire build folder to the shared folder. Once the build is uploaded, copy it to an installation directory of your choice:

cp -r /home/ftpuser/shared/Build_Server /installation/directory/you/want/ chown -R gameuser /installation/directory/you/want/ chmod +x /installation/directory/you/want/NebulousDedicatedServer

Configuration FileThere is a fully commented example server config provided with the server build to get you started. Keep in mind that once the automatic downloading with Steam is available, this file will be tracked by Steam and updated if you change it so it is recommended to make a copy.

When the server starts it will search for DedicatedServerConfig.xml in the installation directory. You can also specify a different configuration file with the -serverConfig flag. This option exists to enable multiple instances to be run without needing multiple distinct installations. I recommend you keep your config file outside the installation directory so that updating the server does not wipe it.

The config file can be broken down into a few logical sections:

Server Basics - Things like the name, MOTD, player count, ports, and admins.

Game Settings - Scenario, time limit, and other game rules.

Map Rotation - Available maps and how the rotation works.

Bots - For PVE servers.

Mods - Available mods and whether modded fleets are allowed.

You can leave the Admin section blank, but if you want to be able to control your server when you're in the lobby you'll need to be registered here. Use your 64-bit Steam ID.

Port FilteringIf you set up a firewall (like you should have) you will need to open the appropriate ports in order for outside computers to connect to your server. There are two primary ports that need to be opened. The default game port is 7777 TCP, and it is what all game traffic flows over. The default Steam query port is 27016 UDP, which is required for your server to be queried by the server browser. Use whatever ports you put in your configuration file.

Unblock these ports like so:

firewall-cmd --permanent --add-port 7777/tcp firewall-cmd --permanent --add-port 27016/udp systemctl restart firewalld

Remember to forward these ports on your router if you are running the server inside your home network.

Running Your ServerAssuming everything above was done correctly, you should be able to start your server now! You can run the server with the following command:

NOTE: When you start your server you will get absolutely spammed with a wall of errors about missing shaders. This is, apparently, a Unity "feature" and they have repeatedly said on their forums it will not be fixed. You can safely ignore them, though it does make it very hard to pick out actual legitimate errors that could be preventing your server from starting up correctly.

/installation/directory/you/want/NebulousDedicatedServer -nographics -batchmode -logFile /path/to/your/log/server.log -serverConfig /path/to/your/server/ServerConfig.xml

However, this will cause your terminal to be kept busy with the running server and closing your terminal will kill the server. You could put an & after the command to cause it to run in the background, or you could take a little extra effort in the next section to make managing your server a breeze.

(Optional) Configuring A Service

Services are processes which are controlled via the systemctl daemon. You can create a process for any binary you want with a special configuration file. Doing this will allow you to start, top, and check the status of your game server easily.

Service FileServices are defined by .service files and are stored in many locations. For this tutorial we'll place it in /etc/systemd/system/.

This file will create a simple service for our N:FC server. Save this file as neb-server.service

[Unit] Description=Nebulous Dedicated Server After=network.target [Install] WantedBy=multi-user.target [Service] Type=simple ExecStart=/installation/directory/you/want/NebulousDedicatedServer -nographics -batchmode -logFile /path/to/your/log/server.log -serverConfig /path/to/your/server/ServerConfig.xml WorkingDirectory=/installation/directory/you/want/ User=gameuser Group=gameuser Restart=always RestartSec=30

Be sure to replace all of the paths with the appropriate ones you want to use.

Once you've written this file and copied it to the correct directory you need to reload the systemctl daemon:

systemctl daemon-reload

You can then use these commands to manage your service:

systemctl start neb-server systemctl status neb-server systemctl stop neb-server

You can also set your game server to start automatically when the server initially boots with this command:

systemctl enable --now neb-server

A Note On Mods

Mods are a precarious topic for dedicated servers due to their long uptime and the fact that Workshop mods are automatically kept updated for players. If a workshop mod is updated and a client has the up to date mod, but the server has been running for a week and thus has not received the update there could be unusual behavior. As always, mods are used at your own risk.

There are few details to keep in mind if you choose to use mods.

Mod DownloadingThere is currently an issue with the dedicated server build where sometimes it is not able to download mods. It seems to vary by computer. Running the server for testing on my own computer resulted in the mods being downloaded, but running on the official server machines they would not. I was forced to copy all of the mods manually to the server. For anonymous logins to Steam, which is what the server uses, your mods are downloading to the installation directory under steamapps/workshop/content/887570/<mod folder>.

Modded MapsMaps were the most frequently tested mods while developing the dedicated servers and they work fine. The only thing to remember here is that you must specify the mod's ID number in the <Mods> section of your configuration file, or it will not be loaded and thus the map cannot be used.

Hull and Component ModsFor security reasons, the dedicated servers will not load mods that are not included in the configuration file's mod list. If you plan to allow modded fleets on your server you must explicitly list each one you are authorizing in your mods list, as well as set the AllowModdedFleets setting to true.

Source: https://steamcommunity.com/sharedfiles/filedetails/?id=2963605370					

More NEBULOUS: Fleet Command guilds