Accessing vector data

Okay so I unrar-ed the "main.dat" and got access to a bunch of .bmp files, but I can't seem to further unrar the coastlines.dat file.. I'd really love the coastlines data for a small project I'm working on. (Will be made available when done, I expect some people will enjoy it)

So yeah, how does this work? Or is this not possible?

@xel, on Apr 24 2007, 03:27 AM, said in Accessing vector data:

Okay so I unrar-ed the "main.dat" and got access to a bunch of .bmp files, but I can't seem to further unrar the coastlines.dat file.. I'd really love the coastlines data for a small project I'm working on. (Will be made available when done, I expect some people will enjoy it)

So yeah, how does this work? Or is this not possible?

I don't recall right off, but I think that coastlines.dat may simply be a .txt file. I think this is true of all of the .dat files within the main archives. Did you try opening it up with a text editor such as SimpleText or BBEdit?

xander

Hmm, yes, I opened it up while you were posting with a text editor and it turns out to be a bunch of point data, separated by "b"'s, it looks like, .. Only problem is I have no idea how to get that into any usable format, like say an illustrator file. I thought that the data was vector? Doesn't that kind of contradict it being points? (I thought vector data was scalable to any size, because it was made up of formulas, not point data..)

@xel, on Apr 24 2007, 03:56 AM, said in Accessing vector data:

Hmm, yes, I opened it up while you were posting with a text editor and it turns out to be a bunch of point data, separated by "b"'s, it looks like, .. Only problem is I have no idea how to get that into any usable format, like say an illustrator file. I thought that the data was vector? Doesn't that kind of contradict it being points? (I thought vector data was scalable to any size, because it was made up of formulas, not point data..)

Those formulas are, basically, a way of getting point data. Vectors are contrasted with rasters. A raster is basically a grid, where each cell has a value. Your monitor is basically a raster, with each pixel being a cell with a color value. If you get a magnifying glass and look at your monitor, you can see the individual pixels. You can't zoom in forever, because there is a limited resolution.

Vectors, on the other hand, are lines. In mathematics, a vector is a distance and direction (or a rate (i.e. speed) and direction). You could define a vector in polar coordinates as an angle (a direction) and distance (how far you travel in that direction). So, a simple shape might look like this:

go east for 10 meters
from there, go north for 10 meters
from there, go west for 10 meters
from there, go south for 10 meters

This would define a square. You could zoom in on the boundary of this square forever, and it would never lose detail. You could zoom in on a corner, and it would never pixelate.

You could create the same square using Cartesian coordinates like this:

0,0
10,0
10,10
0,10

Connect the dots. Done. This is how Defcon creates its coastlines, more or less.

Coastlines are defined in blocks, separated by those b's. Try importing those blocks into a spreadsheet, like Excel, (or a good math package like MatLAB or Maple) and plotting them. You should see a map of the earth, albeit upside down. You can monkey with the files by hand, if you like. Otherwise, you are going to have to come up with a way of converting them to a format that you can import into some other program.

If that doesn't work for you, and you have a Windows box lying around, you could try using Zanzer7's Mod Suite. I haven't used it, but have heard good things. That being said, it seems to be in a perpetual state of beta, so use at your own risk. 😉

xander

Making progress....

Posted Image

:blink:

Okay so, it turns out that if you make lines between every vertex listed in the dat file, pausing to make a new line between (b)'s, you get this horrendous blob.

How do they get this data to actually work in the game? I'm trying to get the coastlines, not a bunch of random lines. The coastlines.bmp shows what I want, but far too low-res. I can't seem to find any love on the IV forums either.

All I really need is a 4k res Defcon map... grrr...

Posted Image

This post has been edited by xel : 24 April 2007 - 08:18 PM

This is all speculation, but could the "b" in coastlines.dat stand for "Body"? Perhaps you should only connect lines in each "b" section.

Add-on: If you can extract a high-res map, I can try to make a screenaver that looks like the lobby globe.

Basically, you have a list of polygons. Each block, starting with a "b" is a different polygon. The random lines that you see are the lines connecting those polygons, i.e. the lines connect the points where one polygon ends and the next begins. You basically have found all of the information that you need. If you can't use the Mod Suite that I linked to above, I think you may have to write your own utility to import/export coastlines. I am not sure what else to say. 😞 Also, if you are working on a mod, remember to edit coastlines-low.dat and international.dat (these control the low res version of the map, and the international boundaries, respectively).

xander

No, see, I thought of that too, but what you see in the bad-looking image is what it looks like with a bunch of 2-point polygons. That is to say, they only consist of a single edge.

It just so happens that some of these edges go all over the place. I made sure not to draw any edges between points that were punctuated by b's.

It's not that I can't use the mod suite (well, it would be very inconvenient, I only have access to windows through virtual PC emulation) but it's that I need a 2k-4k image map, and I doubt you can do that in the mod suite.