12 Replies
      Latest reply on Apr 12, 2019 11:14 AM by Dr_Beta
      Dr_Beta Level 1 Level 1 (0 points)

        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?

        • Re: Game Center real time multiplayer
          KMT Level 9 Level 9 (13,915 points)

               >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.

            • Re: Game Center real time multiplayer
              Dr_Beta Level 1 Level 1 (0 points)

              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.

                • Re: Game Center real time multiplayer
                  KMT Level 9 Level 9 (13,915 points)

                       >but it got rejected.

                   

                  Interesting, thanks - I'd be curious what the rejection was for.

                   

                       > I have the Pong mechanics down in SpriteKit

                   

                  Good on you - moving on, and speaking of swift-centric tutorials...have you seen this one yet? ttps://www.codementor.io/wolf1981/building-a-real-time-ios-multiplayer-game-with-swift-and-websockets-jibk2xrrr

                    • Re: Game Center real time multiplayer
                      Dr_Beta Level 1 Level 1 (0 points)

                      My game was a game where you tapped a button for 11 seconds and see how many taps you could get, it had a leaderboard for your best score too.  The game was going to be free and ad-free, but I got rejected for App Store Review Guideline 4.2 - Design - Minimal Functionality

                       

                      I submitted a appeal and here is what they said

                       

                      We are writing to let you know the results of your appeal for your app, Tap That Button!.

                       

                      The App Review Board evaluated your app and determined that the original rejection feedback is valid. Your app does not comply with:

                       

                      Design 4.2

                       

                      We appreciate your efforts to resolve the 4.2 issue and understand your desire to provide a fun game app to your users. However, the current version of the app submitted for review provides a limited user experience.

                       

                      In order for your app to be reconsidered for the App Store, please revise your app to include native, interactive iOS features that take advantage of the iOS platform. For more information about developing apps for the App Store, visit the Develop section of the Apple Developer website.

                       

                      We hope the resources available on the Apple Developer website will assist you to resolve this issue.

                       

                      Best regards,

                      Yolanda

                      App Review Board

                       

                       

                      But that is off-topic, I have seen that tutorial before, but I would like to make a Game Center based multiplayer experience. It is seamless and amazing to use, but I have no idea how to do it. I also would like to know how sync data, two Integers (Wins VS. CPU, and Wins VS. Online Players) to make sure that the scores are synced, to put on leaderboards and in my UI, do you know how to this also?

                        • Re: Game Center real time multiplayer
                          KMT Level 9 Level 9 (13,915 points)

                          I've done multi-player w/BT in the past - have you gotten far enough in your plans to decide what type network would work best for you?

                           

                          I think today, the pref. is for Wi-Fi...but that assumes more than just a handful of players, which today seems a bit old hat

                           

                          I'm trying to locate something for you that helps entry to the topic easy enough that you can transition to the docs and work with current tools...not an easy task, I'm afraid - I tend to lean on the docs. I'll ping this thread if I find something lower level.

                  • Re: Game Center real time multiplayer
                    PBK Level 7 Level 7 (3,105 points)

                    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