sjc / godot-game-services

Godot native plugins for iOS Game Center and Android Google Play Game Services
MIT License
11 stars 3 forks source link

godot-game-services

Godot native plugins for iOS Game Center and Android Google Play Game Services for Godot v3.5.

This plugin was developed with the intention to provide a single standard interface to game services on mobile, thus simplifying development.

The following features are currently supported:

Support for other features is planned for the future. If there is a particular feature you would like to see, please either open a new issue or comment on one of the existing issues to help us prioritise what we work on:

These plugins are based on the excellent AdMob plugin by Poing Studios.

Instalation

Editor Plugin

Whether you want to use iOS, Android, or both, you will need the Godot editor plugin. Install it in the usual way:

You will now have access to the GameServices singleton from code.

Android

In order to make use of Play Game Services in your mobile app, you must have an Android developer account and you must have setup game services.

Note: The OAuth setup for Release builds requires the SHA1 fingerprint of the Play Store signing certificate. Unless you're working on a legacy app, you'll only have access to the upload certificate, since Google now generates and maintains the release certificate for you. In order to find the correct fingerprint to use to setup Release OAuth, you will need to run an Internal Test Track build via the Play Console and look at the output in Logcat to get the fingerprint of the actual distribution certificate, which you'll then need to put into the Play Games console. But this all comes at the end of development. For now, using the Debug setup is preferred.

To install the Android plugin:

<manifest>
  <application>
    <meta-data android:name="com.google.android.gms.games.APP_ID"
               android:value="@string/game_services_project_id"/>
  </application>
</manifest>

Note: It's possible that you will encounter build errors when first trying to build after adding the plugin, especially if you are using other Android plugins. These can be resolved by adding the following to your build.gradle:

android {
    defaultConfig {
        ...
        multiDexEnabled = true
        ...
    }
}

iOS

Configuring the plugins

The "Game Services" tab in the Godot editor allows you to configure settings used between the iOS and Android plugins.

Leaderboard IDs

Play Game Services and Game Center use different IDs to refer to leaderboard. You can assign a common name to leaderboards which you can use to refer to them in code. The correct ID for the current platform will be passed to the native API by GameServices.

Note: On iOS, the leaderboard ID should not include the grp. prefix, if one is shown in App Store Connect.

GameServices API

To learn how to use the GameServices singleton in your app, please see the docs.

Building the plugins

If you wish to build the native plugins yourself, you will need to checkout this repo.

Android

In the android-play-game-services folder:

The gameservices/build/outputs/aar folder will contain the build debug and release .aar files. These should be moved into the android/plugins directory of the Godot project, along with the gameservices.gdap file.

iOS

In the ios-gamecenter folder:

The bin/release/gameservices folder will contain the generated plugin files and should be copied into the ios/plugins folder of the Godot project.