Dedicated Server

## Local Server

A local server is run on the same computer you are using to play the game. To start a local server through Steam, go to Library > Tools and install the Colony Survival Dedicated Server. You can choose to run this tool in two ways:

1. "Play Colony Survival Dedicated Server" will open the server console, a command-line interface to start and manage the server.
2. "Play with GUI" will open a window with easy to use buttons to get your server started. This is the easier option if you are not familiar with command line interfaces.

In order to make your server available to people on the internet, you just set the network type to SteamOnline and you must forward your ports.

In order to use mods in your server, you must place mods in the right folder and enable them Server with mods.

## Dedicated Server

A dedicated server is a separate machine from your own, responsible only for running the server. The easiest option is to find an established game server host which supports Colony Survival, and you simply pay for the server and use their tools to configure it.

The most affordable and best performing servers are created using dedicated servers or Virtual Private Servers that you configure yourself. This style of hosting is typically beneficial as most server hosts run in a shared environment where your server performance can be impacted by other servers hosted on the same machine. You can rent a dedicated server or Virtual Private Server (VPS) from a service like Digital Ocean.

In order to use mods in your server, you must place mods in the right folder and enable them Server with mods.

## Dedicated Server via Game Hosting Provider

You can also rent a game server from a hosting companies or by using your own server such as a VPS.

### Installation (Linux)

These instructions are written for an Ubuntu 16.04 64-bit Server but and should apply to other Linux installations. Some SSH/command-line experience is necessary.

1. Log in to your server via SSH or any other means of accessing it's console.
2. If you installed 64bit, install 32bit support for steamcmd:
	1. dpkg --add-architecture i386
	2. add-apt-repository multiverse
	3. apt-get update
	4. apt-get dist-upgrade

Install SteamCMD in a directory (in the case below we are creating it in a new steam user and installing it into the user directory):

```
useradd -m steam
cd /home/steam/
apt-get install steamcmd

```

Install Colony Survival Dedicated server via steamcmd and set an installation directory

```
cd /home/steam/
steamcmd +login anonymous +force_install_dir /home/steam/colony_survival_dedicated/ +app_update 748090 +quit

```

At the moment there is a bug where the steamclient is not automatically transfered over, so we will have to do it ourselves.

```
mkdir /home/steam/.steam/sdk64
cp /home/steam/colony_server_dedicated/linux64/steamclient.so /home/steam/.steam/sdk64/steamclient.so

```

**If you are using 32-bit, you should use the steamclient.so located in /home/steam/colony\_server\_dedicated/steamclient.so**

Run the server software, replace the tags with your own info.

```
./colonyserver.x86_64 -batchmode -nographics +server.world "**YOUR\_WORLD\_NAME**" +server.networktype SteamOnline +server.name "**YOUR\_SERVER\_NAME**"

```

**Providing +server.ip should not be necessary however may fix issues if your server is having problems. A list of all other accepted arguments can be found below.**

```
-| Singleplayer  - connects to a localhost client, not really usable manually

```

### persistent process

As the server-process stops as soon as you disconnect or time-out from your ssh session, you have to run the comment in a tmux session.

Tmux keeps running your command as it creates a persitent session.

install tmux

```
apt install tmux

```

open a session

```
tmux

```

run your command (e.g.)

```
/home/steam/colony_survival_dedicated/colonyserver.x86_64 -batchmode -nographics +server.world **YOUR\_WORLD\_NAME** +server.name "**YOUR\_SERVER\_NAME**" +server.networktype SteamOnline +server.ip **YOUR\_SERVER\_IP\_ADDRESS**

```

exit tmux

```
ctrl+d

```

```
b

```

to re-enter your tmux session, for example to send commands to the server, or stop it

```
tmux attach

```

### Mods

Mods can be downloaded from the Steam Workshop, however they require manual activation.

```
steamcmd +login anonymous +force_install_dir /home/steam/colony_survival_dedicated/ +workshop_download_item 366090 <Workshop ID> +quit
ln -s /home/steam/colony_survival_dedicated/steamapps/workshop/content/366090/<Workshop ID> <Mod Name>

```

To specify what mods you want loaded, you must create the following file /home/steam/colony\_survival\_dedicated/gamedata/savegames/<World Name>/modstate.json

```
{"Enabled":true,"ModName":"MOD_NAME","ModVersionLastKnown":"MOD_VERSION"}

```

## Port Forwarding

These are the primary ports that are configurable within the server:

```
27004 UDP (Default Client Port)
27005 TCP (Default Steam Port *This port may not actually be utilized by the game*)

```

These are ports used by the Steam API which may be required to host the game (not confirmed):

```
3478 UDP (Steam API)
4379 UDP (Steam API)
4380 UDP (Steam API)

```

Additionally, steam will use a random port between 27005 and 65535 to establish connections to players.

### Port Forwarding through a router

Especially if you are running a local server and want to play online, you will need to forwarding the ports in your router to the local computer hosting the game. The instructions for this vary widely by router manufacturer and your own networking setup. I suggest you use [portforward.com] and refer to the port numbers above.

### Port Forwarding on Linux

If you are using iptables as a firewall you can allow these ports with the following commands:

```
iptables -I INPUT -p udp -m udp --dport 3478 -j ACCEPT
iptables -I INPUT -p udp -m udp --dport 4379 -j ACCEPT
iptables -I INPUT -p udp -m udp --dport 4380 -j ACCEPT
iptables -I INPUT -p udp -m udp --dport 27004 -j ACCEPT
iptables -I INPUT -p tcp -m tcp --dport 27005 -j ACCEPT
iptables -A INPUT -p tcp --match multiport --dport 27005:65535 -j ACCEPT
iptables -A INPUT -p udp --match multiport --dport 27005:65535 -j ACCEPT

```

## Server Administration

Most administration for a server is done through the server console by running commands, or through editing configuration files.

### Console Commands

These commands are available after running colonyserverdedicated.exe:

```
quit                      - Exits this program
list,help,?               - Lists available commands
start_server              - Starts a server. Arguments possible:
- Example: start_server +server.world "test world" +server.networktype LAN
-| Singleplayer  - connects to a localhost client, not really usable manually

```

```
stop_server             - Stops a server
send                    - Send text to the server

```

### Add user role

You can add a user to a role using the following command:

```
/setgroup god USER_NAME

```

Or by using steam id (Easily find a user's Steam ID at steamidfinder.com):

```
/setgroup god STEAM_ID

```

Or by editing the file gamedata/savegames/(worldname)/permissionusers.json.
Below is an example (from version 0.7.123) with one user added to the "god" role. Replace the entire "YOUR\_STEAM\_ID" entry with your Steam ID.

```
{
	"2.0" : {
		"includes" : ["peasant"],
		"permissions" : [""]
	},
	"3.0" : {
		"permissions" : [""]
	},
	"1.76561198156320300 YOUR_STEAM_ID" : {
		"includes" : ["god"],
		"permissions" : ["printbiome","getlimit","setlimit","resetlimit"]
	}
}

```

### User Permissions

You can find a current list of permissions in your game installation: `Colony Survival/gamedata/settings/permissiongroups.json`. Below are permissions from game version 0.7.123.
The file can be copied into the world savegame folder to have custom groups and permissions per world and also have the changes update safe.

#### List of all permissions

```
printbiome
getlimit
setlimit
resetlimit
loot
reloadvariablesserver
teleport
teleport.position
teleport.banner
time
time.add
permissions
permissions.setgroup
permissions.addgroup
permissions.addpermission
permissions.removegroup
permissions.removepermission
permissions.reload
health.set
setflight
deusvult.self
deusvult.other
cheats.enable
whitelist.add
blacklist.add
whitelist.remove
blacklist.remove

```

#### Permissions by role

##### peasant

```
printbiome
getlimit
setlimit
resetlimit

```

##### king

```
(includes: peasant)
loot
time.add
teleport.position
teleport.banner
health.set
setflight

```

##### emperor

```
(includes: king)
permissions.addgroup.peasant
permissions.addgroup.king
permissions.removegroup.peasant
permissions.removegroup.king
whitelist.add
whitelist.remove
blacklist.add
blacklist.remove

```

##### godemperor

```
(includes: emperor)
permissions

```

##### god

```
(all permissions)

```