Mar 6, 2021

How to compile and install Stunt Rally on Fedora

Stunt rally

Stunt Rally is an open source racing game, one of a few available for Linux. It caught the attention of my son because it supports network mutiplayer mode as well as split screen multiplayer mode. As of writing this, there does not seem to exist an RPM package. There are SNAP and Flatpack packages which I have not tried. If you do not want those for any reason, you might find this compilation guide useful.

Prerequisites

On Fedora 32, I had to install the following prerequisites to be able to compile:

sudo dnf install -y boost-devel cmake hicolor-icon-theme desktop-file-utils mygui-devel ogre-devel ois-devel enet-devel SDL2-devel libvorbis-devel libXcursor-devel bullet-devel bullet-extras-devel shiny-devel tinyxml-devel tinyxml2-devel ogre-pagedgeometry-devel dejavu-lgc-sans-fonts liberation-sans-fonts bitstream-vera-sans-fonts bitstream-vera-sans-mono-fonts openal-soft-devel cmake g++ git

Clone the source repositories

Starting from here, the steps are actually the same as on the Stunt Rally wiki.

git clone git://github.com/stuntrally/stuntrally.git
cd stuntrally
SR_HOME="$(PWD)"
# get the tracks
cd data
git clone --depth=1 git://github.com/stuntrally/tracks.git

Enable the master server compilation target (optional)

If you want to play in multiplayer mode, having your own master server makes joining the game easier than direct connect. Direct connect works too, but master server saves you some typing and clicking.

To enable the master server compilation target, add -DBUILD_MASTER_SERVER=ON to the cmake command below

Compile the game

cd "${SR_HOME}"
mkdir build
cd build

cmake -DBUILD_MASTER_SERVER=ON ..
make -j4        # Compile using 4 threads (change to your number of CPUs)

Install (optional)

sudo make install

Play the game (single player)

${SR_HOME}/stuntrally

Play multiplayer

Server

On the machine that will fulfill the server role, create a script like the following and name it e.g. sr.sh

#!/bin/bash
set -x
set -e

# change to where you have the stuntrally and sr-masterserver binaries
SR_HOME=path/to/build

cd "${SR_HOME}"

# start the server

./sr-masterserver -p 4242 -V &

# start the game
./stuntrally

# kill the server after exiting the game
killall sr-masterserver

Then open the ports

firewall-cmd --add-port=4242/udp --permanent
firewall-cmd --add-port=4243/udp --permanent

Start the game and master server using the sr.sh script

sr.sh

In the game, go to Multiplayer > Settings

Multiplayer > Settings
  1. Leave Local port unchanged

  2. Change the Master server IP to an address or hostname of the current machine your clients can access

  3. Change the Port to 4242

Switch to Server tab and click Create game

Create game

Clients

Start the game as usual

${SR_HOME}/stuntrally

Go to Multiplayer > Settings and perform the same changes as on the server

Multiplayer > Settings
  1. Leave Local port unchanged

  2. Change the Master server IP to an address or hostname of the current machine your clients can access

  3. Change the Port to 4242

Switch to Server tab and click Get/refresh list. The game created on the server should appear in the list.

Get/refresh list

Select the game and click Join game below.

After that, the client should be visible in the list of players in the Game tab.

Once all clients click the green Ready button, the game can be started on the server by pressing the green Start button.

Edit this post