Game Center Finding a Match Programmatically

后端 未结 3 946
青春惊慌失措
青春惊慌失措 2021-02-13 16:00

I just can\'t figure out how this works. What I am trying to do is let two players play a game if a third player joins it can instantly join the game, if the fourth and last pla

3条回答
  •  伪装坚强ぢ
    2021-02-13 16:32

    Your using the Apple iOS Game Center GKMatchmaker class. I'm assuming you are using a peer to peer connection, not hosted.

    The GKMatch class gives the playerIDs array to you.

    @property(nonatomic, readonly) NSArray *playerIDs
    

    This is an ordered list, so you might be able to use it to select the first player call addPlayersToMatch.

    Linked below is some documentation.

    http://developer.apple.com/library/ios/#documentation/GameKit/Reference/GKMatchmaker_Ref/Reference/Reference.html

    http://developer.apple.com/library/ios/#documentation/GameKit/Reference/GKMatch_Ref/Reference/Reference.html

    http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Conceptual/GameKit_Guide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40008304

提交回复
热议问题