Building The Game

Build Guide

This Guide covers the general method of building the latest code from GitHub for Momentum for Windows, Linux and macOS.

Important Note If you just want to try out the most recent publicly available version, you can grab a ready-to-use, already compiled build from the Releases page. You only need to follow this guide for debugging and development purposes.

Prerequisites

To make use of this page, you should:

  • Be using the Administrator account of the machine you’re using
  • Have a pot of coffee (optional)

Important Note
You’ll need Momentum activated on your Steam account in order to test online features or mount assets from other games automatically! New Steam keys are currently reserved for users that are making contributions to the game.

Cloning

Download GitHub Desktop, it will require a bit of setup, and may require an account.

Go to the Main Page and click Clone or Download > Open in Desktop:

Github Open In Desktop

You should have cloned the develop branch.

If not, switch to it from the top (if you’re using GitHub Desktop).

It may also be called origin/develop:

Develop Branch Github Desktop

Your installation of GitHub Desktop may look different, but should otherwise function the same.

Windows

Download Momentum Mod on Steam or grab the MomentumDev folder from Google Drive.

Download Visual Studio 2019.

Your installation only requires the “Desktop development with C++” workload:

Desktop development with C++ selected

If you downloaded Momentum Mod from Steam, create an extra folder somewhere called MomentumDev, and copy everything from your steamapps/common/Momentum Mod folder to it. Then delete the momentum folder from MomentumDev.

Otherwise if you downloaded the MomentumDev folder from Google Drive, extract it somewhere.

Edit the creategameprojects.ps1 file to point the $path variable to the full path of the MomentumDev folder.

This script will create a symlink of your mp/game/momentum folder into the MomentumDev folder automatically for you, which allows you to test changes immediately and run the debugger from Visual Studio.

creategameprojects screenshot

Run creategameprojects.bat as administrator.

running creategameprojects

If you can’t run it as administrator, start cmd.exe as Administrator, then change directory to the Git clone, and run it from cmd.exe.

Open momentum.sln, go start the pot of coffee, come back a minute later, and click Build…

Visual Studio build screenshot

…then go finish the pot of coffee and pour yourself some.

Click Debug.

Visual Studio debug screenshot

You can launch with no debugger attached by pressing CTRL+F5 instead…

…but if a crash occurs no useful information can be gathered!

Linux

Install the following dependencies:

sudo apt-get install build-essential gcc-multilib g++-multilib

Git clone the Steam Runtime repository.

Go into its directory and run:

./setup_chroot.sh --i386

Download Momentum Mod on Steam (see the important note at the top of this page) or from Google Drive.

Clone this repository wherever you’d like.

Create an extra folder somewhere called MomentumDev, and copy all of the files from your Steam’s steamapps/common/Momentum Mod directory into this folder.

So for example, to get at the game’s binaries, it should look like MomentumDev/momentum/bin.

Now, delete the momentum folder inside MomentumDev.

Symlink the mp/game/momentum/ folder from your Git clone over to this MomentumDev folder, so that the binaries you end up compiling automatically copy over.

To compile the game, run the following commands in the mp/src/ directory of your clone:

./creategameprojects  
sudo schroot --chroot steamrt_scout_i386 -- make -f games.mak

Make sure Steam is open, and you should be able to run ./hl2.sh -game momentum in the MomentumDev folder to launch the game.

Unfortunate Note
Developing on Linux is going to be a chore, and is best reserved for Windows.
If we ever convert the project to CMake, this unfortunate note will go away, but blame VPC for not generating any good Linux development files for the time being.

macOS

macOS support has been dropped indefinitely due to the operating system no longer supporting 32 bit applications.