Skip to content

Google Play Games (Desktop)

MGSX edited this page May 10, 2018 · 14 revisions

Please see Google Play Games wiki article for an overview. This article describes the differences to use GPGS in your desktop project.

Overview

Google Play Games is not only available for Android, it is possible to use it with a REST API. While GPGS is mainly used on Android, its usage outside the mobile world is not widespread. We are proud that gdx-gamesvcs provides a desktop implementation for using GPGS in your desktop clients, so you can give your user platform-independant cloud save, achievements and leaderboards experience. Not provided by this implementation, it is even possible to provide platform-independant multiplayer games.

More information about security consideration and how authentication works can be found in official Google documentation.

Configure your Play Games project

Configuration according to Android article is presumed.

For desktop-gpgs, it is needed to add a linked app of type "Other platform" in GPGS developer console. Google generates an oauth id and a secret client key, downloadable as a json file.

Changing credentials :

  • If for some reasons you want to change credentials (id, application type, etc.), you need to remove the old token file which is by default located at %USER_HOME/.store/%APP_NAME/StoredCredential.
  • If not you will get an error during first connection : Token has been expired or revoked and you will be unable to connect.
  • If your game is already published, you will need to change your %APP_NAME to avoid conflicts with player's old token file.

Usage in your libGDX project

Add the dependency to your Desktop project:

compile "de.golfgl.gdxgamesvcs:gdx-gamesvcs-desktop-gpgs:$gamesvcsVersion"

Please note that the implementation is only available with release 0.2.0 and above.

Place the secret client json file in your assets folder.

Change your DesktopLauncher to use GpgsClient:

    new LwjglApplication(new GdxGameSvcsApp() {
        @Override
        public void create() {
            gsClient = new GpgsClient().initialize("YourAppName",
                    Gdx.files.internal("gpgs-client_secret.json"));
            super.create();
        }
    }, config);

Set up mapping according to Android GPGS documentation.

Cloud save

If you plan to access your saved game data from other platforms, make sure to read the notes on the corresponding article.

What work is undone?

desktop-gpgs does not support submitting events in current state.