PDA

View Full Version : Minor breakthrough - map_heights.hgt partly deciphered



alpaca
10-04-2005, 15:21
Ok, first off a screenshot:

https://img281.imageshack.us/img281/786/mapheights3ty.th.jpg (https://img281.imageshack.us/my.php?image=mapheights3ty.jpg)

As you can see this is taken from the BI-exe so I'm talking no shit ;)
Ok, I mostly discovered how the height-information is saved in map_heights.hgt, then I created a small tool that let me table-edit the numbers and so I was able to create the plateau you see on the screen.
I think from this discovery it isn't too far to creating a converter that takes the tga file and creates a hgt out of it.

If anybody feels like he can do it (I don't have any experience in reading image files and stuff), this is how the numbers are saved (programmer talk):
You have to read in the first 8 bytes of the file and store them somewhere, they seem to be some kind of header.
The rest of the file consists of single-precision IEEE Floats (32-bit); each float represents a certain height.
If you want you can divide the file in 511*313 fields, which is exactly the size of the tga file it's based upon.
What you have to find out to create a converter is how colors are mapped to heights, but I think you should be able to do this yourself ;)
Oh, and I don't know exactly why there's a peak on my plateau, because all the height informations have the same value.

I'll also try to create a converter, but it might take me a few days, so if anybody can do it faster, you're highly welcome :)

Myrddraal
10-04-2005, 18:52
hope this works out

SigniferOne
10-04-2005, 19:11
Me too!

Stuie
10-04-2005, 19:20
Me three!

I find it rather discouraging that CA would make a change that so drastically hinders our ability to mod the game. Guess modding isn't their goal anymore. Once again I look at something like Civ4 with xml and Python and wonder why CA is so reluctant to adopt a more mod-friendly attitude. I'm just glad we've had Jerome to help us out so much...

alpaca
10-04-2005, 23:44
Prob is: RTW is much funnier than Civ4 ;)
You're right though.

Stuie
10-05-2005, 00:30
Prob is: RTW is much funnier than Civ4 ;)
You're right though.

Yeah, well... Civ4 isn't out yet! When it's out, then we'll see which is "funnier". ~;)

BDH
10-05-2005, 03:43
I'd suggest that i may be easier to use a different file format in the converter. i don't know the details on hand:book: , but converting from a bitmap or tiff or anything like that may be easier on you to create and everyone who uses photoshop could just convert their tgas or just create them using the new format. :bow:

alpaca
10-05-2005, 13:31
Ok, guys. I'll release a converter later today.
I have made a working version last evening, I now have the height-calculation function ready insofar that it produces satisfying results.
It doesn't produce the same results as CAs does, they are using some kind of nivellating algorithm in making the height-map, but my tests don't suggest that this is necessary.
I'm currently working on it a little more, i.e. adding export capabilities, making it more safe and user-friendly and I also think about making a converter for real satellite data. But no matter what I'll release a version later.
It's written in Java, though. So you'll need JRE 1.50 or higher to use it.

Stuie
10-05-2005, 14:05
http://boa.apolyton.net/forums/images/smilies/danceparty.gif

Looking forward to it!

:medievalcheers: