Talk:WORLD.DAT

From UFOpaedia
Revision as of 06:41, 30 January 2008 by Danial (talk | contribs) (New section: Resolution)
Jump to navigation Jump to search
  // World.Dat = World Map Terrain
  
  typedef struct worlddat
  {
     short         QuadData[4][2]; // Coordinates of quadrilateral
     unsigned long texture;        // Terrain texture of quad
  } WorldDat;
  
  #define MaxQuads 768      // Observed values, XCOM = 666, TFTD = 733

QuadData/8 = realworld latitude and longitude numbers.

if QuadData[3][1] = -1 then the shape is a triangle and that entery is not used. (for you non programers QuadData[0] is the first so [3] is the forth.)

This may not be usefull for the wiki but I once wrote a program to detect what world.dat entry a givin ship was located in and therefor what texture/terrain file used to create the battlescape map. I have the function if anyone is interested in the math.

--BladeFireLight 21:24, 20 January 2007 (PST)


Gah, I just spent the last 20 minutes or so figuring this file out, wish I would have seen this before.

Wonder how it defines the countries since this file only seems to designate terrain types. Maybe indexed all the polygons in this file? Be tough to find it then...

Oh, and one thing. When QuadData[3][0] is -1 when it designates a triangle (and actually QuadData[3][1] is 0 as well).

I'll probably put this info on the page article here soon though. --Pi Masta 19:42, 5 April 2007 (PDT)


Pi Masta, can you post an overlay of the TFTD world map? My first thought was that it was a representation of the quad's depth, but that doesn't seem entirely right either. Or perhaps it's a combination of terrain and height in the single byte? - NKF


Yeah it definitely holds terrain data. the TFTD map took a bit to recognize (aka make sure I was rendering it correctly) as it defines the oceans and not the land. I don't remember the depths that TFTD had, but didn't it also have missions on land as well? With differing land types? I never got into TFTD so my knowledge is limited.

I probably should upload a wire-frame version of the TFTD map, where you can see some of the overlaps. Well, I assume they are overlaps, otherwise they are really really small triangles.

This file is a bit of a pain to render as the points will cross the prime meridian thus X values will go from say 6 to 2700 to 2750 to 200, etc. in the same polygon line. I broke them up and split polygons when the difference was large and for TFTD it worked great. It was XCOM that was a problem and eventually I just excluded the troublesome polygons from being split (still rendered).

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


TFTD has four depth levels, one of which is "surface". However the game only puts polygons on the water so presumably this file would only cover three levels (all land missions are terror sites).

For UFO, I did some value tweaking and came up with these referrences on battlescape terrain:

 0 - Jungle
 1 - Farm
 2 - Farm
 3 - Farm
 4 - Farm
 5 - Mountain
 6 - Jungle
 7 - Desert
 8 - Desert
 9 - Polar
10 - Jungle
11 - Jungle
12 - Polar

This does more or less match the imagery, but the problem here is that even with multiple missions on each terrain type I couldn't get a forest to appear. My thought is it has something to do with the position on the globe as all the missions I did were in the one area (south pole).

Values above 12 seemed to all use jungle as well, and looped through the usual texture images (oddly enough, I still had to add images to the set to prevent a crash).

- Bomb Bloke 21:29, 1 January 2008 (PST)


If I'm not mistaken, the game picks between forest and jungle terrain depending on which part of the hemisphere you're on. Everything north of the Equator uses forest terrain while everything south of the Equator goes with jungle terrain.

- NKF

Resolution

Is there any place in the article that we can elaborate that the 2880/1440 values makes for a resolution of 00°07'30"? I know it's not neccessary to the data file, but I think it's a nice little real-world statistic. --Danial 22:41, 29 January 2008 (PST)