• Categories
  • Recent
  • Tags
  • Popular
  • Solved
  • Unsolved
  • Users
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (Darkly)
  • No Skin
Collapse
brainCloud Forums

Limiting number of async matches

Scheduled Pinned Locked Moved APIs
matchmakingasync match
3 Posts 2 Posters 441 Views
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Y Offline
    Y Offline
    Ytterbum
    wrote on last edited by
    #1

    Here's how I have it working at the moment:
    New Game:

    • If player has less than 3 matches, allow creation of a new game.
    • Player looks for an opponent that has matchmaking enabled.
    • If an opponent is found, make a match. Matches can be made whether the opponent is offline or online, doesn't matter.
    • If NO opponent is found, set player's matchmaking to true. Waits for an opponent to make a new game.

    Continue Game:

    • Find matches you belong to that are not EXPIRED or COMPLETE.
    • Select a match from these matches and load the game for the client.

    I would like to limit the number of matches any user can have at a given time to 3. The problem is that when you match with an opponent, their matchmaking will still be enabled if they are offline. Other users can match with them, potentially putting the offline opponent over the match limit of 3. I could not find a way in the API to disable matchmaking for another user that is offline with these conditions.

    Is there any way to do this, or some trick I am missing?

    Ytterbum

    1 Reply Last reply
    0
  • J Offline
    J Offline
    JasonL bitHeads
    wrote on last edited by
    #2

    You may write a pre-hook cloud code script with your validating logic and integrate it with [TurnShieldOn()](https://getbraincloud.com/apidocs/apiref/?cloudcode#capi-matchmaking-turnshieldon) method.

    1 Reply Last reply
    1
  • Y Offline
    Y Offline
    Ytterbum
    wrote on last edited by
    #3

    Thank you! I will try that out.

    Just for anyone else's future reference, I realized you can "log in" as another user using GetSessionForProfile(). So if the other user is offline, you will be able to modify their data (for example, to increment an attribute for number of matches they have).

    I believe this way, you can also do what JasonL said and TurnShieldOn() for the other user, stopping them from being able to match anymore.

    Correct me if I'm wrong.

    1 Reply Last reply
    0

  • Login

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • Solved
  • Unsolved
  • Users