Use Friend In-Game
In this How-to, we will implement a mutual Friends system in-game using LootLocker. You will learn how to send friend requests, accept or decline them, list your friends and pending requests, and handle blocking relationships. This creates opt-in, two-way connections between players.
Prerequisites
Multiple player profiles (e.g. create via separate sessions)
(Optional) Some player ULIDs collected from the Player Manager
(Optional) Familiarity with managing relationships in the Web Console
Friends vs Followers
Friends are a two-way relationship requiring mutual consent. Player A sends a friend request to Player B, and they only become friends once B accepts. This powers you to build:
Private messaging systems
Co-op gameplay invitations
Trusted player groups for guilds or parties
Mutual achievement sharing and challenges
If you need one-way relationships that don't require approval, use Followers instead (see: Use Followers in Game).
Core Concepts
Friends list: Players who have mutually accepted each other's friend requests.
Incoming requests: Friend requests sent to the current player by others.
Outgoing requests: Friend requests the current player has sent but not yet accepted/declined.
Blocked players: Players who cannot send friend requests or interact with the current player.
Offset pagination: Lists use page numbers and per-page counts to paginate the data.
Typical UX Flow
Open Social UI → fetch friend counts for header
Browse friends list, incoming requests, or outgoing requests in tabs
Send friend request from player profile → appears in target's incoming list
Accept/decline incoming requests → moves to friends list or disappears
Cancel outgoing requests if changed mind
Block/unblock players to manage harassment
List Friends and Requests
The foundation of any friends system is showing existing relationships and pending requests.
Coming soon...
Coming soon...
Offset Pagination Strategy
Use page numbers (0-indexed) and
PerPagecount to paginate the dataTrack current page for each list type separately
Consider a page "complete" if returned items equal the requested
PerPageReset to page 0 when refreshing lists
Send and Cancel Friend Requests
Allow players to initiate and manage outgoing friend requests.
Coming soon...
Coming soon...
Accept and Decline Friend Requests
Handle incoming friend requests to build your friends network.
Coming soon...
Coming soon...
Block and Unblock Players
Manage your blocked players list to prevent unwanted interactions.
Coming soon...
Coming soon...
Check Friendship Status
Determine the current relationship between players for UI state management.
Coming soon...
Coming soon...
Displaying Counts and Status
Show meaningful counts and relationship indicators in your UI.
Coming soon...
Coming soon...
Performance Tips
Batch relationship checks: When showing many players (leaderboards for example), only fetch data for visible items
Cache friend IDs locally: Maintain a set of friend ULIDs for instant button state rendering
Moderate page sizes: 20-50 items per page balances responsiveness with network efficiency
Debounce rapid requests: Prevent spam-clicking send/cancel buttons
Lazy load secondary lists: Load friends first, then incoming/outgoing requests when tabs are opened
Example Feature Ideas
Mutual Friends: "You have 3 mutual friends with this player"
Friend Recommendations: Suggest friends-of-friends or players with similar interests
Private Groups: Create invite-only spaces using your friends list
Co-op Quick Join: Join friends' game sessions directly from the friends list
Conclusion
In this How-to we implemented friend requests, list management, acceptance/declining workflows, blocking functionality, and relationship status checking. The friends system provides the foundation for deeper social features like messaging, co-op play, and community building.
Key differences from followers include the mutual consent model, request management workflow, and offset-based pagination. Next, consider adding Followers for asymmetric relationships or explore Web Console management for administrative oversight.
Last updated