Google gaming services, obtain list of rooms - android

I am planning on introducing Google play game services to my app. However I am not sure if i can provide the following capability. I need to be able to list the rooms available so the player can join any room he chooses rather than auto join.
Is there a way to do that? Thank you

In the current implementation of our API, there are no "open rooms" that you can voluntarily enter. You need an invitation to enter a room. So the method we have that's closest to what you're asking is the GamesClient.loadInvitations() method, which will list all the currently active invitations to rooms that the player has.
If the behavior you're trying to implement is "I want to join a room that's playing upside-down four-dimensional chess", without being specifically invited by a friend, then what you want is probably automatching. Automatching means you create a room and specify the number of players you want in your game and, optionally, a variant code (an integer) that indicates the game type. Then, the API will match together a set of players who is wanting to play that same variant at that moment, and will put them all in the same room.

You might need to use Leaderboards in Android

I can't see how you could do this in the current release of Game Services (at least not if you use the API in the way that Google wants you to).
However I just noticed this:
https://developers.google.com/games/services/web/api/rooms/join
Join a room. For internal use by the Games SDK only. Calling this
method directly is unsupported.
Maybe this sort of thing will be possible at a later date ?

Related

Android Multiplayer turn-based: make an invitation

I'm developing a game using Android Multiplayer TurnBased api.
The game that I use as "example" of multiplayer approach is SuperStickman Golf2, even if game is absolutely different.
Like golf2 , I want to implement an invitation where the player indicate the own nickname and he can invite other nickname.
Obviously I dont want to use default UI from Google.
But how can I do that ?
In particular:
1) when I choose a nickname, where it will be stored?
2) when I want to play with another nickname, how/where do I perform the search?
The only way that I know to make an invitation is to use "playerId", but it seems not sufficient...
In my game I've done everything and this is the last thing to make! but I'm stucked in this problem!
As alternative, how can I obtain playerId from displayName (that is like nickname, even if this is not my real target...)?

Quick game with player criteria - realtime multiplayer android google play services

i am currently developing a realtime multiplayer game for android and i got the example ButtonClicker working. I think the "quick game"(or maybe it´s called automatch) option is just what i need. But i need something like this: I would like to make the player play a match with a random player from his level. You see, on my game, every player will have a level and these levels and associated players will maybe be stored on a database. I want the player to have a quick game with only the players from his level. Is it possible to inform that criteria on quick game? What must i do?
I also want him to be able to choose his friends(the invite option) but only friends that are on his level.
In order to restrict automatching between players, you can use the variant option when building a room configuration, ie RoomConfig.Builder#setVariant(int).
In order to restrict invitations, I think you will have to create your own "invite player" activity, which I am less familiar with. You will presumably have to query for the player's friends, and then cross-correlate this list with each of their "levels" and filter it down to those of the same level before showing it in the activity. It looks like The Players API has some methods that you will be able to interact with, and hopefully would contain an Id that you use in your level-based DB.
Rob
When you create your RoomConfig for match making you can provide AutoMatchCriteria. The API just uses a bitmask, so it is up to you what data you put in that bit mask:
createAutoMatchCriteria
exclusiveBitMask: Exclusive bitmasks for the automatching request. The
logical AND of each pairing of automatching requests must equal zero
for auto-match. If there are no exclusivity requirements for the game,
this value should just be set to 0.
In your case this could contain a level range to match up with.
You can see it being used in the sample code here: Developing Real-Time Multiplayer Games.

Google Play Game Services - Managing achievements

According to the GPGS website-
Use the client libraries. The mobile client libraries employ a number
of strategies to reduce the calls you make to the service. For
instance, achievement and leaderboard data is cached, so a user can
view their achievements as often as they'd like without requiring the
service to make multiple calls. Both the Android and iOS client
libraries will know not to send a player's score to the server if
your score isn't as good as one you recently submitted. The Android
library also automatically combines frequent achievement increment
calls when it detects that you are being rate limited.
I'm specifically interested in 'viewing achievements without requiring the service to make multiple calls'. As far as I can see, the best way to do this would be to use the OnAchievementsLoadedListener and get a reference to the achievementBuffer.
Will that buffer be updated when an achievement state is changed and is it okay not to close that buffer immediately? If not, the OnAchievementsUpdatedListener does not pass a buffer or even and indiviudal achievement reference so how would I get the updated collection of achievements?
I found my answer here:
https://developer.android.com/reference/com/google/android/gms/games/GamesClient.html#loadAchievements%28com.google.android.gms.games.achievement.OnAchievementsLoadedListener,%20boolean%29
Set forceReload argument to false to gain the advantages of data-caching :)

Creating a Appwarp chatroom and issues in a Android game

I was creating an android app (actually a game) with customised Cocos2d and I was planning to add in a chat feature. kind of like a counter-strike where other players can send short IM to each other (I think the clash of clan's clan chat comes closest to what i want to make, you can get an idea from that)
I was trying to use AppWarp API to do this, but am finding it hard to do so. I liked appwarp because it handles server management on its own. I don't wanna get into implementing a XMPP/Smack customised code where scalability becomes an issue later on, because i dont know server management at all! (although i would love the freedom it gives me). Did i mention that its a two man team? Me and a friend :).
In my game in I need one global room (a static room) and an another special-group room (this will be dynamic, since its only created if the user selects to create the room).
But the problem with creating a dynamic group room in Appwarp is that it doesnt stay alive (remain persistent) after all the users in it have disconnected. According to the current implementation in the API, the dynamic group gets deleted if the last member logs out.
Q1) Is there a way for me to create a persistent/static room from client side? Q2) and if that isnt possible is there some way i can make the dynamic rooms persistent? Basically i'm asking anyone who has experience with Appwarp, If it requires some tweaking with the code can you please point me out in the right direction?, or is it not possible at all?
Q3) Also, i wanted to implement a chat history feature on the chat rooms. Is that already available via Appwarp API? or would I have to write a listener, so that each time a room receives a message it maintains a history file? Again this is only possible if the user can re-connect to the room.. Please guide me for this too.
Also,supposing i have to drop Appwarp idea (Gulp!) Q4) Can you please point me in the right direction to create a group-based chat with a similar api that can be integrated with an android app with cocos2D.
Currently creating static rooms through the API is not possible. However providing such flexibility is part of AppWarp's plan.
AppWarp doesn't maintain chat history on the server side currently. This is again something we are looking in to as it has been requested by other developers as well. Keep an eye on our blogs (http://blogs.shephertz.com) where we announce our updates.
We expect to release these features by early October.

Simple android multiplayer score keeper

I'd like to have an android app that would allow a given number of users to be "logged in" either as a player or ref. The players would just be able to increment their score, while the ref would have a screen that shows all player scores and alerts the ref with a tone/vibration when a player reaches a target score.
I have no android dev experience and in a perfect world I would just find an app that does something similar to this that I can just tweak. I'm not sure if this kind of functionality would depend on having a server or at all where to begin on learning the knowledge that would be necessary to create such an app.
Kind of a vague question... you will however need a server to keep track of all the scores - for example you can have an SQL database that contains all the users/scores and all the Android app is tell the server which user's count to increment.
Another alternative would be to use the Google Drive APIs - you can probably use forms or something to increment counts while the "ref" would have full access to the document.

Categories

Resources