Simple Tiled Implementation - STI v1.2.3.0

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
qwook
Prole
Posts: 40
Joined: Fri Dec 13, 2013 5:53 am

Re: Simple Tiled Implementation - STI v0.6.11

Post by qwook » Mon Jan 27, 2014 8:45 am

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.

User avatar
Karai17
Party member
Posts: 896
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.6.11

Post by Karai17 » Mon Jan 27, 2014 5:35 pm

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
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé

pauljessup
Party member
Posts: 150
Joined: Wed Jul 03, 2013 4:06 am

Re: Simple Tiled Implementation - STI v0.6.11

Post by pauljessup » Mon Jan 27, 2014 9:35 pm

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.

User avatar
qwook
Prole
Posts: 40
Joined: Fri Dec 13, 2013 5:53 am

Re: Simple Tiled Implementation - STI v0.6.11

Post by qwook » Tue Jan 28, 2014 10:12 am

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

User avatar
Karai17
Party member
Posts: 896
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.6.11

Post by Karai17 » Tue Jan 28, 2014 4:37 pm

Very cool! Does the issue with tiles not being properly flipped or rotated still happen in the latest version of STI?
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé

User avatar
TangZero
Prole
Posts: 11
Joined: Fri May 17, 2013 3:48 pm
Location: Santiago, Chile
Contact:

Re: Simple Tiled Implementation - STI v0.6.11

Post by TangZero » Tue Jan 28, 2014 5:53 pm

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:

User avatar
Karai17
Party member
Posts: 896
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.6.11

Post by Karai17 » Wed Jan 29, 2014 6:30 am

0.6.11 should fix that.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé

User avatar
qwook
Prole
Posts: 40
Joined: Fri Dec 13, 2013 5:53 am

Re: Simple Tiled Implementation - STI v0.6.11

Post by qwook » Wed Jan 29, 2014 9:53 am

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

User avatar
Karai17
Party member
Posts: 896
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.6.11

Post by Karai17 » Wed Jan 29, 2014 10:37 am

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!
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé

User avatar
Karai17
Party member
Posts: 896
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.6.11

Post by Karai17 » Thu Jan 30, 2014 2:01 am

¡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. :)
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé

Post Reply

Who is online

Users browsing this forum: Majestic-12 [Bot] and 4 guests