Discover how Edgegap works

Discover how Edgegap works

/

PlayFab

PlayFab

Deploy to Edgegap

Published

Published

Published

Last reviewed for accuracy

Last reviewed for accuracy

Last reviewed for accuracy

PlayFab: How to start Edgegap dedicated servers from PlayFab Matchmaking

PlayFab: How to start Edgegap dedicated servers from PlayFab Matchmaking

This guide shows you how to keep PlayFab for your player accounts and matchmaking queues, and start an Edgegap dedicated game server for each match: when PlayFab finds a match, a Cloud Script deploys a server near the players, and the server hands its address to every player.

Once your game server is containerized, Edgegap deploys it worldwide to 615+ Edge Cloud locations (on-demand) from a simple API call and billed exclusively on usage: no entire server to rent, provision or keep running between matches. For persistent servers of reserved capacity, Edgegap offers Private Fleets.

PlayFab groups the players; Edgegap hosts the match. The call that starts the server runs in PlayFab's Cloud Script, on PlayFab's side, because it needs your Edgegap API token, which never goes in a game client.

This guide covers:

  1. Preparing a working Edgegap app version and a PlayFab title

  2. Connecting your coding agent to Edgegap (optional)

  3. Setting up a PlayFab matchmaking queue

  4. Adding the Cloud Script that deploys the server

  5. Handing the server's address to the players

  6. Matching players from your game client

  7. Testing with two players

You can do it two ways, and mix them:

  • With a coding agent. Connect Claude Code, Cursor or another agent to the Edgegap MCP server and its agent skills. The agent writes the Cloud Script and the client and server code, and checks your app version and deployments. You handle your PlayFab and Edgegap dashboards, the secrets, and playtest.

  • By hand. Every step below also works without an agent.

No credit card required. Free tier includes the resources to deploy a real game server.

No credit card required. Free tier includes the resources to deploy a real game server.

Step-by-Step Guide

Detailed Integration Steps

1. Before you start

  • A free Edgegap account. Verify your email. No credit card is needed to test.

  • A working Edgegap app version of your game server: a server you deployed and joined at least once. PlayFab starts that version for every match, so it needs a functional, containerized game server to work end to end. If you don't have one yet, use our guides: Unity Engine, Unreal Engine, Godot Engine or Custom Engine. Note its application name, version name and port name (usually gameport).

  • A PlayFab title with Matchmaking, and access to its Game Manager (Title ID and a title secret key).

  • An Edgegap API token, from Dashboard → User Settings → Tokens. It goes only in your Cloud Script's configuration. It is organization-wide, so never put it in your game client, your game server, your project files or a chat.

  • Optional: Edgegap's PlayFab sample, a Unity project (2021.3, FishNet 3) with the client, server and Cloud Script code below.

2. Connect your coding agent to Edgegap

Skip this step if you're doing everything by hand.

The Edgegap MCP server lets your agent check your apps and versions, deploy test servers and read their logs on your account. The edgegap-deployments-api agent skill gives it the tested rules for backends that start Edgegap servers, PlayFab Cloud Script included.

Claude Code (run in your own terminal, so the token never passes through the chat):

claude mcp add --transport http edgegap https://mcp.edgegap.dev/mcp -H "Authorization: token YOUR_EDGEGAP_API_TOKEN" --scope user

Then install the skills: /plugin marketplace add edgegap/edgegap-agent-skills, then /plugin install edgegap@edgegap. Restart the session.

Cursor, VS Code and other clients that send headers: add https://mcp.edgegap.dev/mcp with the header Authorization: token YOUR_EDGEGAP_API_TOKEN, and install the skills with npx skills add edgegap/edgegap-agent-skills --skill "*".

Claude Desktop: custom connectors can't send the header, so use the local server instead (Node 18+): { "mcpServers": { "edgegap": { "command": "npx", "args": ["-y", "@edgegap/mcp"] } } }. It asks for the token on first use.

Check it works:

"List my Edgegap apps and their versions, with each version's ports."

3. Set up a PlayFab matchmaking queue

  1. In PlayFab's Game Manager, open Multiplayer → Matchmaking and create a queue, or reuse yours. For a first test, a rule that matches any two players is enough.

  2. Under Players, create two test players (for example with custom IDs) so two clients can sign in.

Your match rules stay in PlayFab. Edgegap only starts the server once PlayFab has found the match.

4. Add the Cloud Script that deploys the server

The function. In Automation, deploy a Cloud Script revision with a handler, for example StartEdgegapDeployment, that:

  1. Reads the MatchId and QueueName from the match-found event.

  2. Gets the match members with multiplayer.GetMatch, and each player's location with server.GetPlayerProfile (ShowLocations: true).

  3. Calls POST https://api.edgegap.com/v2/deployments with the header Authorization: token <your API token>, and a body with your application and version, the players as users ("user_type": "geo_coordinates" with latitude and longitude), a tag with the match ID, and the match details as environment_variables: PLAYFAB_MATCH_ID and PLAYFAB_MATCH_PLAYERS_ID_LIST (the player IDs, comma-separated).

Edgegap picks the location with the best ping for the whole group and answers 202 with a request_id. Log it with the match ID.

The rule. In Automation → Rules, add a rule: event type playfab.matchmaking.match_found, action Execute Entity Cloud Script, function StartEdgegapDeployment.

With your agent:

"Load the edgegap-deployments-api skill and write a PlayFab Cloud Script handler, StartEdgegapDeployment, for the playfab.matchmaking.match_found event: get the match members and their locations, deploy my Edgegap app version with POST /v2/deployments using geo_coordinates, tag it with the match ID, pass the match ID and player IDs as environment variables, and log the request_id."

Keep the token out of sight: the Cloud Script runs on PlayFab's servers, not in the game, so the token never reaches players. Store it in your title's internal configuration rather than in the script source, and never in client code.

5. Hand the server's address to the players

The server tells each player where to connect, through PlayFab Player Data:

  1. On start, the server reads ARBITRIUM_PUBLIC_IP and ARBITRIUM_PORT_GAMEPORT_EXTERNAL (injected by Edgegap) and PLAYFAB_MATCH_PLAYERS_ID_LIST.

  2. For each player, it writes ip:port into that player's Player Data with PlayFab's Server/UpdateUserData, using the match ID as the key.

  3. When the match ends, the server stops its own deployment: it calls the ARBITRIUM_DELETE_URL Edgegap gives every deployment, with ARBITRIUM_DELETE_TOKEN.

Server/UpdateUserData needs your PlayFab title secret key. If your server holds it, pass it as a hidden environment variable on the app version (is_hidden: true), never in the image, and never log it. For release, a narrower option is a PlayFab function the server calls to write the address for it.

6. Match players from your game client

  1. The client signs the player in to PlayFab (the sample uses LoginWithCustomID; use your game's login).

  2. It creates a matchmaking ticket in your queue (CreateMatchmakingTicket, for example with GiveUpAfterSeconds 90) and checks it with GetMatchmakingTicket until the status is Matched.

  3. It then reads its Player Data (GetUserData) for the match ID key every few seconds, until the server has written its address.

  4. It connects to that IP and port. The server can need up to a minute after starting to accept players, so retry the connection for a while.

  5. Once connected, it removes the key from its Player Data (UpdateUserData with KeysToRemove), so old addresses don't pile up.

7. Test with two players

  1. Make sure no test deployment is still running: the free tier runs one deployment at a time.

  2. Sign in two clients as your two test players and start matchmaking on both.

  3. When PlayFab matches them, the rule runs your Cloud Script. In the Edgegap dashboard, a deployment appears tagged with the match ID, in a location near you.

  4. Both clients read the address from their Player Data and connect to the same server.

  5. End the match: the server stops itself and disappears from the dashboard.

Nothing deploys? Check the Cloud Script's logs in PlayFab first. A deployment starts but nobody connects? It's the server: deploy your version by hand and join it directly.

Next Steps

Next Steps

Going live? Ask your agent to run the edgegap-launch skill's checklist: version rollouts, restart policy, maximum duration, cost control. Prefer a hosted matchmaker with no scripts? See Edgegap's matchmaker.

Stuck? Ask your agent to load edgegap-troubleshoot, or ask our team and other studios on the Edgegap Discord.

Frequently Asked Questions

Common questions about hosting PlayFab matches on Edgegap's dedicated servers.

Can I use PlayFab Matchmaking with Edgegap servers?

Yes. Keep your PlayFab queues and rules. When PlayFab finds a match, a Cloud Script triggered by the match-found event deploys an Edgegap server near the players, and the server writes its address to each player's Player Data.

Do I still need PlayFab Multiplayer Servers?

No. Edgegap hosts the dedicated servers. PlayFab keeps your accounts, player data and matchmaking, and Edgegap starts a server only when a match is found, billed per minute while it runs.

How does Edgegap choose the server location for a PlayFab match?

From each player's location, which the Cloud Script reads from their PlayFab profile and sends as coordinates. Edgegap picks the location with the best ping for the whole group.

Where does my Edgegap API token go with PlayFab?

Only in the Cloud Script's configuration, which runs on PlayFab's servers. Game clients and game servers never hold it.

How do players get the server address from PlayFab?

The game server writes its IP and port into each player's PlayFab Player Data under the match ID. Each client reads it, connects, then removes the entry.

Clients

Learn more from clients who integrated Edgegap

31 case studies are available from studios that moved to Edgegap from another platform.

Key reasons why they chose Edgegap

Discover the impact of Edgegap's automated game server orchestration for a flawless multiplayer experience.

Cost

Pricing

Optimize costs and performance with hybrid orchestration

Optimize costs and performance with hybrid orchestration

Optimize costs and performance with hybrid orchestration

Edge Cloud

On-Demand

$0.00115

/ vCPU

/ MINUTE

Billed by the Minute, Only on Usage

Pay only when players play. 0 active servers = $0

Deploy game servers worldwide, per instance, to all 615+ edge cloud locations. Zero commitment.

Simply add a credit card.

Edge Cloud

On-Demand

$0.00115

/ vCPU

/ MINUTE

Billed by the Minute, Only on Usage

Pay only when players play. 0 active servers = $0

Deploy game servers worldwide, per instance, to all 615+ edge cloud locations. Zero commitment.

Simply add a credit card.

Private Fleet (Bare Metal)

Reserved Capacity

$0.0282

/ vCPU

/ HOUR

Billed Monthly, Always On

$280 per host/month (12 mo rate), or $350 monthly

Optimize the cost effectiveness of your game server with egress-free hosting of Private Fleets.

Persistent, available 24/7, exclusive to your studio.

Private Fleet (Bare Metal)

Reserved Capacity

$0.0282

/ vCPU

/ HOUR

Billed Monthly, Always On

$280 per host/month (12 mo rate), or $350 monthly

Optimize the cost effectiveness of your game server with egress-free hosting of Private Fleets.

Persistent, available 24/7, exclusive to your studio.

Your bill varies per rate and usage; which can vary per game type, player count, & more.

Your bill varies per rate and usage; which can vary per game type, player count, & more.

Model your usage with our estimate calculator ->

Model your usage with our estimate calculator ->

Edgegap's features & price: detailed comparison between Edge Cloud & Private Fleets

Edgegap's features & price: detailed comparison between Edge Cloud & Private Fleets

COMPARE

Free Trial

Edge Cloud

Private Fleets

FEATURES

Analytics & Monitoring

Billing Alarms

Click to Expand

28 more rows

Unlocks

Capabilities are unlocked when a credit card is added to the account.

COMPARE

Free Trial

Edge Cloud

Private Fleets

FEATURES

Analytics & Monitoring

Billing Alarms

Click to Expand

28 more rows

Unlocks

Capabilities are unlocked when a credit card is added to the account.

COMPARE

Free Trial

Edge Cloud

Private Fleets

FEATURES

Analytics & Monitoring

Billing Alarms

Click to Expand

28 more rows

Unlocks

Capabilities are unlocked when a credit card is added to the account.