Author Topic: Connection Failures Explanation  (Read 416 times)

Brian Greenstone, CEO Pangea

  • Administrator
  • Hero Member
  • *****
  • Posts: 2121
  • Karma: +282/-138
    • View Profile
Connection Failures Explanation
« on: June 17, 2017, 08:19:46 AM »
I figured I would do a detailed explanation of the Match Connection startup sequence to try and better explain why it fails so often, and what has improved in 12.0.

STEP 1:  GKMatchmaker

When you start a match we invoke the GKMatchmaker dialog which is part of Game Center / iOS.  Once that dialog appears our app isn't even running anymore - it's all in Apple's hands.  Nothing has changed here because nothing *can* change here until Apple decides to fix things on their end.  When a connection fails when this dialog is up it is because Game Center isn't working properly.  In iOS 10 Apple started spewing out all all sorts of debug information to the Console, so we can see what Game Center is doing, and the number of error messages that we see from Game Center / Game Kit is rather mind boggling sometimes.

The bottom line is that nothing has changed here, and nothing ever will unless Apple does it on their end.


STEP 2:  Handshaking

Once GKMatchmaker has found a Match it returns control to Air Wings.  The first thing the game needs to do is choose a Host, so each player picks a random number and sends that number to all the other players.  The player with the highest number wins and is chosen as the host.  However, this is where almost all of the Connection freezes occur at this stage.  Even though Game Center has told us there is a Match and the players are connected, occasionally no data is received from one or more players, so everyone else just sits there waiting for the missing data until it times out.

A while back we thought the solution was to spew out many copies of this "Ro-Sham-Bo" number in the hopes that at least one copy would make it there.  It's unclear if this has made any difference at all.  In certain rare cases it might, but generally speaking if a player's data stream isn't working properly then sending 1 or 1,000,000 copies of it won't matter because they are never received.

Once again, nothing we can do about this since this has been a long-standing bug in Game Center.


STEP 3:  Setup

This is where things are better in 12.0.  Once the Host has been chosen he first arranges the players in a lineup and sends that to all of the other players so that everyone knows the proper player order.  Next, the Host picks the Level to play and sends that to the other players.  Once the other players receive the Level Number the game begins.

The problem is that according to the Game Center docs there are two ways to send Data:  reliable and unreliable.  Unreliable data is not guaranteed to arrive, and not guaranteed to arrive in order, but its faster.  This is how the gameplay data is sent when planes are moving around and firing.  But for the Setup all data is send Reliably.  However, we discovered years ago that "Reliable" data was no more likely to arrive than "Unreliable" data.  Those packets got lost all the time.  However, up until now we had always assumed that if they did arrive, they at least arrived in order.  This was not the case, and occasionally the level # would arrive before the player lineup.  This caused some synchronization problems that ended in either a crash or just something crazy going on.  If the code noticed the problem then it would abort with a Connection Failure message.

Now that we know the Reliable data is no different at all from the Unreliable data I've changed v12.0 to account for this, and it handles these situations much better.  As a result I estimate there should be maybe 25-30% fewer connection failures than before.


STEP 4:  Game Play

Sometimes a connection just plain sucks.  In these cases you'll see players skipping all over the place, flying off the map for a few seconds, etc.  This is not a bug on anyone's part, it's simply crappy network connections.  The game attempts to detect these sorts of things and deal with it.  In a 2-way match it's impossible to determine if the bad connection is on the sender or receiver's side, so it can't do anything about it.  In a 3 or 4 way match, however, if all of the players agree that one of the other players is going berserk then that player gets kicked out.  But those cases are quite rare because most of the time one player will have a perfectly good connection with the "bad" player even tho the others are having serious trouble.


I hope that helps explain a little about what's going on.

-Brian
« Last Edit: June 17, 2017, 08:32:26 AM by Brian Greenstone, CEO Pangea »

James

  • Full Member
  • ***
  • Posts: 149
  • Karma: +13/-10
  • All in fun
    • View Profile
Re: Connection Failures Explanation
« Reply #1 on: June 17, 2017, 09:41:26 AM »
Brian...
Might it help getting a matchup if the game defaulted to 2 player instead of four?  My reasoning... when a player selects the 2-player option he has reduced his odds of a matchup because he can ONLY match with someone who has also selected 2-player (or someone who's 4-player choice fell apart).  I mean, since the odds of getting a good 4 player match are slimmer, why not make 2-player the default.  I think you'll have less complaints of failed matchups. As it goes now, most players are going to use the default 4 and then be disappointed when things fall apart. 

Brian Greenstone, CEO Pangea

  • Administrator
  • Hero Member
  • *****
  • Posts: 2121
  • Karma: +282/-138
    • View Profile
Re: Connection Failures Explanation
« Reply #2 on: June 17, 2017, 05:13:15 PM »
Yes 2-way matches are many times more likely to work, but 2-way matches are boring, so I try to get as many players in them as possible which is why it defaults to 4.

-Brian

James

  • Full Member
  • ***
  • Posts: 149
  • Karma: +13/-10
  • All in fun
    • View Profile
Re: Connection Failures Explanation
« Reply #3 on: June 17, 2017, 08:27:30 PM »
Yes 2-way matches are many times more likely to work, but 2-way matches are boring, so I try to get as many players in them as possible which is why it defaults to 4.

-Brian
I agree that two player matches are boring at least in the big maps.  Just like four player is crazy in the death match or octogon.  Of course if you get bored easy you could select the four player option. I'm just thinking about player retention.  New players will likely do the 4 player default and be disappointed by apples matchup issues.  Not to mention...even a four player game ends up a two player game after a couple minutes.   Imho