• Categories
  • Recent
  • Tags
  • Popular
  • Solved
  • Unsolved
  • Users
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Darkly)
  • No Skin
Collapse
brainCloud Forums

Questions about brainCloud Friends and Social Leaderboard behavior

Scheduled Pinned Locked Moved Unsolved General
3 Posts 2 Posters 11 Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gyutaelee
    wrote last edited by
    #1

    Context

    Hello brainCloud team,

    We are designing a follow/friend system for our game and would like to confirm a few details before implementation.

    Our intended model is:

    • We maintain our own FOLLOW Custom Entity as the source of truth.
    • A game “friend” is defined only when two users follow each other mutually.
    • When mutual follow is established, we plan to call FriendService.AddFriends([targetProfileId]).
    • When either side unfollows, we plan to call FriendService.RemoveFriends([targetProfileId]).
    • We may later use brainCloud Friends as an optimized source for social leaderboards.

    Questions

    1. Friend Relationship Direction

    Are AddFriends and RemoveFriends bidirectional for internal brainCloud friends?

    • If user A calls AddFriends([B]), will B also see A in ListFriends("brainCloud")?
    • Will both A and B see each other in GetSocialLeaderboard results if they both have leaderboard scores?
    • If A calls RemoveFriends([B]), is the friend relationship removed from both users?

    2. Idempotency

    Are AddFriends and RemoveFriends idempotent?

    • What happens if AddFriends([B]) is called when A and B are already friends?
    • What happens if RemoveFriends([B]) is called when they are not friends?

    3. Consistency and Caching

    Are friend changes immediately visible?

    • After AddFriends or RemoveFriends, should ListFriends("brainCloud") and GetSocialLeaderboard reflect the change immediately?
    • Or is there any eventual consistency or caching delay we should expect?

    4. Friend Count Limits

    Is there a hard or recommended limit for the number of brainCloud friends per user?

    • We could not find a documented hard cap.
    • Are there practical performance limits we should design around?

    5. GetSocialLeaderboard Behavior With Many Friends

    How does GetSocialLeaderboard behave when a user has many friends?

    • Does it return all recognized friends plus self, with no paging or limit?
    • Is there any hidden maximum result count or payload limit?
    • Are pacers included in this result as well?

    6. Recommended API for Top-N Friend Leaderboards

    What is the recommended API for a top-N friends leaderboard?

    • Can we use GetMultiSocialLeaderboard([leaderboardId], leaderboardResultCount, replaceName) with a single leaderboard ID?
    • Is leaderboardResultCount applied after social filtering and score sorting?
    • Is there a maximum allowed value for leaderboardResultCount?
    • Is this API preferred over GetSocialLeaderboard when we only need the top 50 friends?

    7. Social Leaderboard Pagination

    Is regular pagination supported for social leaderboards?

    • We found GetGlobalLeaderboardPage for global leaderboards, but did not find an equivalent offset/page API for social leaderboards.
    • Is there any supported way to retrieve friend leaderboard entries 51-100, 101-150, etc., without requesting all prior entries?

    8. Billing and API Counts

    Is GetSocialLeaderboard counted as one API call regardless of the number of friends returned?

    • Are there additional billing or performance considerations based on response size or number of leaderboard entries returned?

    9. Recommended Usage

    Are brainCloud Friends suitable as an app-specific “mutual follow friend cache”?

    • We will not use brainCloud Friends for unrelated gameplay relationships.
    • We plan to keep FOLLOW as our source of truth and use brainCloud Friends only as a derived mirror/cache for mutual follow relationships.
    • Does this align with recommended brainCloud usage?

    Thank you.

    1 Reply Last reply
    0
  • J Offline
    J Offline
    JasonL bitHeads
    wrote last edited by
    #2

    Hi @gyutaelee ,

    Thanks for the detailed questions.

    1. Friend Relationship Direction - Yes, bidirectional

    • AddFriends: When user A calls AddFriends([B]), both A and B see each other in ListFriends("brainCloud")
    • Both A and B will appear in each other's GetSocialLeaderboard results (if they have scores)
    • RemoveFriends: Removes the relationship from both users atomically

    2. Idempotency - Yes, both are idempotent

    • Calling AddFriends([B]) when already friends: No-op, no error thrown (skips DB write)
    • Calling RemoveFriends([B]) when not friends: No-op, no error thrown

    3. Consistency and Caching - Immediate

    • Friend changes are persisted immediately to the database (no write-behind caching)
    • ListFriends("brainCloud") and GetSocialLeaderboard reflect changes immediately after AddFriends/RemoveFriends
    • No eventual consistency or caching delay

    4. Friend Count Limits - No hard cap

    • No code-enforced limit on brainCloud friends per user
    • Practical consideration: Friend IDs stored as array on UserProfile; very large arrays (>10K) may impact read/write performance

    5. GetSocialLeaderboard Behavior - Returns all friends + self + pacers, no limit

    • Returns all recognized friends + self + pacers
    • No hidden maximum result count
    • Pacers are included (if leaderboard has pacers configured)
    • Warning: Response payload grows linearly with friend count

    6. Recommended API for Top-N - Yes, use GetMultiSocialLeaderboard

    • GetMultiSocialLeaderboard with a single leaderboard ID is a correct approach for top-N results
    • leaderboardResultCount is applied after social filtering and score sorting
    • leaderboardResultCount is capped by maxMultipleLeaderboardScoreLimit app property (default 10, can be raised in app-basis)
    • Preferred over GetSocialLeaderboard for top-N because it has built-in truncation

    7. Social Leaderboard Pagination - Not supported

    • No GetSocialLeaderboardPage API exists (only GetGlobalLeaderboardPage for global leaderboards)
    • Social leaderboards always return the full friend set (potentially truncated by leaderboardResultCount only in the multi variant)
    • I will forward your pagination request for team review

    8. Billing and API Counts - 1 API call per request

    • GetSocialLeaderboard = 1 API call regardless of friends/entries returned
    • GetMultiSocialLeaderboard = 1 API call even with multiple leaderboards
    • AddFriends/RemoveFriends = 1 API call even though they modify both users' profiles

    9. Recommended Usage - Yes, your design aligns perfectly

    1 Reply Last reply
    0
  • G Offline
    G Offline
    gyutaelee
    wrote last edited by
    #3

    Hello, thank you for the clarification.

    Based on your answer, I understand the following:

    • GetSocialLeaderboard returns the full set of friends + self + pacers, and there is no hidden max result limit.
    • GetMultiSocialLeaderboard can return only the Top N results using leaderboardResultCount, after social filtering and score sorting.
    • However, there is no page/offset-based pagination API for social leaderboards like GetGlobalLeaderboardPage.
    • leaderboardResultCount is limited by the app property maxMultipleLeaderboardScoreLimit, whose default value is 10.
    • Friend IDs are stored as an array in the UserProfile, so very large friend lists may affect read/write performance.

    I have two follow-up questions:

    1. How can we increase the maxMultipleLeaderboardScoreLimit value?
      Is this app property something we can change directly in the Console, or does it require a request to brainCloud Support?
      If a Support request is required, could you let us know what information we need to provide and whether there is a recommended maximum value?

    2. We are planning to build a friends-based social leaderboard for up to around 10,000 friends.
      In this case, is the recommended approach to call GetSocialLeaderboard, retrieve the full friends leaderboard, and then handle paging on the client/server side?
      Or, at this scale, would you recommend using a separate Custom Entity, Cloud Code, external ranking cache, or another leaderboard structure instead?

    To clarify, our requirement is not just to fetch the Top 50 users.
    We want to continuously page through a friends-based leaderboard like this:

    rank 1–50
    rank 51–100
    rank 101–150
    ...
    

    Based on your previous answer, I understand that social leaderboard pagination is currently not supported.
    Could you please advise on the recommended architecture or best practice for implementing this kind of UX with a friends leaderboard of up to 10,000 users?

    Thank you.

    1 Reply Last reply
    0

  • Login

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • Solved
  • Unsolved
  • Users