Claiming a Position¶
The SDK provides functionality for players to claim their position during gameplay through QR codes that link to the Scorbit service.
Basic Usage¶
Position Claiming¶
When a player wants to claim their position: 1. Generate a claim deeplink for their player number (1-4) 2. Display the deeplink as a QR code 3. Player scans the QR code with the Scorbit mobile app 4. Position is associated with their Scorbit account
Player Numbers
Player positions are numbered starting from 1.
QR Display
The deeplink should be encoded as a QR code and displayed where the player can easily scan it.
Status Indication¶
When displaying QR codes, consider indicating the Scorbit connection status visually:
void display_claim_qr(sb_game_handle_t state, int player) {
const char* link = sb_get_claim_deeplink(state, player);
sb_auth_status_t status = sb_get_status(state);
// Choose display style based on status
switch (status) {
case SB_NET_AUTHENTICATED_PAIRED:
display_qr_with_style(link, "green"); // All systems go
break;
case SB_NET_AUTHENTICATED_UNPAIRED:
display_qr_with_style(link, "yellow"); // Needs pairing
break;
case SB_NET_DISCONNECTED:
case SB_NET_AUTHENTICATTION_FAILED:
display_qr_with_style(link, "red"); // Connection issue
break;
case SB_NET_CONNECTING:
display_qr_with_style(link, "blue"); // Connecting
break;
}
}
void displayClaimQR(scorbit::GameState& gs, int player) {
std::string link = gs.getClaimDeeplink(player);
auto status = gs.getStatus();
// Choose display style based on status
switch (status) {
case scorbit::AuthStatus::AuthenticatedPaired:
displayQRWithStyle(link, "green"); // All systems go
break;
case scorbit::AuthStatus::AuthenticatedUnpaired:
displayQRWithStyle(link, "yellow"); // Needs pairing
break;
case scorbit::AuthStatus::Disconnected:
case scorbit::AuthStatus::AuthenticationFailed:
displayQRWithStyle(link, "red"); // Connection issue
break;
case scorbit::AuthStatus::Connecting:
displayQRWithStyle(link, "blue"); // Connecting
break;
}
}
def display_claim_qr(gs, player):
# Get the claim deeplink and current status
link = gs.get_claim_deeplink(player)
status = gs.get_status()
# Choose display style based on status
if status == scorbit.AuthStatus.AUTHENTICATED_PAIRED:
print(f"Ready to claim: {link}") # All systems go
elif status == scorbit.AuthStatus.AUTHENTICATED_UNPAIRED:
print(f"Needs pairing: {link}") # Needs pairing
elif status in (scorbit.AuthStatus.DISCONNECTED,
scorbit.AuthStatus.AUTHENTICATION_FAILED):
print(f"Connection issue: {link}") # Connection issue
elif status == scorbit.AuthStatus.CONNECTING:
print(f"Connecting: {link}") # Connecting
Common status indication colors:
Status | Color | Meaning |
---|---|---|
AuthenticatedPaired |
Green | Ready for claiming |
AuthenticatedUnpaired |
Yellow | Device needs pairing |
Disconnected /Failed |
Red | Connection problem |
Connecting |
Blue | Connection in progress |
Visual Feedback
Using color or other visual indicators helps players quickly understand if the system is ready for claiming.
Accessibility
Consider colorblind users when choosing status indicators. You might want to add icons or patterns along with colors.
Best Practices¶
1. Timing¶
- Generate claim links when players join the game
- Allow claiming before scoring begins
- Support mid-game claiming when needed
2. Display¶
- Show QR codes in an easily scannable location
- Make clear which position the QR code is for (e.g. "Player 1")
- Ensure adequate display contrast for scanning
3. Position Management¶
- Verify player numbers are valid
- Handle multiple claim requests gracefully
- Clear claimed positions between games