PlayFab Integration

Intro

This integration describes how to use Gameye game server hosting in combination with Playfab matchmaking and player data storage for your multiplayer game.

Requirements

  • Make use of Playfab matchmaking v2
  • Entity events v2 must be enabled for the correct Title ID in your account.

Content

  • Example NodeJS game client in client
  • Example CloudScript for starting a gameye match in cloudscript

CloudScript

In the cloudscript folder is a cloud script that communicates with the Gameye servers and provides information back to the game client.

Usage

  • In the PlayFab admin panel, go to Content and add your Gameye access token and the Gameye API URL to the Title Internal Data. These will be hidden from the client, but are needed by the cloud script.



Document image
  • In Automation -> Cloud Script -> Revisions, copy the content of script.js, save and deploy



Document image
  • Under Rules, create a new Rule that responds to the event playfab.matchmaking.match_found. - Add an Action that executes the cloud script function matchFound.



Document image
  • Under Multipler -> Matchmaking create a queue with the desired settings for the game. If you wish to take advantage of the region settings, add a Region Selection Rule to the queue which uses the Latencies attribute. In our example, we've set the Max Latency to 350ms, but this could be changed accordingly. Be careful not to set this too low, as matches might not be made, and no Region Preference will be determined.



Document image



Game Client

  • In the client folder is an example NodeJS client using the PlayFab SDK.
  • Run npm install
  • Modify the constants.ts updating the TitleId and QueueName to match the details from the PlayFab admin panel. Update the Gameye constants with values for the game running on Gameye servers. The example provided is for a CS:GO Bot Match.
  • Run npm run compile
  • Run node ./node/program.js USER_ID in multiple terminals/devices with different values for USER_ID. This will create multiple matchmaking tickets, which should then be matched together in the correct region.

Github

Please take a look at our Github repo for Playfab integration. We have also made a demo game using NodeJS that interacts with the matchmaker API to help you understand how it all works: https://github.com/Gameye/playfab