Making tilemaps for LOVE?

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
AirPump
Prole
Posts: 12
Joined: Tue Mar 24, 2009 7:55 pm

Making tilemaps for LOVE?

Post 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?
User avatar
osgeld
Party member
Posts: 303
Joined: Sun Nov 23, 2008 10:13 pm

Re: Making tilemaps for LOVE?

Post 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
AirPump
Prole
Posts: 12
Joined: Tue Mar 24, 2009 7:55 pm

Re: Making tilemaps for LOVE?

Post 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.
User avatar
osgeld
Party member
Posts: 303
Joined: Sun Nov 23, 2008 10:13 pm

Re: Making tilemaps for LOVE?

Post 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
AirPump
Prole
Posts: 12
Joined: Tue Mar 24, 2009 7:55 pm

Re: Making tilemaps for LOVE?

Post 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.
User avatar
subrime
Citizen
Posts: 76
Joined: Thu Nov 13, 2008 6:18 pm
Location: Australia

Re: Making tilemaps for LOVE?

Post 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()
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Making tilemaps for LOVE?

Post 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)
User avatar
osgeld
Party member
Posts: 303
Joined: Sun Nov 23, 2008 10:13 pm

Re: Making tilemaps for LOVE?

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 44 guests