question

draperj81 avatar image
draperj81 asked

Integration with Unreal Dedicated servers

I am looking to use PlayFab to host dedicated servers for my game (variant on the FPS theme). I would like to use Unreal's own replication system and use PlayFab for player authentication, matchmaking and server hosting. When it comes to building the dedicated server executable, I have a couple of questions.

1) Am I still required to create/find/join sessions as done normally in Unreal or is that somehow handled by PlayFab?

2) Am I required to call RegisterGame() on my dedicated server in order to appear in any matchmaking lists?

3) Once matchmake has been called, what is the process for joining the dedicated server? OpenLevel with IP address details or can I just join session?

Thanks

10 |1200

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

brendan avatar image
brendan answered

Sure thing, we have a few people using Unreal in the service - for your specific questions:

RegisterGame is only needed if you plan to host your servers outside PlayFab's custom game server hosting. Here's the tutorial on that: https://api.playfab.com/docs/tutorials/external-game-servers.

The way you find and join servers is via Matchmake(). We return the info on the server (IP/Port), and you connect to it via a normal socket connection, providing the matchmaker ticket so that the server can verify that the user should be joining and get info about the user via RedeemMatchmakerTicket - have a look at this tutorial for more info on this: https://api.playfab.com/docs/tutorials/landing-tournaments/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.

Montana Tuska avatar image
Montana Tuska answered

Hey, also, I built a whole OnlineSubsystem for PlayFab for the Unreal Engine, so you can use the find/join/matchmake and all those fancy things. Friends are added, working on groups. So, I could make a public GitHub if you wanted. It's just a plugin. @draperj81 @Brendan

7 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.

brendan avatar image brendan commented ·

Thanks! One of the goals here is to ensure that developers can help each other as well, so we'd certainly love to have a look at this, if you are planning on making it a public repo.

0 Likes 0 ·
Montana Tuska avatar image Montana Tuska brendan commented ·

@Brendan Here it is, had to make edit my plugin to work on the stable UE4 version since I develop on the promoted branch. Can only be sure it works on 4.15 right now, since Online Subsystem gets a number of updates. Now, to use blueprints with this, you must use the Advanced Sessions Plugin. This is because of the Presence system of UE4. Presence is how players know what friends are playing in Steam or Uplay. Since PlayFab doesn't provide this and doesn't provide proper logout we can't assume presence of players. Might be a draw back I retract later but I'll leave it for now.

Online Session PlayFab 4.15

0 Likes 0 ·
brendan avatar image brendan Montana Tuska commented ·

Thanks again! Our tools team will have a look at getting that linked from our own site.

0 Likes 0 ·
Show more comments
drewbeasty502 avatar image drewbeasty502 brendan commented ·

Is it now possible to access Playfab through ue4 onlinesubsystem with latest 0.0.170807 update?

0 Likes 0 ·
brendan avatar image brendan drewbeasty502 commented ·

Our Unreal Blueprints SDK has been updated for Unreal 4.16, as stated in our release notes: https://api.playfab.com/releaseNotes#170807. However, no, this is not specifically an OnlineSubsystem integration - that was a much earlier SDK version which has since been deprecated. The current SDK is a simple Web API integration.

0 Likes 0 ·
draperj81 avatar image
draperj81 answered

So let me get this straight - on my server do I need to call StartGame() to have it recognised by the matchmaking as an available server or just by having it hosted by you it is available? Then my clients can call Matchmake() in order to find the server details to then join with?

2 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.

Montana Tuska avatar image Montana Tuska commented ·

If you host it via PlayFab, you can just Matchmake directly after. If you are hosting externally, you need to call RegisterGame in the PlayFab API (CreateSession in the OnlineSubsystem if using mine) and RefreshGameServerInstanceHeartbeat within every 2 minutes(done with CreateSession automatically as well).

0 Likes 0 ·
Montana Tuska avatar image Montana Tuska Montana Tuska commented ·

Alright, my plugin should be ready now, go ahead and read the Readme, should be easy enough to follow. Tell me if you need any help.

1 Like 1 ·
sudarshan avatar image
sudarshan answered

@Montana Tuska, @Brendan I have a similar doubt and i am using UE4. In my Game i made a match make call to the PlayFab and i got the Lobby Id and the Host Name, Port but how to connect to the remote server that is hosted in the playfab as the execute console command with the following command open ipaddress:port seems doesn't work. How can run I the function "RedeemMatchMaker" on the server that is hosted in the playfab as the function seems to be only in the Server side by which i can't use UE4 Replication to call the event. Or do i need to define a custom event on the client and server in UE4 and in the server build that custom event should call the Redeem MatchMaker. Need little info on how these work and the work flow of players joining the game.


3 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.

Montana Tuska avatar image Montana Tuska commented ·

For connecting, the console command should be "open ipaddress:port". As I have ran this many times with success within the Unreal Engine, I don't believe there is any issues there.

Now, as for RedeemMatchmakerTicket, this is something a bit more tricky that requires a bit of fangling. So, for now I'll assume you're using the C++ SDK. Unreal Engine doesn't have any real Authentication functions past the client side login. You you run "open 127.0.0.1:7777" you should as provide parameters for the ticket. i.e. "open 127.0.0.1:7777?ticket=XXX?playfabid=XXX" We want both the ticket and the PlayFabId as without the provided PlayFabId, there's no way to make sure that ticket is valid with that client. Now as I haven't tried this in Blueprint, I'm not sure what GameMode functions are available. So, what you can do is on AGameMode::Login, you can parse the Options parameter and use that info to send the RedeemMatchmakerTicket request. When it sends the info back, you compare the two PlayFabIds just to make sure they're equal. If equal, the player should be valid, yay! If not equal, something is either wrong or the client is trying to spoof something.

0 Likes 0 ·
pprkgraphiks avatar image pprkgraphiks Montana Tuska commented ·

Good Morning, @Montana Tuska I succeeded in registering the dedicated server as an externally server. By the way, I would like to ask whether it is externally possible for a large number of clients to register sessions within the externally server(dedicated server). I would like to ask if i want to make this system, Shoud i use additional advance session plugin to register session? Thanks for read my thread. :)

0 Likes 0 ·
brendan avatar image brendan pprkgraphiks commented ·

Could you describe the high-level player experience you're going for? If your custom game server logic is that it can manage many "sub-sessions", then you could certainly have a large number of players matchmake into it, and provide separate play experiences for each subset of players.

0 Likes 0 ·

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.