Augmented Reality is increasingly turning into the hot technology of the moment, especially after the launch of the Pokemon Go game. Some time ago I devoted a blog post to how to start playing around with AR: Augmented Reality in Mobile Devices (with an App Tutorial for Android!). It was a huge success - more than 10,000 people read it. It turns out that location-based AR is not all that complicated so today let’s check what we need to create an app that works like Pokemon Go. Yes, you read it right, we are not immune to the temptation of using this game to boost our blog traffic. Shameless!
What Do We Need to Start With?
Backend with Database
Each mobile application needs a server that will manage the users as well as the data flow. In our case, we need somewhere to store information about our Pokemon objects. It’s enough to have at the beginning:
object's latitude and longitude can be provided by a pseudorandom generator,
Combat Power (CP),
Hit Points (HP),
GIF file of an animated Pokemon, e.g.:
When you develop an MVP and want immediate prototypes, it’s great to choose cloud solutions instead of developing them on your own. I would recommend giving Firebase a try. It’s a really powerful, NoSql database that can be easily integrated with the Google Cloud Platform and, for example, push notifications. Moreover, Firebase has its own SDK for Android and it’s really easy to start using it.
To populate your database, just use the Pokemon API database with detailed information that can be used for future improvements such as the evolution. Maybe you fancy starting up a Water Pokemon for lakes and rivers?
An algorithm for displaying augmented information using the camera view. You can kick off with the one described in the blog post, but it requires some fine-tuning:
Add the option of working with sets of points instead of a single predefined spot. Probably the easiest approach is to detect the closest Pokemon and bring it up on display. You need to grab the object that is closest to you from the set, for example by using the distanceTo() method.
Additionally, we don’t want to show the Pokemon in the centre of the screen only. That’s why you would need to map the azimuth angle to the screen pixels to make it look smooth on display.
One of the key features of Pokemon Go is that you actually need to walk around to catch Pokemon. To pull this off, we can use Google Maps with the first-person view — really simple to set up in your app. Thanks to markers you can place the nearby Pokemons or Pokestops on your map. You can also set a custom location icon with your avatar.
The most interesting part of the UI/UX in Pokemon Go is the throwing Pokeball animation. As you may well expect, to implement this, there are as many solutions as there are developers and everything depends on how accurate and sophisticated you want it to end up. As a starting point, you might want to check out ObjectAnimator from the SDK. This tool allows you to animate a bitmap of a Pokeball. After some user interaction that involves hitting the Pokemon, just play the pre-programmed animation of catching it.
Remember! This Is Just the Beginning!
Application development is a complicated process, and any guidelines that are suggested are just the first step on a longer journey. Our experience here at Netguru has told us that the best results can be achieved from a process of frequent testing among users from your target group and then using the feedback to improve your application. When you finish the first iteration of the MVP according to our guidelines, share it with a selected group of early adopters to gather feedback. As proven in Design Thinking methodology, the iterative process, along with frequent deployments of prototypes for testing, gives you the best insights and prospects for desired profit.