[Tilesathome] Proposal: Keeping tileset as one file

Henry Loenwind henry at loenwind.info
Sun Jun 15 00:35:06 BST 2008


Jiri Klement wrote:

> It might be useful to include some metadata in aggregated file. I
> would go for sure for blank land/sea info, as it doesn't add to file
> size. Other useful info may be user name and version of the client.
> Layer name and tileset coordinates won't hurt, but we can stay with
> relaying on tileset filename.

What about the following format?...:

Byte 0: 'O'
Byte 1: 'S'
Byte 2: 'M'
Byte 3: ' '
Byte 4: 'T' <- Tileset
Byte 5: 'D' <- Layer (D=default, M=maplint)
Byte 6: '1' <- format version number
Byte 7: ^D
Byte 8-11: x-coord of z12 tile
Byte 12-15: y-coord of z12 tile
Byte 16-19: position of xml meta data block
Byte 20-23: length of xml meta data block
Byte 24-27: position of z12 tile
Byte 28-31: length of z12 tile
Byte 32-35: position of firt z13 tile
Byte 36-39: length of first z13 tile
Byte 40-43: position of second z13 tile
...
(All 32-bit values in network order.)

Simple and easy. The first 16 bytes contain the data the reading 
software (webserver) expects to be there, so it can be compared 1:1 
(that is: in one 64-bit comparison). The first position+length pair (all 
values as 32 bit integers paired up to 64 bits, easy to process for 
modern processors) contains the address of an XML meta data block 
(format to be defined). No extra data on the single tiles, so the 
sea/land tiles have to be included once in the file (thats 67+65 bytes 
extra), and each empty tile will just point to the same data. (Note: 
Empty tile data would need 341.25 bytes extra, so including the empty 
tiles (132 bytes) not just saves cpu cycles but also space.)

BTW: If the z12 captionless tile should be also included, it'd go at 
position 24, shifting the rest up by one position.

cu
Henry




More information about the Tilesathome mailing list