You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Social SDK: Clarify that Game Invites are powered by Rich Presence
Restructure the Game Invites guide to emphasize that invites are not a
standalone feature but are entirely powered by Rich Presence configuration.
Add clear explanations of the prerequisite Rich Presence setup including
party information, join secrets, and/or supported platforms needed to enable
invite functionality.
This was a point of friction I ran into when onboarding with the Social
SDK and creating invites.
Copy file name to clipboardExpand all lines: docs/discord-social-sdk/development-guides/managing-game-invites.mdx
+74-47Lines changed: 74 additions & 47 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,33 +10,39 @@ import SupportCallout from '../partials/callouts/support.mdx';
10
10
11
11
## Overview
12
12
13
-
Game Invites allow users to invite others to join their game session or party. This feature is available on the Discord client and the Social SDK.
13
+
Game Invites allow users to invite others to join their game session or party. This feature is available on the
14
+
Discord client and the Social SDK.
15
+
16
+
Game Invites are not a standalone feature - they are **powered entirely by Rich Presence**. When you configure Rich
17
+
Presence with party information, a join secret, and/or supported platforms, Discord automatically enables invite
18
+
functionality. This guide shows you how to configure Rich Presence to unlock game invites.
14
19
15
20
### Prerequisites
16
21
17
22
Before you begin, make sure you have:
18
23
24
+
- Completed the [Setting Rich Presence](/docs/discord-social-sdk/development-guides/setting-rich-presence) guide
25
+
- Understanding that without an active Rich Presence with party data, invites will not work
19
26
- Set up the Discord Social SDK with our [Getting Started guide](/docs/discord-social-sdk/getting-started)
20
-
- Familiarized yourself with [Setting Rich Presence](/docs/discord-social-sdk/development-guides/setting-rich-presence)
21
-
22
-
:::info
23
-
Let's talk about the naming of some Discord primitives first. Rich Presence, aka "Activity", can be thought of as the "current activity of a user" and is represented by the [`Activity`] class in the SDK and [in our gateway events](/docs/events/gateway-events#activity-object). This is not to be confused with [Discord Activities](/docs/activities/overview), which are embedded games that can also set and display rich presence.
24
-
:::
25
27
26
28
---
27
29
28
-
## Configuring Game Invites
30
+
## Configuring Rich Presence to Enable Game Invites
29
31
30
-
Game invites, or activity invites, are powered by rich presence.
32
+
Game invites, or activity invites, are **powered by rich presence**.
31
33
32
34
We covered the basics of [Setting Rich Presence](/docs/discord-social-sdk/development-guides/setting-rich-presence) in a previous guide but let's go over the key points again.
33
35
36
+
:::info
37
+
Let's talk about the naming of some Discord primitives first. Rich Presence, aka "Activity", can be thought of as the "current activity of a user" and is represented by the [`Activity`] class in the SDK and [in our gateway events](/docs/events/gateway-events#activity-object). This is not to be confused with [Discord Activities](/docs/activities/overview), which are embedded games that can also set and display rich presence.
38
+
:::
39
+
34
40
### Setting Up Rich Presence
35
41
36
-
Below is an example of setting up rich presence in your game.
42
+
Below is an example of setting up rich presence in your game to be used with game invites.
37
43
38
44
```cpp
39
-
// Create discordpp::Activity
45
+
// Create discordpp::Activity - This Rich Presence Activity is your invite configuration
// Note: Invites are NOT yet enabled - we need party info and join secret
51
58
} else {
52
59
std::cerr<<"❌ Rich Presence update failed";
53
60
}
@@ -63,17 +70,18 @@ You must set up your rich presence [`Activity`] with party information and a joi
63
70
```cpp
64
71
// rest of the code
65
72
66
-
// Set the party information
67
73
// Create discordpp::ActivityParty
68
74
discordpp::ActivityParty party;
69
75
party.SetId("party1234");
70
76
// current party size
71
-
party.SetCurrentSize(1);
77
+
party.SetCurrentSize(1);
72
78
// max party size
73
-
party.SetMaxSize(5);
79
+
party.SetMaxSize(5);
80
+
// Set the party information in the Activity, to inform the invite about the party size and how many players can join
74
81
activity.SetParty(party);
75
82
76
83
// Update Rich Presence
84
+
// Still not enough for invites - we need the join secret!
77
85
```
78
86
79
87
If we run our game, the Discord client will show that we are "In Competitive Match" on "Valhalla" with more information about the party.
@@ -82,7 +90,7 @@ We're almost there! Let's add the join secret next so we can send and receive ga
82
90
83
91
### Adding Join Secret & Supported Platforms
84
92
85
-
The last step is to add a join secret to your rich presence activity.
93
+
The last step is to add a join secret to your rich presence activity.
86
94
87
95
The `Join Secret` is a generic secret that you can use to [join a Discord lobby](/docs/discord-social-sdk/development-guides/managing-lobbies), a game session, or something else. The game invite system is a way for players to share this secret value with other players - how you use it is up to you.
88
96
@@ -93,20 +101,21 @@ You will also need to set the supported platforms for joining the game so that t
93
101
94
102
// Create ActivitySecrets
95
103
discordpp::ActivitySecrets secrets;
96
-
secrets.SetJoin("joinsecret1234");
104
+
secrets.SetJoin("joinsecret1234");// Rich Presence secret will be in the invite payload
97
105
activity.SetSecrets(secrets);
98
106
99
107
// Set supported platforms that can join the game
100
108
// See discordpp::ActivityGamePlatforms for available platforms
// ✅ Rich Presence updated = Game invites now available!
140
148
} else {
141
149
std::cerr<<"❌ Rich Presence update failed";
150
+
// ❌ No Rich Presence = No invites possible
142
151
}
143
152
});
144
153
```
@@ -154,11 +163,11 @@ Before we send a game invite, let's make sure that the Discord client knows abou
154
163
When a user accepts a game invite for your game within Discord, the Discord client needs to know how to launch the game for that user. We have two ways to do this:
155
164
156
165
- Register a launch command for your game
157
-
- Register a Steam Game ID
166
+
- Register a Steam Game ID
158
167
159
168
For desktop games, you should run one of these commands when the SDK starts up so that if the user tries to join from Discord, the game can be launched for them.
160
169
161
-
### Registering a Launch Command
170
+
### Registering a Launch Command
162
171
163
172
[`Client::RegisterLaunchCommand`] allows you to register a command that Discord will run to launch your game.
164
173
@@ -191,11 +200,19 @@ Users can send game invites directly through the Discord client. This feature is
191
200
192
201
If a player has the required party, join secret, and supported platforms set in their rich presence, your game can send game invites programmatically through the SDK using [`Client::SendActivityInvite`].
193
202
203
+
:::warn
204
+
[`Client::SendActivityInvite`] only works if Rich Presence is active with proper configuration
Use [`Client::SetActivityJoinCallback`] to monitor for a user accepting a game invite, either in-game or in Discord. Use the join secret to connect the players in your game.
240
258
241
259
```cpp
260
+
// This fires when a user clicks "Join" on someone's Rich Presence
0 commit comments