Setting up a Dedicated Server

This guide explains everything you need to know to setup one or more dedicated servers for hosting races for rFactor 2 on Steam. The basic process involves first installing the dedicated server, then installing the tracks and cars you want and creating one or more “race events” with those that you can host. For every different server instance you can setup a profile, configure and open ports on your firewall and start hosting.

Introduction

This guide explains everything you need to know to setup one or more dedicated servers for hosting races for rFactor 2 on Steam. The basic process involves first installing the dedicated server, then installing the tracks and cars you want and creating one or more “series” (in an .rfmod file) with those that you can host. For every different server instance you can setup a profile, configure and open ports on your firewall and start hosting.

The whole process does take some time and some steps might not be immediately intuitive, but in the end this gives you a very flexible hosting setup. If you have any questions while following this guide, please provide feedback so we can improve it.

Downloading and Installing

For people that want to host a dedicated server, a special installation is now available. It does not require you to install and run a Steam client, or log into Steam, but it does provide you with a dedicated server that will register with Steam, so it's visible in the server list.

The installation goes as follows:

  • Download the SteamCMD archive from this link: http://media.steampowered.com/installer/steamcmd.zip
  • Create a new folder on your system for SteamCMD, for example C:\Racing\SteamCMD.
  • Put SteamCMD.exe from the archive you downloaded in that folder.
  • Open a shell (Windows+R to run a command, and then type “CMD”).
  • Go to the folder you just created: cd \Racing\SteamCMD
  • Run the following command:
    steamcmd +login anonymous +force_install_dir ../rFactor2-Dedicated +app_update 400300 +quit

Sit back and get a cup of coffee. Steam will download the full distribution for the dedicated server for you and install it in C:\Racing\rFactor2-Dedicated.

If you ever want to update your installation in the future, because a new version of rFactor 2 has been released, you can simply run the SteamCMD command again and your installation will automatically update to the latest version.

Setting up Shortcuts

Before you continue installing packages and creating events, it is worthwhile to setup a few shortcuts:

  • A shortcut to the 64 bit version of the dedicated server to host a race. You can find it in the Bin64 folder of the installation. Make sure to add:
    +path=".."
    at the end of the line in "Target" to ensure that the dedicated server knows how to load all your content, otherwise the shortcut won't work! So the whole line in that "Target" field should be something like this:
    "C:\rFactor2-Dedicated\Bin64\rFactor2 Dedicated.exe" +path=".."
  • A shortcut to the module manager that can be used to install packages containing tracks, cars or race events. You can find it in the Bin64 folder of the installation and it's called ModMgr.exe
  • A shortcut to the package manager that can be used to create race events. It is located in the Support\Tools folder of the installation, a file called MAS2_x64.exe.

Downloading Packages

The different tracks and cars that you can use to host races in rFactor 2 can be downloaded in different ways. Probably the most convenient way of doing so is through the same Steam Workshop that you are familiar with when playing rFactor 2. The biggest difference being that a server has no Steam account and therefore does not support the notion of being subscribed to content. However, that does not mean that you cannot download items from the workshop, but you have to do that differently.

To download anything from the workshop, you do not need a Steam account, you can anonymously download them. You do need to know the Workshop ID of the item you want to download. If you browse the workshop, the URL will reveal this ID. For example: https://steamcommunity.com/sharedfiles/filedetails/?id=1515644900

Open a command line and run SteamCMD to start the actual download of the item:

S:\Temp>steamcmd.exe +login anonymous +workshop_download_item 365960 505225177 +quit

The command you are running will log into Steam, download an item from the workshop for a game with ID 365960 (which is rFactor 2) and the workshop item ID 1515644900, and then quit. Now to find the item you just downloaded, go into the folder where you installed SteamCMD and then go to this path:

steamapps\workshop\content\365960\1515644900

Again you see the ID of both the game and the workshop item in the path. That folder should give you the contents of the item. This is often a single package file, but could very well be a whole set of files. In the next section we will discuss how to install them.

Installing Packages

Once you have downloaded the packages you need, you can install them. The easiest way is to first copy the files you downloaded into the "Packages" folder of your installation. Then, using a shortcut you've setup earlier in the guide, run the module manager. The packages should now show up in the list and you can use the "Install" button to install them.

For hosting you need at least some kind of "series" (which describes what cars and tracks you're hosting) and the corresponding cars and tracks. If you don't have a series, you can also create your own. This is explained in great detail in a different guide, such as the one you'll find here: https://steamcommunity.com/sharedfiles/filedetails/?id=554544322 and if you're considering hosting paid content, we definitely advise you to read up on that as well in our forum: https://forum.studio-397.com/index.php?threads/how-to-creating-a-raceevent-with-paid-content.57207/

Configuring your Firewall and Router

To make your dedicated server accessible for others, you probably need open up some ports in your firewall and potentially forward them from your router to the computer that is running the dedicated server.

The ports that the dedicated server uses can be configured in the Multiplayer.JSON file that can be located in the player folder in UserData. The following two settings configure the ports:


"HTTP Server Port":64297
"Simulation Port":54297

In addition to these two ports, Steam will use two extra ports (the ones directly after the HTTP server port) so for this example the following ports need to be opened:

UDP+TCP 54297
TCP 64297
UDP 64298
UDP 64299

Running the Server

In one of the previous sections you have already setup a shortcut to the dedicated server, so now all you need to do is launch it. A wizard will guide you through the final steps of selecting a race event, cars, tracks and configuring the many different options.

If you want to run more than one dedicated server on the same computer, you need to have a unique copy of the player folder for each. To set that up, start by going to your installation and then to the UserData folder. If you've already run the dedicated server before, you will see a "player" folder. If not, do that first. Then make a copy of the player folder, go in and change the ports (and possibly your router and firewall again). Then create a new shortcut to launch this dedicated server. In the "Target" field of this shortcut, add the following behind rFactor2 Dedicated.exe:

+profile=player2

Assuming the copy of the player folder is called "player2". From now on, you can use this shortcut to launch this instance of the dedicated server. In theory you can add as many as you have ports, bandwidth, memory and CPU power for.

Server and Client on the same Machine

If you want to run a server and client on the same machine, you need to make sure that the port that is used for the new UI is different for server and client. Since that is a port that gets configured in the player.json you need to make sure to at least run the server using its own profile as described above. The alternative would be to have a completely separate install for both. The line to look for in the player.json and change is:

    "WebUI port":5397

Just make sure that port is different for both and you'll be fine, so for example you could reconfigure the server to use 5398 instead.