4

I am finishing up an update to a 4 player Game Center enabled game and am suddenly having issues with spurious player disconnection messages that I did not have in the previous version. What is more odd is that not all devices connected to the match are receiving the message. One device will think the player is disconnected, but there is still messaging passing from the (supposedly) disconnected player to the other players.

These messages are coming straight from the match instance via match:player:didChangeState: messages so I don't think it would be anything in my code, but it doesn't make much sense. The game can progress for 10+ minutes with no problems and once one errant disconnect comes it, the rest fall out pretty quickly.

I have searched the web with every search term I can think of to see if others have seen this kind of behaviour and it appears that it is unique. It has to be something in my code, but I can't even think of how to get to the bottom of it.

Any help would be GREATLY appreciated, Cameron

cambrose
  • 41
  • 1
  • Sorry, wasn't quite clear there. I'm assuming the player disconnects come from Apple's Game Center servers so I would assume there wouldn't be something in my code generating those messages. As I stated in my last paragraph, because this does appear to be a unique issue, I can only assume it is something in my code. I just don't know how to debug this. – cambrose Apr 07 '12 at 05:46
  • I have seen a number of posts regarding problems when in the Game Center sandbox. Could this be an anomaly of the sandbox? Seems unlikely as well. Would not make for a very good test environment. – cambrose Apr 07 '12 at 05:49
  • Have you added plenty of logging in your code? Comms timing related bugs are hard to track down without it (and sometimes with it!) – Mitch Wheat Apr 07 '12 at 05:50
  • I have extensive console logging, but that is only so useful in this case as again, the messaging is coming directly from GameKit. I've confirmed this with an investigation of the execution stack. I hooked up two of the four devices to stations so I could see at least two console outputs at the same time and confirmed that a false player disconnection at one device is not registering on the other. I think at this point, my only solution will be to implement a secondary mechanism to verify if the player has actually dropped. – cambrose Apr 07 '12 at 21:02
  • No solution there either. The player disconnected message does seem to indicate a real loss of communication between the affected player and receiving device. Guess I'll submit a TSI to Apple and see if they can offer any insight as to what could cause this behaviour. – cambrose Apr 08 '12 at 06:55
  • Any response on this problem? I am implementing multiplayer in our game using Game Kit and I am facing the same issue. – Ricardo Sanchez-Saez May 27 '12 at 18:42
  • +1 to say I am seeing this a lot too. Also sometimes the sandbox just seems to disappear, except player authentications are fine but invitations and game connections simply get no response. But these spurious disconnects are very annoying - at the moment I would be better off ignoring match:didChangeState: completely. – theLastNightTrain Aug 22 '12 at 15:05
  • Same problem here. The messages say CONNECTION INTERRUPTED. – William Jockusch Apr 27 '13 at 01:13
  • Another culprit that might possibly be the case: make sure you're port forwarding the necessary ports if you're on a router with a firewall. http://support.apple.com/kb/HT4307. I'm just starting to test 4-player live matches with these setup and it's looking optimistic. – Shaun Budhram Sep 21 '13 at 11:16
  • I am experiencing this exact same issue now. Once a "connect" is received via "didChange state" for all players, then a spurious player disconnect is immediately received from Game Center "didChange state" method. – UncleT Apr 03 '20 at 21:55

1 Answers1

-1

Make sure to call this:

    //Finalize
    [[GKMatchmaker sharedMatchmaker] finishMatchmakingForMatch:match];

After all players have connected. I was having this problem and it seems to have stopped the spurrious disconnects in my case.

Shaun Budhram
  • 3,690
  • 4
  • 30
  • 41
  • I'm having the same spontaneous disconnections. Calling -finishMatchmakingForMatch didn't help my situation at all. – BGreenstone Apr 21 '15 at 14:55