Pokemon GO is a popular android / iOS game that uses augmented reality to provide fun interactions. Niantic, the company behind Pokemon GO, started as an initial startup within google before branching out as its own private company. The company primarily focuses on location-based games and has also made other games such as Ingress Prime.
Pokemon GO utilities a pre-existing database from Ingress to place poke-stops and gyms in the world. Pokemon GO also uses the Open Street Maps API and also location services to place the player in the world and then uses the database to show the surrounding Pokemon, Pokestops and gyms.
With all this, we can break down Pokemon GO into smaller components, which is the initial starting point for how any game is made. Prototyping is essential and this consists of paper and digital versions. Unity is an excellent platform to so in; anyone can learn to code and build a game within Unity. So, the base components are: The map screen with all the Pokemon, catching a Pokemon and also storing the Pokemon. These components also help form the core gameplay loop.
Let’s look at how we can code a small piece of the game, catching a Pokemon. We can create a Pokemon class. A class acts as a blueprint that can store all the information we need about a Pokemon.
Next, we can add detection for if the Pokemon is hit with a poke-ball. There is always a chance that a Pokemon will flee, which is where the difficulty comes in. We can set the difficulty to be between 1-100 and act as a percentage that a poke-ball will hit.
The OnCollisionEnter function is the collision detection system within Unity. Objects with a collider on them that touch will then trigger the function. The next step is needing to check if the object is thrown is a Pokeball. This helps future proof our code when other items are added like berries. Finally, we check if the Pokemon is caught by comparing a random number to the difficulty.
Overall once breaking down a game enough into smaller manageable chunks you can quickly learn the secrets behind how a game was programmed.