This how-to covers compiling the GodotSteam server code; used primarily for dedicated servers. It is still under construction, has not been thoroughly tested, and should not be used for production games. That being said, it has lots of functionality to tinker with. If you find it is stable and functional, you can try using it in the wild.
- Download the server branch.
- Download the Steamworks SDK.
- Download the Godot Engine source; preferably using 3.0 or higher.
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_server folder from it into the godot/modules/ folder.
Alternate Preparation Option
- Downloading pre-compiled versions of the GodotSteam editor and template.
- Download the Steamworks SDK.
Once you have the pre-compiles and Steamworks SDK, skip ahead to Step 5 in this tutorial.
Unzip the Steamworks SDK and extract the following folders into the godot/modules/godotsteam_server/sdk/ folder:
The repo's directory contents should now look like this:
godot/modules/godotsteam_server/sdk/public/* godot/modules/godotsteam_server/sdk/redistributable_bin/* godot/modules/godotsteam_server/SCsub godot/modules/godotsteam_server/config.py godot/modules/godotsteam_server/godotsteam_server.cpp godot/modules/godotsteam_server/godotsteam_server.h godot/modules/godotsteam_server/register_types.cpp godot/modules/godotsteam_server/register_types.h
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 )
REMEMBER: You must also compile the templates for your target operating system(s). Typically by adding
target=release tools=no use_lto=yes to your compiling command.
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.
When compiling the engine is finished, copy the shared library (steam_api), for your OS, from godot/modules/godotsteam_server/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
godot/bin/libsteam_api.so godot/bin/steam_appid.txt godot/bin/godot.linux.tools.64
godot/bin/libsteam_api.dylib godot/bin/steam_appid.txt godot/bin/godot.osx.tools.64
godot/bin/steam_api.dll godot/bin/steam_appid.txt godot/bin/godot.windows.tools.32.exe
godot/bin/steam_api64.dll godot/bin/steam_appid.txt godot/bin/godot.windows.tools.64.exe
Remember, every function starts with the SteamServer class; e.g. SteamServer.run_callbacks() or SteamServer.getUserID(). All of the available functions can be found in the editor in the Search section under SteamServer. Additionally, you should be able to read the Steamworks API documentation to see what all is available and cross-reference with GodotSteam.
Valve has other master server functionality in the developer's back-end for Steam. Some of this may need set correctly for things to work. I will be creating a tutorial to cover all that in the near future.
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.