The GOG GALAXY SDK allows you to download the list of your friends and get detailed information about them.
After the user is logged in, the GOG GALAXY SDK automatically requests the friends list using the
IFriends::RequestFriendList() method, and then retrieves user information for each member on the list using the
IFriends::RequestUserInformation() method, so there is no need to request it explicitly with the steps outlined below. Moreover, the SDK receives broker notifications about any changes (addition, removal) to the friends list, keeping it up to date.
That said, the only thing developers should care about is iterating over the list with the help of the
IFriends::GetFriendByIndex() methods. The following list of actions is here for your reference only to show how the things work.
- First, call
- After the friends list is retrieved, you can browse it by calling:
The request for a friends list automatically calls
This call is performed automatically for friends (after requesting the list of friends) and fellow lobby members (after entering a lobby or getting a notification about some other user joining it), therefore in many cases you don’t need to call it manually. You should just wait for the appropriate callback to come to the
IFriends::RequestUserInformation()come both to the
IPersonaDataChangedListenerand to the
IUserInformationRetrieveListener. Also, user’s avatars are downloaded, taking into account both the
avatarCriteriaargument given in
defaultAvatarCriteriavalue set by calling
SetDefaultAvatarCriteria()(available options of avatar types are listed here).
- After a user information is retrieved, you can read it by calling
IFriends::GetFriendPersonaName()(not thread-safe) or
IFriends::GetFriendPersonaNameCopy(). A user’s avatar can be obtained with
IFriends::GetFriendAvatarUrl()(not thread-safe) or
It is possible to invite your friends to play together by calling
IFriends::ShowOverlayInviteDialog(). This method requires the
connectionString argument, which will allow other users to join your game. Typically, the
connectionString looks like this:
As a result of this call, a game invitation dialog is displayed and you can invite users to your game.
If an invited user accepts the invitation, the
connectionString is added to the command-line parameters for launching the game. In case the game is already running, the
connectionString comes to the
IGameInvitationReceivedListener or to the
IGameJoinRequestedListener, if the invite was accepted by the user on the overlay.
Before you can use this call, the GOG GALAXY Overlay must be enabled in the GOG GALAXY client (it is on by default, but can be changed by the user), and then successfully injected into the game. To check whether the overlay is initialized, either call
IUtils::GetOverlayState() or wait for the
The GOG GALAXY SDK allows you to set the RichPresence
statuskey will be visible to your friends in the chat and friends list of the GOG GALAXY client,
connectkey will be visible to your friends as JOIN button, which works exactly the same way as if a player received the game invitation sent with the
metadatakey will not be publicly visible, but accessible to other components of a game; for example, this key could contain player’s coordinates on a map, which then could be used to display player’s position on a mini-map on-screen.
RichPresence information can be requested with the
RequestRichPresence method. Responses come both to the
IRichPresenceListener and the
IRichPresenceRetrieveListener. In order to retrieve this information, use the
GetRichPresence (not thread-safe) or the