Book Description

Create your own augmented reality games from scratch with Unity 5

About This Book

  • Create your own augmented reality game from scratch and join the virtual reality gaming revolution
  • Use the latest Unity 5 VR SDK to create pro-level AR games like Pokémon Go
  • Innovate and explore the latest and most promising trend of AR gaming in the mobile gaming industry

Who This Book Is For

This book is for those who have a basic knowledge of game development techniques, but no previous knowledge of Unity is required. Some basic programming knowledge would be desirable, but the book is an introduction to the topic. The book is also suitable for experienced developers new to GIS or GPS development.

What You Will Learn

  • Build a location-based augmented reality game called Foodie Go
  • Animate a player's avatar on a map
  • Use the mobile device's camera as a game background
  • Implement database persistence with SQLLite4Unity3D to carry inventory items across game sessions
  • Create basic UI elements for the game, inventory, menu, and settings
  • Perform location and content searches against the Google Places API
  • Enhance the game's mood by adding visual shader effects
  • Extend the game by adding multiplayer networking and other enhancements

In Detail

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.

Style and approach

This book shows you how to create every step of the game and gives practical examples.

Table of Contents

  1. Augmented Reality Game Development
    1. Augmented Reality Game Development
    2. Credits
    3. About the Author
    4. About the Reviewer
    5. www.PacktPub.com
      1. Why subscribe?
    6. Customer Feedback
    7. Preface
      1. What this book covers
      2. What you need for this book
      3. Who this book is for
      4. Conventions
      5. Reader feedback
      6. Customer support
        1. Downloading the example code
        2. Downloading the color images of this book
        3. Errata
        4. Piracy
        5. Questions
    8. 1. Getting Started
      1. Real-world adventure games
        1. Location-based
        2. Augmented Reality
        3. Adventure games
          1. Introducing Foody GO
          2. Source code
      2. Getting into mobile development with Unity
        1. Downloading and installing Unity
        2. Setting up for Android development
          1. Installing the Android SDK
          2. Connecting to your Android device
        3. Setting up for iOS development
      3. Getting started with Unity
        1. Creating the game project
        2. Building and deploying the game
          1. Building and deploying to Android
          2. Building and deploying to iOS
      4. Summary
    9. 2. Mapping the Player's Location
      1. GIS fundamentals
        1. Mapping
      2. GPS fundamentals
        1. Google Maps
        2. Adding a map
          1. Creating the map tile
          2. Laying the tiles
          3. Understanding the code
        3. Setting up services
          1. Setting up CUDLR
          2. Debugging with CUDLR
          3. Setting up the GPS service
      3. Summary
    10. 3. Making the Avatar
      1. Importing standard Unity assets
        1. Adding a character
        2. Switching the camera
        3. Cross-platform input
        4. Fixing the input
          1. GPS location service
            1. Map tile parameters
            2. GPS simulation settings
          2. Character GPS compass controller
        5. Swapping out the character
      2. Summary
    11. 4. Spawning the Catch
      1. Creating a new monster service
        1. Understanding distance in mapping
        2. GPS accuracy
      2. Checking for monsters
        1. Projecting coordinates to 3D world space
        2. Adding monsters to the map
        3. Tracking the monsters in the UI
      3. Summary
    12. 5. Catching the Prey in AR
      1. Scene management
      2. Introducing the Game Manager
      3. Loading a scene
      4. Updating touch input
      5. Colliders and rigidbody physics
      6. Building the AR Catch scene
      7. Using the camera as our scene backdrop
      8. Adding the catching ball
      9. Throwing the ball
      10. Checking for collisions
      11. Particle effects for feedback
      12. Catching the monster
      13. Summary
    13. 6. Storing the Catch
      1. Inventory system
      2. Saving the game state
      3. Setting up services
      4. Reviewing code
      5. Monster CRUD operations
      6. Updating the Catch scene
      7. Creating the Inventory scene
      8. Adding the menu buttons
      9. Bringing the game together
      10. Mobile development woes
      11. Summary
    14. 7. Creating the AR World
      1. Getting back to the map
      2. The Singleton
      3. Introducing the Google Places API
      4. Using JSON
      5. Setting up the Google Places API service
      6. Creating the markers
        1. Optimizing the search
      7. Summary
    15. 8. Interacting with an AR World
      1. The Places scene
      2. Google Street View as a backdrop
      3. Slideshow with the Google Places API photos
      4. Adding UI interaction for selling
      5. The game mechanics of selling
      6. Updating the database
      7. Connecting the pieces
      8. Summary
    16. 9. Finishing the Game
      1. Outstanding development tasks
      2. Missing development skills
      3. Cleaning up assets
      4. Releasing the game
      5. Problems with location-based games
      6. Location-based multiplayer game
      7. Firebase as a multiplayer platform
      8. Other location-based game ideas
      9. The future of the genre
      10. Summary
    17. 10. Troubleshooting
      1. Console window
      2. Compiler errors and warnings
      3. Debugging
      4. Remote debugging
      5. Advanced debugging
      6. Logging
      7. CUDLR
      8. Unity Analytics
      9. Issues and solutions by chapter
      10. Summary