I'm creating a Game App in objective-c
which is using Google Play Game services
for realtime
Multiplayer
functionality. In the app, user have to bet for some coins before start the game and we want that the user that are connected must have bet for same number fo coins.
I follows the documentation at https://developers.google.com/games/services/ios/realtimeMultiplayer. The application works fine when searching for real time player without having particular role of each player like players with different coins.
- (void)createQuickStartRoom {
GPGMultiplayerConfig *config = [[GPGMultiplayerConfig alloc] init];
// Could also include variants or exclusive bitmasks here
config.minAutoMatchingPlayers = totalPlayers - 1;
config.maxAutoMatchingPlayers = totalPlayers - 1;
// Show waiting room UI
[[GPGLauncherController sharedInstance] presentRealTimeWaitingRoomWithConfig:config];
}
But i want to search the players having same role like each player have spend the same number of coins in my App.
static uint64_t const ROLE_COIN_10 = 0x1; // 001 in binary
static uint64_t const ROLE_COIN_20 = 0x2; // 010 in binary
static uint64_t const ROLE_COIN_50 = 0x4; // 100 in binary
- (void)createQuickStartRoomWithRole:(uint64_t)role {
GPGMultiplayerConfig *config = [[GPGMultiplayerConfig alloc] init];
// auto-match with two random auto-match opponents of different roles
config.minAutoMatchingPlayers = 2;
config.maxAutoMatchingPlayers = 2;
config.exclusiveBitMask = role;
// create room, etc.
// …
}
But the required player is not found having same role. It still provides the RealTime Player having different role. Kindly let me know, how to achieve this functionality. Thanks.
You want to use the variant field to match players requesting the same (non-zero) value. In your example, set the variant to the number of coins. The exclusive bit mask is used to match different types. For example if you need an "offense" and "defense" for a match.