Giter Club home page Giter Club logo

balloon-pop's Introduction

Balloon Pop

A multiplayer geospatial experience


By Google Creative Lab, Sydney

Contents:





What is the Balloon Pop code example?

Balloon Pop is a simple sandbox style game that showcases a multiplayer experience using the ARCore Geospatial API and Firebase.

Place geospatial anchors in the world, and they will stay fixed to the ground in AR. In this demo, balloons are placed as targets and hit using a ball that reacts to distance in world space. The multiplayer aspect means that nearby users can pop the same balloons using Firebase.




How does it work?

The Balloon Pop Unity project can be built to create a mobile game/app.
The project uses Unity 2019.4.36f1 and Google's ARCore Geospatial API.

The Geospatial API anchors balloons to specific GPS coordinates in the real world. The API can track a user's latitude, longitude and altitude on the earth. A user can place a balloon at a location N meters directly ahead of them, at their current altitude (using data from the ARCore Geospatial API).

The balloon anchor's latitude, longitude and altitude is stored on a Firestore database in the cloud. A multiplayer experience is created by loading balloons nearby and anchoring them at the same position in the real world. Users can pop balloons and even watch balloon pops triggered by other players.





Requirements

Your app will require the following:

  • Internet and GPS access.
  • The experience works best outdoors.
  • A compatible device: Android: Google Pixel 2 or later device for optimum performance.



Developer Setup

The app has not been released to the public on a mobile app store, but the code can be downloaded and built in Unity. So far the experience has only been tested on fairly recent Android phones, such as a Pixel or Samsung Galaxy 7 or higher.


Unity App

  1. Download Unity version 2019.4.36f1 for compatibility. We recommend using Unity Hub.

  2. Clone this repo to your machine (optionally fork this repository if you plan on expanding on it).

  3. Open the project in Unity 2019.4.36f1, and open the 'BalloonPopAR' scene (if it doesn't open automatically).

  4. Follow the steps below in the 'ARCore Geospatial API Key' section

  5. Follow the steps below in the 'Firestore Balloon Database' section

  6. Deploy to an ARCore compatible device.


ARCore Geospatial API Key

You will need an API Key with ARCore Geospatial API enabled for your app to use GeoAR features.

Follow the steps here to in order to obtain an API key.

Add the API Key to your Unity Project:

  1. Open the Unity Project Settings

  2. Under 'XR Plug-in Management', click on 'ARCore Extensions'

  3. Past the Android API Key into the 'Android API Key' textfield

  4. 'Geospatial' should be turned on


Firestore Balloon Database

The project uses the Firestore database in Firebase to save balloon coordinates, send balloon pops and listen for changes in balloons near the user. This allows the game to keep a shared global state of balloon locations, creating a multiplayer experience of balloon placing and popping.

Install Firebase

Import the following plugins - using Assets > Import Package > Custom Package menu item - from the [Firebase Unity SDK][https://firebase.google.com/docs/unity/setup]:

IMPORTANT

When importing both packages, make sure the 'ExternalDependencyManager' folder is unchecked.

  • FirebaseAuth.unitypackage
  • FirebaseFirestore.unitypackage

Create a Firebase API Key

  1. Create a Firebase account if you don't already have one

  2. Add a new project in the Firebase Console.

  3. In the 'Build' -> 'Firestore Database' section of your project click 'Create a database'.

  4. Select production mode and choose a relevant region for your Cloud Firestore data to be stored.

  5. Create a new collection in your database and name it 'balloons'.

  6. Go to your 'Project settings' -> 'General' -> 'Your apps' and click the 'Add app' button. Click the button with the Unity icon on it.

  7. Choose a unique package name (for Android), then download the 'google-services.json' config file for the Android build.

  8. Now place the 'google-services.json' config file in the 'StreamingAssets' folder within the Unity project. (Assets -> StreamingAssets -> 'google-services.json').




Debug


Within the 'BalloonPopAR' Unity scene, there is a GameObject called "DEBUG SETTINGS". You can use this to toggle some debug info about the Geospatial API by toggling 'Display Earth Debug'. You can also toggle a information panel to be shown on every balloon which displays some useful information about each balloon.





Attributions


Balloon Pop Cloud Asset

Cloud 3D model 'Cloudsculpt2' on Sketchfab
The 3D model was slightly modified.
Author: curiositysphere
License: CC BY 4.0
(Creative Commons)



Contributors

License & Notes

Apache 2.0 license.

This is not an official Google product, but an AR Experiment developed at the Google Creative Lab. We’ll do our best to support and maintain this experiment but your mileage may vary.

We encourage open sourcing projects as a way of learning from each other. Please respect our and other creators’ rights, including copyright and trademark rights when present, when sharing these works and creating derivative work.

You must disclose the use of ARCore’s Cloud Anchors or Geospatial APIs prominently in your application by including the following text, as well as a link to learn more on a notice screen: https://developers.google.com/ar/cloud-anchors-privacy.

To power this session, Google will process visual data from your camera. Learn more.

You can do this by implementing the recommended user notice flow available in our Cloud Anchor sample apps and Geospatial API sample apps.


balloon-pop's People

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.