Dev Diary: New Intel Map Rendering Algorithm
Rendering is the process of taking all of the data about where a Portal, Link, or Field is and drawing this on the screen. Traditional render methods essentially take a blank canvas, then paint each datapoint one at a time, until finishing the frame and displaying this to the user. To update, it then discards the frame and starts this process all over again. With large datasets, drawing the frame can take a very long time, most of which is spent redrawing existing data — tl;dr: it’s an inefficient process.
Developed in 2012, the general algorithm used by the original Intel Map loaded data in “chunks” rather than all at once to try and reduce initial loading times. And instead of discarding every frame, it looked at the data to see what changed, then removed and redrew the updated data. But in Portal dense areas, like San Francisco and Tokyo, as you’re well aware, the original Intel Map could still take minutes to finish loading.
The new Intel Map rendering algorithm improves upon the original by changing how we define each “chunk.” Mobile phones in 2020 are much more performant than the average hardware available in 2012. We now load as much data as possible within a time window versus a set number, which allows the algorithm to adapt to the CPU performance of each Agent’s device.
Additionally, instead of parsing all of the data with every frame, we check to confirm everything is correct once the render is done, whether that’s at the end of the frame or at the end of a few frames.
Finally, rendering now prioritizes Fields, then Links, then Portals. We found that rendering the data in this order makes larger areas of the map fill in first, showing visual progress earlier.
In a nutshell, the new Intel Map rendering algorithm is a lot faster. It’s now doing less repetitive work, and also working more efficiently. The performance gains from these changes are even more noticeable on mobile than on desktop, and can reduce loading times of Portal dense areas from minutes to several seconds.