Voxel-based crafting games are fun. Minecraft led the way, and there are some strong open source apps in the same genre. Minetest, for example, is an excellent voxel-engine world-building game.
When a 'world' in minetest is created, a complicated process of randomly creating terrains and zones and other features is used to make each world different, yet at the same time belivable and not totally random. Its a short jump from wandering a random world to wanting to wander the real world that you already know, but to do it inside the game.
Minecraft has many many amazing examples of people who hand craft large worlds with amazing detail. Its human nature to want to create, given a satisfying platform to create with. Here's a great example of my town of Portland, hand-crafted inside minecraft.
A different approach to putting the real world into a voxel world is to try and automate the process by 'scanning' the real world and recording the data. It turns out the government has been doing this for a long time because mapping the land is useful for a lot of reasons. Airplanes and satellites use LIDAR to get rough altitudes of whatever features they fly over. The gotcha is that the data is very rough compared to what we can see, and it cant "see through" things so a forest canopy will look just like a flat road at the height of the treetops.
With that caveat in mind, there is an open source project to use these LIDAR maps to build a minetest world. Its called geo-mapgen and it can read LIDAR data and translate it to something that minetest understands. Install minetest (on ubuntu sudo apt install minetest) and then follow these steps to use the geo-mapgen software.
The first step is to download some LIDAR data. If you're looking inside the USA, the Government has a National Map website. Follow the link below and select "Elevation Products (3DEP)", "1/3 arc second", and "ArcGrid" format.
Unzip the data you'll see a folder named something along the lines of 'grdn46w123_13' where 'n46' means lat 45 to 46 degrees and 'w123' means longitude -122 to -123 degrees and '13' means 1/3 arc second. Thats the coverage area for the arcgrid data files you now have. The minetest plugin takes GeoTIFF so the gdal suite of utilities is needed to convert arcgrid to geotiff. On Ubuntu, install the 'gdal-bin' package. Convert the data with this command:
gdal_translate grdn46w123_13 -of GTiff GRID1.tif
In your minetest folder, find the mods folder and copy geo-mapgen from github.
minetest$ cd mods mods$ git clone https://github.com/Gael-de-Sailly/geo-mapgen
Start minetest to create a world but do not start a game with that world yet, exit the program after creation.
$ minetest 1. Press New 2. World name: whatever you like, we'll call it Voxington 3. Mapgen: "singlenode" 4. Press Create 5. Press Configure 6. select "geo_mapgen" and in the checkbox above it, check "Enabled" 7. Press Save 8. exit minetest
For convenience, move the GeoTIFF file into the geo-mapgen folder, then run the 'conversion' utility
mods$ cd geo-mapgen geo-mapgen$ mv ~/nationalmap/grdn46w123_13/GRID1.tif . geo-mapgen$ python image_convert.py 1. fill in Elevation image with the path/file to your GRID1.tif 2. fill in Minetest world directory with the worlds/Voxington folder 3. press Calculate size (in my case its 10812x10812) 4. Tiles scale: 80 5. Vertical scale in meters per node: 40 6. press Proceed 7. Wait for the conversion to finish. If you watch the terminal you launched the program from, it will say "Done." 8. exit image_convert.py
Load minetest and enter the Voxington world. The console where minetest was launched from should have some [geo_mapgen] output and chances are you'll be falling straight down alongside a cliff, with no bottom in sight. Fix this with some minetest admin commands.
Inside minetest type
/grant singleplayer allto grant youself special powers. Then jump back up to 30 blocks above ground level with
/teleport 0,30,0. If you look all around you should see a land surface of some sort. Thats it, you're now in the world that was generated from lidar data.
The next step is translating a lat/lng of somewhere you want to be, into the x,y,z coords of the game. I do not have a great system for this. We know the map is 10812x10812 and we know the lidar data is lat 45 to 56 degrees and long -122 to -123 degrees. So to get to 45.4093,-122.6578, multiply 10812 by the fractional part of the degrees to get an X 5577 and a Y of -7178.
To use the X/Y say
/teleport 5577, 30, -7178where the first number is X, the second number is the elevation to be at (Z), and the third number is the Y value (note the western hemisphere will be a negative value). If you see nothing but blackness, you're inside the ground so use a higher elevation. If you see nothing but sky you're probably too high up. Orienting yourself by spinning around until you find the sun, then look down from there. If you still dont see the ground, teleport again with a lower altitude.
Here is 45.40966/-122.65914 from opentopomap.org
Here is the same area in minetest (4429, -6813 (adjusted from -7112)), facing the tall piece of land and the river on either side is visible.