question

jacobdhart avatar image
jacobdhart asked

What's the best way to store the extra data that I need to properly populate my friends list? (details inside)

We're developing a game in which friends have several pieces of data that are required in order to fully populate the friends list (name, avatar configuration, etc.) However, it appears that GetFriendsList cannot return arbitrary pieces of UserData.

We thought about using statistics for this purpose (since they can be fetched by passing the ShowStatistics constraint to GetFriendsList), but it appears that we would only be able to get 32-bit integers this way. What's the best way to fetch multiple pieces of data per friend whilst populating the friends list? Looking through the documentation, the best option I see is to call GetUserData repeatedly, but this hardly seems ideal.

(Side note: we're already using TitleDisplayName to store a 6-digit friend code so that users can easily find each other via GetAccountInfoRequest.)

dataFriends
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

Actually, calling GetUserData repeatedly would result in the client making far too many API calls, since users could have hundreds or even thousands of friends. The result of that would be that your title would be throttled, or even blocked.

There are a number of things you can get from the friends list using the profile, including Tags (which are arbitrary strings), Statistics, and Avatar URL. If you need more than what is available via the profile, I'd have to recommend using an external data table, so that you don't have clients trying to make excessive calls to the service. Please also add a Feature Request forum post on the specifics of what it is you would like to have in the returned friend info (but please note that no, we will not be able to return all user data for a player as part of the request - that would be incredibly expensive, and force us to increase our pricing to allow for it).

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.