Godot Play Game Services

Godot 4.2+ plugin for integration of the latest version of Google Play Game Services SDK.


Forewords

The whole project started as a collaboration with Rafa Laguna, and this plugin is the updated version of the old one for Godot 3.5+.

With Godot 4.2+, the way android plugins work has changed, so I had to update this plugin to match the new requirements. Now there’s only one editor plugin (this one), instead of having two separate plugins like before, one android plugin and one godot plugin.

How to use the plugin

Using the plugin requires downloading the repository, and generating the sources. I’m working to provide a more user-friendly way of using the plugin, but for now I’m afraid this is the only way of using it.

Downloading the plugin

To download the plugin you can use git to clone it, or just download the repository in a zip file from Github.

Screenshot of Github's menu to download the repository as a zip file

Building the plugin

In a terminal window, navigate to the project’s root directory and run the following command:

./gradlew assemble

The output files can be found in plugin/demo/addons. The plugin itself, that you can copy to your project to use, is in the plugin/demo/addons/GodotPlayGameServices, just copy the whole GodotPlayGameServices folder into the addons folder of your Godot project and activate the plugin in Project -> Project Settings... -> Plugins

Testing the plugin

You can also use the included Godot demo project to test the built Android plugin.

  • Open the demo in Godot (4.2 or higher)
  • Navigate to Project -> Project Settings... -> Plugins, and ensure the plugin is enabled
  • Install the Godot Android build template by clicking on Project -> Install Android Build Template...
  • Connect an Android device to your machine and run the demo on it
  • Follow the steps on Configuring the plugin

Configuring the plugin

Before configuring the plugin, you have to create a Google developer account, which involves a one time payment to google, and then you must create a game. The explanation on how to do all of these is out of the scope of this documentation. Please refer to Google for those steps.

Once that’s done, you will need to create some achievements and leaderboards in your game, which will generate some IDs. You will need those IDs later in your game, but for the plugin, the one that’s important is the Game ID, which can be found in your game configuration, in the Google Dev Console:

Screenshot of the Game ID inside the Google Dev Console

In order to make the configuration easier, the plugin adds a new dock to the bottom panel of your Godot editor, where you can add the Game ID. Once you click on the submit button, the configuration will be saved and loaded every time you reopen the editor.

Screenshot of the new dock in the bottom panel of the Godot Editor

⚠️ Beware of not changing the Game Id and submitting by mistake, since that will break the integration with Google Game Services.

Export configuration

To be able to use the plugin, you need to use a custom gradle build. The steps to do so, are explained with detail in the Godot Documentation.

An additional configuration has to be made in order to connect with Google Game Services. In the Google App, you have to configure an Android OAuth client. Google describes the steps here, but at some point you have to introduce the package name of your game, as well as the SHA-1 of your signing key. Both things need to be introduced also in the Godot Export configuration for Android:

Screenshot of the relevant section inside the export configuration for Android in the Godot editor

Technical Documentation

You can find the technical documentation of the kotlin code in the Github Pages of the repository.

You can find Google’s technical documentation of the SDK here.

GitHub

View Github