GithubHelp home page GithubHelp logo

brianpeek / scavenger Goto Github PK

View Code? Open in Web Editor NEW
29.0 5.0 7.0 5.64 MB

A virtual "scavenger hunt" game for mobile devices using Unity, Azure, and PlayFab

Home Page: https://aka.ms/azgamedev/

License: MIT License

C# 97.48% ShaderLab 1.96% HLSL 0.30% HTML 0.26%
playfab game azure-functions leaderboard unity cognitive-services cosmos-db

scavenger's Introduction

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 their mobile device
  • If the player hasn't logged in previously, they will be asked to create a new name to identify themselves 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 selects an item, and then snaps a photo
  • The Computer Vision Cognitive Service 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, however earlier or later versions MAY work. 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

scavenger's People

Contributors

brianpeek avatar luisbosquez avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

scavenger's Issues

Env variables

Proposal to move it to a static constructor in Constants.cs? And probably throw an exception if they don't exist?

PlayFabSettings.DeveloperSecretKey = Environment.GetEnvironmentVariable("PlayFabKey");
PlayFabSettings.TitleId = Environment.GetEnvironmentVariable("PlayFabTitleID");

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.