iOS Google Play Games SDK - How to invite friends to social circles? - ios

Apple's Game Center has really gone down the toilet recently so I'm adding support for Google Play Games leaderboards and achievements to my iOS games. I'm displaying the leaderboards myself by downloading the scores using the GPGLeaderboard class. There's a property called "social" that lets me download the scores of friends - "A social leaderboard is a public leaderboard filtered by people within the local player's circles." Is there an API that will let me invite other players to my game so I can see them in these social leaderboards? I'm not sure how people are supposed to set up these social circles?

Check this documentation: Starting a real-time multiplayer game.
Invite players button. Lets the user invite friends to join a game session or specify some number of random opponents for auto-matching. When the player selects this option, your app should display either the built-in player selection user interface (UI) provided by the SDK or a custom UI for player selection.
You might also want to check on this GPGLeaderboard Class Reference wherein leaderboard objects must be created with a leaderboard ID. Once a leaderboard object is created, you may interact with it using the provided set of actions.

Related

Real-time game matchmaking with friends in iOS

I would like to implement friends-based matchmaking for a real-time game on iOS 8+
I can already use GKMatchRequest to do anonymous matchmaking, but I'm not sure how to let the user attempt to play against someone they already know
Possibilities:
GKMatchRequest.recipients is where you specify players to invite. But where to acquire the GKPlayer objects to pass to this property? All I can find is GKLocalPlayer.loadRecentPlayers(), which covers only 'someone you have played a game with or a legacy game center friend'.
GKMatchMakerViewController offers a UI for the user to send iMessages to people from Contacts. But the UI is confusing- is there are way to do this programmatically?
Facebook has what many users would consider their canonical list of friends. Does the Facebook SDK for iOS offer matchmaking against this list? Matchmaking is mentioned for Instant Games, but not mobile games
3rd party solution. Perhaps there's another SDK that allows listing of a user's friends/contacts followed by an invitation flow to connect them together?
My ideal UI flow would be
Tap 'Play against friends'
Select from a list of your FB friends/iOS contacts
That user receives an iMessage/FB message from which they can install or open the app
If you're still waiting for them by the time they launch the app, you are both connected and the game begins
It's been driving me a bit crazy because it seems like quite a common problem - surely many users would want to play against people they know? - but I can't seem to find a clear solution. It doesn't help that the GameCenter APIs seem to have changed a lot and documentation is a bit sparse

What is a "guest player" in GameKit?

The documentation for GKPlayer mentions a method for creating "guest players":
The concept of guest players is introduced in iOS 9. Guest players are
treated exactly like authenticated players for Game Center multiplayer
purposes. However, guest players cannot earn achievements, post to
leaderboards, or participate in challenges. Create a guest player with
the anonymous​Guest​Player(with​Identifier:​) method.
But the same documentation says there must be an authenticated player before using GameKit. And indeed, pretty much everything GameKit fails if you aren't logged into Game Center.
So what is the purpose of "guest players" and how would you use them?
its like : lets say your friend wants to play a game(that you also play) using your device. In that case your friend can directly play the game without effecting your scores and achievements if he plays as a guest. Its like a temporary way to play a game from someone else GameCenter account but without affecting his/her scores and achievements

CloudKit and GameCenter in a game?

I am working on a game. It will use Game Center for multiplayer. I would like to be able to use CloudKit for storing levels and the local CloudKit container for storing game progress. The problem is that this requires to different accounts. Any ideas on how to link them together?
I struggled with this recently when building in syncing to my game Qiktionary. At first I associated single player game data with the currently logged in Game Center player. So when I started working on sync, I was associating the single player game data in CloudKit with the Game Center player by using a separate CKRecordZone (in the private db) for each Game Center player.
I ended up abandoning that approach because it turns out that causes some behaviour that looks to the user like data loss. For example, GC Player A is logged into your game and plays 10 single player games (or in your case, levels). Later they happen to log out of Game Center, and even later than that they come back to your game and since they are logged out, they no longer see their 10 games played. It's not obvious that the game data is there but just "missing" because they are now logged out of GC.
I did some research and most other games don't work like that. Single player game progress is not linked to the logged in Game Center player. Which means that the single player game data in CloudKit shouldn't be linked to the Game Center player either.
This is even how the GKSavedGame API from GameKit works. According to the docs:
Saved games are tied to the iCloud account, not the Game Center account

Rails Two players card game

I need to implement a card game between two players. A player clicks "bet" button, then a game appears in queue list and another player clicks "join" button, and then the game starts. Technologies I use include Rails 4, websocket-rails, jQuery. What I'm confused about is how to show each player their own cards and to not show the opponent's cards on the board. What technique is being used for this purpose? I think I should use internal websocket-rails' connection_store method to store players' cards, but I'm not sure how to work with it later in game and how to store each player's cards in variables
Has anybody here have this kind of experience with websocket-rails? Any advice?
I'm not sure but you could create uniq chanel for each user and send specific data to this chanel (like data about user cards). Also you could create second broadcast chanel for concrete game, when just joined users could send messages to it, and there you could put data accessible for all users in game. About connection_store you could look DataStore.
About dealing cards, you should have some pack of cards (36 cards) and when game is started you can randomly select few cards (depends on game) for each user, also each user connected to game has his own unique chanel to which you can put these cards, in broadcasting chanel you can put some game data (like how many players, who should run first, etc.) if user makes some action you can trigger it and send data to server (like put card on the table) then you send to broadcast chanel this public action, and give ability for other user do someting else. Jquery on one client shouldn't know about which cards other client has. All actions between user go through the server.

Chat between players in Game Center turn based match

I am trying to create a turn based game using Game Center. I wanted to know if it is possible to allow the players in the match to chat between each other (either voice or text).
I have looked into it a little and seems that it is possible via the normal game but not a turn based one.
If it is not possible what are the solution or ways to allow this type chat?
Yes, you can have text chat the following way:
Without ending the turn, update the matchData object on the GKTurnBasedMatch. The updated NSData will be provided to all players that open your app and are participants in the game. So, your matchData object would have to carry both the game state and the chat state. Unfortunately, I do not see how one could trigger user notifications or badge the app for new chats without having to end the player's turn each time.

Resources