Unreal Configuration
The Toolkit for Steamworks works with the Steamworks SDK and is compatible with all of Unreal's built-in Steam-related plugins. It uses the same configuration features to keep things simple. This means even if you are not using OnlineSubsystemSteam, you will be using its Engine.ini settings to configure and control the Toolkit for Steamworks.
App ID
In development, the OnlineSubsystemSteam SteamDevAppId value is used
To define UE_PROJECT_STEAMSHIPPINGID
we use the game's Target.cs, an example from one of our projects follows.
The following is just an example, you would use your own settings and the name of your constructor would of course be different. The point is to show you a working example in the Target.cs of your app.
Steam Sockets
We leverage the built-in Steam Socket Net Driver which has a dependency on the Online Subsystem Steam plugin. When you enable the Steam Sockets plugin (not just Online Subsystem Steam) the related dependencies should also be enabled and will require a restart of the engine.
Once enabled, the following ini settings become relevant ... learn more in Unreal's official documentation
Game Instance
With the plugin installed, you will want to set up your Game Instance.
The plugin ships with a ready-to-use Steam Game Instance named BP_SteamGameInstance
You can use this as is, or use it as a learning tool to create your own Game Instance derived from our SteamGameInstance parent class, or use it as is.
Global Events
Steamworks is largely a multi-process and thus asynchronous toolkit where you will need to listen to events to know when a request has been serviced. In many, if not most, cases, we provide a "Callback" parameter to methods where you can create an event that will be invoked for that specific method call.
In some cases, however, you may wish to bind to the global event
To help you do this, we defined all of the global events as delegates on the Steam Game Instance and created a simple Get Steam Game Instance method that will fetch the current instance for you. You can then browse and bind to any events you like, be sure to unbind before the object in question leaves scope, as these are global events that remain in scope themselves for the life of your game.
Callbacks
As you should know, Steamworks SDK enables your game to ask Steam (the authenticated client on the user's machine) to do stuff for your game. This means it is largely a multi-process and asynchronous thing.
Valve classically handles this using Callback and CallResult delegates. This is translated in Unreal as "Global" events and Function callbacks.
Global Events
You can bind to global events via the Steam Game Instance ... we provide a simple Get Steam Game Instance node to make this easy to "get".
You can then browse and bind to any events you like, be sure to unbind before the object in question leaves scope, as these are global events that remain in scope themselves for the life of your game.
Function Callbacks
These take the place of Valve's "CallResult" delegate and are scoped to a specific method call. For these, you will see there is a delegate parameter on the function call where you can create an event that will be invoked when the request is complete.
Steam Developer
Become a Steam Developer and get your own App ID.
Valve does provide a test app ID you can use as a matter of demonstration, and our Steam Game Instance will default to its App ID (480); however, you will want to register for your own App ID as soon as possible.
Builds
If you are building a Dedicated Server, you will need to ensure you have the following definitions declared. There are several ways you can go about this, such as Target.cs, Please see Unreal Engine's documentation for details.
You can use your game's Target.cs to set these values using the GlobalDefinitions list.
UE_PROJECT_STEAMPRODUCTNAME
STEAMPRODUCTNAME
Typically your App ID Used by Steam Game Server Matchmaking features.
UE_PROJECT_STEAMGAMEDIR
STEAMGAMEDIR
This should be the folder where your game resides and is usually just the game name sans spaces and symbols. note it's just the folder name, not the path it's self
UE_PROJECT_STEAMGAMEDESC
STEAMGAMEDESC
Usually the human name of your game
UE_PROJECT_STEAMSHIPPINGID
This is 100% Unreal Engine and is used in both client and server when not in the editor or a Dev build. It is simply your App ID and is used during initialization.
steam_appid.txt
In short, this should only be needed when you're running a packaged project from outside of Steam or if your running a Dedicated server build.
Last updated