Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
69 changes: 63 additions & 6 deletions docs/godot/identifying.mdx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
sidebar_position: 2
description: The Talo Godot plugin allows you to identify multiple aliases, authenticate and sync your players with Steamworks and Google Play.
description: The Talo Godot plugin allows you to identify multiple aliases, authenticate and sync your players with Steamworks, Google Play and Apple Game Center.
---

import { ScopeBadges } from '@site/src/components/ScopeBadges'
import { ScopeBadges } from "@site/src/components/ScopeBadges";

# Identifying a player

Expand All @@ -16,7 +16,7 @@ You should identify a player after they have authenticated and before you attemp

## Identifying

<ScopeBadges scope='players' read write />
<ScopeBadges scope="players" read write />

You can identify a player using `Talo.players.identify()`. The code sample below shows you how you could identify a player using a UI element (this example is also available in the Playground scene):

Expand Down Expand Up @@ -88,7 +88,7 @@ Once all the relevant data has been cleared, the `Talo.players.identity_cleared`

## Merging players

<ScopeBadges scope='players' read write />
<ScopeBadges scope="players" read write />

Sometimes you might start tracking a player's actions before you know their true identity. For example, you could be tracking events with an "anonymous" identifier and then later on the same player chooses their username before submitting a leaderboard entry. Since both of these players need to be identified, two players will be created.

Expand All @@ -97,8 +97,8 @@ You can merge players using `Talo.players.merge()` by providing the IDs of both
:::caution
There are a few limitations to merging players:

- **Player 2** cannot have a Talo Player Authentication, Steam or Google Play Games alias.
- If **Player 1** has a Talo Player Authentication, Steam or Google Play Games alias, the merge must be initiated while identified as **Player 1** (i.e. `Talo.current_alias` must belong to Player 1). In this case, make sure your last `Talo.players.identify()` call before merging uses Player 1's alias.
- **Player 2** cannot have a Talo Player Authentication, Steam, Google Play Games or Apple Game Center alias.
- If **Player 1** has a Talo Player Authentication, Steam, Google Play Games or Apple Game Center alias, the merge must be initiated while identified as **Player 1** (i.e. `Talo.current_alias` must belong to Player 1). In this case, make sure your last `Talo.players.identify()` call before merging uses Player 1's alias.
- Both players cannot have overlapping alias services. For example, if both players have an alias with the service "username", the merging process will fail.
:::

Expand Down Expand Up @@ -208,6 +208,63 @@ After successfully authenticating the player, these [props](/docs/godot/player-p

These props will be updated each time the player is identified using `Talo.players.identify_google_play_games()`.

## Apple Game Center integration

:::tip
You can enable this integration on the [integrations page](https://dashboard.trytalo.com/integrations).
:::

If you have the Apple Game Center integration enabled, Talo can identify a player using Apple's identity verification signature. You can do this via the `Talo.players.identify_game_center` function.

:::caution
The Game Center plugin singleton is only available on iOS and macOS. It will not exist when running from the Godot editor. Make sure to check for its availability before calling any Game Center methods.
:::

You'll need to fetch the local player's identity verification signature and pass the resulting values to Talo. Here's an example using the [GodotApplePlugins](https://github.com/migueldeicaza/GodotApplePlugins):

```gdscript
extends Node

# replace with your own bundle identifier
const bundle_id := "com.example.game"

var game_center: GameCenterManager

func _ready() -> void:
game_center = GameCenterManager.new()

game_center.authentication_error.connect(
func (err: String):
push_error("Game Center auth failed: %s" % err)
)

game_center.authentication_result.connect(
func (success: bool):
if success:
_handle_auth_success()
)

game_center.authenticate()

func _handle_auth_success() -> void:
var local_player := game_center.local_player

local_player.fetch_items_for_identity_verification_signature(
func (res: Dictionary, err: Variant):
if err:
push_error(err)
else:
await Talo.players.identify_game_center(
res.url,
Marshalls.raw_to_base64(res.data),
Marshalls.raw_to_base64(res.salt),
res.timestamp,
local_player.team_player_id,
bundle_id
)
)
```

## Offline player cache

If the `cache_player_on_identify` setting is enabled (default `true`), Talo will store player data locally. If a player tries to identify while offline, Talo will try and use local data if it exists.
Expand Down
22 changes: 22 additions & 0 deletions docs/integrations/apple-game-center.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
sidebar_position: 3
description: Use Talo's native Apple Game Center integration to automatically identify players signed in to Game Center.
---

# Apple Game Center

Using your app's Bundle ID, you can automatically identify players signed in to Apple Game Center.

You can enable this integration on the [integrations page](https://dashboard.trytalo.com/integrations).

![The Talo integrations page showing the Apple Game Center settings](/img/apg-integration.png)

<hr/>

## Authentication

To get started, enter your app's Bundle ID into the dashboard. Talo will use this to verify the identity verification signature provided by Game Center.

To identify a player, fetch the local player's identity verification signature from Game Center and pass the values to Talo. Talo will cryptographically verify the signature against Apple's public key and automatically identify the player without them needing to create an account.

More info is available in the [Godot plugin docs](/docs/godot/identifying#apple-game-center-integration) and [Unity package docs](/docs/unity/identifying#apple-game-center-integration).
Loading