Launching the game

How we direct players to the game

Once the match has been setup we need to redirect the user to your game so that they can play their match; for this to happen we expect a game to provide us with their launch URLs, with the match-token parameter being optional, such as:

  • Browser games: https://mycompany.com/mycoolgame?token={match-token}
  • Android/IOS games: mycompany://mycoolgame?token={match-token}
  • Steam games: steam://run/<id>//-token {match-token}

Match token

Games that have their own authentication system can rely on it coupled with our platform linking to identify users when they join a game, however a game that does not have its own user identification and relies on OkLetsPlay user ids must have a way to identify a player joining their game, which is why we send the optional match-token when required. Using that token a game can request that information from OkLetsPlay's backend.

Request example

curl \
  -X POST \
  -H 'Content-Type: application/json' \
  -H 'Authorization: Bearer ${XXX-secret-jwt}' \
  -d '{
    "token": "${match-token}"
  }' \
  ${config.okletsplay_url}/api/game/v1/token-info

Request Data

  • tokenstringThe token received as parameter when the game was launched

Response example

{
  "match_id": "600f369851f450dd3ecb0035",
  "user_id": "0376d27d-4b0e-4286-9dd9-f9f7528689bb",
  "match_status": "live",
  "submissions_total": 1,
  "submissions_left": 0
}
  • match_idstringThe unique id for this match.
  • user_idstringParticipant of this match identified by match-token.
  • match_statusstringA status of match or tournament.
  • submissions_totalnumberTotal attempts that a participant can submit a score.
  • submissions_leftnumberNumber of attempts left that a participant can submit a score.

Response data description

match_status can be used to identify the status of a match. If it is not 'live' (for matches and tournaments) or 'pending' (for tournaments) it makes sense to let a participant know that the game activity by the match-token is not actual and block a participant from playing a game.

submissions_left can be used to identify how many attempts a participant has to submit a score. The value is initially set by tournament's "Max Submissions" setting. If the value is 0 then no attempts left and subsequent attempts will not be accepted by the OKLP API. If it is > 0 then player has submissions_left number of attempts. Value of -1 means that a participant has unlimited attempts to submit a score. However, tournaments have "Max Ranked Submissions" setting, which identifies how many submissions will be counted for a participant's team place on leaderboard.

submissions_total can be used to represent a participant how many total attempts he has to submit a score. As submissions_left, the value of-1 means unlimited attempts. The value corresponds to tournament's "Max Submissions" setting.