View previous topic - View next topic |
Author |
Message |
rayne Lowly Slime
Joined: 28 Aug 2006 Posts: 2
|
Posted: Mon Aug 28, 2006 4:28 pm Post subject: Tiled Data Format |
[quote] |
|
Tiled data is like this:
Code: | <data>
H4sIAAAAAAAAAO3XsR...
</data> |
What are those letters exactly? This page says they're 32-bit numbers, but how?!? It seems the data is purely ASCII. Anyone knows how to get tile IDs from this data string?
Thanks in advance!
-Rayne
|
|
Back to top |
|
|
LeoDraco Demon Hunter
Joined: 24 Jun 2003 Posts: 584 Location: Riverside, South Cali
|
Posted: Mon Aug 28, 2006 5:12 pm Post subject: |
[quote] |
|
That would be a base64-encoded number, which is to say, that Tiled stores its data in a "safe" binary format: its data is converted such that its bytes, when interpreted by any program as ASCII text, fit within the normal ASCII character set. So, all that you would need to do is decode the base64 string, and properly interpret the resulting binary data. _________________ "...LeoDraco is a pompus git..." -- Mandrake
|
|
Back to top |
|
|
rayne Lowly Slime
Joined: 28 Aug 2006 Posts: 2
|
Posted: Mon Aug 28, 2006 5:51 pm Post subject: |
[quote] |
|
Thanks, I'll try it ASAP. After base64-decoding, should I gunzip it? Or is it raw tile ID array?
|
|
Back to top |
|
|
white_door Icemonkey
Joined: 30 May 2002 Posts: 243 Location: New Zealand
|
Posted: Wed Aug 30, 2006 7:17 pm Post subject: |
[quote] |
|
In the past tiled would default to compressing the layer data with gzip then base64ing it. Now I think it leaves it uncompressed and just base64s it by default.
Also you can now gzip the whole file, by saving with the .tmx.gz format. I found this to give better compression and was easier to decode when using zlib in C.
|
|
Back to top |
|
|
Bjorn Demon Hunter
Joined: 29 May 2002 Posts: 1425 Location: Germany
|
Posted: Sat Sep 16, 2006 3:43 pm Post subject: |
[quote] |
|
A reason for using layer data gzip compression would be to keep down the size of this part of the file, so that it remains easier to edit the file in a text editor or to keep it under version control in its basic form. You can do this in addition to using .tmx.gz.
Using the .tmx.gz scheme has the advantage of reducing file size even more as white_door pointed out. Loading it with libxml2 is very easy since it has built in support for gzip encoded files (though only when loading from disk as far as I know).
|
|
Back to top |
|
|