Docs / Steamworks compatibility
Steamworks compatibility
Partly liveHow games built with the Steamworks SDK run on 0x unmodified through sg-steamclient, a drop-in steamclient library backed by the 0x platform.
Games built with the Steamworks SDK can run on 0x without changing the game or its
libsteam_api. 0x provides sg-steamclient, a drop-in replacement for the
steamclient library that libsteam_api loads at start-up. Every Steamworks call the game
makes lands in sg-steamclient, which serves it from the 0x platform (accounts, ownership,
stats, achievements, leaderboards, cloud saves, Workshop, inventory, lobbies, game servers,
networking) at https://api.0x.limo.
Not in the 0x app download yet
sg-steamclient is built and tested (see what is tested), but the 0x app download (version 0.1.0, Linux and Windows) does not ship it yet, and the app does not yet start Steamworks games for you. This section documents how the layer works and what it supports, so you can plan a release. The step-by-step guide shows the process layout the app will set up.
#How it works
A Steamworks game never talks to a Steam service itself. Its copy of libsteam_api:
- loads the client library from a fixed place:
~/.steam/sdk64/steamclient.soon Linux (a dedicated server first tries asteamclient.sonext to its binary), or thesteamclient64.dllthe Steam client registers on Windows; - asks it for
ISteamClient(CreateInterface("SteamClient0NN")); - fetches every other interface through
ISteamClient::GetISteamGenericInterface; - pumps callbacks through three plain C exports.
sg-steamclient implements that boundary. It exports the same entry points
(CreateInterface, Steam_BGetCallback, Steam_FreeLastCallback, Steam_GetAPICallResult,
Steam_IsKnownInterface, Steam_NotifyMissingInterface, Steam_ReleaseThreadLocalMemory)
and constructs 249 interface versions: the 31 current ones and 218 historical ones, so
games built against SDK generations from 0.99 up to the current release find the exact
versions they were compiled against. See the interface list.
#What happens at SteamAPI_Init
| Step | What sg-steamclient does |
|---|---|
| Version check | libsteam_api asks Steam_IsKnownInterface for every interface version the game was compiled against. Each of the 249 versions answers yes; an unknown one fails init cleanly with k_ESteamAPIInitResult_VersionMismatch, as on Steam. |
| App ID | The client must know the app ID before the game says it. sg-steamclient reads SteamAppId from the environment, then steam_appid.txt in the working directory, the same sources a developer uses. libsteam_api then reads it back with ISteamUtils::GetAppID(). |
| Sign-in | ConnectToGlobalUser loads the session: the signed-in 0x account (/v1/me), the app's schema and your ownership of it, your stats, and a cloud sync-down. The token comes from the 0x app (see environment); the game never handles it. |
| Stats ready | UserStatsReceived_t is posted after the session loads, as current Steam clients do. |
| Callbacks | Callbacks and call results are queued and delivered from SteamAPI_RunCallbacks, converted to the struct layout of the SDK the game was built with. |
| Shutdown | Writes (stats, cloud saves) go through one ordered worker thread; shutdown waits up to 10 seconds so they are flushed before the process exits. |
Your 0x account appears to the game as a 64-bit SteamID, and your display name as the persona name.
#App IDs
Each game on 0x has a numeric app ID. sg-steamclient uses it for ownership, stats,
cloud saves, lobbies and everything else that is per game. The process that starts your game
sets SteamAppId to your 0x app ID. The environment variable wins over a steam_appid.txt you
ship for local testing. SteamAPI_RestartAppIfNecessary returns false when SteamAppId
or steam_appid.txt is present, so the game does not try to relaunch itself through a Steam
client.
#Platforms
| Platform | Library | Status |
|---|---|---|
| Linux x86_64 | steamclient.so (64-bit) | Built and tested with real games |
| Windows games under Proton or Wine | the Linux steamclient.so, reached through Proton's bridge | Tested with real games |
| Windows x86_64, native | steamclient64.dll from the same source: MSVC vtable order, Windows struct packing and callback layouts | Tested with one real game; newer |
32-bit Windows (steamclient.dll), macOS | — | Not built |
#In this section
- Point a game at 0x: the process layout, environment, game servers.
- Supported interfaces: every interface and version, and which are inert by design.
- Features: what each Steamworks feature does on 0x.
- Limitations: what is not covered, and the test evidence.
