Should Starting a Quick Game via Google Game Services be Iterated?
- by user46727
I have been following this tutorial for Google Play Game Services. I am a little unclear as to if the room matching algorithm should be looped or not. Can I just initialize this process once and let it time out? Or by iterating through it is it somehow rechecking it? If anyone had the approximate timeout that would be great as well.
The problem stems from the fact that even when both phones are signing into the Game Services (at virtually the same time, my friend and I logged in), the room is not registering multiple people. One time my friend's phone even entered the game map, showing that he somehow was able to progress from the room initialization process.
Relevant screen update methods which I am starting this matchmaking process:
@Override
public void update(float deltaTime)
{
game.options.updateTiles();
if(!isInitiated)
{
startQuickGame();
}
}
private void startQuickGame()
{
// auto-match criteria to invite one random automatch opponent.
// You can also specify more opponents (up to 3).
if(game.mGoogleClient.isConnected() && !isInitiated)
{
Bundle am = RoomConfig.createAutoMatchCriteria(1, 3, 0);
// build the room config:
RoomConfig.Builder roomConfigBuilder = RoomConfig.builder(Network.getInstance());
roomConfigBuilder.setMessageReceivedListener(Network.getInstance());
roomConfigBuilder.setRoomStatusUpdateListener(Network.getInstance());
roomConfigBuilder.setAutoMatchCriteria(am);
RoomConfig roomConfig = roomConfigBuilder.build();
// create room:
Games.RealTimeMultiplayer.create(game.mGoogleClient, roomConfig);
// go to game screen
this.mRoom = Network.getInstance().getRoom();
if(this.mRoom != null && this.mRoom.getParticipants().size() >= 2)
{
game.setScreen(new MultiGameScreen(game, this.mRoom));
isInitiated = true;
}
}
else
{
game.mGoogleClient.connect();
}
}