Fast play with player criteria - multiplayer games for android
I am currently developing a real-time multiplayer game for Android and I got a ButtonClicker example. I think the "quick play" option (or perhaps it's called automatch) is what I need. But I need something like this: I would like to force the player to play a match with a random player from his level. You see, in my game, each player will have a level, and those levels and associated players will probably be stored in the database. I want the player to have a quick game only with players from his level. Is it possible to report on the criteria for quick play? What should I do?
I also want him to be able to choose his friends (invite option), but only friends who are at his level.
source to share
To limit the automation between players, you can use the variant variation when building the room configuration, i.e. RoomConfig.Builder # setVariant (int) .
To restrict invites, I think you will need to create your own invite player activity, which I am less familiar with. You will probably have to query the player's friends and then cross-match that list with each of your "levels" and filter it down to the same level before showing it in action. It looks like the Players API has some methods that you will be able to interact with and will hopefully contain an identifier that you use in yours based on the level.
Rob
source to share
When you create your RoomConfig to create a match, you can provide an AutoMatchCriteria. The API just uses a bitmask, so you need the data you put into that bitmask:
exclusiveBitMask . Exclusive bitmasks for automation request. the logical AND of each pairing of automation requests must be zero for an auto-match. If there is no exclusivity requirement for the game, this value should be 0.
In your case, this may contain a range of levels to match.
You can see that it is used in the sample code here: Real-Time Multiplayer Game Development .
source to share