One player matches are a great way to get players feeling like their skin is in the game that requires almost no development effort. Galaxy will find a different player with a similar skill level and return their Leaderboard Record. You can display this before ("score to beat") or after ("you won/lost") the game starts depending on your preference. Prizes are not awarded for One Player matches.
We recommend showing the player their competitors avatar to emphasize they're competing with another real human.
Get an opponent
Galaxy will find another player with a score close to the current player:
GalaxyClientAPI.FindOpponent(newGalaxySDK.ClientModels.FindOpponentRequest { //Required parameter LeaderboardId ="leaderboard_id"//Which leaderboard to use for matching //Optional parameters OnlineOnly =false,//true will only return players currently online FriendsOnly =false,//true will only return friends FirstBound =-500,//Ranks below the player to consider SecondBound =500,//Ranks above the player to consider}, result => { var scoreToBeat =result.Record.Score;var opponentName =result.Record.PlayerProfile.Nickname;}, error => { })
window.galaxy.ClientAPI.FindOpponent({//Required parameter leaderboard_id:'leaderboard_id',//Optional parameters online_only =false,//true will only return players currently online friends_only =false,//true will only return friends first_bound =-500,//Ranks below the player to consider second_bound =500,//Ranks above the player to consider}, (result, error) => { })
Opponent Record Objects
Response
/// User records for the requested user.publicLeaderboardRecord Record;