Table of Contents

, , , ,

Start Page » Game Development with the Drag[en]gine » Service Listing » Microsoft GDK

Microsoft GDK

The ServiceMsgdk Service Module provides access to the Microsoft GDK. With the GDK XBoxLive functionality can be used.

The Microsoft GDK is NDA covered. To be allowed to use it the developer has first to apply for the respective developer program and sign the NDA. Once the developer is accepted and has signed the NDA he gets access to the parameters required for use during service initialization.

The service has the unique identifier MicrosoftGdk.

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

Initialization

Automatic

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

Tag Value
msgdk.pathGameConfig Path to the MicrosoftGame.config file inside the .delga file.

The values for all these tags can only be obtained after the developer has been accepted into the developer program and has signed the NDA.

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>
 
   <!-- Microsoft GDK -->
   <string path='msgdk.pathGameConfig'>/MicrosoftGame.config</string>
</parameterTree>

If the provided initialization data is incorrect creating the ServiceMsgdk 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 MSGDK service has been created using:

   if getBaseGameServices().getMsgdk() != null
      // ServiceMsgdk is ready to be used
   end

Manual

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

ServiceUser

The service module provides user management support. Supported is logging in, logging, retrieving user information and retrieving user resources.

Login

The user can log in using different methods. The loginUser() call accepts a ServiceUserCredentials instance. Depending on the set parameters one of the possible login methods is used.

Default User

If the credentials parameter is null the GDK tries to use the currently logged in XBoxLive account.

It is highly recommended to use <AdvancedUserModel>true</AdvancedUserModel> in the MicrosoftGame.config file. If SimpleUserMode is used the game will be hard-aborted with no explanation why if the there is no XBoxLive account currently logged in on the system which is a very frustrating user experience.

Optionally you can create an instance of ServiceUserCredentials and manually set the defaultUser member to true.

Login Dialog

If the credentials instance is empty (no value assigned after creating it) the GDK shows a login dialog overlay allowing the user to select which XBoxLive account to log in to. Once successful the login will be completed.

Authentication Provider

The service module provides Authentication Provider support to other modules. The provider has the unique identifier epic. This feature allows other service modules to link accounts to the logged in XBoxLive account. 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 XBoxLive 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 not use the same function for achievements since this is not supported by the GDK. Use getStatsAndAchievements() to retrieve the current stats and achievements state.