1

I end the turn like this , but i want to give an time-out for searching for player , issue that i'm having is turnTimeout only works for active players , but not working for status "matching" . Is there another way to stop matchmaking after a give time ? please help me out . thanks

currentMatch.endTurn(withNextParticipants: [nextParticipant], 
turnTimeout: 15.0, match: data!) { (error) in  
            if ((error) != nil) {  
                print("Error Oops, there was a problem.  Try that 
                again.",error!)  
            }  
        }  
        statusLabel.text = "Game has ended"  
   }  
nan
  • 11
  • 3

1 Answers1

1

GKTurnbasedMatch does not provide any way to do that. But, you can set your own NSTimer. If the timer fires and you haven't found an opponent, you can leave the match.

Thunk
  • 4,099
  • 7
  • 28
  • 47
  • Even lets say i have started the game with 5 players and the matchmaking couldn't find a 4th player(matching state), do i have a way to continue playing with 3 players other than leaving ? – nan May 15 '17 at 09:22
  • Yes, you can continue playing. At the end of the turn, you set the order for the upcoming participants and then end the turn. So, if you have an empty seat when player 3 ends their turn, they can pass the turn back to player 1. But, I don't think you can stop #4 and #5 from still joining at a later time. – Thunk May 16 '17 at 03:34
  • when 3rd Player end the turn and pass to 4th player, then only we know if the 4th player is available or not right ? so is there a way to stop matching for 4th player and go back to 1st player after a timeout or anything? but timeout is not working if the status is matching – nan May 16 '17 at 03:53