A virtual "scavenger hunt" game for mobile devices using Unity, Azure, and PlayFab
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
docs/images Initial commit May 6, 2018
src Fixes #3 May 23, 2018
.gitignore Initial commit May 6, 2018
LICENSE Initial commit May 6, 2018
README.md Update README.md Jul 25, 2018
azuredeploy.json Initial commit May 6, 2018

README.md

Software License PRs Welcome unofficial Google Analytics for GitHub

Scavenger

Scavenger is a game written in Unity for a session presented at Microsoft Build 2018. The game demonstrates usage of various Azure services:

The game plays as follows:

  • Player opens the game on her mobile device
  • If the player hasn't logged in previously, they will create a new name to identify them for the leaderboard
  • At this point the player can view the current leaderboard or start playing
  • If the player starts the game, they are presented with 5 ordinary (or not!) items to take a picture of
  • The player taps one of these items, and then snaps a photo of the item
  • The Computer Vision Cognitive Services is triggered to recognize the object in the photo
  • If the object is found in the picture, a point is awarded!
  • Once all 5 objects are "found", the player has completed the day's challenge, and five new objects will be available the next day

PlayFab

Before deploying, you will need to register for a free PlayFab account. Once you do that, you need to create a new 'Studio' and a new 'Title', check as described here. This will generate some credentials (a PlayFab Title ID and Key) which you will need to use when you deploy the game infrastructure. PlayFab is used to authenticate and identify the user as well as to store the leaderboards for the players participating in this game.

Deployment

One-click deployment via an Azure ARM template is supported. Just click the button below to deploy the project to your Azure subscription using an Azure Functions Consumption Plan.

The deployment will take some time to execute (due to resource creation and time to pull code from GitHub), so please be patient.

Be aware that App name, Storage account name and Cosmos DB database name must all be globally unique, otherwise, the deployment will fail to complete and you will see an error message in the Azure portal. In this case, you should delete the created Resource Group and try again.

Running the Functions locally

You can use Visual Studio 2017: Open the Server.sln file located in the src\Server directory. For more details, check here, you may also need to update Azure Functions tools.

Most importantly, in order for the Functions Proxy to work, you should modify the backendUri setting in the Proxies.json file, replacing the port 80 with 7071 (the local development port of Functions runtime).

Running the game

The game requires Unity 2018.2 to build and run properly, however earlier versions MAY work. At the time of writing, you can download the latest 2018.2 Beta here. Once you have it installed, open the src/Unity folder which contains the game code. If you want to test the project in the Editor, you should be running the Functions project locally (check previous paragraph for details). Feel free to modify this behavior in the Globals.cs file.

When you open the game in Unity, the PlayFab SDK is already installed. You should configure it to access your PlayFab data (Studio etc.) by navigating to the Window > PlayFab > Editor Extensions menu item. This will open a small window where you sign in with your PlayFab account. After that, you need to configure the game to work with your PlayFab game by modifying the values in the PlayFab Editor Extensions window. If the PlayFab sign in worked, you'll be able to easily select your Studio and Title.

To run the game in the Editor, select the Title scene in the Scenes folder and run the project. You can press "Start" to begin the game or "Leaderboards" where you can see the current leaderboard. For best display, ensure you have set the editor to a Portrait display instead of Landscape (9:16 or 10:16 work best).

Presentations

Learn more about the game and Azure integration from our session at Build 2018: video

Credits/Special Thanks