How to use Unity Apple GameKit Plugin For Rule-based matchmaking?

Hello,

**I'm Using **

  1. Unity 6 LTS
  2. Unity Apple GameKit + Core plugins
  3. Turn-based matchmaking interface w/ 2 players max
  4. App Store Connect API for rule-based matchmaking

I have already

  1. enabled game center in app store connect (I think)
  2. authenticated players and matched via friend request

I am stuck

  1. Using queues to match players automatically

I'm working on a rule-based matchmaking system which aims to place two players against each other into a GKTurnBasedMatch. I have a simple Unity Project that correctly authenticates a user and proceeds to send a matchmaking request. The matchmaking script utilizes the Unity plugins' GKTurnBasedMatchmakerViewController.Request(...) request function with a GKMatchRequest.Init() request configured with a QueueName equal to the App Store Connect API Queue I created.

The queue I created is also linked to a ruleset with a very basic rule that checks if the properties contains a key called 'preference' that contains a string value for what side the player wants to play for this match. If during the matchmaking, the preferences between players are different, then the match is made and both players should join the match; each player gets to play the side they have chosen. I have my rule expression designed to just check if the preferences are not equal:

requests[0].properties.faction_preference != requests[1].properties.faction_preference

When I launch the game with two physical iPads and begin the matchmaking request, each player is immediately presented with two options:

  1. Invite a friend, or
  2. Start game

The Problem: Inviting a friend works to get two players into a game, but queue seems to not matter, and clicking start game will just put the current player into its own match (no one joins).

The Question: How do I get queue based matchmaking to work in Unity for a Turn-based match with only two players who are able to select the enemy side they want to play dictated by a rule that compares enemy play-side preferences?

Resources I've used:

Answered by Vision Pro Engineer in 858685022

Hello @AlexAtBlueMilkApps , thank you for your question!

If you have the time, would you mind submitting any feedback using Feedback Assistant, and then include the ticket number in your post here? Additionally, if you include the bundle id in the ticket, that will help us pin point what might be happening on our end.

It appears that our documentation has fallen behind, so let me clarify the way matchmaking works for turn based games using GameKit:

First, turn based games in GameKit do not support rules based matchmaking. Please send us a feature request using Feedback Assistant if this is something you'd like us to add in the future.

Second, turn based games handle matchmaking differently than real time games. Here is the flow you should follow:

  1. Player 1 (P1) creates a game session (S1) and initializes the session turn to slot 0.
  2. P1 takes a turn and moves the S1 turn to slot 1, which does not yet have a player to fill it.
  3. S1 is put in the matchmaking pool because of the empty turn slot.
  4. Player 2 (P2) attempts to start a session. The server first checks to see if P2 is a match for the session S1. If so then P2 is placed into slot 1 and is able to take a turn immediately. If not then a new session S2 is created with P2 in slot 0. P2 can take a turn immediately.

If you have started a match without taking a turn, there will not be a slot of available for your other devices to matchmake into. What is likely happening is that both of your devices are starting a match, never taking the first turn, and so don't see each other as available to match.

Let me know if you have any questions!

Hello @AlexAtBlueMilkApps , thank you for your question!

If you have the time, would you mind submitting any feedback using Feedback Assistant, and then include the ticket number in your post here? Additionally, if you include the bundle id in the ticket, that will help us pin point what might be happening on our end.

It appears that our documentation has fallen behind, so let me clarify the way matchmaking works for turn based games using GameKit:

First, turn based games in GameKit do not support rules based matchmaking. Please send us a feature request using Feedback Assistant if this is something you'd like us to add in the future.

Second, turn based games handle matchmaking differently than real time games. Here is the flow you should follow:

  1. Player 1 (P1) creates a game session (S1) and initializes the session turn to slot 0.
  2. P1 takes a turn and moves the S1 turn to slot 1, which does not yet have a player to fill it.
  3. S1 is put in the matchmaking pool because of the empty turn slot.
  4. Player 2 (P2) attempts to start a session. The server first checks to see if P2 is a match for the session S1. If so then P2 is placed into slot 1 and is able to take a turn immediately. If not then a new session S2 is created with P2 in slot 0. P2 can take a turn immediately.

If you have started a match without taking a turn, there will not be a slot of available for your other devices to matchmake into. What is likely happening is that both of your devices are starting a match, never taking the first turn, and so don't see each other as available to match.

Let me know if you have any questions!

How to use Unity Apple GameKit Plugin For Rule-based matchmaking?
 
 
Q