Microsoft Azure PlayFab logo
    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Add-ons
    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA
  • Runs on PlayFab
  • Pricing
    • Blog
    • Forums
    • Contact us
  • Sign up
  • Sign in
  • Ask a question
  • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges
  • Home /
  • General Discussion /
avatar image
Question by Hans Weber · May 03 at 01:24 AM · multiplayerTitle Data

Next step after finding a match

hello,

ich am sorry for the stupid question but I have just gotten started with playfab and have a small problem, that I am incapable of solving myself.

I am working on a turnbased 1v1 strategy game using unity and for networking mirror.

So far I have followed a video-tutorial series which unfortuntelly abruptly ends after establising matchmaking and I am not quite sure how to continue.

Right now I submit a ticket from my main menu and want the game to switch to the "GAME" scene once the match is found. At the same time the server is supposed to spin up and let both players connect. Is there a way to do this with Playfab, or is this rather a Unity connected question?

Comment

People who like this

0 Show 0
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
Best Answer

Answer by Made Wang · May 03 at 05:31 AM

Referring to the steps in Matchmaking quickstart - PlayFab | Microsoft Docs, if you have hosted the server to PlayFab and enabled server allocation for the matchmaking queue, then when the match is successful, the player can call GetMatch to get the server's IP and port.

If you don't host the server to PlayFab then you need to manually start your server and connect the client to the server after the match is successful, this needs to be done by yourself.

Comment

People who like this

0 Show 0 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image

Answer by Hans Weber · May 05 at 02:57 AM

Thank you for the quick answer, I was tring this, but so far I get the first debug filled out, while unity doesn't receive anything for the IPV4Adress:

public void OnGetMatch(GetMatchResult _result)                                                          // get the data needed to connect the player ot the server and do so
{
    queueInfotext.text = $"{_result.Members[0].Entity.Id} vs {_result.Members[1].Entity.Id}";           // display who the player is up against

    Debug.Log("before IP: " + _result.ServerDetails.IPV4Address);
    PlayFabBattleClient.matchAddress = _result.ServerDetails.IPV4Address;                               // set the playfab object in the battle-scene up to be able to connect to the server
    
    Debug.Log("before Port" + (ushort)_result.ServerDetails.Ports[ 0 ].Num);
    PlayFabBattleClient.matchPort = (ushort)_result.ServerDetails.Ports[ 0 ].Num;
    
    Debug.Log("Player will be connected to ip: " + PlayFabBattleClient.matchAddress + ", Port:" + PlayFabBattleClient.matchPort);
    
    SceneManager.LoadScene( "Battle" );                                                                 // load the scene
}

Do you maybe know what the problem could be?

PlayFabBattleClient.matchAddress

and

PlayFabBattleClient.matchPort 

are on a sript in another scene where they will be read, to connect the player to the right match:

static public ushort matchPort = 0
static public string matchAddress = "";

Thank you for your help.

Comment

People who like this

0 Show 5 · Share
10 |1200 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Hans Weber · May 04 at 01:22 PM 0
Share

to be precise I get this error:

NullReferenceException: Object reference not set to an instance of an object
choseLoadouttoBattle.OnGetMatch (PlayFab.MultiplayerModels.GetMatchResult _result) (at Assets/Scripts/UI/choseLoadouttoBattle.cs:187)

Line 187 is the first Debug message:

Debug.Log("before IP: " + _result.ServerDetails.IPV4Address);
avatar image Hans Weber Hans Weber · May 05 at 09:00 AM 0
Share

No, I think I have figured this out. I can't get a server back, when my build is unhealthy, right?

avatar image Made Wang Hans Weber · May 05 at 09:56 AM 1
Share

Right, you need to deploy the server to PlayFab correctly.

You will need to integrate your server with GSDK, and we recommend using LocalMultiplayerAgent to verify that the necessary integration has been done before deploying.

Show more comments
Show more comments

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Navigation

Spaces
  • General Discussion
  • API and SDK Questions
  • Feature Requests
  • PlayStream
  • Bugs
  • Add-on Marketplace
  • LiveOps
  • Follow this Question

    Answers Answers and Comments

    2 People are following this question.

    avatar image avatar image

    Related Questions

    Legacy Server Upload or Easy Migration 1 Answer

    1 xbox account linked to 2 playfab master accounts and unique names 1 Answer

    Title Data - Player Data ambiguties 1 Answer

    Can I specify remote config for group of players or with different OS, for example I want to change something for only IPhone users. I am using playfab with unity. 1 Answer

    News with Claimed Rewards 1 Answer

    PlayFab

    • Multiplayer
    • LiveOps
    • Data & Analytics
    • Runs on PlayFab
    • Pricing

    Solutions

    • For Any Role

      • Engineer
      • Designer
      • Executive
      • Marketer
    • For Any Stage

      • Build
      • Improve
      • Grow
    • For Any Size

      • Solo
      • Indie
      • AAA

    Engineers

    • Documentation
    • Quickstarts
    • API Reference
    • SDKs
    • Usage Limits

    Resources

    • Forums
    • Contact us
    • Blog
    • Service Health
    • Terms of Service
    • Attribution

    Follow us

    • Facebook
    • Twitter
    • LinkedIn
    • YouTube
    • Sitemap
    • Contact Microsoft
    • Privacy & cookies
    • Terms of use
    • Trademarks
    • Safety & eco
    • About our ads
    • © Microsoft 2020
    • Anonymous
    • Sign in
    • Create
    • Ask a question
    • Create an article
    • Post an idea
    • Spaces
    • PlayStream
    • Feature Requests
    • Add-on Marketplace
    • Bugs
    • API and SDK Questions
    • General Discussion
    • LiveOps
    • Explore
    • Topics
    • Questions
    • Articles
    • Ideas
    • Users
    • Badges