Game Center real time multiplayer

Hello Game Center forums! I am working on a real time Pong game and I can't figure out how to do real time multiplayer matches. Apple's docs are confusing and there are not any Swift 4/5 tutorials. Can you tell me how to do it or recommend a tutorial?

Replies

>I can't figure out how to do real time multiplayer matches.


Where are you in the app and what part dealing w/real time are you stuck on? Do you have at least one multi-player game under your belt? Have you built networking apps in the past?

>Apple's docs are confusing


If you mean non-trivial at times, sure. Which parts...perhaps someone can shed light.

You have a couple of challenges. The best document is:

https://developer.apple.com/library/archive/documentation/NetworkingInternet/Conceptual/GameKit_Guide/Introduction/Introduction.html?language=objc#//apple_ref/doc/uid/TP40008304


A 'multi-player real time GameKit game' requires solving the following issues:

1) defining the game on one computer

2) authenticating Game Center players

3) starting a match between two players over GameKit

3) transmitting information between two computers using GameKit

4) synchronizing the two computers so the game flows correctly


Your other issue is Swift versus Objectove C. Lots of issues (i.e. authentication and transmission) are explained in tutorials in Objective C because GameKit came out before Swift was conceived.


One 'learning' approach to consider is:

1) use MCSession to link two computers running on the same WiFi network and swap data.

2) construct a two player game using MCSession

3) add in Game Center Leaderboards

4) after doing 1-3, transition the game to GameKit

Post not yet marked as solved Up vote reply of PBK Down vote reply of PBK

Dr_Beta wrote (in response to KMT):

I added leaderboards to one game, but it got rejected. I have the Pong mechanics down in SpriteKit, and trying to add multiplayer to my game.


On the off-chance that you meant this comment as a to 'Reply' to my message above, then please 'Reply' to my message above not to other message threads. Thanks.


By the way, based on your comments I strongly recommend you do #1and #2 in the 'learning approach'.

I was replying to to KMT, I am more looking for online, I have solved #1 and #2

You can get your app approved if you link two devices in the same room running on the same WiFi using MCSession.

Good luck!


bye.