General Question "_tile.bin" file format

Piper

Orbiting Space Addict
Addon Developer
Tutorial Publisher
Donator
Joined
Apr 7, 2008
Messages
356
Reaction score
0
Points
0
Location
Ottawa, Canada
Anybody know what the file format is for a "_tile.bin" file? The one for 9+ level textures in the Texture2 folder. I'm looking to write a program that extracts specific tiles from a "_tile.tex" file. I've already written a program that can divide a .tex file into all its subsequent .dds files, but I have no way of knowing where on the surface each tile belongs to.
 

fort

Active member
Joined
Mar 19, 2008
Messages
1,018
Reaction score
20
Points
38
Hello Piper,

I'm not sure of that but in the 2005 version, you will find a tile manager. Is this obsolete ? I don't know.
 

Piper

Orbiting Space Addict
Addon Developer
Tutorial Publisher
Donator
Joined
Apr 7, 2008
Messages
356
Reaction score
0
Points
0
Location
Ottawa, Canada
Tile Manager doesn't seem to want to work properly. It only shows the breakdown for a Level 9 tile set, and not the Level 11 tile set I load into it. As far as I can tell (from extracting all the .dds files from the Moon_tile.bin file), there should be 30576 .dds files, but it only shows 1092 tiles, which doesn't even cover the whole map (there's gaps).

As it is right now, I can extract every .dds file from a "_tile.dds" file, and select specific ones, but I have no way of telling where each tile belongs. AFAIK, that information is only contained in the "_tile.bin" file. If I knew how to read that file, I could simply select the exact tile(s) I want, instead of trying to sift through literally thousands of different tiles.
 

orb

New member
News Reporter
Joined
Oct 30, 2009
Messages
14,020
Reaction score
4
Points
0
*_tile.bin file format:
Code:
char idstr[8]; // optional - not present for version 0, starts with "PLTS" for version 1 and above

DWORD n; // number of TILEFILESPEC present in the file

struct TILEFILESPEC {
	DWORD sidx; // index for surface texture (-1: not present)
	DWORD midx; // index for land-water mask texture (-1: not present)
	DWORD eidx; // index for elevation data blocks (not used yet; always -1)
	DWORD flags; // tile flags: bit 0: has diffuse component; bit 1: has specular component; bit 2: has city lights
	DWORD subidx[4]; // subtile indices
};

More info:
 

fort

Active member
Joined
Mar 19, 2008
Messages
1,018
Reaction score
20
Points
38
I've made some tests some time ago with Tune Your Planet ( by Tofitouf ):

[ame="http://www.orbithangar.com/searchid.php?ID=4114"]Tune Your Planet v0.3[/ame]

...and some others a long time ago with pltextool2 ( from David Rowbotham aka Daver )...a time on Orbithangar, with the possibility to decompile tex files ( by levels, and with numerotation... 1.dds, 2.dds... * ), edit, and recompile...

...but helas, twice, stopping at level 9.

If you want to see how the program made by Daver works, i can send it to you by mail ( but there is no sources of it with it ).

(*) "The numerical suffice ascribed during the decompilation process indicates the .dds files place in the .tex file". "It splits out the .dds files into seperate folders for each texture patch level which should make figuring out what patch goes where".
( Daver )
 

Piper

Orbiting Space Addict
Addon Developer
Tutorial Publisher
Donator
Joined
Apr 7, 2008
Messages
356
Reaction score
0
Points
0
Location
Ottawa, Canada
Thanks orb! I think that will do nicely :) I was hoping that the lat/long for each tile was in the .bin file, but I should be able to figure out how to calculate that myself with the other two files. Thanks!

If you want to see how the program made by Daver works, i can send it to you by mail ( but there is no sources of it with it ).

Thanks, but as I said, I already can extract .dds files from .tex files.
 

fort

Active member
Joined
Mar 19, 2008
Messages
1,018
Reaction score
20
Points
38
...but I should be able to figure out how to calculate that myself...

Yes, it was also in my mind, starting from the Tile Manager's help file.

good day.
 

Piper

Orbiting Space Addict
Addon Developer
Tutorial Publisher
Donator
Joined
Apr 7, 2008
Messages
356
Reaction score
0
Points
0
Location
Ottawa, Canada
That TileMgr.cpp file definitely helped, I can extract the level 9 textures and name them according to their Latitude/Longitude, but I'm still having trouble with the level 10 and level 11 textures. The formula I'm using to identify which tile belongs where is based on the patch templates in the GlobalInit function, and it seems to work for identifying where each patch belongs where for the level 9 portion of the file, but it's not working for the level 10 and level 11 portion.

BTW, anybody know what the subtile indices in the .bin file refers to?
 

Glider

Addon Developer
Addon Developer
Joined
Apr 12, 2008
Messages
226
Reaction score
0
Points
16
Location
Saint-Petersburg
That TileMgr.cpp file definitely helped, I can extract the level 9 textures and name them according to their Latitude/Longitude, but I'm still having trouble with the level 10 and level 11 textures. The formula I'm using to identify which tile belongs where is based on the patch templates in the GlobalInit function, and it seems to work for identifying where each patch belongs where for the level 9 portion of the file, but it's not working for the level 10 and level 11 portion.

BTW, anybody know what the subtile indices in the .bin file refers to?
As far as I understand it, subtile indices (subidx[4]) are indexes of TILEFILESPEC structs of 4 next level tiles. So L9 tilefilespec has subidx[4] that are offsets for 4 L10 tilefilespec structs, which have their own subidx[4] array that are offsets for 4 L11 tfs structs. If subidx[j] == 0 then that subtile's tfs doesn't exists.

indexes for subtiles and their position in tile:
0, 1
2, 3
subtiles in the upper row should have ilat % 2 = 1, and subtiles in the right row should have ilng % 2 = 1

If you want to get L11 tile texture with, for example (ilat = 58 or 81.56 deg., nlat = 8*2*2*2 = 64 , ilng = 33 or 247.5 deg (67.5 deg E) nlng = NLNG[7]*2*2*2 = 48 ).
L10:
58 % 2 = 0, 58 / 2 = 29 ilat for L10
33 % 2 = 1, 33 / 2 = 16 ilat for L10
so this L11 tile have subidx = 3
L9:
29 % 2 = 1, 29 / 2 = 14
16 % 2 = 0, 16 / 2 = 8
L10 tile is a subtile of L9 tile with index 0
L8:
14 % 2 = 0, 14 / 2 = 7 [1st row]
16 % 2 = 0, 8 / 2 = 4 [5th of 364]
previous L9 tile is a subtile of this tile with index 2
so, TILEFILESPEC struct for that L11 tile can be found (if all these tiles exist) as = tfs[ tfs[ tfs[ tfs[4].subidx[2] ].subidx[0] ].subidx[3] ]. then you can get texture offset in Planet_tile.tex from tidx or midx. (if they not == NOTILE, i.e. 0xFFFFFFFF )
 
Last edited:
Top