Chat between players in Game Center turn based match - ios

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.

Related

How to implement webRTC for iOS mobile app creating 1 to 1 Call (Video and Audio)?

I am developing an iOS Video application with webRTC, I have developed application for room video call as i got a demo named AppRTC.
But the problem is, we can connect if and only if we know the room name.
Any help and suggestion for creating 1-1 Video with webRTC.
Actually, i am not getting the proper way to create Signaling between two users.
I want to develop video call like Whatsapp,facebook and Hangout one to one video call.
I have followed this AppRTC Demo Code On GitHub demo code.
You can implement a WhatsApp-style video call between two users using the "room" approach behind the scenes.
Let's say that User 1 wants to call User 2.
The app running on User 1's device generates a random room name and joins that room.
User 1's app also communicates the room name to User 2's device.
The app on User 2's device shows an incoming call alert.
If User 2 taps the Answer button, the app joins the room and the call with User 1 starts.
The actual room name used for the call doesn't need to be shown to any of the users.
If you want to create 1 to 1 video call you should build your own signaling mechanism.
What I mean by signaling mechanism is basically sending SDPs to each other.
You can find some useful info here

Is it possible to issue an alert when a GameKit opponent is ready?

I made a game using GameKit and I am using the framework to manage a real-time match between two opponents. If I invite a specific person to a match, or make sure they are "waiting for opponent" at the same time as me, the match and game goes smoothly and everything is great.
The problem I have now is that there aren't a lot of people on my app yet, and so people that are wanting to play against a random opponent who also wants to play, don't have any way of knowing when a match could be ready.
Is there a way to utilize GameKit, but enhance the experience so that a push notification or alert of some kind is sent when an opponent is found? It could be this is all built in, but I'm not seeing anything.
AFAIK, GameKit does not support push-notifications for matching real-time games while your App isn't running.
But, GameKit has a Player Activity API that tells you how many matches were requested in the last 60 seconds, and you could use that number to create an informative message or status to show the player.
EDIT: the methods in question are
- queryActivityWithCompletionHandler:
- queryPlayerGroupActivity:withCompletionHandler:

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.

Game Center Turn-based game

Is it possible to use the GameKit framework to pass matchdata to the other player without actually ending the turn of the current player?
So the answer to this, for iOS 7 at least, is to use the GKTurnBasedExchanges. You can send data, exchanges, replies to players even though it isn't the players turn.
I don't think there is a way to pass data to another player, then get a response back without the exchanges.
There is a way to pass data once by using saveCurrentTurnWithMatchData:completionHandler:, but the players who receive the match data won't be able to reply.

Game Kit Send data to offline player

I am pretty sure i know the answer but is it possible to send data using game kit to a player who is not playing the game anymore so next time he loads the game the data will be there. Is there any sort of messaging queue in gamecenter that can hold data
Nope, this is not possible if you let Game Center host the game. But you can set up your own server which stores the data and hands it over to the client while still having Game Centers match making functionality.

Resources