android - How to manage multiple 'minigames' inside one application/game using Google Play Services? -
i have developed application game , therefore have decided make use of online multiplayer , register google play game services. after developing first minigame, working expected , not coming across issues. when developing second minigame, wondered how able uniquely allow users play multiplayer games on specific minigame?
the application linked game service provides me app_id exists in manifest file so:
<meta-data android:name="com.google.android.gms.games.app_id" android:value="@string/app_id" />
it seem make sense create multiple game services , link them application. how able handle multiple app_ids in application? when use googleapiclient
, utilises app_id manifest , cannot specify specific app_id game service launch , provide connection google play games , google+:
mgoogleapiclient = new googleapiclient.builder(this) .addconnectioncallbacks(this) .addonconnectionfailedlistener(this) .addapi(plus.api).addscope(plus.scope_plus_login) .addapi(games.api).addscope(games.scope_games) .build();
is there best practice tackle multiple games inside 1 application?
i have found out can specify variant
value int
value of 1 1023. when building room, can set variant appropriate int
reflect different game type:
roomconfig.builder selectplayersroomconfigbuilder = makebasicroomconfigbuilder(); selectplayersroomconfigbuilder.addplayerstoinvite(invitees); // specifies specific game variant selectplayersroomconfigbuilder.setvariant(gametype); if (automatchcriteria != null) { selectplayersroomconfigbuilder.setautomatchcriteria(automatchcriteria); } // prevent screen sleeping during handshake getwindow().addflags(windowmanager.layoutparams.flag_keep_screen_on); games.realtimemultiplayer.create(mgoogleapiclient, selectplayersroomconfigbuilder.build());
with game example, gametype
int set previous activity
when user chooses game play , passed in through intent
. have decided on using 1 first game type , 2 second game type etc.
Comments
Post a Comment