GodotSteam: setting up Steamworks in a Godot 4 game
2 min read
By Eduardo Orellana ·
GodotSteam is the open-source Steamworks integration for Godot: a GDExtension plugin or a pre-compiled editor that gives GDScript a Steam singleton. Set your App ID (480, Valve's Spacewar, while testing) in Project Settings under Steam > Initialization, call Steam.steamInitEx() from an autoload's _ready(), and call Steam.run_callbacks() every frame from a node that never pauses. A status of 0 means Steam is ready; most failures are a missing steam_api library or an unset App ID. The current release is GodotSteam 4.23 on Steamworks SDK 1.65.
Godot has no Steam support built in; GodotSteam is how everyone adds it
Godot ships with no Steamworks integration, by design: the engine stays platform-neutral. GodotSteam fills the gap and has since the days of Godot 2. Achievements, stats, lobbies, the overlay, cloud files and Steam networking all come through it, as one Steam singleton your GDScript calls.
Which flavour
- GDExtension plugin: added to a normal Godot 4 project, from the Asset Library or GodotSteam's releases. The easiest start.
- Pre-compiled editor and templates: Godot with GodotSteam compiled in as a module.
- Server: for dedicated or master servers.
The current release is GodotSteam 4.23 for Godot 4, on Steamworks SDK 1.65.
Initialize Steam
- App ID. Set it in Project Settings under Steam > Initialization (GodotSteam 4.14 and later). Use 480, Valve's Spacewar sample, until you have your own. Avoid steam_appid.txt, and never ship it.
- An autoload (for example steamworks.gd) that calls Steam.steamInitEx() in _ready(). It returns a dictionary with status and verbal: 0 means initialized, 1 another failure, 2 cannot connect (Steam not running), 3 Steam client out of date.
- Callbacks every frame: Steam.run_callbacks() in _process(), in a node that always processes. In a pausable node, callbacks fail silently.
Steam itself must be running and signed in while you test.
extends Node
func _ready() -> void:
var result: Dictionary = Steam.steamInitEx()
if result['status'] > Steam.STEAM_API_INIT_RESULT_OK:
push_error('Steam did not start: %s' % result['verbal'])
func _process(_delta: float) -> void:
Steam.run_callbacks()What you can build on it
Achievements and stats, which GodotSteam 4.14 and later sync at boot on their own; lobbies and invites through the overlay; Steam networking through SteamMultiplayerPeer; cloud saves; rich presence. Our guides cover achievements, lobbies and multiplayer and cloud saves.
Where Flockbay fits
Flockbay builds games on the official Godot engine, and when a game should play online on Steam, its AI writes GodotSteam into it as an ordinary autoload you own: the lobby, the overlay invite, Join Game and SteamMultiplayerPeer. Flockbay's Windows export ships GodotSteam's libraries beside the .exe. Building is free.
Questions
- Is GodotSteam free?
- Yes. It is an open-source project; Steamworks itself needs a Steamworks account and the $100 Steam Direct fee per game.
- What App ID do I use to test GodotSteam?
- 480, Valve's Spacewar sample, until your game has its own App ID.
Keep reading
- The indie game publishing guide
- Steam lobbies in Godot
- Steam achievements in Godot
- Port a Godot game to Steam
- How to put a Unity game on Steam
- Multiplayer: test rooms and Steam
- Steamworks.NET or Facepunch.Steamworks for Unity?
- How to put a Construct 3 game on Steam
- Steam achievements in Unity
Flockbay builds Godot games for free, and writes GodotSteam into them for online play on Steam.
Download Flockbay free