Minecraft is a fascinating video game that remains popular with the pre-teen, teen, and post-teen crowds. You build and/or exploit a 3D world by manipulating blocks of various materials such as “stone”, “dirt”, or “sand”. In the footsteps of my colleague Pamela Robinson in the School of Urban and Regional Planning, and her student Lisa Ward Mather, I became interested in ‘serious’ applications of Minecraft. Lisa studied the use of the game as a civic engagement tool. Apparently, the blocky 3D nature of Minecraft worlds can be useful in planning to give viewers an idea of planned building volumes while making it clear that preliminary display are not architectural plans.
Taking a geographic perspective, I am interested in the potential of Minecraft to educate kids about larger areas, say the City of Toronto. In this post, I outline the conversion of a digital elevation model (DEM) into a Minecraft terrain. I imagine the output as a novel way for ‘gamers’ to explore and interact with the city’s topography. Some pointers to related, but not Toronto-specific work include:
- GIS StackExchange discussion on “Bringing GIS data into Minecraft“, including links to the UK and Denmark modeled in Minecraft
- A video conversation about “Professional Minecraft GIS“, where Ulf Mansson combined OpenStreetMap and open government data
- Workflow instructions for converting “Historical Maps into Minecraft” using WorldPainter, which automatically converts DEMs into Minecraft terrain (if I had seen this before I started implementing the Python script outlined below…)
- An extensive webinar on “Geospatial and Minecraft” by FME vendor Safe Software, touching on creating Minecraft worlds from DEMs, GPS, LiDAR, building information management, and the rule-based CityEngine software
The source data for my modest pilot project came from the Canadian Digital Elevation Model (CDEM) by Natural Resources Canada, accessed using the GeoGratis Geospatial Data Extraction tool at http://geogratis.gc.ca/site/eng/extraction. In QGIS, I converted the GeoTIFF file to ASCII Grid format, which has the advantage of being human-readable. I also experimented with clipping parts from the full DEM and/or reducing the raster resolution, since the first attempts at processing would have taken several hours. The QGIS 2.2 raster translate or clip operations ran a GDAL function along the following lines (see http://www.gdal.org/gdal_translate.html and http://www.gdal.org/formats_list.html for details):
gdal_translate -projwin [xmin ymin xmax ymax] -outsize 25% 25% -of AAIGrid [input_file.tif] [output_file.asc]
On the Minecraft side, you need an account (for a small cost), a working copy of the game, and an installation of MCEdit. Player accounts are sold and managed by the game’s developer company, Mojang, see https://minecraft.net/store/minecraft. The Minecraft software itself is launched from the Web – don’t ask about the details but note that I am using version 1.8.7 at the time of writing. MCEdit is a free tool for editing saved Minecraft worlds. It has an option to add functionality through so-called ‘filters’.
The MCEdit filter I wrote is “dem_gen.py”, a Python script that collects a few input parameters from the user and then reads an ASCII GRID file (currently hard-coded to the above-mentioned Toronto area DEM), iterates through its rows (x direction) and columns (y direction in GIS, z in Minecraft), and recreates the DEM in Minecraft as a collection of ‘columns’ (z direction in GIS, y in Minecraft). Each terrain column is made of stone at the base and dirt as the top-most layer(s), or of other user-defined materials.
I have freshly uploaded the very first version 0.1 to GitHub, see https://github.com/crinner/mc_dem_gen. (This also serves as my first developer experience with GitHub!) The general framework for an MCEdit filter and the loop creating the new blocks were modified from the “mountain_gen.py” (Mountain Generator) filter found at http://www.mediafire.com/download.php?asfkqo3hk0lkv1f. The filter is ‘installed’ by placing it in the filter subfolder in the MCEdit installation. The process then simply involves creating an empty world (I used a superflat world with only a bedrock layer) and running the DEM Generator filter. To run any filter in MCEdit, select an area of the world, press ‘5’, and select the filter from the list.
Converting the 2,400 by 1,600 pixel CDEM dataset shown in the above screenshot of my QGIS project took about half a day on a middle-aged Dell Latitude E6410 laptop. The screenshot below shows that many data “chunks” are missing from this preliminary result, perhaps an issue when saving the terrain in MCEdit.
With a coarser DEM resolution of 600 by 400 pixels and using a newer Dell XPS 12 tablet (!), the processing time was reduced to 10 or so minutes and the result is promising. In the following screenshots, we are – I believe – looking at the outlets of the Humber River and Don River into Lake Ontario. Note the large vertical exaggeration that results from the horizontal dimensions being shrunk from around 1 block = 20m to 1 block = 80m, while vertically 1 block corresponds to 5m.
There remain a number of challenges, including a problem translating the geographic x/y/z coordinate system into the game’s x/-z/y coordinate system – the terrain currently is not oriented properly. More thought also has to be put into the scaling of the horizontal dimensions vis-a-vis the vertical dimension, adding the Lake Ontario water level, and creating signs with geographic names or other means of orientation. Therefore, your contributions to the GitHub project are more than welcome!
Update, 10 June 2015: I was made aware of the #MinecraftNiagara project, which Geospatial Niagara commissioned to students in the Niagara College GIS program. They aim to create “a 1:1 scale representation of Niagara’s elevation, roads, hydrology and wooded areas” to engage students at local schools with the area’s geography. It looks like they used ArcGIS and the FME converter, as described in a section of this blog post: http://geospatialniagara.com/backlog-of-updates/. Two screenshots of the Lower Balls Falls near St. Catharines were provided by @geoniagara’s Darren Platakis (before and after conversion):