Dedicated Server Setup: Difference between revisions

From Empires Wiki
Jump to navigation Jump to search
No edit summary
m (→‎Dedicated Server - SteamCMD: fix outdated district map name in the start command :D)
 
(52 intermediate revisions by 8 users not shown)
Line 1: Line 1:
{{Sitenav|Dedicated Server Setup}}
{{ServerResources}}


{{Warning|'''The information on this page applied to the older source 2007 based version of empires and is no longer correct.'''}}
Dedicated servers are like the listen servers (which can be created by pressing the "create server" button on the main menu), but they don't require a copy of the game to be running. This is less resource intensive as the server doesn't need to spend any time rendering graphics.


== Dedicated Server (Windows) ==
== Installation ==
There are two ways of installing an Empires dedicated server:
There are two supported ways of installing a dedicated server. On Windows and Linux, you can install the server using the SteamCMD utility. On Debian-based distributions of linux, you can also install the server through APT, this will set it up as a service and with tmux.


*Using [https://developer.valvesoftware.com/wiki/SteamCMD SteamCMD].
=== Dedicated Server - SteamCMD ===


*Using [http://didrole.com/UpdateTool/ Didrol's update tool]. For the rest of this setup tutorial, we will assume we use this tool.
The Empires Dedicated Server can be installed using the [https://developer.valvesoftware.com/wiki/SteamCMD SteamCMD] utility. The server has an appid of 460040, and must be downloaded while logged in as an anonymous user.


{{Note|If updating multiple instances, you will need to apply this for each one. That means running the tool against more than one directory: "C:\****\Empires Main Server"; "C:\****\Empires Test Server"; or wherever your instances are. Open notepad andcopy and paste so there are no typo's.}}
To install the server on Windows:
*[https://developer.valvesoftware.com/wiki/SteamCMD#Downloading_SteamCMD Install SteamCMD].
*Open a command line window with elevated / local administrator privileges
*Browse to the location where SteamCMD was installed, and enter this command:
<pre>
steamcmd.exe +login anonymous +app_update 460040 validate +quit
</pre>
*This same command can also be used to update Empires Dedicated Server.


=== Download Tool ===
Once the server has been downloaded, you can launch the server by navigating to the installed location of SRCDS.exe and running the following console command:
<pre>
srcds.exe -game "empires" -console -toconsole -secure +map con_district402 +maxplayers 64
</pre>


You can download the tool [http://didrole.com/UpdateTool/UpdateTool-0.3.rar here].
To allow players to connect to your server from outside your local network, you may need to port-forward the following ports:  
* UDP 27005
* TCP and UDP 27015


*After downloading, extract the RAR.
=== Dedicated Server - APT ===
This method will install the server as a service, with tmux. (with tmux you run the server in a separate terminal window, so you can switch between the dedicated server and linux environment) <br>
<br>
Video tutorial: https://www.youtube.com/watch?v=RVvJTphiG24 <br>
<br>
Installing a dedicated server is supported on [https://www.debian.org/CD/netinst/ 32 bit Debian 10]. <br>
If you have a 64 bit install you might need to execute the following as root: <br>


=== Downloading Empires ===
dpkg --add-architecture i386
apt update
apt install lib32gcc1


*Open a command line window with elevated / local administrator privileges and browse to the location of the update tool.
Execute the following in a root shell to add the key and repository:
*Update syntax example:
mkdir -p /etc/apt/keyrings/
<pre>
wget -qO- https://deb1.ws.maxmaton.nl/debian/signing.pub | gpg --dearmor | sudo tee /etc/apt/keyrings/maxmaton.gpg >/dev/null
updatetool.exe -command update / install -game 17740
echo 'deb [signed-by=/etc/apt/keyrings/maxmaton.gpg] http://deb.maxmaton.nl/debian buster main non-free' | sudo tee /etc/apt/sources.list.d/maxmaton.list
-dir "C:\Folder Path to Empires\" -username SteamUsername -password SteamPassword -verify_all
 
</pre>
After that you can continue with:
apt update
apt install empires-server
''When it shows the license agreement, you have to press TAB to put your cursor to OK button.'' <br>
'''Your server is now up and running.''' <br>
<br>
You might also need to manually port forward the following ports:
* UDP 27005
* TCP and UDP 27015
 
If you also want the community provided maps, you can install the empires-server-maps-extra package : <br>
''Warning!'' <br>
''Takes a long time to install.'' <br>
''This pack is no longer maintained, and has outdated versions of maps.''  <br>
apt install empires-server-maps-extra
 
==== Opening the server console ====
To open the server console, execute the following command:
 
su - empires -c "tmux attach"
 
To get out of the server console, dont do CTRL + C or you will kill the server <br>
You can do CTRL + B and then CTRL + D to detach and get out of server console <br>
You can do CTRL + B and then page up and page down to scroll higher in console, then ESC to get out of the CTRL + B mode (tmux basics, you can google them) <br>
 
You can also start or stop the empires-server service
service empires-server stop
service empires-server start
 
Typing quit in server console will automatically restart the server. <br>
When server crashes it will restart automatically. (unless it freezes) <br>
 
Server folder is located in '''/var/lib/empires'''
 
Start parameters can be edited in '''/etc/empires-server.conf'''
 
More detailed/full start parameters are inside the service '''/usr/bin/empires-server'''
 
== Configuration ==
 
=== Cvars ===
 
Most configuration can be done through the use of [Server Cvars]. There are several ways commands can be set to run automatically:
 
* Include the command in the call to SRCDS. This is how the <code>maxplayers</code> cvar is set in the example above. This will run the command as soon as possible.
* Include the command in the <code>/cfg/autoexe.cfg</code> file. This will run the command once on server start-up, before any maps have loaded.
* Include the command in the <code>/cfg/server.cfg</code> file. This will run the command every time any map loads.
* Include the command in a <code>/cfg/maps/[mapname].cfg</code> file. If there is a <code>.cfg</code> file in this directory with the same name as a map, the commands in it will be run every time that map loads. Use this for map-specific configuration changes, such as adjusting the resource multiplier or ticket count.


*-command update - Tells the tool you are updating an existing server.
The following configuration options are the ones you will most likely need to change:
*-command install - Tells the server you are installing a new server.
*-game 17740 - Tells the server the Steam AppID. In the case of Empires you need to use "17740".
*-dir - This is the installation path to the Empires Server files. It is probably worth noting that for the author of this tutorial, it was "C:\*****\Empires\orangebox" .
{{Warning|It is very important that you use a full local file path & wrap it with quotation marks to help it parse any spaces. Use an existing path in conjuction with "-command update" or a new path in conjunction with "-command install".}}
*-username SteamUsername - Where Username is the Steam account you will use to connect to Steam and download the files. It is a good idea to have a separate account set up for this.
*-password SteamPassword - Self explanatory.
*-verify_all - This will verify all the files once they have been installed. Highly recommended.


{{Warning|If you have not verified the Steam account you are using to update / install your server, an e-mail will be sent with a Steam verification code to the registered primary e-mail account. In this case, you will need to run the same command again but include the verification code by adding this switch:}}
{| class="wikitable"
<pre>
|+ Common Configuration
-steam_guard_code 5char
!  Command !! Description
</pre>
|-
Where "5char" is replaced by the verification code Steam will e-mail.
| hostname || The name of your server, as it appears in the server browser.
|-
| rcon_password || A password that can be used to send server commands remotely.
{{Warning|Set this to a secure password, and do not share it freely. Anyone with this password can execute admin commands on your server.}}
|-
| sv_password || If this is set, players will be required to enter this password before joining the server.
|-
| sv_downloadurl || The URL of a [[FastDL]] server.
|-
| sv_region || A number representing the region your server is located in. A list of valid regions [[https://developer.valvesoftware.com/wiki/Sv_region can be found here]].
|-
| sv_contact || An email address players can use to contact the server owner.
|-
| sv_setsteamaccount || Link the server to a Steam account using an authentication token.
{{Fixme|Why/under what circumstances should this be done?}}
|-  
| maxplayers || The maximum number of players allowed to join the server. This can only be set as part of the command that launches SRCDS.
|}
=== FastDL Setup ===


Original author: A-z-K
The [https://developer.valvesoftware.com/wiki/FastDL FastDL system] allows server owners to specify a URL from which custom content will be downloaded. This speeds up the process of players downloading custom content when joining a server, so setting this system up is highly recommended.


== Dedicated Server (Linux) ==
{{Fixme|We need instructions here on how to set up a FastDL server.}}
Linux server is unfortunately unsupported. Valve's version of the Source 2007 engine for Linux is too slow to handle any decent amount of players, and becomes unstable very, very quickly.


== Server Extensions ==
== Server Extensions ==
There are several plugins available for use in Empires. Two extension systems are available (and can run in parallel):
There are several plugins available for use in Empires. Two extension systems are available (and can run in parallel):
* [http://www.sourcemod.net/ SourceMod] is the most common system, and is used for the majority of plugins. Handy SourceMod plugins that have been confirmed to work on Empires servers are:
* [http://www.sourcemod.net/ SourceMod] is the most common system, and is used for the majority of plugins. Handy SourceMod plugins that have been confirmed to work on Empires servers are:
** [http://raegquit.com/beerdude26/empires-plugins/rg_ungrief.smx Ungrief Command Vehicle] - Teleports the specified command vehicle to where you are looking. Usage: !ungrief <nf | be | imp>
** [http://raegquit.com/beerdude26/empires-plugins/rg_ungrief.smx Ungrief Command Vehicle] - Teleports the specified command vehicle to where you are looking. Usage: !ungrief <nf | be | imp>
** [http://www.sourcebans.net/ SourceBans] - A free global administration and banning system for Source engine based servers.
** [http://www.sourcebans.net/ SourceBans] - A free global administration and banning system for Source engine based servers.
** [http://kigenac.com/viewtopic.php?f=4&t=231 Kigen's Anti-Cheat] (Requires Sockets 3.0.1 plugin) - An extensive anti-cheating plugin.
** [http://kigenac.com/viewtopic.php?f=4&t=231 Kigen's Anti-Cheat] (Requires Sockets 3.0.1 plugin) - An extensive anti-cheating plugin.
** For more plugins, look at the [[Sourcemod Plugins]] page.
* [http://www.sourceop.com/wiki/Installing SourceOp] is less popular, but is required to run an anti-DoS plugin:
* [http://www.sourceop.com/wiki/Installing SourceOp] is less popular, but is required to run an anti-DoS plugin:
** [http://www.sourceop.com/modules.php?name=Downloads&d_op=viewdownload&cid=9 DoS Attack Fixer] - Protects against A2C_PRINT and other spam.
** [http://www.sourceop.com/modules.php?name=Downloads&d_op=viewdownload&cid=9 DoS Attack Fixer] - Protects against A2C_PRINT and other spam.
Line 73: Line 152:


If you want a mode to be automatically loaded after map change / server restart, you can add another line to server.cfg below the "exec myserver.cfg" entry.
If you want a mode to be automatically loaded after map change / server restart, you can add another line to server.cfg below the "exec myserver.cfg" entry.
As an example of custom configuration you might want to use, the following line will disable the ability to join spectators at the start of the round:
<pre>
emp_allowspectators 0; wait 30000; emp_allowspectators 1
</pre>
It should be put at the end of the .cfg file so as to not delay any subsequent commands. The wait command delays all further commands by the amount specified in 1/100ths of a second.
== Running a beta server ==
Running a beta server is just like a normal server, with the desired steam branch mentioned when downloading the server package.
<pre>
steamcmd.exe +login anonymous +app_update 460040 -beta beta validate +quit
</pre>
See this link for more info on automating server creation, and on switching to specific steam branches.
https://developer.valvesoftware.com/wiki/SteamCMD#Automating_SteamCMD


== Related Links ==
== Related Links ==
* [http://server.counter-strike.net/server.php?cmd=cmdall General HL2 Directives/Commands]
* [http://server.counter-strike.net/server.php?cmd=cmdall General HL2 Directives/Commands]
* [http://www.sourcemod.net/ SourceMod]
* [http://www.sourcemod.net/ SourceMod]
* [https://pastebin.com/SXsp0r2F How to create an Empires Server on Windows from A to Z.]

Latest revision as of 05:12, 13 March 2024

Empires Server Resources
Dedicated Server Setup | Cvars | Optimization | Sourcemod Plugins



Dedicated servers are like the listen servers (which can be created by pressing the "create server" button on the main menu), but they don't require a copy of the game to be running. This is less resource intensive as the server doesn't need to spend any time rendering graphics.

Installation

There are two supported ways of installing a dedicated server. On Windows and Linux, you can install the server using the SteamCMD utility. On Debian-based distributions of linux, you can also install the server through APT, this will set it up as a service and with tmux.

Dedicated Server - SteamCMD

The Empires Dedicated Server can be installed using the SteamCMD utility. The server has an appid of 460040, and must be downloaded while logged in as an anonymous user.

To install the server on Windows:

  • Install SteamCMD.
  • Open a command line window with elevated / local administrator privileges
  • Browse to the location where SteamCMD was installed, and enter this command:
steamcmd.exe +login anonymous +app_update 460040 validate +quit
  • This same command can also be used to update Empires Dedicated Server.

Once the server has been downloaded, you can launch the server by navigating to the installed location of SRCDS.exe and running the following console command:

srcds.exe -game "empires" -console -toconsole -secure +map con_district402 +maxplayers 64

To allow players to connect to your server from outside your local network, you may need to port-forward the following ports:

  • UDP 27005
  • TCP and UDP 27015

Dedicated Server - APT

This method will install the server as a service, with tmux. (with tmux you run the server in a separate terminal window, so you can switch between the dedicated server and linux environment)

Video tutorial: https://www.youtube.com/watch?v=RVvJTphiG24

Installing a dedicated server is supported on 32 bit Debian 10.
If you have a 64 bit install you might need to execute the following as root:

dpkg --add-architecture i386
apt update
apt install lib32gcc1

Execute the following in a root shell to add the key and repository:

mkdir -p /etc/apt/keyrings/
wget -qO- https://deb1.ws.maxmaton.nl/debian/signing.pub | gpg --dearmor | sudo tee /etc/apt/keyrings/maxmaton.gpg >/dev/null
echo 'deb [signed-by=/etc/apt/keyrings/maxmaton.gpg] http://deb.maxmaton.nl/debian buster main non-free' | sudo tee /etc/apt/sources.list.d/maxmaton.list

After that you can continue with:

apt update
apt install empires-server

When it shows the license agreement, you have to press TAB to put your cursor to OK button.
Your server is now up and running.

You might also need to manually port forward the following ports:

  • UDP 27005
  • TCP and UDP 27015

If you also want the community provided maps, you can install the empires-server-maps-extra package :
Warning!
Takes a long time to install.
This pack is no longer maintained, and has outdated versions of maps.

apt install empires-server-maps-extra

Opening the server console

To open the server console, execute the following command:

su - empires -c "tmux attach"

To get out of the server console, dont do CTRL + C or you will kill the server
You can do CTRL + B and then CTRL + D to detach and get out of server console
You can do CTRL + B and then page up and page down to scroll higher in console, then ESC to get out of the CTRL + B mode (tmux basics, you can google them)

You can also start or stop the empires-server service

service empires-server stop
service empires-server start

Typing quit in server console will automatically restart the server.
When server crashes it will restart automatically. (unless it freezes)

Server folder is located in /var/lib/empires

Start parameters can be edited in /etc/empires-server.conf

More detailed/full start parameters are inside the service /usr/bin/empires-server

Configuration

Cvars

Most configuration can be done through the use of [Server Cvars]. There are several ways commands can be set to run automatically:

  • Include the command in the call to SRCDS. This is how the maxplayers cvar is set in the example above. This will run the command as soon as possible.
  • Include the command in the /cfg/autoexe.cfg file. This will run the command once on server start-up, before any maps have loaded.
  • Include the command in the /cfg/server.cfg file. This will run the command every time any map loads.
  • Include the command in a /cfg/maps/[mapname].cfg file. If there is a .cfg file in this directory with the same name as a map, the commands in it will be run every time that map loads. Use this for map-specific configuration changes, such as adjusting the resource multiplier or ticket count.

The following configuration options are the ones you will most likely need to change:

Common Configuration
Command Description
hostname The name of your server, as it appears in the server browser.
rcon_password A password that can be used to send server commands remotely.
Warning  Warning: Set this to a secure password, and do not share it freely. Anyone with this password can execute admin commands on your server.
sv_password If this is set, players will be required to enter this password before joining the server.
sv_downloadurl The URL of a FastDL server.
sv_region A number representing the region your server is located in. A list of valid regions [can be found here].
sv_contact An email address players can use to contact the server owner.
sv_setsteamaccount Link the server to a Steam account using an authentication token.
~Fixme
Why/under what circumstances should this be done?
maxplayers The maximum number of players allowed to join the server. This can only be set as part of the command that launches SRCDS.

FastDL Setup

The FastDL system allows server owners to specify a URL from which custom content will be downloaded. This speeds up the process of players downloading custom content when joining a server, so setting this system up is highly recommended.


~Fixme
We need instructions here on how to set up a FastDL server.

Server Extensions

There are several plugins available for use in Empires. Two extension systems are available (and can run in parallel):

  • SourceMod is the most common system, and is used for the majority of plugins. Handy SourceMod plugins that have been confirmed to work on Empires servers are:
    • Ungrief Command Vehicle - Teleports the specified command vehicle to where you are looking. Usage: !ungrief <nf | be | imp>
    • SourceBans - A free global administration and banning system for Source engine based servers.
    • Kigen's Anti-Cheat (Requires Sockets 3.0.1 plugin) - An extensive anti-cheating plugin.
    • For more plugins, look at the Sourcemod Plugins page.
  • SourceOp is less popular, but is required to run an anti-DoS plugin:

Both systems themselves run on MetaMod, allowing them to run in parallel.

Tips and Tricks

Customize server.cfg settings

As the server.cfg (amongst others) can be overwritten during upgrade and you may wish to have your server run in different "modes" such as password protected clan match/practice, increased resource rates for "tank wars", etc, it is best to treat your server.cfg as "read-only".

Any default settings you wish to use can be placed in a separate file such as "myserver.cfg". At the end of server.cfg, you can then add the line "exec myserver.cfg".

This way, server.cfg will then run myserver.cfg and override any server.cfg settings.

Loading various server "modes" can then be done by calling them in the server console:

rcon exec tankwars.cfg

If you want a mode to be automatically loaded after map change / server restart, you can add another line to server.cfg below the "exec myserver.cfg" entry.

As an example of custom configuration you might want to use, the following line will disable the ability to join spectators at the start of the round:

emp_allowspectators 0; wait 30000; emp_allowspectators 1

It should be put at the end of the .cfg file so as to not delay any subsequent commands. The wait command delays all further commands by the amount specified in 1/100ths of a second.

Running a beta server

Running a beta server is just like a normal server, with the desired steam branch mentioned when downloading the server package.

steamcmd.exe +login anonymous +app_update 460040 -beta beta validate +quit

See this link for more info on automating server creation, and on switching to specific steam branches. https://developer.valvesoftware.com/wiki/SteamCMD#Automating_SteamCMD

Related Links