How-To For Modules

These instructions should work for both 2.x and 3.x versions of the GodotSteam module.


1. Preparing

Unzip the Godot Engine source code and place the contents into a folder. For the purpose of this how-to we will name the folder godot.

Unzip the GodotSteam you downloaded and copy the godotsteam folder from it into the godot/modules/ folder.

NOTE: You may now put the godotsteam folder anywhere you want and just append the custom_modules= flag in SCONS as long as it points to the godotsteam folder's location. For example: scons platform=windows production=yes tools=yes target=release_debug custom_modules=C:\stuff\godotsteam.

Alternate Preparation Option

Once you have the pre-compiles and Steamworks SDK, skip ahead to Step 5 in this tutorial.


2. Copy The Steamworks SDK

Unzip the Steamworks SDK and extract the following folders into the godot/modules/godotsteam/sdk/ folder:


public/
redistributable_bin/


3. Folder Layout

The repo's directory contents should now look like this:


godot/modules/godotsteam/sdk/public/*
godot/modules/godotsteam/sdk/redistributable_bin/*
godot/modules/godotsteam/SCsub
godot/modules/godotsteam/config.py
godot/modules/godotsteam/godotsteam.cpp
godot/modules/godotsteam/godotsteam.h
godot/modules/godotsteam/register_types.cpp
godot/modules/godotsteam/register_types.h


4. Compiling

Compile for your platform:
On Windows ( http://docs.godotengine.org/en/stable/reference/compiling_for_windows.html )
On Linux ( http://docs.godotengine.org/en/stable/reference/compiling_for_x11.html )
On OSX ( http://docs.godotengine.org/en/stable/reference/compiling_for_osx.html )

For the best results (size and performance), you will want to use these SCONS flags when compiling your editor:


production=yes tools=yes target=release_debug

Use this for your template:


production=yes tools=no target=release

NOTE: when creating templates for OSX, please refer to this post for assistance as the documentation is a bit lacking ( http://steamcommunity.com/app/404790/discussions/0/364042703865087202/ ).

NOTE: using MinGW causes crashes. There is a _mingw-patch.py_ file that corrects one known crash due to compiling with MinGW but there is now a newer crash that hasn't been solved; as well as who knows how many unfound issues. I strong recommend you do not use MinGW to compile at this time.


5. Copy Steamworks Redistributables

When compiling the engine is finished, copy the shared library (steam_api), for your OS, from godot/modules/godotsteam/sdk/redistributable_bin/ folder to the Godot binary location. By default, it is in the Godot source godot/bin/ folder. You can move them to a new folder but, for the sake of the how-to, we will leave them in the bin folder.

In the godot/bin/ folder, or wherever you put the editor executable, you must include a steam_appid.txt file with either your game's Steam ID, or the generic 480, as the only text inside. Running the game from the editor or outside of the Steam client will cause a crash without it.

With everything now in place, your working directory should look like this:

Linux 32-bit

godot/bin/libsteam_api.so
godot/bin/steam_appid.txt
godot/bin/godot.linux.tools.32
Linux 64-bit

godot/bin/libsteam_api.so
godot/bin/steam_appid.txt
godot/bin/godot.linux.tools.64
OSX

godot/bin/libsteam_api.dylib
godot/bin/steam_appid.txt
godot/bin/godot.osx.tools.64
Windows 32-bit

godot/bin/steam_api.dll
godot/bin/steam_appid.txt
godot/bin/godot.windows.tools.32.exe
Windows 64-bit

godot/bin/steam_api64.dll
godot/bin/steam_appid.txt
godot/bin/godot.windows.tools.64.exe

6. Done

Now you can open the editor you just created and get to work! If you are are starting from scratch or importing an existing project, you can just start adding in Steamworks code. Remember, every function starts with the Steam class; e.g. Steam.run_callbacks() or Steam.getUserID(). All of the available functions can be found in the editor in the Search section under Steam. Additionally, you should be able to read the Steamworks API documentation to see what all is available and cross-reference with GodotSteam.

I suggest checking out the various tutorials available here in the documentation to get you started on most of the main features of Steamworks. Though I do recommend that you create a separate copy of your project if you intend to have a non-Steam version of your game.


7. Exporting / Shipping

Check out the exporting and shipping tutorial to learn more details about process. Here are a few important bits though:

Your game must ship with the executable and Steam API DLL/SO/DyLIB to function. Lack of the Steam API DLL/SO/DyLib (for your respective OS) will cause it fail and crash. Do not, however, ship your steam_appid.txt file; it is a harmless file to include by Valve recommends you do not.

NOTE: For Linux, some users may experience problems with the editor or game finding the libsteam_api.so file even with it right there in the directory. It is actually an issue with how Steam installed that file on the system. Read more on this in the Linux Caveats tutorial.

NOTE: For OSX, the libsteam_api.dylib must be in the Content/MacOS/ folder in your application zip or the game will crash. Read more on this in the Mac Exporting tutorial. Those of you using the pre-compiled OSX template from the GodotSteam release section can ignore this as libsteam_api.dylib is already included.