{{tag>service epic eos dragonscript}} [[:start|Start Page]] >> [[:gamedev|Game Development with the Drag[en]gine]] >> [[:gamedev:servicemodules#service_listing|Service Listing]] >> **EPIC EOS SDK** ====== EPIC EOS SDK ====== The ''SteamEos'' Service Module provides access to the EPIC EOS SDK. With this SDK EOS functionality can be used. EPIC requires the developer to read their terms of service and accept them before the SDK can be downloaded. Downloading the SDK is not required to use this service but accepting the terms of service are a requirement. Once accepted the developer gets access to the EOS parameters required for use during service initialization. To comply with this do the following: * Go to the Epic Developer Portal * Click on ''SDK & Release Notes'' * As ''SDK Type'' select anything you want, for example ''C SDK''. What you choose here doesn't matter * Click ''Download'' * Read the terms of service and accept if and only if you agree to them * Cancel the download. You do not need the file at all to use this Service Module The service has the unique identifier ''EOSSDK''. Support for this service is provided in the DragonScript Script Module using the class #@LinkApiDocDEDS2_HTML~classDragengine_1_1Services_1_1ServiceEos,ServiceEos~@#. This service implements the following interfaces: * #@LinkApiDocDEDS2_HTML~interfaceDragengine_1_1Services_1_1User_1_1ServiceUser,ServiceUser~@# * #@LinkApiDocDEDS2_HTML~interfaceDragengine_1_1Services_1_1Stats_1_1ServiceStats,ServiceStats~@# ====== Initialization ====== ===== Automatic ===== The #@LinkApiDocDEDS2_HTML~classDragengine_1_1BaseGameApp,BaseGameApp~@# class automatically creates the ServiceEos service instance if the following values are present in the ''configuration.ptree.xml'' file: ^ Tag ^ Value ^ | eos.productName | Game product name | | eos.productVersion | Game version | | eos.productId | Game product identifier | | eos.clientId | Game client identifier | | eos.clientSecret | Game client secret | The values for all these tags can only be obtained after the developer has accepted the terms of service. An example ''configuration.ptree.xml'' file looks like his: true true My Game 1.0 1234567890abcdef12345678 1234567890abcdef12345678 1234567890abcdef12345678 If the provided initialization data is incorrect creating the ServiceEos 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 EOSSDK service has been created using: if getBaseGameServices().getEos() != null // ServiceEos is ready to be used end ===== Manual ===== The SteamEos service can be manually created either by using the ''new'' constructor on the #@LinkApiDocDEDS2_HTML~classDragengine_1_1Services_1_1ServiceEos,ServiceEos~@# class using #@LinkApiDocDEDS2_HTML~classDragengine_1_1Services_1_1ServiceEos_1_1InitParameters,ServiceEos.InitParameters~@# setup with the initialization data or by calling ''initEos()'' on #@LinkApiDocDEDS2_HTML~classDragengine_1_1BaseGameApp,BaseGameApp~@#. Using ''initEos'' 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 #@LinkApiDocDEDS2_HTML~classDragengine_1_1Services_1_1User_1_1ServiceUserCredentials,ServiceUserCredentials~@# instance. Depending on the set parameters one of the possible login methods is used. ==== Epic Launcher ==== If the ''credentials'' parameter is ''null'' the game is expected to be launcher by the Epic Launcher. The Epic Launcher appends to the command line the required exchange token. If this method is used the service module retrieves the required credentials from the passed command line arguments. Optionally you can create an instance of #@LinkApiDocDEDS2_HTML~classDragengine_1_1Services_1_1User_1_1ServiceUserCredentials,ServiceUserCredentials~@# and manually set the ''exchangeCode'' member. It is up to you to obtain this token from the Epic Launcher. ==== Auto Login ==== If the ''credentials'' instance is empty (no value assigned after creating it) auto login is used. If during a previous run of the game a successful login has been done and no logout has been done then the user will be automatically logged in. If nothing of this applies or problems are present during login manual login will be done using ''Account Portal''. This will show an overlay managed by EOS SDK prompting the user to log in using a web interface. The user can either login (or create) an Epic Games Account or he can link to another platform account he is already using. Once successful the login will be completed. Future auto login calls will then automatically log in the user without showing the account portal again. ===== 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 Epic Games 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 Epic Games 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.