Stats #

The Stats system tracks and updates both public and private player statistics. Learn more in the Stats concept guide.

Overview #

The Stats system allows your game to:

  • Retrieve current player statistics.
  • Update both public and private player statistics.

Before You Start #

Make sure you have:

  • Python project configured with Hiro SDK.
  • Nakama system integrated (guide).

Working with Stats #

Retrieving Stats #

Retrieve all current stats for the player:

1
2
stat_list = await hiro_client.stats_get()
print(stat_list)

Updating Stats #

Update public and private stats for the player:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
request = StatUpdateRequest()
request.public = [
    {
        "name": "public_stat_1",
        "value": 100,
        "operator": StatUpdateOperator.SET
    }
]
request.private = [
    {
        "name": "private_stat_1",
        "value": 100,
        "operator": StatUpdateOperator.SET
    }
]

stat_list = await hiro_client.stats_update(request)
print(stat_list)

Next Steps #