Build an AR Scavenger Hunt

Overview

This post assumes you have setup Explore-AR as a Unity project or have downloaded the Explore-AR app to test on mobile.

If you are using mobile only, replace the Vancouver locations selected here with locations near you that you can test with.

This post will dive deep into the process of creating a short augmented reality scavenger hunt using the [permalink id=3716 text=’Explore-AR Unity template’]. This tutorial uses locations in downtown Vancouver, Canada, but feel free to swap out the locations used in the tutorial for any other. Also, this tutorial expects readers to supply their own image media in place of the content used here.

Although this tutorial uses the Explore-AR template, the concepts learned here are helpful for authoring any experience using Motive.

The gameplay created by following along with this article is a scavenger hunt experience. It will play as follows:

  1. The player will find a Scroll in the world.
  2. The Scroll will show the player the location of a Treasure Chest. This will appear on the player’s map.
  3. The player will walk to the Chest but needs “something to dig it up…”
  4. The player will find a character who will offer a Shovel for Coins.
  5. The player will have to walk to the coins, collecting them using the AR camera experience..
  6. The player will trade the Coins for a Shovel.
  7. The player will dig up the Treasure Chest, completing the experience.

Create the Main Script

Navigate to your Motive Authoring tool dashboard and select your Explore-AR project. The Scavenger Hunt Main [permalink id=3264 text=’Scripts’] is going to be the Script that “kick starts” the scavenger hunt experience.

When this main Script is launched, it will in turn launch other secondary Scripts. It is within these secondary Scripts that the majority of the gameplay is authored. This method of one main Script launching the other secondary Scripts is highly recommended.

  1. In the Motive Authoring tool dashboard navigate to the Authoring tab.
  2. Create a folder called Scavenger Hunt.
  3. Under that folder, create a new Script called Scavenger Hunt Main.

Create the Scavenger Hunt Quest/Script-Launcher

Now we are going to create a Script Launcher for our experience. A Script Launcher references a Script. A Script Launcher can launch a script when a user selects it in-app, or launch a Script when the app starts. The Script we are going to launch is the Scavenger Hunt Main Script.

  1. In the Motive Authoring tool dashboard navigate to the Authoring tab.
  2. Besides Script Launchers select Create New.
  3. Give this new Script Launcher the name Scavenger Hunt and any description. Click Next.
  4. Select Launch an Existing Script and choose the Scavenger Hunt Main script we just created.

Author the Scroll Collectible

We need to author the Scroll Collectible that players will collect. To do this we will add a new item into a Collectible catalog. It is not critically important which Catalog it is added to.

  1. Select the Catalogs tab found on the left hand side of the dashboard.
  2. Find the Collectible row and select the existing Collectible catalog: Explore Collectibles, this will open the Catalog Editor.
  3. Click New Item on the left side.
    1. Title: put Treasure Scroll.
    2. Description: put “The ink is faded.. but the scroll seems to show a big ‘X’.”
    3. Image: select the Quest Images Catalog and click Add New Item. Upload any photo to represent a Scroll. The title is not incredibly important.
  4. Save the item.
  5. Click Save Catalog.

Spawn the Scroll

The first thing we want our player to do is to find an item in the world around them. This item will be a Scroll that shows them the location of the Treasure Chest. To author this Scroll being found, we are going to use an [permalink id=3327 text=’Location Valuables’] Resource.

  1. In the dashboard for your project, under your Scavenger Hunt folder create new Script called Spawn Scroll.
  2. Click this new Script to enter the Script Editor.
  3. On the left, on the [permalink id=3265 text=’Frame] called Main Frame, click the plus button and create a new Frame. Name this Frame Spawn Scroll.
  4. With the new Frame selected, drag a Location Valuables Resource into the Frame Editor column (the middle column).
  5. Set the properties of the Location Valuables:
    1. Locations: Select Add from Catalog. Choose Howe and Georgia and choose Select on the map annotation.
    2. Valuables: Click the plus symbol beside Collectibles to add a new one. For count put 1. Click Add from Catalog and choose the Treasure Scroll we created previously.
    3. Probability: Put a value of 1 here.
    4. Collect Options: Click the plus. For Collect Range, set a Max of 40 (this is metres). Under Collection Mechanics select Collect With AR and make sure Show On Map is checked.
  6. In the bottom right hand corner of the Location Valuables Resource, click the blue plus button and select close. This will create a Frame that will activate when this Resource closes.
  7. In the newly created Frame, add an End Script Resource. This is important to make sure the Script closes fully, allowing the next Script to be launched from our main script.
  8. Click Save to commit your changes.

Launch the “Spawn Scroll” Script

Now we are going to launch the “Spawn Scroll” script from our “Scavenger Hunt Main” Script.

  1. Go to your project Dashboard by clicking the Motive logo in the top left. Navigate to the Authoring tab. Find the Scavenger Hunt Main script and select it to enter the Script Editor.
  2. On the Main Frame, click the plus button to create a child Frame. Call this child Frame Launch Spawn Scroll.
  3. In this new Frame, add a Launch New Script Resource.
    1. For Script, select your “Spawn Scroll” Script.
  4. Click Save.

Test Your Script

It is very important to test your Scripts as you author them. It is better to author a small amount and test frequently, rather than author a large amount and test infrequently. We are going to test our “Spawn Scroll” Script as well as test our “Scavenger Hunt Main” script.

  1. (optional) If testing in Unity, under Hierarchy, navigate to Motive and then to LocationServices. On Player Location in the inspector, choose Vancouver.
  2. Start your Explore-AR application (in Unity or on mobile).
  3. Click the ‘hamburger’ slide-out in the top-left corner.
  4. Select Settings.
  5. Select Scripts. For debugging purposes, you can launch any script from this screen.
  6. Select the Scavenger Hunt folder.
  7. On the Scavenger Hunt Main Script, select Reset then Launch. It is good practice to reset a Script before launching to ensure that it is going to start fresh.
  8. If you see a ‘scroll’ item on the map then your Script was successful. If not, be sure to double check the steps. If the scroll is there, try to collect it by using your camera and tapping on the scroll.

Alternatively, you can launch your script by clicking the hamburger slide-out, selecting Tours, and then choosing your Script.

Add the Big Red ‘X’ Media Item Image

When the player collects the scroll, it is going to reveal to the player the location of the Treasure Chest. This is going to be shown to the player as a big red ‘X’ on the map. When the player walks to the ‘X’, the app will tell them they need “… something to dig it up”. To author this experience, we need to add the image that represents the big red ‘X’.

  1. Navigate to your project Dashboard (click the Motive logo in the top left).
  2. Navigate to the Media tab on the left hand side.
  3. Click Add New.
  4. Upload an image file that you want to use to represent a big red ‘X’.
  5. When prompted, add this [permalink id=3239 text=’Media’] to a [permalink id=3296 text=’Media Item ] Catalog so it can be referenced in our Script.

Author the Chest Collectible

To reward the player with a treasure chest, we need to author this treasure chest as a Collectible.

  1. Navigate to your project Dashboard (click the Motive logo in the top left).
  2. Navigate to the Catalog tab on the left hand side.
  3. Find the “Collectible” row and click to edit the Explore Collectibles Catalog.
  4. Click New Item.
  5. Set these properties:
    1. Title: Set the value to “Treasure”
    2. Description: Set the value to “An old treasure chest. It seems to have been buried for a long time.”
    3. Image: Choose an image of a treasure chest you would like to use.
  6. Click Save Catalog to commit your changes.

Author the Shovel Collectible

  1. Navigate to your project Dashboard (click the Motive logo in the top left).
  2. Navigate to the Catalog tab on the left hand side.
  3. Find the “Collectible” row and click to edit the Explore Collectibles Catalog.
  4. Click New Item.
  5. Set these properties:
    1. Title: Set the value to “Shovel”
    2. Description Set the value to “Good for digging!”
    3. Image: Choose an image of a Shovel you would like to use.
  6. Click Save Catalog to commit your changes.

Spawn the Big Red ‘X’

When the player collects the scroll, the app should reveal the location of the treasure with a big red ‘X’ on the map. The player will be able to “dig up” the treasure using a shovel. To author this experience we will use a [permalink id=3795 text=’Location Task].

  1. In the Scavenger Hunt folder, create a new Script called Spawn Red X. Select this Script to edit it.
  2. Create a new Frame under Main Frame called Spawn X.
  3. Drag a Location Task Resource into this Frame. Set the following properties:
    1. Locations: Select Add From Catalog and choose Robson Square.
    2. Title: Set the value to “X Marks the Spot”.
    3. Description: Set the value to “The scroll seems to point to this location. The ground is soft here, maybe we can dig it up with something…”
    4. Image. Set this to the image of the treasure chest.
    5. Action Range: Set the Max value to 40.
    6. Action: Set the value to Exchange. This means we will have to give something to get something (give a shovel to get a treasure chest).
    7. Action Items: These are the items the player will “give”. Click the plus symbol, then click the plus beside Collectibles. Set Count to 1 and choose the Shovel Collectible created in the previous section.
    8. Reward: These are the items the player will receive once they ‘give away’ the Action Items. Set the Reward to be 1 Treasure Collectible.

When the Location Task spawns on the map, it will show a default image that is not very exciting. Let’s override this annotation with our ‘Big Red X’ image.

  1. In the navigation bar at the top of the page select View, then select Show Advanced so that the toggle is active. This will show advanced properties on all Resources.
  2. On the Location Task, for the now visible Marker property, click the plus button.
  3. Click to add a Media item. Choose the big red ‘X’ image we uploaded earlier.

Now we want to make sure this Script closes properly when the Location Task is complete.

  1. On the Location Task, click the blue plus in the bottom right hand corner, select close.
  2. In the new Frame, add an End Script Resource.
  3. Click Save.

Launch ‘Spawn Big Red X’

Now we have two scripts to use in our main Script. The first Script (Spawn Scroll) will run and the player will collect the scroll. When that script has finished (the scroll is collected), we want our next script to run (Spawn Red X). We will do this in our main Script by listening for the Close event on the Script Launcher for ‘Spawn Scroll’.

  1. Navigate to your project’s dashboard and select the authoring tab.
  2. Select the Scavenger Hunt Main script to edit.
  3. In the Launch Spawn Scroll Frame, find the Launch New Script Resource. On that Resource, in the bottom right hand corner find the blue plus symbol and select Close.
  4. This creates a new Frame that will launch when the ‘Spawn Scroll’ script has completed. Name this new Frame Launch Spawn X.
  5. In this new Frame, add a Script Launcher Resource and select the Spawn Red X script.
  6. Click Save to commit your changes.

Test Test Test!

We always want to test our changes. Go to you application and launch the Scavenger Hunt Main script (reset first). After collecting the scroll, you should see the big red X show up on the map.

Author the Doubloon Collectible

This Doubloon Collectible will be used in the next Task.

  1. Navigate to your project Dashboard (click the Motive logo in the top left).
  2. Navigate to the Catalog tab on the left hand side.
  3. Find the “Collectible” row and click to edit the Explore Collectibles Catalog.
  4. Click New Item.
  5. Set these properties:
    1. Title: Set the value to “Doubloon”
    2. Description: Set the value to “An old coin.”
    3. Image: Choose an image of a Doubloon you would like to use.
  6. Click Save Catalog to commit your changes.

Author the Salty Pete Character

For our experience, the player needs a shovel to dig up the spot marked by the ‘X’. To get this shovel, the player is going to exchange items with a [permalink id=3300 text=’Character].

  1. Navigate to your project’s Dashboard.
  2. Navigate to the Catalogs tab on the left.
  3. Select the Explore Characters Catalog to edit it.
  4. Click New Item.
  5. Set these properties on the new item:
    1. Alias: Set the value to Salty Pete.
    2. Profile: Image. Set this value to an image representing this Character.
    3. First Name: Set the value to Salty Pete.
  6. Click Save Catalog.

Create the Salty Pete Task

Now that we have a Character, we want to use this Character in a Location Task to exchange items with a player. We could also use a Character Task, but the Location Task is a bit nicer as it will place the Task at a physical location in the world.

  1. Navigate to your project’s Dashboard.
  2. Navigate to the Authoring tab on the left.
  3. Mouseover the Scavenger Hunt folder and select new script.
  4. Name this new Script Spawn Salty Pete Task.
  5. Click this Script to edit it.
  6. Create a new Frame under the Main Frame, name this new Frame Spawn Salty Pete Task.
  7. Add a Location Task Resource to this new Frame.
  8. At the top of the page, on the navigation bar, Select View, then make sure Show Advanced is enabled.
  9. Set these properties on the Location Task:
    1. Locations: Select Add From Catalog. Add a new Location by clicking on the map wherever you want your Location. Place it with a couple blocks of Robson Square. Give it the name “A Dark Alley”.
    2. Marker: Click the plus. For Media, select Add From Catalog and select the image of Salty Pete.
    3. Character: Select Add From Catalog and choose the Salty Pete Character we created.
    4. Title: Put “Hey Stranger…”
    5. Description: Put “Got any Doubloons? I need Doubloons. Gimme gimme. I’ll trade you anything for some Doubloons. I found this Shovel, want it? I’ll trade you for it. I know there’s some Doubloons around here somewhere…”.
    6. Image. Choose the image of the shovel.
    7. Action Range: Select a Max of 40.
    8. Action: Choose exchange.
    9. Action Items: Click the plus, then click the plus beside Collectibles. Set count to 3. Choose the Doubloon Collectible we created earlier.
    10. Reward: Click the plus, then click the plus beside Collectibles. Set Count to 1 and choose the Shovel Collectible.
  10. On the bottom right hand corner of the location task, click the blue plus icon and select close. This will create a new Frame. Add a End Script Resource to this new Frame.

Launch ‘Spawn Salty Pete Task’

When our player collects the Scroll, we want the big red X to show and we also want Salty Pete to show up on the map at the same time.

  1. Navigate to your project’s Dashboard.
  2. Navigate to the Authoring tab on the left.
  3. Select the Scavenger Hunt Main to edit.
  4. Select the Launch Spawn Scroll Frame.
  5. On the Launch New Script Resource, click the blue plus in the bottom right and select close. This will create a new Frame.
  6. Name the new Frame “Launch Salty Pete Task”.
  7. Add a Launch New Script Resource to this new Frame. Target the Spawn Salty Pete Task.

Test Often

Test your project. Now when you collect your scroll item, there should be 2 annotations on the map. The first is the Big Red X, the second is the image of Salty Pete.

Populate the World with Doubloons

Salty Pete is looking for Doubloons. Let’s give him some. We are going to use a Location Valuables Resource to populate multiple Locations with Doubloons.

  1. In your Scavenger Hunt folder, create a new script called Spawn Doubloons.
  2. Click on this new Script to edit it.
  3. Create a new Frame under the Main Frame by clicking the plus symbol. Name this new Frame Spawn Doubloons.
  4. Add a Location Valuables Resource to this new Frame.
  5. Set these properties on the Locations Valuables:
    1. Locations: We are going to select multiple Locations. A Doubloon will spawn at each selected Location.
      1. Select Add From Catalog. Click on the map to add a new Location the player can walk to from Salty Pete. Name this Location “Street Corner”. Click Select.
      2. Again, select Add From Catalog beside ‘Locations’. Create another Location and name it “the sidewalk”.
      3. Again, select Add From Catalog beside ‘Locations’. Create another Location and name it “the phonebooth”.
      4. Again, select Add From Catalog beside ‘Locations’. Create another Location and name it “the bench”.
    2. Valuables: Click the plus, then click the plus beside Collectibles. Set Count to 1 and choose the Doubloon Collectible.
    3. Probability: Set this to 1.
    4. Collect Option: Click the plus, then click the plus beside Collect Range. Set Max to 40. For Collection Mechanic, choose Collect With AR, and make sure Show On Map is checked.
  6. On the Location Valuables, in the bottom right hand corner find the blue plus icon and select it. Choose close to create a new Frame.
  7. In this new Frame, add an End Script Resource.

Launch ‘Spawn Doubloons’

  1. Navigate to your Scavenger Hunt Main script.
  2. Select the Launch Spawn Scroll Frame.
  3. Find the blue plus icon on the bottom right hand corner of the Launch New Script Resource. Select close. This creates a new Frame.
  4. Name this new Frame Spawn Doubloons.
  5. Add a Launch New Script Resource to this Frame. Target the Spawn Doubloons script.

Final Test

One last test. Run through the whole experience by resetting and then launching your Scavenger Hunt Main Script. Now, the player should be able to complete the entire experience by digging up the Treasure Chest using the Shovel.

Bonus Tasks

The scavenger hunt is fully authored, but lacks a little bit of polish. Here are a few things you can do to improve the player’s experience.

  1. Make “winning” more exciting. Collecting the Treasure Chest is not very rewarding. Maybe try playing some exciting audio content or placing a message on the screen congratulating the player.
  2. Add a Salty Pete intro. Salty Pete doesn’t seem to connect very well with the rest of the experience, he simply shows up and the player is expected to interact with him. Try adding a Character Message from Salty Pete that activates when the player collects the Scroll. This way the player knows who Salty Pete is and what his purpose is.
  3. Collect Doubloon messages. As the player collects the Doubloons, trigger messages from Salty Pete such as: “Good job!” or “You only need one more!”. Use multiple Frames, each with an Inventory Precondition to trigger Character Messages.

Image Credits

Salty Pete: https://opengameart.org/content/11-portraits-108px

Treasure Chest: https://opengameart.org/content/planetcute-chest-closedpng

Doubloon: https://opengameart.org/content/coin-icon