The core of most real-world games is the location-based map. That integration of the player's real-world position mapped into the virtual world extends the game's virtual elements into the real world, allowing players to explore the world around them with a new perspective and sense of exploration.
In this chapter, we will take our first steps to understanding how to integrate maps into a Unity game. However, before working with Unity, we will cover the basics of GIS and GPS. This will allow us to establish some simple definitions and background for what can be complex topics. After that, we will dive back into Unity and add a location-based map, a basic character, and free look camera to our Foody GO project. Even though we are dealing with advanced concepts, we will keep things simple for now and avoid getting into any code. Of course, more advanced readers with a background in GIS have the options to explore the code at their leisure.
Here is a quick breakdown of what we will cover in this chapter:
GIS stands for geographic information system, a system in which geographic data is collected, stored, analyzed, manipulated, and served as maps. Although that definition is still prominent, GIS has come to mean everything from software applications, hardware, tools, science, and services. Google Maps, for example, is the best-known example of a GIS in use today. Yet, in this book, we will also use GIS to mean the science and process of converting geographic data and mapping.
Cartographers have been mapping the world around them for thousands of years. Yet only very recently with the development of computers did it become efficient to be used in computers and GIS to create dynamic maps. Unlike traditional hand-drawn paper maps, dynamically rendered maps are composed of layers of spatial data that could describe roads, points of interest, parks, boundaries, landscape, water, and more. As much as the common Google Maps user has little control over what layers are shown, they are there. The following is a figure that shows the typical layers that could comprise a road map:
Source: http://bit.ly/2iri2vr
Google Maps, Bing, and other GIS providers will typically render maps at various zoom levels and then cut those maps into static image tiles. The GIS server then serves those tiles to the user. This works well for performance, but provides few options for customization or styling, aside from adding shapes, lines, or points of interest. This form of tile mapping is often referred to as static mapping. For this book, we will work with the Google Maps API, which provides us with dynamic maps.
Dynamic maps give the presenter or developer options to style and/or symbolize the data as required. For instance, on some maps, you may want to alter parks to be shown as blue instead of green. This is the type of flexibility that dynamic maps provides. When we will add the Google Maps API to our project later in this chapter, we will explore custom style and symbolization options.
Now that we understand the basics of GIS mapping, let's get into understanding some terminologies and concepts. The following is a list of terms we use when describing or making maps:
The following is a diagram showing WGS 84 major lines of interest:
Source: http://bit.ly/2iOoPNG
Longitude west of the prime meridian is measured as negative. Latitude south of the equator is measured as negative.
Web Mercator projection on the left and Gall-Peters on the right
3.12.161.77