Getting elevation files to work in Empire Earth, 2021
May 27, 2021 15:52:16 GMT
Shieldwolf likes this
Post by joaoalves on May 27, 2021 15:52:16 GMT
this is a in dept guide by the editor master "Eggman" himself how to make elevation files work in 2021
Getting elevation files to work in Empire Earth, 2021 version
Hello- firstly, I need to give a shout-out to Discord member Âgræl#9008, as it was their conversations on
this topic trying to help others that I started reading to figure out how to get these files going in modern
times.
Making elevation maps:
Empire Earth wants the elevation data to make a map stored as 16-bit integers (signed, little-endian, but
that’s not relevant) in a single file with a DAT extension, with one value representing the height mapping
for one cell of the source map. Presumably negative values might indicate land below sea level, but
again we don’t really need to know this. Since the DAT file stores cell data only and nothing else, you
need a separate file to tell the game how the data is organized by columns & rows (in that order). This is
done with a TXT file that lists the width and height of your map separated by a single space and no line
feed at the end of the number for the height. Example:
6000 4500
…for a 6000 x 4500 map. Note that the game only supports making map sizes up to 400 x 400, so your
data will get interpolated up or down depending on if your source data is too big or too little compared
to the in-game size of the map you want.
When the game was released in 2001 places like the National Oceanic and Atmospheric Administration
(NOAA) allowed you to download the raw data for their satellite imagery. These days, this ability is
extremely rare. I looked through numerous websites and most of them only allow you to download
data processed into various other formats. In fact I found only 2 sites that allowed the downloading of
data as raw numbers, and the first one did in it ASCII format, which is no help as EE is looking for binary
data in the DAT file.
The second site was this: www.diva-gis.org/gdata
Sharp-eyed viewers might immediately notice a problem here: you have to pick a country and can’t
select an arbitrary area of the world. This is actually not the fault of this website, which I’ll get to in a
bit. First though, here’s a mini-map image of the elevation map EE generated after I picked “Italy” as the
country:
This website will give you an archive with three files. One of them is the GRI file that contains the
elevation data. Change this extension to DAT and place it in your Data\Scenarios\Elevation Maps folder.
This folder doesn’t exist on the base installation of the game, so you have to create it. Then make your
TXT file in this same folder and make sure it has the exact same name as the DAT file. Your downloaded
data will also have a GRD file; this can be opened with a text editor and will tell you the column & row
values that you need to place in your TXT file. Once you’ve done that, you can start making maps.
This is the simplest method you can employ to make an elevation map, but it will only take you so far
since you can’t specify an arbitrary land area. I mentioned before that this isn’t DIVA-GIS’ fault. Their
website is actually pulling data from this place: srtm.csi.cgiar.org/srtmdata
So this site divides the world into 5 x 5 degree lat/long squares as the smallest size you can get, and as
you can see, their interface isn’t too hot, they don’t even place an outline of the world on the GUI so you
have to guess where the land area is that you want. You’ll also notice that you can’t get the raw data in
binary format from here, so the DIVA-GIS site is figuring out which tiles correspond to the country you
picked, getting the data for you, concatenating it and converting to binary. “Italy” corresponded to a 3 x 3 tile area of the CGIAR data sets. You’ll notice that GeoTIFF is an option to get the data here. From
what I’ve seen this is by far the most common option you’ll have for being able to download elevation
data, so this is the file format I spent my time figuring out how to deal with. Here’s an example of the
GeoTIFF file I downloaded of the tile holding most of England and Wales along with the mini-map of the
EE map I made from this:
You’ll notice that GeoTIFFs typically look like a black-and-white image when viewed in a standard image
viewer. I’m assuming this is an example of steganography. The pixels that look black to the human eye
must have minor variations in the RGB values that correspond to changes in elevation. For example a
pixel colored (0, 0, 1) might be 1,000 meters lower than one colored (0, 0, 2) but both these colors will
pretty much appear black. I should note that you don’t even need to bother looking at the file in an
image viewer, although this can be helpful to get the width & height values you need for your text file.
In Windows I was able to get this information by right-clicking the file, choosing ‘Properties’, and then
‘Details’:
Alright, so we know we can get GeoTIFF to work if we convert the data. So how do we do that? Discord
member Âgræl#9008 said they were using a product called Global Mapper to load the TIF and then
export as binary data. The problem with Global Mapper is you can only use it for free as a time-limited
demo version that allows you to export binary data exactly one time! So unless you decide to pay for
this (but who wants to pay for any tool?), Global Mapper is not a good choice.
After poking the Internet with a sharp stick I found people discussing how to convert GeoTIFF to raw
numbers using a software package called ENVI developed by a company called ITTVIS. But ENVI is not
free… however some of their conversion drivers are available for use in open-source software. One of
these software packages is called GDAL, which you can get from GitHub, but you then have to compile it
yourself (something that annoys me to no end about the open-source community). So if you don’t want
to compile it yourself, can you get a ready-made executable? Luckily the answer is yes!This place hosts installers for lots of OS variants:
www.gisinternals.com/query.html?content=filelist&file=release-1928-x64-gdal-3-2-2-mapserver-7-6-2.zip
Since I’m using Windows 10 I went with release-1928-x64-gdal-3-2-2-mapserver-7-6-2.zip, but since this
site recompiles GDAL every time GitHub has a new update, the options may be different when you view
it. This archive doesn’t actually install anything, it just unzips some folders, but you do have to run the
SDKShell.bat file in order to correctly setup the environment variables as GDAL has to be run via
command line. Luckily, since it is a command-line tool, you can tell it to do the GeoTIFF conversion
directly into a file with a DAT extension to at least save you the step of renaming the binary output file.
The England map data generated a GeoTIFF file called srtm_36_02.tif, so I converted it to a data file
called UK.dat with this command in a shell window:
gdal_translate -of ENVI srtm_36_02.tif UK.dat
And then I had to manually create the UK.txt file with the
6000 6000
…entry to match the pixel size of the GeoTIFF file. And poof! Everything finally works.
A good source of free GeoTIFF downloads can still be had from the NOAA here:
maps.ngdc.noaa.gov/viewers/grid-extract/index.html
Just make sure you pick ‘ETOPO1’ as your dataset. I successfully converted GeoTIFFs generated here
with GDAL and used them in EE no problem.
Lastly, I want to make a few comments on setting good values for generating a map. Here’s an in-game
shot of making an elevation map. I use an area including northern Italy and Switzerland here due to the
Alps so there are lots of mountains:
If you have a correct DAT/TXT pair in your Scenarios\Elevation Maps folder then it should be an available
option in your drop-down menu here. Now you have 4 key settings. Water Depth and Land Height refer
to the in-game settings for the maximum land elevation and water depth. The cutoff values then set the
maximum value in meters that your elevation can have before being chopped off by the land/water
cutoff values. In this image you’ll see that the mini-map indicates we’re still in the Alps, but the map
view is showing a plateau. That means that the mountains in this area are more than 2,000 meters tall
and are getting limited by the Land Cutoff value. For making maps, I would keep the Water Depth at 1
or 2 (maybe 2 is best) and have the Land Height in the 4 – 6 range. Too low on the land and you won’t
get nice mountains, too high, and the cliffs get way too steep. If you want your map to look as accurate
as possible, find out what the highest elevation point is for the region you’re working with and make this
the cutoff point. Values lower than this will start turning your mountain peaks into plateaus as you see
here, and values higher than this will start pushing your peaks downwards (which could be a good thing,
as you can end up with more playable land).
Something that’s a bit of a problem is that EE will use cliffs to make the hillsides, which are not playable
land, so if your terrain is too bumpy you may not have enough land for players to occupy or travel
through. And cliffs are a major pain to work with- any adjustment near a cliff can suddenly make the
cliff disappear and affect any number of tiles near it, usually totally ruining the nice coastline you just took the trouble to generate. If your map is not all-land I recommend that you literally use the
QuickSave button any time you click when using the elevation tool to make adjustments on your map,
otherwise you have no way to undo any changes that might totally ruin it. In this regard you can help
yourself out by raising the Land Cutoff value so that less cliff is generated to begin with.
Now I mentioned that the Water Depth should probably be 2 or even 1. This is because of a very
unusual bug in the game that I don’t think was ever patched and I wouldn’t have even remembered if
Discord user Philla007#2344 hadn’t dug up some of my old messages in the Empire Earth Heaven
forums. Basically, if there is exactly one tile at game elevation -1 that is completely surrounded by water
at elevation -2 or deeper, and there is an AI player with the power to reach this tile by boat, the game
can crash if the AI player attempts to do so. Since this is something the human players in the game have
no control over, it can lead to the game appearing to crash at random times. So if you keep the water
depth down to a minimum you can work to prevent these areas from even being spawned, and once the
map is generated you can make whatever areas of the map need it have deeper water if you want to, by
lowering it manually (but not too close to the shoreline, or you have the risk of a cliff suddenly changing
as discussed before).
I think that about covers everything you might need to know about making an elevation data map in
Empire Earth. Good luck with your scenario building!
by: Eggman
Getting elevation files to work in Empire Earth, 2021 version
Hello- firstly, I need to give a shout-out to Discord member Âgræl#9008, as it was their conversations on
this topic trying to help others that I started reading to figure out how to get these files going in modern
times.
Making elevation maps:
Empire Earth wants the elevation data to make a map stored as 16-bit integers (signed, little-endian, but
that’s not relevant) in a single file with a DAT extension, with one value representing the height mapping
for one cell of the source map. Presumably negative values might indicate land below sea level, but
again we don’t really need to know this. Since the DAT file stores cell data only and nothing else, you
need a separate file to tell the game how the data is organized by columns & rows (in that order). This is
done with a TXT file that lists the width and height of your map separated by a single space and no line
feed at the end of the number for the height. Example:
6000 4500
…for a 6000 x 4500 map. Note that the game only supports making map sizes up to 400 x 400, so your
data will get interpolated up or down depending on if your source data is too big or too little compared
to the in-game size of the map you want.
When the game was released in 2001 places like the National Oceanic and Atmospheric Administration
(NOAA) allowed you to download the raw data for their satellite imagery. These days, this ability is
extremely rare. I looked through numerous websites and most of them only allow you to download
data processed into various other formats. In fact I found only 2 sites that allowed the downloading of
data as raw numbers, and the first one did in it ASCII format, which is no help as EE is looking for binary
data in the DAT file.
The second site was this: www.diva-gis.org/gdata
Sharp-eyed viewers might immediately notice a problem here: you have to pick a country and can’t
select an arbitrary area of the world. This is actually not the fault of this website, which I’ll get to in a
bit. First though, here’s a mini-map image of the elevation map EE generated after I picked “Italy” as the
country:
This website will give you an archive with three files. One of them is the GRI file that contains the
elevation data. Change this extension to DAT and place it in your Data\Scenarios\Elevation Maps folder.
This folder doesn’t exist on the base installation of the game, so you have to create it. Then make your
TXT file in this same folder and make sure it has the exact same name as the DAT file. Your downloaded
data will also have a GRD file; this can be opened with a text editor and will tell you the column & row
values that you need to place in your TXT file. Once you’ve done that, you can start making maps.
This is the simplest method you can employ to make an elevation map, but it will only take you so far
since you can’t specify an arbitrary land area. I mentioned before that this isn’t DIVA-GIS’ fault. Their
website is actually pulling data from this place: srtm.csi.cgiar.org/srtmdata
So this site divides the world into 5 x 5 degree lat/long squares as the smallest size you can get, and as
you can see, their interface isn’t too hot, they don’t even place an outline of the world on the GUI so you
have to guess where the land area is that you want. You’ll also notice that you can’t get the raw data in
binary format from here, so the DIVA-GIS site is figuring out which tiles correspond to the country you
picked, getting the data for you, concatenating it and converting to binary. “Italy” corresponded to a 3 x 3 tile area of the CGIAR data sets. You’ll notice that GeoTIFF is an option to get the data here. From
what I’ve seen this is by far the most common option you’ll have for being able to download elevation
data, so this is the file format I spent my time figuring out how to deal with. Here’s an example of the
GeoTIFF file I downloaded of the tile holding most of England and Wales along with the mini-map of the
EE map I made from this:
You’ll notice that GeoTIFFs typically look like a black-and-white image when viewed in a standard image
viewer. I’m assuming this is an example of steganography. The pixels that look black to the human eye
must have minor variations in the RGB values that correspond to changes in elevation. For example a
pixel colored (0, 0, 1) might be 1,000 meters lower than one colored (0, 0, 2) but both these colors will
pretty much appear black. I should note that you don’t even need to bother looking at the file in an
image viewer, although this can be helpful to get the width & height values you need for your text file.
In Windows I was able to get this information by right-clicking the file, choosing ‘Properties’, and then
‘Details’:
Alright, so we know we can get GeoTIFF to work if we convert the data. So how do we do that? Discord
member Âgræl#9008 said they were using a product called Global Mapper to load the TIF and then
export as binary data. The problem with Global Mapper is you can only use it for free as a time-limited
demo version that allows you to export binary data exactly one time! So unless you decide to pay for
this (but who wants to pay for any tool?), Global Mapper is not a good choice.
After poking the Internet with a sharp stick I found people discussing how to convert GeoTIFF to raw
numbers using a software package called ENVI developed by a company called ITTVIS. But ENVI is not
free… however some of their conversion drivers are available for use in open-source software. One of
these software packages is called GDAL, which you can get from GitHub, but you then have to compile it
yourself (something that annoys me to no end about the open-source community). So if you don’t want
to compile it yourself, can you get a ready-made executable? Luckily the answer is yes!This place hosts installers for lots of OS variants:
www.gisinternals.com/query.html?content=filelist&file=release-1928-x64-gdal-3-2-2-mapserver-7-6-2.zip
Since I’m using Windows 10 I went with release-1928-x64-gdal-3-2-2-mapserver-7-6-2.zip, but since this
site recompiles GDAL every time GitHub has a new update, the options may be different when you view
it. This archive doesn’t actually install anything, it just unzips some folders, but you do have to run the
SDKShell.bat file in order to correctly setup the environment variables as GDAL has to be run via
command line. Luckily, since it is a command-line tool, you can tell it to do the GeoTIFF conversion
directly into a file with a DAT extension to at least save you the step of renaming the binary output file.
The England map data generated a GeoTIFF file called srtm_36_02.tif, so I converted it to a data file
called UK.dat with this command in a shell window:
gdal_translate -of ENVI srtm_36_02.tif UK.dat
And then I had to manually create the UK.txt file with the
6000 6000
…entry to match the pixel size of the GeoTIFF file. And poof! Everything finally works.
A good source of free GeoTIFF downloads can still be had from the NOAA here:
maps.ngdc.noaa.gov/viewers/grid-extract/index.html
Just make sure you pick ‘ETOPO1’ as your dataset. I successfully converted GeoTIFFs generated here
with GDAL and used them in EE no problem.
Lastly, I want to make a few comments on setting good values for generating a map. Here’s an in-game
shot of making an elevation map. I use an area including northern Italy and Switzerland here due to the
Alps so there are lots of mountains:
If you have a correct DAT/TXT pair in your Scenarios\Elevation Maps folder then it should be an available
option in your drop-down menu here. Now you have 4 key settings. Water Depth and Land Height refer
to the in-game settings for the maximum land elevation and water depth. The cutoff values then set the
maximum value in meters that your elevation can have before being chopped off by the land/water
cutoff values. In this image you’ll see that the mini-map indicates we’re still in the Alps, but the map
view is showing a plateau. That means that the mountains in this area are more than 2,000 meters tall
and are getting limited by the Land Cutoff value. For making maps, I would keep the Water Depth at 1
or 2 (maybe 2 is best) and have the Land Height in the 4 – 6 range. Too low on the land and you won’t
get nice mountains, too high, and the cliffs get way too steep. If you want your map to look as accurate
as possible, find out what the highest elevation point is for the region you’re working with and make this
the cutoff point. Values lower than this will start turning your mountain peaks into plateaus as you see
here, and values higher than this will start pushing your peaks downwards (which could be a good thing,
as you can end up with more playable land).
Something that’s a bit of a problem is that EE will use cliffs to make the hillsides, which are not playable
land, so if your terrain is too bumpy you may not have enough land for players to occupy or travel
through. And cliffs are a major pain to work with- any adjustment near a cliff can suddenly make the
cliff disappear and affect any number of tiles near it, usually totally ruining the nice coastline you just took the trouble to generate. If your map is not all-land I recommend that you literally use the
QuickSave button any time you click when using the elevation tool to make adjustments on your map,
otherwise you have no way to undo any changes that might totally ruin it. In this regard you can help
yourself out by raising the Land Cutoff value so that less cliff is generated to begin with.
Now I mentioned that the Water Depth should probably be 2 or even 1. This is because of a very
unusual bug in the game that I don’t think was ever patched and I wouldn’t have even remembered if
Discord user Philla007#2344 hadn’t dug up some of my old messages in the Empire Earth Heaven
forums. Basically, if there is exactly one tile at game elevation -1 that is completely surrounded by water
at elevation -2 or deeper, and there is an AI player with the power to reach this tile by boat, the game
can crash if the AI player attempts to do so. Since this is something the human players in the game have
no control over, it can lead to the game appearing to crash at random times. So if you keep the water
depth down to a minimum you can work to prevent these areas from even being spawned, and once the
map is generated you can make whatever areas of the map need it have deeper water if you want to, by
lowering it manually (but not too close to the shoreline, or you have the risk of a cliff suddenly changing
as discussed before).
I think that about covers everything you might need to know about making an elevation data map in
Empire Earth. Good luck with your scenario building!
by: Eggman