Book Image

Augmented Reality Game Development

By : Micheal Lanham
Book Image

Augmented Reality Game Development

By: Micheal Lanham

Overview of this book

The heyday of location-based augmented reality games is upon us. They have been around for a few years, but the release of Pokémon Go was a gamechanger that catalyzed the market and led to a massive surge in demand. Now is the time for novice and experienced developers alike to turn their good ideas into augmented reality (AR) mobile games and meet this demand! If you are keen to develop virtual reality games with the latest Unity 5 toolkit, then this is the book for you. The genre of location-based AR games introduces a new platform and technical challenges, but this book will help simplify those challenges and show how to maximize your game audience. This book will take you on a journey through building a location-based AR game that addresses the core technical concepts: GIS fundamentals, mobile device GPS, mapping, map textures in Unity, mobile device camera, camera textures in Unity, accessing location-based services, and other useful Unity tips. The technical material also discusses what is necessary for further development to create a multiplayer version of the game. At the end, you will be presented with troubleshooting techniques in case you get into trouble and need a little help.
Table of Contents (17 chapters)
Augmented Reality Game Development
Credits
About the Author
About the Reviewer
www.PacktPub.com
Customer Feedback
Preface

Preface

At the beginning of 2016, most of the world had very little knowledge of augmented reality and location-based games. That, of course, all changed with the release of Pokemon Go later that year. Literally overnight, the genre became entrenched as an upcoming trend in game development. Chances are you have played Pokemon Go and the reason you are reading this book is because of your interest in the genre of AR and location-based games.

In this book we will explore in detail the aspects of creating a location-based AR game just like Pokemon Go. Location-based AR games are expensive and require multiple services for everything from mapping to spawning monsters. However, the game we develop will be done with zero budget using freely available services. While this may not be something you could release commercially, due to some licensing restrictions, it will certainly introduce you to most of the concepts. Along the way, you will also learn how to use a great tool, Unity, and introduce many other concepts in game development.

What this book covers

Chapter 1, Getting Started, introduces the concepts that make up the genre of location-based AR games and our fictional game, Foody Go. This will be followed by a walk-through of downloading all the required software and setting up your mobile development environment with Unity.

Chapter 2, Mapping the Player's Location, starts by introducing the fundamental concepts of GIS, GPS, and mapping. Then shows how those concepts are applied to generating a real-time map and plotting the player’s location in a game.

Chapter 3, Making the Avatar, builds on the previous chapter and transforms our simple location marker into a moving animated character. This allows the player to see their avatar move around the map as they move carrying their mobile device.

Chapter 4, Spawning the Catch, explains that the premise of Foody Go is about catching experimental monsters. In this chapters, we learn how to spawn the monsters around the player on the map.

Chapter 5, Catching the Prey in AR, ups the intensity by introducing integrated AR part of the game by accessing the device's camera, introduces physics for throwing balls, tracking player swiping, using creature reactions, and working with a new game scene.

Chapter 6, Storing the Catch, devoted to developing the player's inventory bag, which will hold all the Foody creatures they catch, and other useful items. Here, we walk the reader through adding persistent storage and adding a simple inventory scene.

Chapter 7, Creating the AR World, adds locations of interest around the player based on a real-time data service.

Chapter 8, Interacting with an AR World, allows the player to interact with the locations of interest. In our simple game, the player will be able to sell their caught monsters.

Chapter 9, Finishing the Game, provides the reader with the information on how to finish the game or better yet write their own location-based AR game. For the purposes of this book, we will only develop the demo Foody Go game.

Chapter 10, Troubleshooting, cover a number of troubleshooting tips and tricks to overcome those development obstacles. As with any software development exercise, problems always arise.

What you need for this book

In order to follow all the exercises in this book you will need, at a minimum, a computer capable of running Unity 5.4+ and an iOS or Android device capable of running Unity games and equipped with a GPS.

More details about Unity system requirements may be found at: https://unity3d.com/unity/system-requirements.

Who this book is for

This book is intended for anyone with an interest in developing their own Pokemon Go, location-based AR game. While this book assumes no prior game development skills or Unity experience, you will need a basic understanding of the C# language or equivalent (C, C++, Java, or JavaScript).

Conventions

In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "The next lines of code read the link and assign it to the to the BeautifulSoup function."

A block of code is set as follows:

#import packages into the project 
from bs4 import BeautifulSoup 
from urllib.request import urlopen 
import pandas as pd

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

<head> 
<script src="d3.js" charset="utf-8"></script>  
  <meta charset="utf-8"> 
  <meta name="viewport" content="width=device-width"> 
  <title>JS Bin</title> 
</head>

Any command-line input or output is written as follows:

C:\Python34\Scripts> pip install -upgrade pip
C:\Python34\Scripts> pip install pandas

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "In order to download new modules, we will go to FilesSettings | Project Name | Project Interpreter."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book-what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of. To send us general feedback, simply e-mail [email protected], and mention the book's title in the subject of your message. If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

Downloading the example code

You can download the example code files for this book from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

You can download the code files by following these steps:

  1. Log in or register to our website using your e-mail address and password.
  2. Hover the mouse pointer on the SUPPORT tab at the top.
  3. Click on Code Downloads & Errata.
  4. Enter the name of the book in the Search box.
  5. Select the book for which you're looking to download the code files.
  6. Choose from the drop-down menu where you purchased this book from.
  7. Click on Code Download.

Once the file is downloaded, please make sure that you unzip or extract the folder using the latest version of:

  • WinRAR / 7-Zip for Windows
  • Zipeg / iZip / UnRarX for Mac
  • 7-Zip / PeaZip for Linux

The code bundle for the book is also hosted on GitHub at https://github.com/PacktPublishing/Augmented-Reality-Game-Development. We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing/. Check them out!

Downloading the color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/AugmentedRealityGameDevelopment_ColorImages.pdf.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books-maybe a mistake in the text or the code-we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at [email protected] with a link to the suspected pirated material.

We appreciate your help in protecting our authors and our ability to bring you valuable content.

Questions

If you have a problem with any aspect of this book, you can contact us at [email protected], and we will do our best to address the problem.[footnote]