CosmoServer is the "Cosmoteer Lobby Server". It is a small command-line application that runs a simple server. Cosmoteer players can connect to a CosmoServer to chat and play multiplayer games with anyone else on that server. CosmoServer does not actually run any gameplay logic, and so it is compatible with all Cosmoteer mods. (But individual players must still be using the same mods in order to play with each other.)
Connecting to a CosmoServer
To connect to a CosmoServer, first click Multiplayer on the title screen and then click on the Online tab (if it is not already selected). Near the top-right of the screen there is a dropdown list of available servers that should already be populated with a list of official servers. If you want to connect to a non-official server, click the menu button just right of the dropdown and select "Add Custom Server". Type in a name for the non-official server (it can be anything you want) and enter its public I.P. address. If the server is running on a non-default port (anything other than 35872) or requires a password to join, enter those as well.
If you want to connect to a server running on your own network, you'll want to enter the private I.P. address of the computer running the server, because many routers have issues when a computer on its network uses its public I.P. address (even if port-forwarding is correctly configured). If the server is running on the same computer you're playing Cosmoteer on, you can simply enter
localhost as the I.P. address.
Running your own CosmoServer
If you want to run your own CosmoServer that other players can join, simply run the
CosmoServer.exe program that is included in Cosmoteer's installation directory. (Typically
C:\Program Files\Cosmoteer\CosmoServer.exe.) Running that program with no command-line arguments will start up a server that is running on UDP port 35872, has a maximum of 100 simultaneously-connected players, and requires no password to join.
If you're running CosmoServer behind a router, you'll need to setup "port forwarding" (sometimes called "virtual server") so that players on the outside of your network can connect to your server. If your server is running on the default port of 35872, you'll want to forward UDP port 35872 to the computer actually running the server. (Make sure you forward UDP port 35872, not TCP port 35872.) Here is a website that describes how to setup port forwarding for many common routers.
CosmoServer supports a handful of command-line arguments to configure its behavior:
--help This argument causes the program to print the full list of command-line arguments to the console and then exit.
--port 35872 This argument allows you to customize the UDP port on which the server communicates. If you omit it, it uses the default port of 35872.
--verbose If this argument is specified, the server will print various debugging output to the console. This may reduce the performance of the server.
--maxplayers 100 This argument allows you to change the maximum number of players that can be simultaneously connected to the server. If more players try to connect than the server allows, they will fail to connect. If you omit this argument, then it will default to a maximum of 100 players.
--password "mypassword" This argument allows you to require a password in order to join the server, if you don't want just anyone to be able to join. Players will have to enter the password you specify when they add your custom server in Cosmoteer.
(There are also some additional arguments that are useful when running the server in the background. These are described below.)
Once a server is running, there are some additional commands that you can type to check its status or modify its behavior:
shutdown Disconnects all players and shuts down the server. This will immediately interrupt all in-progress games that anyone is playing.
stats Prints out various statistics such as the number of currently-connected players and bandwidth usage.
list Prints out the I.P. address and port of every player currently connected to the server.
drain Blocks all new attempts to connect to the server but does not disconnect any already-connected players. This can be useful if you want to shut down a server soon but don't want to interrupt anyone already playing on it.
Running on Linux/Mac
Since Cosmoteer is currently only compatible with Windows, you might think that CosmoServer is also only compatible with Windows. This is actually not true! CosmoServer should run just fine on both Linux and Mac using Mono, and has been specifically tested to work on Ubuntu 16.04 using Mono 5.4.1.
In order to run CosmoServer on a Mac or Linux computer, you'll first need to copy the following files from a Cosmoteer installation on a Windows computer (you could just copy the whole installation, but these are the minimum files you need):
Next, download and install the latest version of Mono. (CosmoServer has been tested with Mono 5.4.1 but may work fine with earlier versions.)
To run CosmoServer, open up a command-line terminal,
cd into the directory where you copied the above files, and then run:
This will run CosmoServer with all of the default settings. You can append any additional command-line arguments you want to the end of that command.
Running CosmoServer as a background process
If you run CosmoServer by double-clicking
CosmoServer.exe or opening up a command-line and running it from there, it will run as a "foreground" process, meaning that you can type commands into it and the server will quit if you ever close the command-line window. This works fine for testing and for short-lived servers, but for long-lived servers, you'll probably want to run it in the "background", meaning that you can't see or interact with it but it's still running. How exactly you do this depends on your operating system (for operating systems using
systemd such as Ubuntu 16.04, see the guide below), but regardless of your operating system, there are some additional command-line arguments of CosmoServer that you'll likely want to take advantage of:
First, since you're running CosmoServer in the background, it won't be able to read any user input from the console, which can actually cause CosmoServer to use abnormally high CPU as it continuously tries and fails to read user input. To prevent CosmoServer from doing this, you should specify the
--nostdin command-line argument.
Second, even though it can't read input from the console, you'll probably still want to be able to interact with it by typing in commands. The way we can do this is by running a foreground instance of CosmoServer and having it "attach" to the already-running background instance of CosmoServer. In order to do this you'll need to use another couple of command-line arguments:
--attachable This argument should be specified when running CosmoServer in the background. It allows another CosmoServer to "attach" to it and send it commands.
--attach This argument should be specified when running a foreground CosmoServer that you want to attach to a background CosmoServer. Instead of running an actual server that players can join, it will instead "attach" to an already-running server on the same computer and allow you to type commands into it. (To detach from the background server, simply type the
When CosmoServer attaches to another CosmoServer, it does so using a local TCP connection, which by default uses TCP port 35872. If for some reason that port is not available, you can change what port it uses by specifying the
--attachport 35872 command-line argument on both the foreground and background servers.
Running CosmoServer as a background process using systemd (Ubuntu 16.04)
Follow these instructions if you want to run CosmoServer on Ubuntu 16.04 (perhaps because you can get a cheap Ubuntu 16.04 cloud server on DigitalOcean for only $5/month). This has been tested on Ubuntu 16.04 but is likely to work with minor modifications on any operating system running
First, you'll want to create the file that tells
systemd how to run CosmoServer as a service. Type the following into your command-line:
sudo nano /lib/systemd/system/cosmoserver.service
And then paste the following code into that file:
[Unit] Description=CosmoServer [Service] Type=simple ExecStart=/usr/bin/mono /path/to/CosmoServer.exe --attachable --nostdin Restart=always RestartSec=5 User=walt [Install] WantedBy=multi-user.target
(You'll want to replace
/path/to/CosmoServer.exe with the actual path where you copied the
This basically tells
systemd to run CosmoServer in the background, don't read input from the console (to prevent high CPU usage), and to allow a foreground CosmoServer to attach to it. It also tells
systemd to restart the server automatically if it ever crashes.
Once you've created and saved this file, you should tell
systemd to actually start the server by typing:
sudo systemctl start cosmoserver
CosmoServer should now be running in the background, which you can test by running Cosmoteer, adding your server as a custom server, and connecting to it. If you can't connect to it, then you probably need to allow connections to the server through your firewall:
sudo ufw allow 35872/udp
One last thing, which is that CosmoServer still won't run automatically whenever your system boots. To make it run automatically upon boot, simply type:
sudo systemctl enable cosmoserver