Top Banner
Mobile Application Programming GameKit
11

Mobile Application Programming - The College of ...cs4530/2010ios/media/GameKit (PDF).pdf · In-Game Voice GKSession Bluetooth Internet with Sockets GameKit Programming Guide GameKit

May 26, 2018

Download

Documents

lamdiep
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Mobile Application Programming - The College of ...cs4530/2010ios/media/GameKit (PDF).pdf · In-Game Voice GKSession Bluetooth Internet with Sockets GameKit Programming Guide GameKit

Mobile Application ProgrammingGameKit

Page 2: Mobile Application Programming - The College of ...cs4530/2010ios/media/GameKit (PDF).pdf · In-Game Voice GKSession Bluetooth Internet with Sockets GameKit Programming Guide GameKit

GameKit

Peer-to-Peer Connectivity

Asynchronous Communication

Guaranteed or Non-Guaranteed Delivery

Initial Connection UI

In-Game Voice

Page 3: Mobile Application Programming - The College of ...cs4530/2010ios/media/GameKit (PDF).pdf · In-Game Voice GKSession Bluetooth Internet with Sockets GameKit Programming Guide GameKit

Peers

Page 4: Mobile Application Programming - The College of ...cs4530/2010ios/media/GameKit (PDF).pdf · In-Game Voice GKSession Bluetooth Internet with Sockets GameKit Programming Guide GameKit

Communication

Page 5: Mobile Application Programming - The College of ...cs4530/2010ios/media/GameKit (PDF).pdf · In-Game Voice GKSession Bluetooth Internet with Sockets GameKit Programming Guide GameKit
Page 6: Mobile Application Programming - The College of ...cs4530/2010ios/media/GameKit (PDF).pdf · In-Game Voice GKSession Bluetooth Internet with Sockets GameKit Programming Guide GameKit

Need a Protocol

Page 7: Mobile Application Programming - The College of ...cs4530/2010ios/media/GameKit (PDF).pdf · In-Game Voice GKSession Bluetooth Internet with Sockets GameKit Programming Guide GameKit

Serialization Protocols

NSKeyedArchiver NSKeyedUnarchiver

NSCoding compliant

NSCoding compliant

GKSession

Page 8: Mobile Application Programming - The College of ...cs4530/2010ios/media/GameKit (PDF).pdf · In-Game Voice GKSession Bluetooth Internet with Sockets GameKit Programming Guide GameKit

Sending / Receiving Data- (BOOL) sendData:(NSData*)data

toPeers:(NSArray*)peers withDataMode:(GKSendDataMode)mode error:(NSError**)error

- (void) setDataReceiveHandler:(id)handlerwithContext:(void *)context

- (void) receiveData:(NSData *)data fromPeer:(NSString *)peer inSession: (GKSession *)session context:(void *)context;

Page 9: Mobile Application Programming - The College of ...cs4530/2010ios/media/GameKit (PDF).pdf · In-Game Voice GKSession Bluetooth Internet with Sockets GameKit Programming Guide GameKit

In-Game Voice

System Singleton

Your object implementing

protocol

General Overview

GameKit Programming Guide

Page 10: Mobile Application Programming - The College of ...cs4530/2010ios/media/GameKit (PDF).pdf · In-Game Voice GKSession Bluetooth Internet with Sockets GameKit Programming Guide GameKit

In-Game Voice

GKSession Bluetooth Internet with Sockets

GameKit Programming Guide

GameKit Programming Guide

Page 11: Mobile Application Programming - The College of ...cs4530/2010ios/media/GameKit (PDF).pdf · In-Game Voice GKSession Bluetooth Internet with Sockets GameKit Programming Guide GameKit

Configure AVAudioSession singleton for playback and record

Implement 2 GKVoiceChatClient protocol methods

- (NSString*) participantID

- (void) voiceChatService:(GKVoiceChatService*)voiceChatService sendData:(NSData*)data toParticipantID:(NSString*)participantID

Implement GKSession data receive handler

- (void) receiveData:(NSData*)data fromPeer:(NSString*)peer inSession: (GKSession*)session context:(void*)context

Set GKVoiceChatService system singleton client

[[GKVoiceChatService defaultVoiceChatService] setClient:clientObject];

Initiate voice chat session

[[GKVoiceChatService defaultVoiceChatService] startVoiceChatWithParticipantID:otherPeerID error:nil];

GameKit Programming Guide