Game Center Turn-Based Multiplayer isn't working properly

Has anyone else had trouble with Game Center’s turn-based multiplayer recently? When Apple released iOS 8.3 on April 8th, the Game Center turn-based multiplayer in our app went from working pretty much perfectly to almost totally broken. When the app was in focus, new moves were not shown on screen. Also, push notifications did not occur. If a user would look at the Game Center screen that shows turns waiting, it would correctly show that they had a turn waiting, but no one exits the app to check this or reloads their game to check if it’s their turn. Users expect the game to progress in real-time if they’re looking at the main game screen. This issue appeared to affect ALL games that use GC’s turn-based multiplayer that were running iOS 8.3 (previous iOS versions were not affected). We filed a bug report with Apple, and it was marked as a duplicate. Also, we found other developers that were experiencing the same problem: http://stackoverflow.com/questions/29568913/endturnwithnextparticipants-doesnt-trigger-receivedturneventformatch-after-upda

When iOS 8.4 was released on June 30th, things were fixed for a time. Now, things are partially broken again. The same thing that was happening with iOS 8.3 is happening again, except that GC “it’s your turn” push notifications are being displayed IF the app is suspended. A new problem is that tapping the “it’s your turn” banner or “would you like to accept the game invitation” banner now will open Game Center and then a popup window showing our app in the app store, instead of opening the app and loading the game like is supposed to happen. The most disturbing part this time is that a different GC turn-based multiplayer app that I know was developed using Xcode (I have spoken with the developer) that previously WAS affected by the iOS 8.3 issue is NOT affected by the latest issues. That other app appears to be working perfectly.

This issue has been very frustrating for us and has affected reviews, downloads, and revenue.

Is there an issue with Corona’s use of GameKit? Is it using some deprecated classes? I found this iOS 8 release notes document that shows that there are some deprecations for GameKit regarding player identification strings: https://developer.apple.com/library/ios/releasenotes/General/WhatsNewIniOS/Articles/iOS8.html#//apple_ref/doc/uid/TP40014205-SW17

Brent or anyone at Corona: Any insights here? We’re desperate to get things working again.

Hi @drewns,

I understand this is a problem for you. Can you file a bug report that shows what is happening? The engineers will especially need this to investigate what may be going on, so if you can file it a.s.a.p., I can push for some exploration into the issue.

Thanks,

Brent

Brent,

Thank you for your quick response. I will file a bug report with more details immediately.

-Andrew

Thanks Andrew. When you file it and get a bug #, please post it here for reference.

Brent

Brent,

I’ve received word from Apple (via a bug report I filed with them) that they believe that this issue has been addressed in the latest iOS 9 beta. They would like me to test with that build and get back to them. I’m going to test that before submitting anything to Corona Labs. I will let you know how it goes.

Thanks,

Andrew

Brent,

I tested our app with 2 devices running iOS 9, beta 5 and the results were, unfortunately, not good. Same problem as with 8.4, except it was worse in that the gameNetwork.show(“matches”) call didn’t show the player’s matches. Instead, the “create new match” screen was displayed (same thing that happens if you don’t have any matches to show).

I have submitted a bug report to you guys and included a basic app to test with. It demonstrates the problem we’re seeing. The case number is 42147.

I really appreciate you guys taking a look at this. It’s frustrating not knowing if this is an Apple issue or a Corona issue. Either way, we’re desperate to get the multiplayer portion of our app working 100% correctly again.

Thanks,

Andrew

Brent,

Is there a place on the website where I can see updates for the bug report I submitted? Can you provide any updates on this issue? I appreciate your help.

Thanks,

Andrew

Hi Andrew,

I haven’t received an update from engineering yet. These kind of bugs are the hardest to reproduce on our end because it entails actually setting up a real “live” game with multiplayer interaction. Hopefully we can get something together soon and see if our results match yours.

Brent

Brent,

Good morning. Any updates on this issue? The multiplayer feature of our app is still DOA. Thank you for your help.

-Andrew

Hi Andrew,

I’m in the process of trying to get a working setup between two GC accounts so I can test your code. As you likely know, that setup is a fairly exhaustive process, and multiplayer is even more tricky to test, but I’m making some progress and I’ll keep you posted.

Thanks,

Brent

Hi Andrew,

I might have some positive news for you. I managed to get two iOS devices speaking to each other using your sample, with some modifications. The biggest change I made – meaning, the change that seems to have made all the difference – was that I assigned the “requestCallback” listener to all matches using this command:

[lua]

gameNetwork.request( “setEventListener”, { listener = requestCallback }

[/lua]

If you look at our docs here…

https://docs.coronalabs.com/plugin/gameNetwork-apple/request.html

…you’ll see that using that “sets the event listener for all matches”, essentially like an over-arching assignment of the listener function for matches.

The result of this is that GC now sends the data back and forth, and I get a response on one device when I call “endTurn” on the other device. I can continue doing this like volleying a tennis ball back and forth, and it updates (triggers the listener) back and forth just like I’d expect it to.

Anyway, can you please try to implement that in your app and see what happens?

Note that I’m not dismissing what appears to be a legitimate bug in Corona on this. It seems that the listener which you can typically assign “inline” with all of the gameNetwork.request() calls is not sending all of the data to the listener specified therein (only some of it, I think). So basically, we need to continue exploring what is going on and fix it in the Corona core if we determine it’s a bug. In the meantime, however, please try my approach above and see if you can get it working like you had it in iOS 8.3.

Best regards,

Brent

Brent,

Thank you for the in-depth information. I already use the “setEventListener” in our live app. I just neglected to put that line in the test app I sent you. In the test app, I tried inserting the “setEventListener” code first immediately after the “gameNetwork.init” call at the bottom. I also tried moving it to the “initCallback” listener, in case Game Center wasn’t fully initialized when I was sending the “setEventListener” request. In both cases, the result was the same: no dice. The behavior is exactly the same as I saw before. When one device creates a game and makes a play, the other device gets a banner notification telling them about the game invite. When I tap the banner, instead of the app opening, Game Center opens and shows a view of the app store. If I go to the app by accepting the invite in Game Center, the turn does not update when the app opens. If I go to “Continue Game”, I can see that it’s my turn and can “continue” the game. If I make a play, the first device never sees the play come back. If I go to “Continue Game” on the first device, I do see that it’s that player’s turn and can load the data by tapping on the game. The listeners are not being triggered and I do not get the smooth gameplay you described.

I am testing on two devices that are both running iOS 9, Beta 5, but I was having this same problem when I was testing the live app on two devices running iOS 8.4. The only other weird thing is that when I go to build for iOS in Corona (latest public build 2646), it’s wanting to target iOS 8.3, but I’m running the Xcode version that targets iOS 8.4 (Xcode Version 6.4 (6E35b)). It says: “8.3 (UNSUPPORTED: Local iOS SDK is 8.4 which does not match)”. Could that be the problem? I’m stumped.

This is the line of code I’m using when setting the event listener:

gameNetwork.request( "setEventListener", { listener = requestCallback } )

Brent,

Another update for you. This morning I downgraded to Xcode version 6.3.2, built the test app (no warnings from Corona this time), and tested it on my devices. Same issue. It appears that the Xcode version doesn’t seem to be the issue in this case.

I’m very encouraged that you were able to get things working properly. I’m just racking my brain trying figure out how with the same test app we are seeing different results. Can you tell me EXACTLY where in the test app you put the “setEventListener” code? The app name I specify on the Corona build screen shouldn’t matter, right? I’m using “GCTest” as the app name and 1.0 as the version, even though I’m using the dev certificate for the live app.

Thanks,

Andrew

Brent,

Just a point of clarification: iOS 8.3 was the version where Game Center turn-based multiplayer was for sure broken for everybody. I only mention this because you described that as being the last version that worked. All versions prior to 8.3 worked perfectly. 8.4 fixed the problem. We released an update to our app after the release of iOS 8.4 mainly to let people know that they needed to upgrade to iOS 8.4 if they were using 8.3. I’m worried now that the update build actually somehow broke what was working in 8.4, even though nothing changed about the gameNetwork code in the app.

-Andrew

Hi Andrew,

Let me clean up my modified project a bit, test a little more, and then I’ll share it with your for testing. In the meantime, a few more points:

  1. What type of provisioning profile are you using? I’m testing with one from my own Apple dev account (Distribution>AdHoc) with Game Center enabled. I then put this “CFBundleIdentifier” inside the build.settings file in the proper place. Of course both of my testing devices (iPhone 5 and iPad Air) are properly configured as devices for that App ID, etc. etc… I assume you’re completely familiar with this process and you’re doing basically the same thing, but it never hurts to confirm…

  2. The “8.3 (UNSUPPORTED: Local iOS SDK is 8.4 which does not match)” message shouldn’t matter. I’m building with that same thing in place using Corona 2646 and iOS 8.4, and it doesn’t affect my successful tests.

  3. We need to get the basic communication between the listeners working before we can tackle all the iOS “banner notifications” and so forth. As you know, there are just too many options in iOS for notifications that appear in different places (badges, notifications, on the lock screen or not, blah blah blah), so that’s a whole new can of worms I don’t want to open yet. My tests so far involve simply having the app communicate between itself while running in the “active” state on both devices (not backgrounded or closed).

Brent

Hi Andrew,

I have moved communication on this to the bug report system so I can share files easier. Please confirm that you are able to test the updated sample project that I attached.

Brent

Brent or other Corona Labs support staff,

Do you have any updates on this issue (Case 42147)? I’ve sent a couple of emails recently, but haven’t heard back.

Thank you,

Andrew

Hi @drewns,

I understand this is a problem for you. Can you file a bug report that shows what is happening? The engineers will especially need this to investigate what may be going on, so if you can file it a.s.a.p., I can push for some exploration into the issue.

Thanks,

Brent

Brent,

Thank you for your quick response. I will file a bug report with more details immediately.

-Andrew

Thanks Andrew. When you file it and get a bug #, please post it here for reference.

Brent