Metamod

A guide on how to install and compile Metamod:Source for Source 2 dedicated servers.

Metamod:Source is a plugin loader for Source 2 games like Counter-Strike 2. It provides a basic plugin API but does not offer functionality on its own. This guide covers both installation and compilation for Linux and Windows.

Installation

Steps to Install Metamod:Source

Download the Latest Build:

Move the addons Folder:

  • Extract the downloaded archive and move the addons folder to your game/csgo directory.

Edit gameinfo.gi:

  • Open the gameinfo.gi file located in game/csgo.
  • Add the following line to the SearchPaths section:
    "GameInfo"
    {
    game        "Counter-Strike 2"
    title       "Counter-Strike 2"
    title_pw    "E58F8DE68190E7B2BEE88BB1EFBC9AE585A8E79083E694BBE58ABF"
    
        LayeredOnMod    csgo_imported // Inherits the gameinfo.gi data from csgo_imported (which itself inherits from csgo_core)
    
        FileSystem
        {
            SearchPaths
            {
                Game_LowViolence    csgo_lv // Perfect World content override
    
      +         Game    csgo/addons/metamod
                     Game   csgo
                     Game   csgo_imported
                     Game   csgo_core
                     Game   core
    ...
    

Compilation

Linux Compilation

A guide on how to compile Metamod:Source for Linux.

Prerequisites

File Structure

For simplicity, perform all steps in an alliedmodders folder:

mkdir alliedmodders
cd alliedmodders

Ubuntu 20.04 Setup

sudo apt update
sudo apt install python3-pip
sudo apt-get install clang

# Add pip-installed packages to PATH
echo "export PATH=\"$HOME/.local/bin:$PATH\"" >> ~/.bashrc
. ~/.bashrc

Download AMBuild

git clone https://github.com/alliedmodders/ambuild
pip install ./ambuild

# If you encounter errors, try:
# cd ambuild && python setup.py install && cd ..

Compilation Instructions

Set up the HL2SDK and Metamod:Source repositories:
mkdir hl2sdk-root
git clone https://github.com/alliedmodders/hl2sdk/ --branch cs2 hl2sdk-root/hl2sdk-cs2

git clone https://github.com/alliedmodders/metamod-source --recursive
cd metamod-source
Set environment variables:
echo "export HL2SDKCS2=/absolute/path/to/hl2sdk-root/hl2sdk-cs2" >> ~/.bashrc
echo "export MMSOURCE112=/absolute/path/to/metamod-source" >> ~/.bashrc
. ~/.bashrc
Build Metamod:Source:
mkdir build && cd build
CC=clang CXX=clang++ python3 ../configure.py -s cs2
ambuild

Windows Compilation

A guide on how to compile Metamod:Source for Windows.

Prerequisites

Installing Visual Studio 2022

  • Download and install the Community Edition of Visual Studio 2022.
  • During installation, ensure the Desktop development with C++ component is selected.

File Structure

For simplicity, perform all steps in an alliedmodders folder:

mkdir alliedmodders
cd alliedmodders

Download AMBuild

git clone https://github.com/alliedmodders/ambuild
pip install ./ambuild

# If you encounter errors, try:
# cd ambuild && python setup.py install && cd ..

Compilation Instructions

Set up the HL2SDK and Metamod:Source repositories:
mkdir hl2sdk-root
git clone https://github.com/alliedmodders/hl2sdk/ --branch cs2 hl2sdk-root/hl2sdk-cs2

git clone https://github.com/alliedmodders/metamod-source --recursive
cd metamod-source
Set environment variables:
setx HL2SDKCS2 C:/absolute/path/to/hl2sdk-root/hl2sdk-cs2
setx MMSOURCE112 C:/absolute/path/to/metamod-source
Build Metamod:Source:
mkdir build && cd build
python ../configure.py -s cs2
ambuild