Diving deeper into the code for Pokemon GO

We reported the daily quests upcoming for Pokemon GO in the upcoming weeks. This was found out by our friends at PokemongoHub.

pokemon-go-logo

The developers decided to search more into the coding for any clues as to upcoming events and changelogs. They found quite a bit.

 

The code behind the events looks quite simple and straightforward. This code appeared in the APK recently, possibly with the 0.43.3 update. Here’s the summary of everything we found:

  • Events are referred as FESTIVALS inside the code base
  • Every FESTIVAL is defined by the following information
    • FESTIVAL_TYPE
    • FESTIVAL_SETTINGS
    • FESTIVAL_SCREENS
    • FESTIVAL_PROGRESS
  • There is only one Festival Type in the metadata so far: HALLOWEEN
    • Christmas or Thanksgiving events are not mentioned anywhere
  • FestivalWarningScreen spotted in the wild
    • New Halloween warning (loading?) screen could be coming during the event period
    • New Halloween loading screen confirmed
  • Festivals are some how connected to Gyms as they are using the FortSettings and FortSettingsProto
    • Note: Gyms are called Forts in the code base

new-loading-screen

Full research

We extracted all of the code fragments that reference the Festivals below. Do note that much of the code is incomprehensible due to being hidden in the binaries. There could, and probably is, be much more code dealing with the events elsewhere.

First encounter was the FESTIVAL_TYPE_KEY. It’s a constant pointing to a concrete type of event, probably on the server side. Interestingly, the CachedFestivalProto references the LoadingWarningScreen, implying there is support for different warning screens during the events.

Also note the ObserveFestival and SetProgress references in the snippet.

.FestivalService
.get_CachedFestivalProto.set_CachedFestivalProto.SettingsUpdated.fest.<Initialize>m__13E
.FESTIVAL_TYPE_KEY
.FESTIVAL_AES_KEY_KEY
.FESTIVAL_AES_VECTOR_KEY.CachedFestivalProto.LoadingWarningScreen
.festival.ObserveFestival.SetProgress.defaultLoadingObject.defaultLoadingBar.warningImage.defaultSprite
.festivalScreens
.festivalService

Festival Receipt? We are not sure what that could mean, but we highly doubt an event could be locked behind a paywall. Update: Rechecked the rest of the metadata, it seems receipt is a weird naming convention on Niantic development team for confirming you received an item/candy/egg. Moving on, there are even more interesting code references: FestivalWarningScreen and FestivalSettings!

The first one is easy, points to an upcoming warning screen while the app is loading. The other one, however, could mean a lot of things. We are trying to tie in some better tools to figure out what Festival Settings are.

.festivalReceipt.currentLoadingBar.currentProgress
.FestivalWarningScreen
.festivalType
.festivalLoadingObject.<ObserveFestival>c__AnonStorey155.<>m__13F.BilateralFilter.Niantic.Holoholo.Filters
.get_FestivalSettings
.set_FestivalSettings.<_parser>m__24B.FortSettingsFieldNumber.MapSettingsFieldNumber.LevelSettingsFieldNumber.InventorySettingsFieldNumber.MinimumClientVersionFieldNumber.GpsSettingsFieldNumber
.FestivalSettingsFieldNumber.fortSettings_.mapSettings_.levelSettings_.inventorySettings_.minimumClientVersion_.gpsSettings_
.festivalSettings_.FortSettings.MapSettings.InventorySettings.MinimumClientVersion.GpsSettings
.FestivalSettings.FortSettingsProto
.FestivalSettingsProto

Finally, there is only a small number of references to the Halloween Festival Type. As you can see, the game uses the DownloadSettingsActionProto to fetch Halloween settings, again to what extent, we do not know.

.get_FestivalType
.set_FestivalType
.FestivalTypeFieldNumber.VectorFieldNumber
.festivalType_.vector_
.FestivalType.Vector.HALLOWEEN.SettingsActionReflection.DownloadSettingsActionProto

Here’s a screenshot of the full search results for “Festival” inside the metadata dump.

festival-data-mining-png

 

All of this points to the fact that Niantic has been planning for future events and how to keep the game fresh for its players. The unprecedented surge in the interest in the game left the developers frantic and well behind the community’s expectations in terms of the updates to the game. They definitely do not want such a situation repeating for them in the current event.