Below are some more thoughts about the process I'm guessing Novalogic used in order to create these DF2 terrain files, as well as which connections there are between them... I'll be using the DFD2 terrain files as examples below. In order to make them show up inside these forums, I have converted all of them to .JPG, and I've also resized them if needed.
Color Map and Elevation Map:
DF2 was released in 1999, and I believe I've read somewhere that they used an early version of Bryce to make the elevation maps. The color maps can also have been made with Bryce, but they might also have used other graphics tools or even painted them it manually.
DF2 includes 18 different terrains, and they consist of a limited set of main terrain types when it comes to colors, i.e. brown (desert), green (meadows), and white (snow). Some of them also contains blue (water) and grey (mountain). The 18 color maps can be seen here...:
http://txp.df2.org/gallery/thumbnails.php?album=5
The main things to remember about the color map and the elevation map, is that both are 1024x1024 and that they tile seamlessly in all directions. I have earlier said that 1 pixel looks to represent ca 0.5 meters inside the game, but for purposes becoming obvious below, we should instead make that 0.64 meters, or 64 cm.
The color map is the skin of the elevation map, but the detailed look of it is only visible in-game when viewing the commander's map, or outside the game, when making maps for DF2 with the included map editor.
The elevation map contains 1024x1024=1048576 height values to render for the voxel terrain engine. The DF2 voxel terrain engine doesn't simply render the flat top of all the columns for those height values, though, but it also uses some sort of algorithm to level out the sharp vertical borders between columns of different heights. Thus, inside the game, the player will walk on a surface made out of the column heights (from elevation map) + delta heights (created by leveling algorithm).
There are no very high mountains in DF2, due to the limited resolution of the elevation map. Most of the terrains consist of medium sized hills and valleys, or plains and river beds, lakes, etc. There are a few cliffs here and there, which the players can't climb, but they're never very steep, since steep hills are poorly rendered with a voxel terrain engine.
The DFD2 Color Map...:
The DFD2 Elevation Map...:
Texture Map and Texture Elevation Map:
I'm not exactly sure how Novalogic created the texture maps and the texture elevation maps. I'll present a theory further down, but first I'll describe these maps a bit more detailed.
Each of them are 64x16384, and they consist of 256 64x64 tiles. The first tile is always black, and at the end there are also a number of black tiles, or which are used for special non-terrain purposes. The number of those tiles at the end seems to be different for each terrain.
The purpose of the texture map and the texture elevation map is to add more detail to the terrain as viewed in-game by the players. The texture map includes detailed texture tiles, and the texture elevation map includes the detailed elevation information for those detailed texture tiles.
Each 64x64 tile of the texture map is blended together with the color of one of the pixels of the color map. I believe the alpha channel of the texture map decides the level of blending.
Each 64x64 block of the texture elevation map adds additional height to the resulting texture from blending one 64x64 texture map tile with one pixel of the color map. This additional height isn't solid, i.e. the player will be able to walk through it, be it grass, small rocks, soil, dirt, etc... Because of this, the texture elevation maps usually don't contain large height values.
I have studied the content of the texture map and the texture elevation map a bit more, and below is shown the 7 first tiles (0 - 6) of them. The 4 columns are (from the left)...:
A) Texture Map (DFD2_CM.TGA)
B) Alpha Channel of Texture Map
C) Texture Elevation Map (DFD2_DM.PCX)
D) Texture Elevation Map (with values adjusted so that one can see that it's not all black)
.......A...............B...............C..............D.......
It's no coincident that I've showed only the first seven 64x64 tiles here, since they (except for the first, black one) represent the six main texture patterns (or climate types in L3DT...?) for the DFD2 terrain. Most of the remaining tiles below are tiles which contains different variants of transitions between those six main texture patterns. I'll get to those below... I have checked with some of the other DF2 terrains, and the number of main texture patterns is different from terrain to terrain...
Now, if we look closer on tile 3 of the texture map, we can see that it tiles seamlessly in all directions...:
The same thing is valid for tile 3 of the texture elevation map as well (doesn't look 100%, but this could be due to the adjustments I did to it in order to see any content) ...:
It even looks to be valid for tile 3 of the alpha channel of the texture map...:
So, what comes below these 6 main texture patterns...? Well, before the transition tiles, there are some more tiles for the main texture patterns (but not necessarily for all of them). There are some 3 - 7 tiles from each texture pattern, tiling seamlessly in the vertical direction. For DFD2, the texture patterns of tile 1, 2, 4, 5 and 6 (but not 3) are represented...:
As far as I can see, the texture tiles 1 - 6 are not used inside any of those vertical texture strips... Now, will these texture strips tile seamlessly in both horizontal & vertical directions...?
Yes, they will... (only showing the results for the first of them, but I've checked for the others as well).
Just to satisfy my curiosity, I tested to see if perhaps tiles of the same texture pattern would tile seamlessly no matter which way you put them together, and it seems that they do (at least regarding colors - haven't tested with height value tiles in the texture elevation map yet, but it would surprise me if the same wasn't true for those)...:
This would mean that for the DFD2 terrain we have 6 different main texture patterns, and for each of those there are between 1 and 7 different tiles which can be placed next to each other and tile seamlessly no matter which way you put them together. This would make it possible to make a large area of the same main texture pattern seem more natural, both with regard to the variation of colors, as well as variation of height.
The only thing missing now, is the transition tiles, i.e. tiles for adding a transition in both color and height, between those 6 main texture patterns, and that's exactly what the next 180 or so tiles are...
I've tried to discover some sort of pattern to the order they've been added to the texture map, but there doesn't seem to be any, except that transition tiles between each pair of texture patterns usually are grouped together...
From what I can see, it looks like only the single tiles at the top of the file (i.e. tiles 1 - 6) have been used to create the transition tiles. Most of them include transitions between two of the main texture patterns, but a few of them include transitions between three of the main texture patterns. Here's an example of the latter, a transition between the main texture pattern tiles 2, 3 and 5...:
After the transition tiles, there are usually around 40 more tiles at the end of the file, reserved for special purposes. For the DFD2 terrain, this includes some railroad track and concrete tiles...:
However, these tiles are not used for the DFD2 terrain at all, so they must be left-overs from another terrain. Also, the tiles 178 - 143 are black, i.e. not used, so if needed, we could have had 77 more texture tiles inside the texture map for DFD2. Anyway, here's a screen shot from another terrain, to show how the rail road track appears inside the game...:
Character Data Map:
If looking at the character data map (
http://txp.df2.org/q/L3DT/DFD2_CM.TXT), we see that the null lines correspond with the black tiles in the texture map, i.e. the ones not used, in that line 1 and lines 179 - 144 are null lines. If we look at the lines at the beginning of the file, we see that 3 different descriptions are used for the 6 main texture patterns, and this will thus describe 3 different footstep sounds when walking on the different parts of the terrain, and also what type of animation (if any) should be shown when shooting at the ground...:
- Code: Select all
null,0
Dt2,0
Rk2,0
Sd3,0
Rk2,0
Dt2,0
Sd3,0
I guess that they've only got a limited number of different footstep sounds included for the game, and that they decided already when creating the main texture patterns which footstep sound should be used for each of them. This could easily be changed later on by editing the character data map.
When it comes to the lines further down, corresponding to the transition tiles, I can't see any pattern to which description is used if the texture tiles are represented by different terrain descriptions in the lines at the beginning of the file, except that one of those descriptions is used.
Detail Map:
The detail map is simply an index over which texture (and texture elevation) maps are to be used at which pixel coordinate of the color map inside the game. ...:
The DFD2 Detail Map (and its palette)...:
I believe this file must have been generated automatically, since it would be an enormous task to create it manually. I haven't studied the palette (index) thoroughly yet, but one can see that only the first and last ones have been given colors, the rest showing as blank/white. Among the first ones are the primary texture pattern tiles, and among the last ones are the special purpose tiles... This means for instance that it would be relatively easy to add a railroad track to the map afterwards.
Now, if we pick 4 pixels from each of the corners of the detail map, and add the palette numbers to them, we get...:
Then, if we put them together the way they would be aligned when the terrain tiles seamlessly in all directions, we get:
If we align the corresponding texture map tiles together in the same way, we'll get:
Hmm, when showing the corresponding color map pixels, we get:
That doesn't seem correct... I'll have to ponder on this for a while...
Theories of how Novalogic did it:
Now, back to my theory about how the texture map and texture elevation map were created by Novalogic... Remember that in order to cover all of the 1024x1024 pixels in the color map, you'll need 1048576 texture map tiles, but since you've only got around 220 tiles to pick from inside the texture map, they'll have to be used many times each, i.e. around 4770 times each on average...
![Shocked :shock:](./images/smilies/icon_eek.gif)
Since the number of main texture patterns vary between each DF2 terrain, the number of transition tiles between two (or more) texture patterns might also vary. The latter might also vary depending on the layout of the map, i.e. for instance which angles there are between the different texture patterns, as well as how complex the paths of the borderlines between them are.
One theory is that they made a special utility for calculating all of this. The algorithm of this utility would...:
- Analyze the color patterns and palette of the color map, and define how many different (and which) main texture patterns (and variants of each of them) should be used for the terrain. Alternatively, this information could already be defined manually and used as an input to the utility. Anyway, Novalogic probably had pre-made a large set of main texture pattern tiles, and variants of them.
- Calculate the minimum number of transition tiles needed (but within the limit of 220 or thereabouts) in order to be able to render the transitions between the defined main texture patterns as detailed as possible. This calculation would also need to include the way (angle, direction, size) two (or more) main texture patterns should be blended together. The more tiles available, the more detailed the rendering could become, for instance for complex borders between two (or more) main texture patterns. Thus, if there are no special texture tiles planned for this terrain, the last 40 or so tiles could be used as well, bringing the number of available tiles up to 255.
- Produce the transition tiles by blending the first variants of texture pattern tiles together according to the calculations above. Alternatively, these transition tiles could also have been pre-made, but I don't believe so, since the number of possible variants of transition tiles would be very large.
- Create the detail map and the character data map, based on the above calculations and definitions.
(This theory doesn't explain the process of creating the accompanying texture elevation map, though, and I'm a bit clueless about this... If you put all of texture map tiles together for the complete 1024x1024 terrain and pretend the terrain is flat (since the elevation map doesn't matter), then the texture elevation map tiles would form a mini elevation map for this detailed terrain surface, defining the height differences for the crust of the terrain, like dirt, mud, pebbles, etc., but also for grass, which in general is much higher. I believe they must have created each of the texture elevation map tiles at the same time as they created each of the texture map tiles, and I can't see that they can have used a completely automatic utility for this, but that they must have had some sort of manual control, for instance in order to be able to decide the placement and height of grass and pebbles, etc... I believe they must have had some sort of visual GUI available for this purpose, but I'm not sure. They could have had a special utility for adding grass later on, since the height values for the grass pixels are quite extreme compared to the rest of the texture elevation map content.)
An alternative theory is that instead of creating the color map on the basis of the elevation map (like you can do in Bryce, L3DT etc.) and then creating the texture map from there, they could instead have created the texture map directly on the basis of the elevation map. The color map could then have been created by putting all the 1024x1024=1048576 texture map based tiles together, according to the detail map, and finally resized/saved to a 1024x1024 JPG file.