Skip to content

How-To Compile Multiplayer Peer

For those of you who are comfortable compiling or want to give it a shot, here are some steps to follow.

Set Up Tools

Follow Godot's documentation to setup the required tools for your operating system.

Get Godot

Regardless of which option you pick, make sure it is for Godot version 4.0 or higher.

Cloning the Source

You can clone the latest Godot source in a folder called godot like so:

git clone https://github.com/godotengine/godot.git -b 4.3-stable godot
You may need to change the tag from 4.3-stable to whatever the current version is or whatever version you need.

Downloading the Source

Alternatively, you can download and unpack the Godot source from their Github into a folder called godot.

Get GodotSteam

You can alternatively use GodotSteam Server to add this kind of peer functionality to master or dedicated servers.

Cloning the Source

Head into the godot/modules/ folder and clone the source like so:

git clone -b godot4 https://github.com/GodotSteam/GodotSteam.git godotsteam

Downloading the Source

Alternatively, you can download the godot4 branch from our repository then unpack it into a folder named godotsteam inside your Godot source godot/modules/ folder.

Get GodotSteam Multiplayer Peer

Head into the godot/modules folder and clone the source like so:

git clone -b main https://github.com/GodotSteam/MultiplayerPeer.git godotsteam_multiplayer_peer
Alternatively, you can download the multiplayer-peer branch from our repository then unpack it into a folder called godotsteam_multiplayer_peer inside your Godot source godot/modules/ folder.

Get the Steamworks SDK

Download the Steamworks SDK from Valve's partners site. This requires a Steam developer account.

Move the public and redistributable_bin folders from the unzipped Steamworks SDK into the godot/modules/godotsteam/sdk/ so you have the following layout:

godot/
└─ modules/
    └─ godotsteam/
        └─ sdk/
            ├─ public/*
            └─ redistributable_bin/*

Double-Checking Folder / File Structure

Before we start compiling, let us make sure everything is in place. Your godot directory should look something like this:

godot/
└─ modules/
    ├─ godotsteam/
      ├─ doc_classes/
      ├─ sdk/
        ├─ public/*
        └─ redistributable_bin/*
      ├─ config.py
      ├─ godotsteam.cpp
      ├─ godotsteam.h
      ├─ godotsteam_constants.h
      ├─ register_types.cpp
      ├─ register_types.h
      └─ SCsub
    └─ godotsteam_multiplayer_peer/
        ├─ config.py
        ├─ godotsteam_connection_data.h
        ├─ godotsteam_constants.h
        ├─ godotsteam_id.cpp
        ├─ godotsteam_id.h
        ├─ godotsteam_multiplayer_peer.cpp
        ├─ godotsteam_multiplayer_peer.h
        ├─ register_types.cpp
        ├─ register_types.h
        ├─ SCsub

You can also just put the godotsteam and godotsteam_multiplayer_peer directories where ever you like and just point to them in SCONS when compiling:

custom_modules='../path/to/dir/godotsteam, ../path/to/dir/godotsteam_multiplayer_peer'

Compiling Time

To compile editors, use this SCONS line:

scons platform=<your platform> target=editor

To compile debug templates, use this SCONS line:

scons platform=<your platform> target=template_debug

To compile release templates, use this SCONS line:

scons platform=<your platform> target=template_release

A Linux Note

If using Ubuntu 16.10 or higher and having issues with PIE security in GCC, use LINKFLAGS='-no-pie' to get an executable instead of a shared library.

All Together Now

When the compiling is finished, make sure to copy the Steam shared library, for your operating system, from godot/modules/godotsteam/sdk/redistributable_bin/ folder to the newly-compiled Godot binary location.

By default, it should be in the godot/bin/ folder. You can move them to a new location as long as you keep the two files together.

Missing Shared Library

A lack of the Steam API .dll/.so/.dylib for your respective OS will cause the editor or game to fail and crash when testing or running the game outside of the Steam client.

A General Note

Some people report putting the Steam API file inside their project folder fixes some issues.

A Mac Note

For MacOS, the libsteam_api.dylib must be in the Content/MacOS/ folder in your application zip or the game will crash.

A Linux Note

For Linux, you may have to load the overlay library for Steam overlay to work:

export LD_PRELOAD=~/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so;~/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so

or 

export LD_PRELOAD=~/.local/share/Steam/ubuntu12_32/gameoverlayrenderer.so;
export LD_PRELOAD=~/.local/share/Steam/ubuntu12_64/gameoverlayrenderer.so;

This can be done in an .sh file that runs these before running your executable. This issue may not arise for all users and can also just be done by the user in a terminal separately. You can read more about it in our Linux Caveats doc.

Good to Go

From here you should have access to all of the Steamworks SDK functions and callbacks, as well as use Godot's RPC, MultiplayerSynchronizer node, and MultiplayerSpawner node.

You should be able to read the Steamworks API documentation to see what all is available and cross-reference with GodotSteam's documentation.

Feel free to check out our tutorials if you want to learn some basics or just start tinkering!