JameeKim / godot-play-game-services

A Godot 4.2 plugin for integration with Google Play Game Services

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Godot Play Game Services

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


Plugin Header

Android version and API level 33 Godot version 4.2 Google Play Game Services version 19.0.0


Table of contents

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, generating the sources, and making some configuration steps. 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
  • Follow the steps on Configuring the plugin
  • 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

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. Please note that 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

Documentation

Kotlin Code

You can find the technical documentation of the kotlin code in the GitHub Pages of this repository. It's generated with Dokka from the KDocs documentation on the source code.

GDScript Code

The GDScript code is documented in the code itself, so you can access it via the Godot Editor. I'm working to publish it in a static webpage too.

Google

Google provides lots of documentation for integrating with Google Play Game Services, creating an app, etc.

The main page for Game Services is this one. There you can find the Guides section and the Reference section, which contains the technical documentation of their API.

When it comes to Google Play Console, the main page is here, but the Google Play Game Services documentation also provides a good setup guide here.

Contact me

If you have any questions or want to propose changes, features, or found a bug, please feel free to open an issue.

I try to answer in the same day and provide all help I can, even if it's out of scope of the plugin, like guiding over some Google configurations, etc.

Please, be kind and respectful when creating issues.

About

A Godot 4.2 plugin for integration with Google Play Game Services

License:MIT License


Languages

Language:Kotlin 78.2%Language:GDScript 21.8%