Sign In Register

How can we help you today?

Start a new topic

Matchmaking problem in Unity. MatchNotFound error.

Hello,


I am trying to add matchmaking in my game and I cannot seem to get it to work. First off, here is my code:

public void FindPlayers()
        {
            Debug.Log("Attempting matchmaking...");
            new GameSparks.Api.Requests.MatchmakingRequest()
                .SetMatchShortCode("PLAYER_BATTLE") // set the shortCode to be the same as the one we created in the first tutorial
                .SetSkill(0) // in this case we assume all players have skill level zero and we want anyone to be able to join so the skill level for the request is set to zero
                .Send((response) => {
                    if(response.HasErrors)
                    {
                        Debug.LogWarning("<b>GSM|</b> Matchmaking error: <b>" + response.Errors.JSON + "</b>");
                    }
                });
        }

 This is in another file.

private void Start()
        {
            GameSparks.Api.Messages.MatchNotFoundMessage.Listener = (message) => {
                Debug.LogWarning("No matches were found.");
                SetStatusText("No Match Found...");
            };
        }

  For some reason when I call the FindPlayers() method, the callback method I added in the second snippet of code never gets called! I have no idea why this is happening. I am following the documentation but it is pretty vague.


Does anyone know how to fix this? If I need to provide more, please let me know.


Also, this post https://support.gamesparks.net/support/discussions/topics/1000082540 was pretty much the exact problem I have now, except I didn't find a solution to it yet.


Thank you,

Kyle


Edit:

I ran a test in the "Test Harness" and got this:

image


Notice it says "action: unknown"


I am really not sure what is wrong here...

Hello.

For the Test Harness, try removing the action field.


2 people like this

I removed the action field and I got no error. However, I got nothing else back. All I got was "@class": ".MatchmakingResponse"

I have no idea what is wrong...

Hi Kyle

.MatchmakingResponse is the correct response.
You need to wait until the time set in your matchmaking thresholds is up and you will receive a message.
If a match is found you will get a match found message if not you will get a match not found message.

Regards
Katie

 

I am following the official documentation and it confuses me a little bit. It sets the threshold as 3600, but later on it says if we wait about 10 seconds(which we set up in the game's portal), then the message will occur. The documentation walked you through setting up a threshold, but it never mentioned setting anything to "10 seconds." When I get home I will try to lower the threshold and see what happens...

1 person likes this

I changed the "Period" under Thresholds to 10 seconds and got the same exact result... Anyone have any ideas what is causing this? It is honestly probably something very easy to solve but I am new to using GameSparks so I would not know.

Hi Kyle

Are you testing this on the test harness?
Can you show me a screenshot of the match set up.

Regards
Katie

 

I deleted the threshold and then added a new threshold and changed the value to 10, and it works great. However, 10 was quite fast. I found that changing the value to 250 gave a good amount of time for me. For some reason, 250 seconds is actually only like 5 seconds but it is okay

How this threshold algoritm works? I'm following tutorial there is writen 600. How many life seconds is this 600 thresholders?

And What about Unity error? Fixed?

Login to post a comment