question

martinliu1993 avatar image
martinliu1993 asked

Correct Workflow for Client joining dedicated server hosted on PlayFab

I've sucessfully got a UE4 Dedicated Server hosted on PlayFab. On the client side, I've also been able to call "LoginWithCustomID", then "MatchMake" or "StartGame" on the client to connect to the dedicated server.

My question is now what exactly is the correct flow for connecting the client to the dedicated server, and ultimately launching the game on client side? This tutorial indicates that there needs to be calls to "RedeemMatchmakerTicket" and "NotifyMatchmakerPlayerLeft" on server side, but when should those calls happen? What is the general workflow and call flow for those HTTP requests?

Basically, what I'm doing right now is this:

1. UE4 Dedicated Server running on Playfab

2. Client code calls "LoginWithCustomID"

3. Client code calls "StartGame"

4. ???? Then what????? Should the server code be calling now? When do I redeem the match ticket on server side? How does the match ticket that only exists on clients get passed to server?

Custom Game Servers
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
brendan avatar image
brendan answered

I detailed out the steps you'll want to take for having the player join the session in the other thread you have on this, here: https://community.playfab.com/questions/9099/how-to-create-a-custom-ue4-game-server-using-playf.html. One thing I can add is that the matchmaker ticket the client gets back is only valid for two minutes, which is why I recommended that you do the redemption call in the GameMode PreLogin, so that if the player is waiting on data from the server, that doesn't block joining the session.

To get data to the server, you'll want to use Unreal's replication model - if that's not something you're familiar with, I would highly recommend that you consider bringing an experienced Unreal developer into your team, as that engine can be a bit daunting for a developer picking it up for the first time.

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

martinliu1993 avatar image martinliu1993 commented ·

Hi @Brendan, thanks for getting back to me. I am still confused about how to get the ticket Ticket and LobbyID from Client to Server after Client called "StartGame", but before Server called "RedeemMatchmakerTicket". UE4 Client RPC to Server can only happen after we have the dedicated server connected. After I called "LoginWithCustomID", is my client already connected to the dedicated server hosted on PlayFab already?

0 Likes 0 ·
brendan avatar image brendan martinliu1993 commented ·

You may want to post some of your questions to the Unreal forums, as the questions you have actually aren't about using PlayFab, but rather how to use Unreal. In this case, the login call logs your client into PlayFab, and the StartGame/Matchmake calls return the info on the server you need to join. Once you're at that point, you need to have the client join the server by IP Address. One way to do that would be via the APlayerController::ClientTravel in Unreal, but depending on your implementation, you may have a preference for something else, like an online subsystem plugin that manages server connections.

0 Likes 0 ·
martinliu1993 avatar image martinliu1993 brendan commented ·

Hey @Brendan, so in that case, since I hosted my dedicated server on PlayFab with IP: 52.90.223.183, I just need to tell my client to join the server hosted here right?

One last verification of work flow

1. Client calls "LoginWithCustomID"

2. Client connects to Dedicated Server at IP: 52.90.223.183

3. Client calls "StartGame"

4. Client uses Unreal Replication to give Lobby ID, Ticket to Server, by this point client should have connected to Server

5. Server receives Lobby ID, Ticket, calls "RedeemMatchMakerTicket"

Is this the correct flow? The steps that involves UE4 are steps 2 and 4, while PlayFab would be 1,3 and 5

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.