1

I want to create three different rooms as follows: Room 1: All players want to play 10 coins match Room 2: All players want to play 50 coins match Room 3: All players want to play 100 coins match

Now, if a player presses the match with 10 coins, only those players can join the room with different players (it's a 2 player match) not the all players pressed 50 coins or 100 coin match.

Please let me know how I do this as the code:

Bundle autoMatchCriteria = RoomConfig.createAutoMatchCriteria(1, 1, role);

Only sends the role to other players but all players can join the room, either presses the 10, 50 or 100 coin match.

jitain sharma
  • 584
  • 5
  • 19

1 Answers1

0

Here is the answer to my own question, If someone also stuck here:

Bundle autoMatchCriteria = RoomConfig.createAutoMatchCriteria(1, 1, role);

Here 'role' represents the player role in the game, like for RPG game role maybe, Shooter, Snipper etc.

Where, for the game variant as I want for the different game mode, set the variant type value as 'int' to the RoomConfig 'setVariant(variant)' as below:

RoomConfig roomConfig =
                RoomConfig.builder(mRoomUpdateCallback)
                        .setOnMessageReceivedListener(mMessageReceivedHandler)
                        .setRoomStatusUpdateCallback(mRoomStatusCallbackHandler)
                        .setAutoMatchCriteria(autoMatchCriteria)
                        .setVariant(variant)
                        .build();

This resolved my problem and works well for different game mode.

Now, In my game, the players playing for 10 coins match auto join for the 10 match players only.

jitain sharma
  • 584
  • 5
  • 19