Armax / Pokemon-GO-node-api

Pokemon GO api node.js library
MIT License
875 stars 198 forks source link

What are MapPokemon and WildPokemon? #128

Closed firanto closed 8 years ago

firanto commented 8 years ago

I have a few question regarding heartbeat payload sent by the server.

  1. What are MapPokemon and WildPokemon in the heartbeat?
  2. What are the differences between these two? It seems that their coordinate are equals.
  3. Can we get nearby pokemons' location (which usually invisible until we close enough to them)? It seems that MapPokemons and WildPokemons are the pokemon that actually show on the map so users can tap into it to engange them. Can we map nearby pokemons and show them on google map and use the location data to actually move closer to those pokemons so the pokemon itself will spawn on the game itself?
WhataShane commented 8 years ago

To tag along, here are my similar questions from another github issues thread:

In lieu of a new Pokemon species, I'm now encountering a new problem instead.
My script, made to print the Pokemon available in the surrounding area (using WildPokemon), seems to only work when I set my location to popular places like the Santa Monica Pier or Times Square. Otherwise, when it's set to locations like the street I live on, it prints absolutely nothing, bar the heartbeat notification. Is this a kink in the api? Or is my search radius simply not large enough to detect the surrounding "invisible" Pokemon?

Assuming the latter: I was under the impression that WildPokemon would reveal all Pokemon in a larger radius than NearbyPokemon, but I suppose this is not the case. I take it the only way to map out the locations of all the local Pokemon is to write an algorithm that has my character move in circles that gradually grow in size. Has something like this already been developed?

I'm not sure it makes much of a difference in this use case, but I switched over to @d-pollard's fork of the api.

Edit: Just stumbled upon the nearby Pokemon function found in this https://github.com/Daplie/node-pokemap/blob/master/index.js ... They don't seem to have a script implemented that moves their character around. Why/how are they able to register these Pokemon?

firanto commented 8 years ago

After I look into it a bit more, I think each this is flow:

  1. heartbeat only provide nearby pokemons (the one shown on the nearby panel on the game app).
  2. Once the user move close enough to the location specified by server data and calling heartbeat again, by this time, the heartbeat will provide map and wild pokemons (both are showing exact coordinate, which is why I'm asking the difference between the two) which will be shown on the game's map and tappable by the user to engage.

By these flow, that script mentioned by @WhataShane is reading this map pokemons data from the heartbeat which only returned if the player is sending heartbeat with location data near enough to the pokemon location stored on the server. He does exactly what the game did. He didn't scan all nearby pokemons' location.

This way, we cannot get all pokemon's position without actually moving the character's location. As WhataShane said, we must decide a point, and then move in circular motion wider and back to the center to scan the vicinity. Note that each pokemon will disappear after each of them reach their designated expiration (which means you need to constantly moving in circular motion with your gps location as the center).

My suggestion when doing this, use any secondary, disposable account just in case you get banned. You didn't plan to catch anything anyway.

coolaj86 commented 8 years ago