Sign In Register

How can we help you today?

Start a new topic

Matchmaking not work from unity

Hi.

I'm trying to do a matchmaking from unity but it seems it doesn't work . I tested my match config in TestHarness and everything is fine . I can create/join match without any problem in TestHarness , But calling matchmakingrequest do nothing from unity . My unity code snippet is like this :


   

new MatchmakingRequest().SetMatchShortCode("TEST_MATCH").SetSkill(0).Send(response =>{});

 

After calling this the only thing happen is getting request Response like this :


 

GS: RECV:{"@class":".MatchmakingResponse","requestId":"636213876770693433_3"}

 

I get no error,no "matchFoundMessage",no "MatchNotFoundMessage",nothing except above message . i even check PendingMatchCollection in mongoDB but there is no record there . The point here is that if I use wrong match ID like "TEST_MATCH1" instead of correct one ("TEST_MATCH") ,Then I get "MatchNotFoundMessage" Error. The period for TEST_MATCH is set to (Period1:15s,Period2:30s,Period3:60s)


Another thing that can help better understand the problem is : When I First Call MatchmakingResuest from TestHarness,Then calling same Request from unity It work and I can join the match successfully but Calling Request first from unity then from TestHarness not work.(Calling First from unity not result to nothing , And in Test Harness it leads to get the Message "MatchNotFoundMessage" after Match Expire time


Shall I publish my game to Live to test matchmaking from unity.


Please help me cause I really stuck here.


Thanks for your answers



1 person has this question

Still No Answers ...

Hi Aboozar,


We've answered your ticket. Please check it for more details. 


Thanks,

Liam

Has this been resolved? I am also having this issue. I don't see a response from GameSparks.

David, The MatchFound- and MatchNotFoundMessage are notifications that you need to tell Unity to listen for. 

GameSparks.Api.Messages.MatchNotFoundMessage.Listener = YourMatchFoundMethod;

  

Refer to: https://docs.gamesparks.com/tutorials/real-time-services/real-time-matchmaking.html#matchnotfoundmessage-listener

Thanks, Christopher. I had implemented the listeners. I was tabbing between Unity and a browser window. Unity was losing context whenever I tabbed away from it. Any matchmaking requests were lost whenever Unity went to the background.

You need to enable Run in background in the Player settings.

 

Anyone there?
I'm getting this problem.

My build setting: Run in background, setup the game similiar with tutorial from GameSparks, something like Authencation, matchmakingrequest done, but listener from MatchNotFoundMessage and MatchFoundMessage didnt do anything? My game is just in preview mode
pls help me

What is your listener code ?

 

oh thank god, you are here
this is my listener code:

MatchNotFoundMessage.Listener = (msg) => {
			playerList.text = "No Player Found ...";
		};
		// register callback for Matchrequest if found a match
		MatchFoundMessage.Listener += OnMatchFound;

 

private void OnMatchFound(MatchFoundMessage _msg){
		Debug.Log("Found Match");
		StringBuilder strBuilder = new StringBuilder ();
		strBuilder.Append ("Match Found ...");
		strBuilder.AppendLine ("Access Token: " + _msg.AccessToken);
		strBuilder.AppendLine ("Host: " + _msg.Host);
		strBuilder.AppendLine ("Port: " + _msg.Port);
		strBuilder.AppendLine ("MatchID: " + _msg.MatchId);
		strBuilder.AppendLine ("Amount Players: " + _msg.Participants.Count());
		strBuilder.AppendLine ("____________________");
		foreach (MatchFoundMessage._Participant player in _msg.Participants) {
			strBuilder.AppendLine ("Player: " + player.Id + "\tName: " + player.DisplayName);
		}
		playerList.text = strBuilder.ToString ();
		startGamebtn.gameObject.SetActive (true);
	}

  and here my MatchMakingRequest:

 

public void FindMatch(){
		new MatchmakingRequest ().SetMatchShortCode ("trumpMatch").SetSkill (0).Send ((response) => {
			if(!response.HasErrors){
				Debug.Log("Collected to Match");
			}
			else {
				Debug.Log("Failure");
			}
		});
	}

 Another question: Could you guide me how to set matchmakingrequest expire. E.g 60s
Thanks

Default MMR timeout is 60 seconds. Is it correct that trumpMatch has Manual matching disabled ?

Hi Christopher Bonnell, I was resovle the problem with mmr, now i found another player who also using mmr, 

could you guide me steps to create my room for waiting another player? I read the tut about findpendingmatch and joinpendingmatch, but too many infomation, and its too hard.

thanks

The match response will contain the list of players... just print them out.

 

"You need to enable Run in background in the Player settings." - I can't find this setting in Unity. Where is it? I just want the Editor to Run in the background while I create a MatchmakingRequest in the Test Harness. I don't want my iOS or Android builds to run in the background when I ship.


1 person likes this
Login to post a comment