Code Monkey home page Code Monkey logo

pf-af-devfuncs's Introduction

pf-af-devfuncs

Azure Functions related to the PlayFab developer experience

This repository contains various Azure Functions that contribute to the PlayFab developer experience. Specifically, various implementation of ExecuteFunction, which are used to support local debugging of Azure Functions when using CloudScript.

Setting up local debugging involves 2 broad steps;

  • Adding an implementation of ExecuteFunction to your local Azure Functions app
  • Adding a settings file to tell the PlayFab SDK to call that local implementation from your game.

Once those steps are complete, you can run your local Azure Functions app under the debugger (e.g. in VS Code or Visual Studio), set your breakpoints and run your game client.

The rest of this document provides details on the above two steps.

Local implementation of ExecuteFunction

For C# Azure Functions apps

To get the local implementation of ExecuteFunction set up in your C# Azure Functions app, add the ExecuteFunction.cs file to your local Azure Functions app.

Required environment variables for local implementation of ExecuteFunction

Next, add two settings to your local.settings.json file;

Name Value
PLAYFAB_TITLE_ID Your title ID, in hex form
PLAYFAB_DEV_SECRET_KEY Secret key for your title

For example;

{
  "IsEncrypted": false,
  "Values": {
    "AzureWebJobsStorage": "...",
    "FUNCTIONS_WORKER_RUNTIME": "dotnet",
    "PLAYFAB_TITLE_ID": "B55D",
    "PLAYFAB_DEV_SECRET_KEY": "AAAABBBBCCCCDDDDEEEEFFFFGGGGHHHHIIIIJJJJKKKKLLLLMM"
  }
}

Configuring PlayFab SDK to call local ExecuteFunction implementation

To tell the PlayFab SDK to redirect ExecuteFunction API calls to your local implementation, add a file called playfab.local.settings.json to one of two places;

  • The temporary directory on your machine
    • TMPDIR environment variable on Linux/Mac
    • TEMP environment variable on Windows
  • The directory of your game executable.

The content of the file should be as follows;

{ "LocalApiServer": "http://localhost:7071/api/" }

To stop local redirects and make ExecuteFunction call the PlayFab API server simply delete the playfab.local.settings.json file.

The above is supported in the following SDKs;

Custom route prefixes

If you use a custom route prefix in your host.json, you will need to change the /api/ part of the file content to match the custom route prefix specified in the host.json. For example, if your host.json specifies a route prefix of 'cs', then your playfab.local.settings.json should be as follows;

{ "LocalApiServer": "http://localhost:7071/cs/" }

If your host.json specifies an empty custom route prefix, then your playfab.local.settings.jsoon should be as follows;

{ "LocalApiServer": "http://localhost:7071/" }

pf-af-devfuncs's People

Contributors

mgudgin avatar nima-ap-zz avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.