Page 1 of 1

Making tilemaps for LOVE?

Posted: Fri Apr 10, 2009 7:22 pm
by AirPump
Is there a way I can use a tile editing program to export a simple 2D array containing tile numbers to place in a map? It seems like every tile editor I use likes to either 64-bit encode map data or put it in an unnecessarily bloated array, containing labels all over.

For example, say that tile 0 is a O and tile 1 is an X, and I want a map like this:

Code: Select all

OXO
XOX
OXO
How can I use a tile editor to export a text file like this?

Code: Select all

table = {
{0,1,0}
{1,0,1}
{0,1,0}
}
You wouldn't think it would be that hard, but I can't seem to find a solution to this problem. Does anyone know any way to do this with a tile editor?

Re: Making tilemaps for LOVE?

Posted: Fri Apr 10, 2009 7:54 pm
by osgeld
tiled uses base64 encoding which is pretty simple to decode, but the gzip compression has been abit more elusive within the lua/love world

mappy on the other hand is a tad bit easier to read, but it seems much more difficult to make it mean something, due to its chunk structure and basicly nill documentation

those are the 2 major ones that seem to come up, and I have not had much experience with other less known programs

Re: Making tilemaps for LOVE?

Posted: Fri Apr 10, 2009 8:56 pm
by AirPump
osgeld wrote:tiled uses base64 encoding which is pretty simple to decode, but the gzip compression has been abit more elusive within the lua/love world

mappy on the other hand is a tad bit easier to read, but it seems much more difficult to make it mean something, due to its chunk structure and basicly nill documentation

those are the 2 major ones that seem to come up, and I have not had much experience with other less known programs
Well, how do you unencode base64 encoding? I'm kind of a noob to the more technical bits of programming.

Re: Making tilemaps for LOVE?

Posted: Fri Apr 10, 2009 9:04 pm
by osgeld
http://lua-users.org/wiki/BaseSixtyFour

course it doesnt get you far with tiled maps since the data is in both base64 and gzipped

Re: Making tilemaps for LOVE?

Posted: Fri Apr 10, 2009 10:45 pm
by AirPump
osgeld wrote:http://lua-users.org/wiki/BaseSixtyFour

course it doesnt get you far with tiled maps since the data is in both base64 and gzipped
I think you can turn off gzip, though.

Re: Making tilemaps for LOVE?

Posted: Sun Apr 12, 2009 3:26 am
by subrime
or use io.popen... (works on linux/osx... unable to test on windows, sorry)

Code: Select all

file='zippydata.gz'
f=io.popen('cat '..file..' | gunzip')
data=f:read('*a')
f:close()

Re: Making tilemaps for LOVE?

Posted: Sun Apr 12, 2009 6:38 am
by bartbes
subrime wrote:(works on linux/osx... unable to test on windows, sorry)
I thought io.popen works, but I know there are no cat and gunzip on windows. (cat can be replaced by type, but you'd still need gunzip)

Re: Making tilemaps for LOVE?

Posted: Sun Apr 12, 2009 5:06 pm
by osgeld
io functions work fine in windows but yes you will need gzip which is not a default package of windows like it is on other os's