Game ideas & features

Your next feature

Player Profile

Display the player's avatar, frame and badges.

SDK developRequires a player session
Godot
Illustration of Player Profile
Your visible result

The selected avatar, frame or badge appears in the profile after loading it again.

Use player profiles2:37
Open video separately ↗

Prepare the same project

  1. Choose the same project in the dashboard as in your game configuration.

    Player Profile →
  2. Create or reuse these test entries in the dashboard form. These are example values, not current project data.

    Cosmetic ID
    avatar.zombie_07 (avatar), badge.supporter (badge)
    Locked (only players with an unlock can pick it)
    false

    Each entry is an ID that your game maps to its own art. Free entries can be picked by every player, locked entries only by players who own an unlock (from a gift code with grants or granted in the user management).

  3. Save, reload and verify the entries before running the example. Preserve unrelated definitions.

Build this feature

You can preview the guide. Running it requires an active project key. Prepare project

SDK installed, project configuration imported and player signed in.

This SDK example uses develop. Check whether the required APIs exist in your installed SDK.

Save the GDScript, attach it to a node in the main scene and run it. Check Output.

GDScript
res://scripts/player_profile.gd
horizOn callSetup
1# Attach this script to a node in your main scene.
2extends Node
3​
4​
5func _ready() -> void:
6 # Setup: initialize, connect and sign in a player.
7 var connected = await Horizon.connect_to_server()
8 if not connected:
9 print("Failed to connect to horizOn server")
10 return
11 if not Horizon.auth.isSignedIn():
12 var signed_in: bool
13 if Horizon.auth.hasCachedAnonymousToken():
14 signed_in = await Horizon.auth.restoreAnonymousSession()
15 else:
16 signed_in = await Horizon.auth.signUpAnonymous("StatisticsPlayer")
17 if not signed_in:
18 return
19​
20 # horizOn: read the profile, then change avatar, frame and badges.
21 # Profile, unlocks and the cosmetics catalog of the signed in player
22 var result: Dictionary = await Horizon.playerProfile.getProfile()
23 var profile: Dictionary = result.get("profile", {})
24​
25 # Save avatar, frame and up to three badges (ids from your catalog in the dashboard)
26 var updated: Dictionary = await Horizon.playerProfile.setProfile(
27 "avatar.zombie_07", profile.get("frameId", ""), ["badge.supporter"])
28 if updated.is_empty():
29 print(Horizon.playerProfile.getLastErrorCode())
Open the complete SDK sample ↗

Test your new feature.

The selected avatar, frame or badge appears in the profile after loading it again.

Choose the same project in the dashboard as in your game configuration.

Endpoints
  • GET/player-profile
  • PUT/player-profile
All endpoints in the API reference
Our suggestion for your next step

Give every round a high score.

Save the score after a round and show who's ahead. Keep using your connection and player session.

Tutorial video

Player ProfileGodot3:21
Open video separately ↗