Game ideas & features

Your next feature

Friends

Friends, requests and blocks for the selected project.

SDK developRequires a player session
Godot
Illustration of Friends
Your visible result

After timeout or conflict, refresh and reconcile the intent. Never automatically retry with a new revision.

Video coming later

This step does not have a video yet. The guide and MCP request are ready to use.

Friends

Prepare the same project

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

    Friends →
  2. No additional definition is needed for the first request. An empty result is valid until matching game data exists.

    Use two separate player sessions in the same project. Copy the other player’s exact UUID from User Management.

    Use an exact UUID or canonical H-code. Names and emails are not accepted.

    Inspect here; only the player’s own session can change relationships.

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.

Complete the Quickstart connection with the intended player. Call run_reviewed_action() from an explicit button or scene action. Opening the file alone sends no request.

GDScript
res://scripts/friends.gd
horizOn call
1extends Node
2​
3# Existing configured SDK and authenticated player session required.
4# Invoke run_reviewed_action explicitly after reviewing this example.
5func run_reviewed_action() -> void:
6 if not Horizon.auth.isSignedIn():
7 return
8 var user_id: String = Horizon.auth.getCurrentUser().userId
9 var loaded: Dictionary = await Horizon.friends.getFriends(user_id)
10 if not loaded.success:
11 push_warning(loaded.errorCode)
12 return
13 print(loaded.data.friendCode) # Public identifier, not a credential.
14 for friend in loaded.data.friends:
15 print(friend.display.name, ": ", friend.lastActiveAt) # null means unknown, not offline.
16​
17 # Examples for explicit player actions, never run these as an automatic sequence:
18 # var found = await Horizon.friends.findPlayer(user_id, exact_uuid_or_h_code)
19 # var r = await Horizon.friends.sendRequest(user_id, target_id, reviewed_revision)
20 # var r = await Horizon.friends.acceptRequest(user_id, target_id, reviewed_revision, original_request_id)
21 # var r = await Horizon.friends.declineRequest(user_id, target_id, reviewed_revision, original_request_id)
22 # var r = await Horizon.friends.cancelRequest(user_id, target_id, reviewed_revision, original_request_id)
23 # var r = await Horizon.friends.removeFriend(user_id, target_id, reviewed_revision)
24 # var r = await Horizon.friends.blockPlayer(user_id, target_id, reviewed_revision)
25 # var r = await Horizon.friends.unblockPlayer(user_id, target_id, reviewed_revision)
26 # Success: replace the entire snapshot with r.data. Do not patch one side locally.
27 # Timeout/REVISION_CONFLICT: refresh and reconcile; never silently substitute a new revision.
28 # Keep original incoming requestId for accept/decline, outgoing requestId for cancel.
29 # Inbox notices are hints; only the current snapshot authorizes a request action.
30 # Refresh explicitly on reconnect/metadata invalidation; no hidden polling timer.
Open the complete SDK sample ↗

Test your new feature.

After timeout or conflict, refresh and reconcile the intent. Never automatically retry with a new revision.

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

Endpoints
  • GET/friends
  • GET/friends/find
  • POST/friends/request
  • POST/friends/accept
  • POST/friends/decline
  • POST/friends/cancel
  • POST/friends/remove
  • POST/friends/block
  • POST/friends/unblock
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.