User:Steffo/Counter-Strike: Global Offensive dedicated server

From ArchWiki

This article or section is out of date.

Reason: Counter-Strike: Global Offensive has been retired, and is no longer available. (Discuss in User talk:Steffo/Counter-Strike: Global Offensive dedicated server)

Counter-Strike: Global Offensive is a popular multiplayer first-person shooter developed by Valve and Hidden Path Entertainment.

This article details the installation, configuration and modification of a dedicated game server for Counter-Strike: Global Offensive on Arch Linux.

Prerequisites

Installation

No packages to install the software are currently available.

Create a new user

Create a new user to run the game server as:

useradd --system --home-dir "INSTALLDIR" --create-home csgo

Enter a shell as the new user:

sudo -iu csgo

Download the server files

As the csgo user, run steamcmd.

In the command prompt, specify the absolute path to the directory where the game server should be downloaded in with the following command:

force_install_dir INSTALLDIR

To begin downloading the game files, enter the following command:

app_update 740

When the download is complete, leave steamcmd with Ctrl+C.

Configuration

Cfg files

The INSTALLDIR/csgo/cfg directory contains .cfg files, which contain newline-separated series of game console commands.

These can be executed from the game server console with the following command:

exec FILENAME

Some of these are run automatically at certain moments:

  • autoexec.cfg is run once when the gameserver is started;
  • server.cfg is run every time the server loads a new map;
  • gamemode_armsrace.cfg is run every time the server loads an Arms Race match;
  • gamemode_casual.cfg is run every time the server loads a Casual match;
  • gamemode_competitive2v2.cfg is run every time the server loads a Wingman match;
  • gamemode_competitive.cfg is run every time the server loads a Competitive match;
  • gamemode_cooperative.cfg is run every time the server loads a Guardian match;
  • gamemode_coopmission.cfg is run every time the server loads a Coop Strike match;
  • gamemode_custom.cfg is run every time the server loads a Custom match;
  • gamemode_deathmatch.cfg is run every time the server loads a Deathmatch match;
  • gamemode_demolition.cfg is run every time the server loads a Demolition match;
  • gamemode_retakecasual.cfg is run every time the server loads a Retakes match;
  • gamemode_survival.cfg is run every time the server loads a Danger Zone match;
  • gamemode_teamdeathmatch.cfg is run every time the server loads a Team Deathmatch match.

Steam account token

To enable Internet connections to the game server, a Steam account token is required.

Visit this page and create a game server account with the App ID 730.

Add a new line to your server.cfg file that sets your login token:

vim INSTALLDIR/csgo/cfg/server.cfg
sv_setsteamaccount LOGINTOKEN

Run the server

To run the server, run the following command as the csgo user:

INSTALLDIR/srcds_run

The game will start, and you'll gain access to the game server console, where commands can be entered.

You can shut down the server with Ctrl+C.

Selecting a map

Once the server is started, you can select a map by with the changelevel command:

changelevel MAPNAME

A list of available maps can be viewed with the maps command:

maps *

Optional steps

Enable rcon

The remote console (rcon for short) allows you to control the server without having access to the server tty.

To enable it, add the following line to the server.cfg file:

vim INSTALLDIR/csgo/cfg/server.cfg
rcon_password VERYSECUREPASSWORD

Run as a service

Comment: How should the systemd service for the dedicated server be structured?

Change the server tickrate

To change the server tickrate, pass the -tickrate TICKSPERSECOND argument to srcds_run:

INSTALLDIR/srcds_run -tickrate TICKSPERSECOND

If not passed, the tickrate will default to 64.

Note: Higher tickrates require larger network bandwidth.

Install Metamod:Source

From the AlliedModders wiki:

Metamod:Source is an API manager and interception handler that sits in between the Half-Life 2 Engine (Source) and a subsequent Game Modification (MOD). It can dynamically load "Metamod:Source Plugins", written in C++, to intercept, override, and hook Engine and GameDLL API interfaces.

Download the Metamod:Source tarball:

wget "URL"

Move the tarball to the csgo game files directory:

mv mmsource-*-linux.tar.gz DIRECTORY/csgo

Enter the directory:

cd DIRECTORY/csgo

Extract the tarball:

tar -xzf mmsource-*-linux.tar.gz

Metamod files should have appeared in the DIRECTORY/csgo/addons directory.

Delete the downloaded tarball:

rm mmsource-*-linux.tar.gz

#Run the server, and check if Metamod is installed correctly by seeing if the meta command is registered in the game server console:

meta

Install SourceMod

Note: Metamod must be installed before installing SourceMod.

From the AlliedModders wiki:

SourceMod is a Metamod:Source plugin for Half-Life 2. It provides comprehensive scripting for the Source engine and mods written using the Source SDK. It has features for administration systems, commands, console variables, events, network messages, timed actions, math and string routines, entity modification, and more. It also features a safely versioned, object oriented API usable from "extensions" written in C++. The extension API can be used to add scripting language callbacks and native features.

Download the SourceMod tarball:

wget "URL"

Move the tarball to the csgo game files directory:

mv sourcemod-*-linux.tar.gz DIRECTORY/csgo

Enter the directory:

cd DIRECTORY/csgo

Extract the tarball:

tar -xzf sourcemod-*-linux.tar.gz

A sourcemod directory should have appeared in DIRECTORY/csgo/addons.

Delete the downloaded tarball:

rm sourcemod-*-linux.tar.gz

#Run the server, and check if Sourcemod is installed correctly by seeing if it appears in the installed plugins list:

meta list

Installing SourceMod plugins

Note: Ensure the plugins you installed do not break the Game Server Operation Guidelines!

To install SourceMod plugins, follow the instructions provided by the plugin developer.

Usually, .smx files go in the INSTALLDIR/csgo/addons/sourcemod/plugins directory, while .sp files go in the INSTALLDIR/csgo/addons/sourcemod/scripting directory.

External links