Should Starting a Quick Game via Google Game Services be Iterated?

Posted by user46727 on Game Development See other posts from Game Development or by user46727
Published on 2014-06-04T02:03:40Z Indexed on 2014/06/04 3:40 UTC
Read the original article Hit count: 184

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();
    }
}

© Game Development or respective owner

Related posts about android

Related posts about google-play-services