Welcome to the first entry of our ERA developer's blog! We plan on using this not only as a medium for updates and communication between players and developers, but also a source of entertainment and information for those interested in developing, GIS, or gaming as a whole. Our community right now is made up largely of geography or GIS professionals/enthusiasts, so the first few entries will be heavily focused on the GIS aspect.
Right from the inception of the idea to create a game, we wanted to make something that had a geography aspect to it. Would it be a virtual reality game utilizing user location? An isometric desktop game with a god-like feel to it? Eventually, after weeks of discussion and thinking, we produced the concept of ERA, a territory wars game that's played in the same world that we live in today. We would start with the contiguous United States, and if the idea was well-received, maybe even the entire planet.
Before starting on the actual game, however, we needed to build the set on which ERA would perform. This required a great deal of geographic data, and an efficient data schema that allowed for fast queries to retrieve territory information in-game.
Upon starting our data search, we turned directly to the USGS data catalog, where hundreds upon thousands of datasets exist. For version 1 of our renderer, we needed two sets of data: elevation and land cover. Both of these sets needed to cover the entire US at equal intervals within the dataset so that we could accurately store and depict the landscape.
Elevation was the first on the shopping list. Eventually, we found the SRTM Digital Elevation Dataset, a dataset with a 90m resolution stored in GeoTIFF tiles. For those of you are unfamiliar with GIS, GeoTIFF files are used for storing a matrix of values encoded in image form. When you open one of these with a default image viewer, you'll probably need to squint to see any detail. However, if you use a GeoTIFF viewer or normalize the values yourself, you'll see the data visualized beautifully.
In the normalized version of the image, you can distinctly see the mountain peaks of the Cascade Range, Mt. Rainier, and many others. This makes the Pacific Northwest the perfect testing grounds for a geographic renderer.
In conjunction with the elevation dataset, we also need land cover data in order to paint the landscape. For this part of the project, we used the National Land Cover Database, which provided us with a 16 GB dataset to lay over our elevation data.
Now that we had the two datasets necessary for world creation, we used the GDAL Python library and got to work weaving the two datasets together, which involved transforming their projections to match, breaking up the land cover dataset into smaller, more relevant pieces in order to optimize the script, and ultimately write each individual territory to our PostgreSQL database. Our basic schema consists of the territory's id, team, lat, lng, elevation, and terrain data encoded in a 64 bit integer. When the driver is finished populating the database, we're left with around 5.8 million territories in our table just for the Pacific Northwest.
With our database appropriately filled, we can now query for a region of the territories and render the elevation and terrain to check results. Using Three.js and an isometric camera setup, we see the fruit of our work.
It's a bit rough around the edges, but the render is an excellent example of what we wanted to see. I've spared a few techinical details about implementation, but work needs to continue on the game, so we must conclude this entry. Please feel free to discuss on our subreddit at /r/EarthRevivalAct and mention what you liked, what you didn't, and what you'd like to see more of in the future!