The SC_ChallengeController manages single instance of the SC_Challenge class.

The SC_ChallengeController is used to
  • Accept a challenge

  • Reject a challenge

  • Submit a challenge's score or context to the server

SC_Challenge life-cycle:
  1. The contender decides on a stake and creates a challenge. The contender also decides if the challenge should be open to any user or directed to a designated user.

  2. The contender plays the game and submits the challenge and the score he obtained to the Scoreloop server.

  3. A second Scoreloop user, the contestant, accepts the challenge and pays the challenge stake. If the challenge is open it may be accepted by any Scoreloop user. If it is a direct challenge, only the user, to whom the challenge was assigned by the contender may accept it.

  4. The contestant plays the game and submits the score to Scoreloop.

  5. Scoreloop compares the scores of the contender and the contestant in accordance with the game scoring schema as defined by the game developer, and declares a winner.

  6. The winner takes the challenge prize (the combined contender and contestant stakes decreased by a challenge sink).

Some of the basic Use Cases are listed below:

Use Case 1: To create a challenge:
  1. Call the SC_Client_CreateChallenge() method to create the challenge with the given stake and contestant.

  2. The challenge contender is automatically set as equal to the current session user. The contestant is equal to the user argument passed in step 1. Pass a NULL value as the user argument instead, in order to create an open challenge. The controller automatically sets the challenge in the current session (for further easier access).

Use Case 2: To accept, reject, or submit a challenge:
  1. Get an instance of SC_ChallengeController or re-use an existing instance.

  2. Call the SC_ChallengeController_SetChallenge() on the controller. This is the challenge that the controller will deal with. If this is not explicitly set, the controller will take the challenge from the current session instead.

  3. Await notification of success using delegate callbacks.

Important note:

Do not modify a challenge object, or any of its sub-objects like score or the userContext of a score, while one of the following asynchronous methods is in progress, as this might result in undefined results:

See also:

SC_Challenge, Challenges

Last modified: 2014-05-14

Got questions about leaving a comment? Get answers from our Disqus FAQ.

comments powered by Disqus