1) This is working exactly as Google intends. There is NO GUARANTEE that if you use createAutoMatchCriteria(1, 3, 0) that 3 opponents will be found for your game. In my testing, (4 devices requesting at once) 90% or more of the time It will become 2 games of 2 that get started. Only if I have one device invite either a friend or manually select AutoPick, then the chances go up dramatically of getting a 3 or 4 player game started (otherwise, pure AutoMatch results in the 2 and 2 behavior)
2) If I understand the behavior correctly, you get one player that leaves the waiting room (normally the device that initiates first) and then the other player joins, but the first player leaves the Waiting Room, and the other is left in it? If so, then you need to ensure you use the following ( I do it in onRoomConnected
try {
bWaitRoomDismissedFromCode = true;
finishActivity(RC_WAITING_ROOM);
} catch (Exception e) {
dLog("would have errored out in waiting room");
}
This will then close the waiting room for any players that are in the waiting room still, and get them back into your activity. From below, if you want the behavior of "Start Playing", this is only if there are invited players that have accepted invitations into the room. (IF Google meant it to work another way for AutoMatch, they haven't got it there yet)
public Intent getRealTimeWaitingRoomIntent (Room room, int minParticipantsToStart)
Returns an intent that will display a "waiting room" screen that shows the progress of participants joining a real-time multiplayer room. Note that this must be invoked with startActivityForResult(Intent, int), so that the identity of the calling package can be established.
If the necessary number of peers have connected and it's now OK to start the game, or if the user explicitly asked to start the game now, the activity result will be RESULT_OK. If the user bailed out of the waiting room screen without taking any action, the result will be RESULT_CANCELED. If the user explicitly chose to leave the room, the result will be RESULT_LEFT_ROOM.
Regardless of what the result code was, the waiting room activity will return a data intent containing a Room object in EXTRA_ROOM that represents the current state of the Room that you originally passed as a parameter here.
If desired, the waiting room can allow the user to start playing the game even before the room is fully connected. This is controlled by the minParticipantsToStart parameter: if at least that many participants (including the current player) are connected to the room, a "Start playing" menu item will become enabled in the waiting room UI. Setting minParticipantsToStart to 0 means that "Start playing" will always be available, and a value of MAX_VALUE will disable the item completely. Note: if you do allow the user to start early, you'll need to handle that situation by explicitly telling the other connected peers that the game is now starting; see the developer documentation for more details.
Finally, note that the waiting room itself will never explicitly take any action to change the state of the room or its participants. So if the activity result is RESULT_LEFT_ROOM, it's the caller's responsibility to actually leave the room. Or if the result is RESULT_CANCELED, it's the responsibility of the caller to double-check the current state of the Room and decide whether to start the game, keep waiting, or do something else. But note that while the waiting room is active, the state of the Room will change as participants accept or decline invitations, and the number of participants may even change as auto-match players get added.
3) Google Play Game Services (for Auto-Match) does NOT have this behavior. Only when all participants for a Room are found and selected by the server, will the room actually be Connected (onRoomCreated does NOT mean that a ROOM for communication has been setup, it is for the players to join if they are waiting for others to join... and can be switched once the Service has all the other Players) onRoomConnected is the last call to all connected players and signifies the Room is ready for passing messages around. Now, if you have intivees, the behavior changes, in that yes, you can see an invitee accept, but if they then leave the room.. there is NO WAY to have it filled by an AutoMatch, but you CAN see them leave... (how nice eh?)
4)If the games are using GPGS, then once a room has been created and made it to the onRoomConnected stage, it is being played and no more matches can be done with that room. So when you join a room, everyone else has joined at the same time. So when a player leaves, nobody else will be able to join.
public abstract void onRoomConnected (int statusCode, Room room)
Called when all the participants in a real-time room are fully connected. This gets called once all invitations are accepted and any necessary automatching has been completed. Possible status codes include:
STATUS_OK if data was successfully loaded and is up-to-date. STATUS_CLIENT_RECONNECT_REQUIRED if the client needs to reconnect to the service to access this data. STATUS_INTERNAL_ERROR if an unexpected error occurred in the service. Parameters room The fully connected room object. The room can be null if it could not be loaded successfully.