## Primitive "Tiled" map loader and 2D game lighting

Party member
Posts: 105
Joined: Fri Sep 03, 2010 12:39 pm
Contact:

### Re: Primitive "Tiled" map loader and 2D game lighting

The Editor looks interesting. Is this written with love?

thelinx
The Strongest
Posts: 848
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

### Re: Primitive "Tiled" map loader and 2D game lighting

ninwa
Party member
Posts: 118
Joined: Tue Oct 12, 2010 1:21 am
Location: Metro Detroit
Contact:

### Re: Primitive "Tiled" map loader and 2D game lighting

Now featuring TechnoCat's "MessageInABottleLibrary."

Walk to the NPC in the upper left and press 'z'

Also, tidied up my lighting code. Feel free to peak around it. Also added "time of day" 1 minute = 1 hour, and the lighting changes based on this.

http://www.josephbleau.com/PlanetCute_miab.love

Thank you Technocat! <3

Party member
Posts: 135
Joined: Fri Oct 15, 2010 10:58 am

### Re: Primitive "Tiled" map loader and 2D game lighting

This should give you a file that you can reasonably transform into a text one
I use Workflowy but you can check out Dynalist as its the better offer.

arquivista
No longer with us
Posts: 266
Joined: Tue Jul 06, 2010 8:39 am
Location: Insert Geolocation tag here
Contact:

### Re: Primitive "Tiled" map loader and 2D game lighting

Things are becoming very good ninwa. Was hard for you develop the XML Tiled reader?. "Tiled" webpage says that can be exported in Lua but I foundn't in Mac version that option.
--------------------------------------------------------
To Do: Insert Signature Here
--------------------------------------------------------

ninwa
Party member
Posts: 118
Joined: Tue Oct 12, 2010 1:21 am
Location: Metro Detroit
Contact:

### Re: Primitive "Tiled" map loader and 2D game lighting

arquivista wrote:Things are becoming very good ninwa. Was hard for you develop the XML Tiled reader?. "Tiled" webpage says that can be exported in Lua but I foundn't in Mac version that option.
I didn't write an XML reader so much as a quick and dirty .tmx parser. It's limited in functionality, but it gets the job done. That said, no, not too bad. I just read in each line of the file and use a couple of flags to know which level of tags I should be in, and use :find() with captures to pull out data I need.

PS: The stable windows build only includes .xml also and is missing a few key features I needed. That's why I'm using their beta nightly build from a few weeks ago.

arquivista
No longer with us
Posts: 266
Joined: Tue Jul 06, 2010 8:39 am
Location: Insert Geolocation tag here
Contact:

### Re: Primitive "Tiled" map loader and 2D game lighting

Yeah, it seems that the Java is the most advanced version. I was curious about the so called Lua Export when I saw in changelog (0.7.1)

Code: Select all

Fixed Lua export to increase firstgid of tilesets properly (by Jelle Geerts)
However I only experienced 0.5.1 Mac QT version and that option seems not there. But XML output and not some custom program output seems interesting. I will look further how to parse it and study the Tiled tags. I glad you use it, I got interested on this.

Edited: Experienced Java version. Here is your map in Lua Export option (with GZIP option on. plain one can't be posted here -excess of chars-).

Code: Select all

-- Generated by Tiled's Lua Exporter Plugin.
map = {
["label"] = "map";
["version"] = "0.99b";
["luaversion"] = "5.1";
["orientation"] = "orthogonal";
["width"] = 16;
["height"] = 16;
["tilewidth"] = 101;
["tileheight"] = 80;
["tilesets"] = {
{
["label"] = "tileset";
["name"] = "PlanetCuteSpritesheet";
["firstgid"] = 1;
["tilewidth"] = 101;
["tileheight"] = 171;
{
["label"] = "image";
["source"] = "PlanetCuteSpritesheet.png";
};
};
};
["layers"] = {
{
["label"] = "layer";
["name"] = "Ground";
["width"] = 16;
["height"] = 16;
["data"] = {
["encoding"] = "base64";
["compression"] = "gzip";
["content"] = "H4sIAAAAAAAAABNiYGAQgmIDErAQFkyKfmzmgPhmROLBqh8fprV+XHgo6edGw4T0o6unln5S3Y9LL6n6yQ0/cvUDAGPrfmAABAAA";
};
};
{
["label"] = "layer";
["name"] = "Surface";
["width"] = 16;
["height"] = 16;
["data"] = {
["encoding"] = "base64";
["compression"] = "gzip";
["content"] = "H4sIAAAAAAAAAGNgoAwYAbEUlKbEjFEwOAAHGo0MTJEwMjAkwlxJIBZFwmJEukeSSvpBAJf7BysgJlwpBQAWQKvyAAQAAA==";
};
};
{
["label"] = "layer";
["name"] = "collision";
["width"] = 16;
["height"] = 16;
["properties"] = {
["collision"] = "true";
};
["data"] = {
["encoding"] = "base64";
["compression"] = "gzip";
["content"] = "H4sIAAAAAAAAAGNgQABhBtKBMBomBwij0eSC4aAfG6anm9DjQhhNDpub0NXg0k/ITloDcsIUn99orR/dreTqR/c3Mh8AWb+XlQAEAAA=";
};
};
{
["label"] = "layer";
["name"] = "lightsources";
["width"] = 16;
["height"] = 16;
["properties"] = {
["lightsources"] = "true";
};
["data"] = {
["encoding"] = "base64";
["compression"] = "gzip";
["content"] = "H4sIAAAAAAAAAGNgGAWjgHpAEI0eBYMbAAAsYCpAAAQAAA==";
};
};
};
};
-- EOF


--------------------------------------------------------
To Do: Insert Signature Here
--------------------------------------------------------

Party member
Posts: 135
Joined: Fri Oct 15, 2010 10:58 am

### Re: Primitive "Tiled" map loader and 2D game lighting

The pot edition
Just moved the tileset so as to give a pot with minor modifications(warning height is tile hight is now 170 instead of 171 so as to enter a 1024 sheet)
.tmx files can be easily made to work by chaining some values
the %10 and /10 represents how many tiles are in a row,change this if you have more/less
PlanetCute_pot.love
I use Workflowy but you can check out Dynalist as its the better offer.

ninwa
Party member
Posts: 118
Joined: Tue Oct 12, 2010 1:21 am
Location: Metro Detroit
Contact:

### Re: Primitive "Tiled" map loader and 2D game lighting

Oh hey, very cool! Thank you adrix. I have moved on to other projects, so if anybody wants to pick this one up and make it their own, feel free. I'm pretty excited though that you got it working. I think we did end up pinning down the problem to too big of a sprite-sheet, right? I'm using the tiled map parser in a new game, and though I haven't run into the problem, I should consider fixing it before I do.

Party member
Posts: 135
Joined: Fri Oct 15, 2010 10:58 am

### Re: Primitive "Tiled" map loader and 2D game lighting

ninwa wrote:Oh hey, very cool! Thank you adrix. I have moved on to other projects, so if anybody wants to pick this one up and make it their own, feel free. I'm pretty excited though that you got it working. I think we did end up pinning down the problem to too big of a sprite-sheet, right? I'm using the tiled map parser in a new game, and though I haven't run into the problem, I should consider fixing it before I do.
Well I'm still not sure if it works for all depending on how love handles stuff
I wish there was a tester with really old hardware
Currently it works on my ati 1900 but I'm not sure about the previous series, although the tile map would probably work perfectly as there 1024 what I'm not sure is the character sprite which 171 by 101
I use Workflowy but you can check out Dynalist as its the better offer.

### Who is online

Users browsing this forum: No registered users and 28 guests