Overview
Hyperscape includes comprehensive social features for player interaction: friend management, private messaging, and an ignore list for blocking unwanted players. Location:packages/shared/src/systems/shared/social/
Friend System
Adding Friends
- Right-click another player
- Select “Add Friend”
- Friend request sent to target player
- Target accepts or declines request
- If accepted, both players added to each other’s friend lists
Friend List
The friend list shows:- Friend’s name
- Online/offline status (real-time)
- Combat level
- Current activity (if online)
Managing Friends
| Action | Description |
|---|---|
| Add Friend | Send friend request to player |
| Remove Friend | Remove player from friend list |
| View Friends | Open friend list panel |
| Private Message | Send direct message to friend |
Online Status
Friend online status updates in real-time:- Green dot: Friend is online
- Gray dot: Friend is offline
- Notification: “Friend [Name] has logged in”
Private Messaging
Sending Messages
- Open friend list
- Click friend’s name
- Type message in chat input
- Message appears in private chat tab
Message Features
- Direct messages: Only visible to sender and recipient
- Message history: Conversation history per friend
- Notifications: Alert when new message received
- Offline messages: Messages delivered when friend logs in
Chat Integration
Private messages appear in dedicated chat tab:- Purple color for private messages
- “From [Friend]:” or “To [Friend]:” prefix
- Separate from public chat
- Persistent message history
Ignore List
Blocking Players
- Right-click player
- Select “Ignore”
- Player added to ignore list
- Blocked player can’t:
- Send you private messages
- Send you trade requests
- Send you friend requests
Managing Ignore List
| Action | Description |
|---|---|
| Add to Ignore | Block player from contacting you |
| Remove from Ignore | Unblock player |
| View Ignore List | See all blocked players |
Ignore Behavior
When you ignore a player:- Their messages don’t appear in your chat
- Their trade requests are auto-declined
- Their friend requests are auto-declined
- They don’t know they’re ignored (OSRS-style)
Database Schema
Tables
friendshipsNetwork Packets
Client → Server
| Packet | Data | Purpose |
|---|---|---|
friendRequest | { targetPlayerId } | Send friend request |
friendRequestRespond | { requestId, accept } | Accept/decline request |
friendRemove | { friendId } | Remove friend |
privateMessage | { recipientId, message } | Send private message |
ignoreAdd | { playerId } | Add to ignore list |
ignoreRemove | { playerId } | Remove from ignore list |
Server → Client
| Packet | Data | Purpose |
|---|---|---|
friendRequestIncoming | { requestId, fromPlayerId, fromPlayerName } | Incoming friend request |
friendAdded | { friendId, friendName, online } | Friend added to list |
friendRemoved | { friendId } | Friend removed |
friendOnline | { friendId } | Friend logged in |
friendOffline | { friendId } | Friend logged out |
privateMessageReceived | { fromId, fromName, message } | Incoming private message |
friendListSync | { friends } | Full friend list on login |
Implementation
SocialSystem
Location:packages/shared/src/systems/client/SocialSystem.ts
Client-side system managing social UI state:
Server-Side Handlers
Location:packages/server/src/systems/ServerNetwork/handlers/friends.ts
Server-authoritative friend management:
Friend List Synchronization
On player login:- Server loads friend list from database
- Server checks online status of each friend
- Server sends
friendListSyncpacket with full list - Server notifies online friends that player logged in
- Server broadcasts
friendOfflineto all online friends - Friend list persists in database
UI Components
FriendsPanel
Location:packages/client/src/game/panels/FriendsPanel.tsx
Main friend list interface:
- Friend list: Scrollable list of friends with online status
- Add friend button: Opens player search
- Private message: Click friend to open chat
- Remove friend: Right-click menu option
- Ignore list tab: View and manage ignored players
Chat Integration
Private messages integrate with chat system:- Private tab: Dedicated tab for private messages
- Color coding: Purple for private messages
- Notifications: Badge count for unread messages
- History: Persistent conversation history
Security & Privacy
Rate Limiting
- Friend requests: 5 per minute
- Private messages: 10 per minute
- Prevents spam and abuse
Validation
- Player existence: Target player must exist and be online
- Duplicate prevention: Can’t send multiple requests to same player
- Self-requests: Can’t friend yourself
- Ignore check: Ignored players can’t send requests
Privacy
- Ignore is private: Ignored players don’t know they’re ignored
- Online status: Only visible to friends
- Message privacy: Private messages not logged or visible to others
Common Issues
Friend Request Not Received
Possible causes:- Target player is offline
- You’re on their ignore list
- Request already pending
Can’t Send Private Message
Possible causes:- Player is not on your friend list
- Player is offline
- You’re on their ignore list
Friend Shows Offline But Is Online
Cause: Friend list not synced Solution: Relog to refresh friend listFuture Enhancements
Planned social features:- Clan system: Player-created groups
- Group chat: Multi-player chat rooms
- Friend notes: Add notes to friends
- Last seen: Show when offline friend was last online
- Activity status: Show what friend is doing (skilling, combat, etc.)