Table of Contents

, , ,

Start Page » Game Development with the Drag[en]gine » Service Listing » Steam SDK

Steam SDK

The SteamSDK Service Module provides access to the Steam SDK. With this SDK SteamWorks functionality can be used if Steam is running. If Steam is not running creating the service fails.

The service has the unique identifier SteamSDK.

Support for this service is provided in the DragonScript Script Module using the class ServiceSteam. This service implements the following interfaces:

Initialization

Automatic

The BaseGameApp class automatically creates the SteamSDK service instance if the following values are present in the configuration.ptree.xml file:

Tag Value
steam.appid Steam AppId as shown in the SteamWorks game page

An example configuration.ptree.xml file looks like his:

<?xml version='1.0' encoding='UTF-8'?>
<parameterTree>
   <boolean path='defaultEnableGI'>true</boolean>
   <boolean path='defaultEnableAuralization'>true</boolean>
 
   <!-- Steam SDK -->
   <string path='steam.appid'>12345678</string>
</parameterTree>

If Steam is not running creating the SteamSDK service fails. This does not fail starting the application. Wait until all the services have finished initializing:

func void initGame()
   // super call starts automatic initialize services
   super.initGame()
 
   // add listener called once all services have finished initialize, no matter if successfull or not
   getBaseGameServices().setActionInitialized(BlockActionListener.new(block ActionEvent event
       // services have initialized
       launchApplication()
   end))
 
   // you can now do other things in the mean time like showing startup logos or videos
end   

You can then check first if the SteamSDK service has been created using:

   if getBaseGameServices().getSteam() != null
      // ServiceSteam is ready to be used
   end

Manual

The SteamSDK service can be manually created either by using the new constructor on the ServiceSteam class using ServiceSteam.InitParameters setup with the initialization data or by calling initSteam() on BaseGameApp. Using initSteam is preferred if manual creation is required.

ServiceUser

The service module provides user management support. Supported is only retrieving user information and user resources.

Login

The user can not be logged in or out since a Steam user is always logged in as soon as Steam is running.

Authentication Provider

The service module provides also Authentication Provider support to other modules. The provider has the unique identifier steam. This feature allows other service modules to link accounts to the logged in Steam user. For this to work you have to call getAuthToken() to asynchronously retrieve an authentication token. Once received in the listener this token can be used on other service modules supporting linking with Steam user accounts.

ServiceStats

The service module provides achievement and statistics support. Use setStatsAndAchievements() to set the value of individual statistics. Once the requirements are fulfilled server side the respective achievements will be unlocked. You can also use the same function to manually unlock achievements. Use getStatsAndAchievements() to retrieve the current stats and achievements state.