Difference between revisions of "WORLD.DAT"

From UFOpaedia
Jump to navigation Jump to search
m (→‎The last value: TFTD update)
(Updated, added XCOM and TFTD map with sensible color schemes)
Line 35: Line 35:
  
 
{|
 
{|
| [[Image:world_render.gif|640px]]
+
| [[Image:xcom_render2.gif|360px]]
 
|  
 
|  
Originally I thought the last value was the terrain type but it is obvious that it cannot be since there are only 6 real terrain types on the map (10 in all, but xcom base, alien base, city, and mars aren't on the world map) There are 12 discrete values, 0 to 10 and then 12. Some reason 11 is skipped. There are 12 regions in the world but a rough rendering of the data shows it must be representing the terrain as well.
+
Rendering of the data in WORLD.DAT for the original XCOM. The colors are obtained by using offset 16-19 for each record. Click on the image to see the exact color key, generally speaking though it goes bright green to dark green for 0-5, and dark yellow to white for 6 - 12. Value 11 however is not used.
 +
|-
 +
| [[Image:tftd_render.gif|360px]]
 +
|
 +
Rendering of the data in WORLD.DAT for TFTD. Colors again are obtained by using the same offset as before. The colors simply go from  blue to white for 0 to 13. It looks like it designates the depth of the water in the areas. Judging by the Great Barrier Reef as one of the shallowest places in the ocean, the lower the number the shallower the water. Thus blue is shallow and white is deep. (A bit counter-intuitive, I apologize [[User:Pi Masta|Pi Masta]])
 +
|}
 +
Originally I thought the last value was the terrain type but I think that it cannot be since there are only 6 real terrain types on the map (10 in all, but xcom base, alien base, city, and mars aren't on the world map). For TFTD it seems obvious it is designating depths, but for XCOM I don't know what 12 different values would mean for terrain since there should only be 6.
  
Rough rendering of the data in WORLD.DAT. Each color is a different number in offset 16-19, for example white is 2. You can see that it does follow some terrain as found, but for example the Rocky Mountains and the Alps are different colors but should both be mountainous.
+
Also TFTD seemed to have overlapping polygons at places whereas XCOM didn't (exception to the poles, which is probably because these polygon's are rendered to a sphere not a flat surface).
 
 
--[[User:Pi Masta|Pi Masta]] 23:24, 5 April 2007 (PDT)
 
: '''Update''': I checked TFTD's WORLD.DAT file, it '''does''' include entries with this number as 11 (88 of them exist). Not sure what this means though --[[User:Pi Masta|Pi Masta]] 17:07, 9 April 2007 (PDT)
 
|}
 
  
 +
--[[User:Pi Masta|Pi Masta]] 15:24, 10 April 2007 (PDT)
 
== See Also ==
 
== See Also ==
  

Revision as of 22:24, 10 April 2007

The original XCOM file is 13320 bytes long, while TFTD is 14660 bytes long. However, each uses the same 20-byte record length giving the original 666 entries and TFTD 733 entries. This file describes the terrain on the geoscape screen using quadrilateral polygons and triangles.

The first 16 bytes of file contain the points for the quad/triangle. 4 sets of 2 short (2-byte) integers, designating the 'X' and 'Y' coordinate (or latitude and longitude if you prefer). If the last set has an x value of -1 then it is to be rendered as a triangle, otherwise it is a quad.

The last 4 bytes in the record contain the terrain type. This could be a long integer or 2 short integers as the last 2 bytes in each record are 0.

Structure

Offsets Meaning Values
0-1 First X coordinate 0 - 2880
2-3 First Y coordinate -720 - 720
4-5 Second X coordinate 0 - 2880
6-7 Second Y coordinate -720 - 720
8-9 Third X coordinate 0 - 2880
10-11 Third Y coordinate -720 - 720
12-13 Fourth* X coordinate 0 - 2880
14-15 Fourth* Y coordinate -720 - 720
16-19 Terrain Type See Below 0-10 and 12

* As mentioned above, the fourth coordinate could be (-1, 0) denoting a triangle

Note: The values were obtained only on the original XCOM. Presumably the same restrictions apply for TFTD except for maybe the terrain types. Also the X ranges are assumed to max at 2880 as this is a multiple of 360, the max observed in the file is actually 2877

The last value

Xcom render2.gif

Rendering of the data in WORLD.DAT for the original XCOM. The colors are obtained by using offset 16-19 for each record. Click on the image to see the exact color key, generally speaking though it goes bright green to dark green for 0-5, and dark yellow to white for 6 - 12. Value 11 however is not used.

Tftd render.gif

Rendering of the data in WORLD.DAT for TFTD. Colors again are obtained by using the same offset as before. The colors simply go from blue to white for 0 to 13. It looks like it designates the depth of the water in the areas. Judging by the Great Barrier Reef as one of the shallowest places in the ocean, the lower the number the shallower the water. Thus blue is shallow and white is deep. (A bit counter-intuitive, I apologize Pi Masta)

Originally I thought the last value was the terrain type but I think that it cannot be since there are only 6 real terrain types on the map (10 in all, but xcom base, alien base, city, and mars aren't on the world map). For TFTD it seems obvious it is designating depths, but for XCOM I don't know what 12 different values would mean for terrain since there should only be 6.

Also TFTD seemed to have overlapping polygons at places whereas XCOM didn't (exception to the poles, which is probably because these polygon's are rendered to a sphere not a flat surface).

--Pi Masta 15:24, 10 April 2007 (PDT)

See Also

Saved Game Files

COS.DAT