Go bindings for the Steamworks SDK implemented with purego, allowing you to call the Steamworks C API from Go without CGO.
These bindings are designed for game developers who need direct, low-overhead access to Steam services such as achievements, leaderboards, multiplayer matchmaking, and inventory—while staying within pure Go toolchains.
- Zero CGO: Built on
puregofor fast builds and simple cross-compilation. - Complete API coverage: Wraps core Steamworks interfaces (e.g.
ISteamApps,ISteamFriends,ISteamGameServer,ISteamInput) with idiomatic Go interfaces and types. - Callback & CallResult support: Dispatches Steam callbacks and async call results using native Go generics and channels.
- Windows and Linux: Works wherever the Steamworks SDK is supported.
- Permissive license: Apache 2.0.
go get github.com/assemblaj/purego-steamworksThis assumes you have the Steamworks SDK downloaded and available on your build machine.
Initialize Steam and call any of the exposed interfaces. Here’s a minimal example:
package main
import (
"fmt"
sw "github.com/assemblaj/purego-steamworks"
)
func main() {
// Ensure Steam is running and restart if necessary
if sw.RestartAppIfNecessary(480) { // 480 = Spacewar test AppID
return
}
if err := sw.Init(); err != nil {
panic(err)
}
defer sw.Shutdown()
name := sw.SteamFriends().GetPersonaName()
fmt.Println("Logged in as:", name)
// Pump callbacks regularly (e.g. each frame in a game loop)
for {
sw.RunCallbacks()
// your game loop …
}
}interfaces.go– Go interfaces mirroring Steamworks APIs (e.g.ISteamFriends,ISteamApps)steam_methods.go– Core Steam initialization, shutdown, and error handlingcallback_dispatch.go– Central dispatch for hundreds of Steam callback typesutils_*.go– Platform-specific helpers (e.g. Windows string conversions)
- The binding uses generated type definitions and flat API constants from
steam_api.json. - Callbacks are dispatched using
dispatchCallbackanddispatchCallResult, mapping the Steamm_iCallbackIDs to strongly typed Go structs. - Debug mode can be enabled with
sw.SetDebugMode(true).
Apache License 2.0 — see LICENSE.