Godot Plugin

Download the Godot plugin from itch.io: https://hyplay.itch.io/hyplay-godot-plugin

To get started with Godot, you'll need an App ID. If you don't already have one, check out the Quickstart Guide!

Once you've got your app id, you must initialise the Hyplay plugin:

func _ready() -> void:
  Hyplay.initialise("your_app_id")

Once the plugin is initialised, you then use the Hyplay class to log in, sign in a guest account, get leaderboard scores, or post leaderboard scores.

Auth

You can sign the player in using either

Hyplay.real_login()

or

await Hyplay.guest_login()

Note: Hyplay.real_login() will redirect the page using the oauth flow, and game state will be lost! For best player experience, give them an option to sign in straight away, or continue as a guest.

Once the player is signed in, you can use the following method to get user details:

await Hyplay.get_user_details()
print(Hyplay.user_details.username)

Leaderboards

To get and post scores on a leaderboard, you must first create a leaderboard. You can do this with the API explorer for now, the developer dashboard is still in development. You should note down your newly created leaderboard's ID and leaderboard secret.

Once you have an ID and a secret for your leaderboard, you can post scores to it like so:

await Hyplay.submit_score_leaderboard("leaderboard-id", "leaderboard-secret", score)

And you can retrieve scores like this:

var scores = await Hyplay.get_leaderboard("leaderboard-id")
for item in scores.scores:
  print (item.score)
  print (item.username)