Page 6 of 92

Re: Simple Tiled Implementation - STI v0.6.11

Posted: Mon Jan 27, 2014 8:45 am
by qwook
Hi, me and my friends recently used your library for the Global Game Jam and we noticed an issue:

Sometimes tiles that are flipped and rotated do not show up flipped and rotated in the game. I haven't had time to read the other posts in this thread to see if this was already reported, but I just wanted to bring it up.

Re: Simple Tiled Implementation - STI v0.6.11

Posted: Mon Jan 27, 2014 5:35 pm
by Karai17
Are you using the latest version of STI? I added tile flags a few days ago, so they should be working now.

I'm glad you found STI useful, could you share your game with us? :D

Re: Simple Tiled Implementation - STI v0.6.11

Posted: Mon Jan 27, 2014 9:35 pm
by pauljessup
Collision Maps are awesome- I've been doing some cool things with layers, so that when you collide with a roof layer it makes the roof invisible, stuff like that. Glad you included that in STI.

Re: Simple Tiled Implementation - STI v0.6.11

Posted: Tue Jan 28, 2014 10:12 am
by qwook
Karai17 wrote:Are you using the latest version of STI? I added tile flags a few days ago, so they should be working now.

I'm glad you found STI useful, could you share your game with us? :D
You can check it out right here:
http://globalgamejam.org/2014/games/bak ... ets-go-box

Re: Simple Tiled Implementation - STI v0.6.11

Posted: Tue Jan 28, 2014 4:37 pm
by Karai17
Very cool! Does the issue with tiles not being properly flipped or rotated still happen in the latest version of STI?

Re: Simple Tiled Implementation - STI v0.6.11

Posted: Tue Jan 28, 2014 5:53 pm
by TangZero
My shit game uses STI too.

http://globalgamejam.org/2014/games/nic ... inish-last

You may notice a problem when moving (translate) the camera. The Tiles are "separated".
I've the same issue with MOAI. http://getmoai.com/forums/white-lines-r ... ders-t502/

Good luck trying to fix that. :crazy:

UPDATED: Karai had already fixed this issue. Good work! :awesome:

Re: Simple Tiled Implementation - STI v0.6.11

Posted: Wed Jan 29, 2014 6:30 am
by Karai17
0.6.11 should fix that.

Re: Simple Tiled Implementation - STI v0.6.11

Posted: Wed Jan 29, 2014 9:53 am
by qwook
I was using v0.6.7 so that explains it.

Some suggestions:
I have a lot of collision layers because the game is dynamic, so I needed to generate a lot of collision layers.
I ended using:
map:createCollisionMap(layername)
local collision = map.collision.data

Which is a bit hacky. The only time collision.data is used in the STI library is when you call map:drawCollisionMap().
My suggestion is to have createCollisionMap return the data, and then to draw the collision map you send the data as a parameter to drawCollisionMap.

I also had hidden layers that was only used for data, but they were still being drawn, so I needed a way to draw each layer on it's own.
The solution was to do this:
self.tiledmap:drawTileLayer(self.tiledmap.layers["Decoration"])
Which looks a bit huge in the code.
Why not have a function that is called like this:
self.tiledmap:drawTileLayer("Decoration")


In tiled, you are able to give some tiles in your tileset special properties, and I needed to use this feature but STI didn't supply it from the start. This was the very hacky edit I made to get the properties:

Code: Select all

                local properties = {}
                local id = ((x-1)+(y-1)*w)
                for k,v in pairs(tileset.tiles) do
                    if v.id == id then
                        properties = v.properties
                    end
                end
                map.tiles[gid] = {
                    gid     = gid,
                    tileset = i,
                    quad    = love.graphics.newQuad(qx, qy, tw, th, iw, ih),
                    sx      = 1,
                    sy      = 1,
                    r       = 0,
                    properties = properties,
                    offset  = {
                        x = -map.tilewidth,
                        y = -tileset.tileheight,
                    },
                }
                
Most of these are just small gripes, overall STI was a very straightforward and simple library to use. I recommend people use Tiled with STI, since it saves a load of time from having to write your own tile editor.

** also, I didn't fully take the time to read some of the documentation for STI because I was under pressure during the GGJ. correct me if some of these issues are already addressed

Re: Simple Tiled Implementation - STI v0.6.11

Posted: Wed Jan 29, 2014 10:37 am
by Karai17
First off I want to say thank you for taking enough interest to actually file reports. :)

I have been undecided about Collision Maps form the very beginning, so I stuffed them in and forgot about them. I do like your idea about returning the data and drawing with a parameter. I'll make that adjustment in my next release. It is worth noting that the code you wrote actually creates a reference, not a clone of the table so if you create another collision map, then Map.collision will no longer match local collision.

Hidden layers are actually not drawn, nor are layers with an opacity of 0. If you check the Map:draw() function, it does a check for layer visibility and opacity before it actually executes a draw command.

All of the data from the Tiled map is imported into the Map object. All layer and tile properties should remain intact, unless I buggered that up somewhere specifically where data is being adjusted instead of imported. If that is so, can you point to the line or method that I erred on?

Thanks!

Re: Simple Tiled Implementation - STI v0.6.11

Posted: Thu Jan 30, 2014 2:01 am
by Karai17
¡Double Post!

Just pushed an update. Collision maps are now more flexible by allowing the user to create and store a collision map on their own, and draw particular maps if they see fit. Also fixed that bug where properties were not being loaded properly. :)