Difference between revisions of "WORLD.DAT"

From UFOpaedia
Jump to navigation Jump to search
m
m (→‎The last value: TFTD update)
Line 42: Line 42:
  
 
--[[User:Pi Masta|Pi Masta]] 23:24, 5 April 2007 (PDT)
 
--[[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)
 
|}
 
|}
  

Revision as of 00:07, 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

640px

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.

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.

--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 --Pi Masta 17:07, 9 April 2007 (PDT)

See Also

Saved Game Files

COS.DAT