What might seem like a trivial piece of coding can become exceedingly complex when you're dealing with the entire planet. This is what I found out when I sat down with Infinite Flight developer Valentin Horner to discuss his world of coding. Admittedly, I asked Val to keep things in simple terms for me, but I think this benefits most people who are learning about what goes into coding maps. The result was fun and informative.

Animated Infinite Flight Map

Can you give an overview of the work you do with maps?

Not much, I've been just playing Factorio for the last 2 years. At the end I will just rename the old map "new map", change a few colors, add a few bugs, and call it a day. But actually, so far I've been in charge of vector data. This means everything that can be drawn using lines which is lightweight and fast to render.

Before working on the new map, I worked on airports in Infinite Flight. The new map is very similar to that. We are using the same pipeline to take information about coastlines, country lines, states lines, etc. We cut these lines into tiles, put them in the tile server, and then the new map will load these tiles and display them in the app. There are slight differences in how lines are processed and then rendered in the app, so it's not as easy as re-using code from the airport rendering.

What is the main purpose of the map rebuild?

They had no idea what to do with me, so they thought, "let's have him do a useless piece of software for 2 years."

No, really...

The map that is currently used in the app is pretty old. It was originally designed to work with small regions pre-global. At that time we didn't simulate a round earth, and we already had a preset number of things to display on the map, so we could keep it all in memory and access it quickly to display to the user.

With the addition of global flight, we didn't have the time to re-design the map from scratch. So my task was to make the old map "global" without changing too much, or delaying the global release. However a map for the whole planet (especially an ellipsoid-shaped planet) is a whole other thing. There are so many things to render on the map for the whole planet that we couldn't keep it all in memory.

A lot of tricks were used to make the old map run kind of smoothly while rendering the planet. However some sacrifices had to be made, such as removing terrain elevation, as well as adding different projection due to memory limitations and performance issues.

We reached the point where this old map, with an old design that worked fine before Global, turned into a monster with many tentacles that was super inefficient (it currently takes almost as much time to render as an airplane). We wanted to add new features to the old map, but it just wasn't possible without taking major performance hits.

That's why a new map, designed for Global, and based on the way we render the planet and the airports made much more sense.

Why don't we have terrain elevation for ATC and pilots anymore?

As I explained earlier, it was just impossible with the old map. The new map is designed so that adding elevation back is possible without too much of a performance hit. It just won't be released with the new map right away.

What new features can you share that people will notice with the new map?

No major new features as it is basically the same map, but the inner workings are completely new. There will be a few changes in the looks of it, though nothing is final as of right now.

The coastlines will be much more detailed, no more KSAN in the ocean! There will be country lines and also state lines for large countries. Other than that, nothing will really be new as it's just meant to replace the existing map. Over time we will add more functionality and features to the map; things that we couldn't have done with the old one.

What features won't people notice that were necessary in building the map?

Everything. The new map is made from scratch. There is almost nothing in common with the old one. It's not just code in the app, as there are changes in our processing pipeline to allow the new type of data to be processed as well. It took a while to make something that basically is the same as before. However we can build many more features on top of it in the future.

What kinds of things do you have to take into account when working across different types of devices?

For the map, not much really. Performance is the number one priority. Otherwise, the type of device shouldn't change the way the map works.

Why is this taking so long?

The new map has indeed been a long time in the works. A lot of time was spent on designing it so that we would see a performance improvement compared to the old map, and also allow us to easily add more features later on. Some designs turned out to be dead-ends and there were a few re-writes. Also we are such a small team, we can't truly work full time on something as there are sometimes higher priority features or bug fixes that require our attention. I made a little human as well, but my wife deserves 99% of the credit for that.

Are you building anything that could support buildings (shapes) in the future?

Yes and no. I've done a few tests to see what kind of data we can use to render buildings in the app but I'll leave it there for now.

Thanks to Val for taking some time to give us a look into what he's doing to make Infinite Flight awesome!