Simple Tiled Implementation - STI v1.2.3.0

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
ChicoGameDev
Citizen
Posts: 62
Joined: Thu Feb 14, 2019 6:02 pm
Location: Switzerland
Contact:

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by ChicoGameDev »

Indeed your answer was in first sight a bit rude due to a time loss or something like that. That being said I will PM you cause I'm curious to hear what you define as useless in Luven.

But just to stay focused on the subject, everything is working fine, the tilemap drawn by STI is correctly affected by Luven's lights and camera, all is great. The only strange factor in it is the bump bodies that are a little bit "off". All of this should be entirely correctable with the value passed to the STI draw functions. It has to be a little detail to make them work together, the thing is to find it.
Karai17 wrote: Fri Oct 16, 2020 5:18 am ...but external cameras usually end up conflicting with STI in ways that I don't really intend to "fix"...

I'm sure you fixed it with the ability users have to set the translation and scale in the draw functions.

But let's make no drama here and just not start a libraries wars. :crazy:
I thought you will take that as an interesting challenge, but that's not the case and I shouldn't have asked in the first place.

And sorry for the .love file I was sure it could be launch I do not understand the error.. At least once extracted it works, it is strange.


Regards.
Lionel Leeser

Luven : https://github.com/chicogamedev/Luven

--

Always keep Game Dev as a passion.
User avatar
Karai17
Party member
Posts: 909
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by Karai17 »

The general problem that I can see is that STI needs to control the graphics state to draw the map correctly when transformed, and Luven's camera (as most cameras) also tries to control the graphics state, seemingly causing a conflict. When I removed luven's state-affecting function calls, both the map and the bump debug draw lined up correctly as one would expect. Adding back the luven calls causes the debug draw in particular to break (though the actual collision objects themselves should be in their correct places).
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
yetneverdone
Party member
Posts: 378
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by yetneverdone »

Hi, i'm wondering if you could give a guide or an overview on how can i implement my own plugin for STI for usage with Bump3dpd
User avatar
Karai17
Party member
Posts: 909
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by Karai17 »

I suppose you could look at the bump plugin as a reference since it should be very similar to what you need.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
wolf
Prole
Posts: 1
Joined: Tue Jan 12, 2021 10:24 am

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by wolf »

I am reasonably new to Lua, but in general an experienced developer, so with that said, I believe I encountered 2 bugs or perhaps 1 bug and 1 missing feature.

I created a map in Tiled. In the map I added an object layer. On the object layer I've added tile objects (objects that a represented by sprites, not by polygons). I also added a single rectangle for reference.

Now when I load the map in the game I see 2 issues:
- Seems all sprites need to be rotated and translated in order to be drawn at correct position
- The rectangle is shown 2 tiles above it's position in Tiled.

I should note the size of the tiles is larger than of the tile object sprites, so perhaps this is somehow related to this issue?

The creature sprite size is 32 x 32 and the map tile size is 64 x 96.

https://ibb.co/HdbcD6m

https://ibb.co/7C3n8Xg
User avatar
Karai17
Party member
Posts: 909
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by Karai17 »

Yeah I think something wonky happened to the isometric code at some point and i'm not sure when that happened.. i haven't had much time to look into issues with STI as of late but if you want to poke around the coordinate code and see if something is up, i'd certainly accept a PR that fixes it!
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
monolifed
Party member
Posts: 155
Joined: Sat Feb 06, 2016 9:42 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by monolifed »

Tiled added parallax support recently, I modified STI a little to support it.

Code: Select all

	-- Scale map to 1.0 to draw onto canvas, this fixes tearing issues
	-- Map is translated to correct position so the right section is drawn
	lg.push()
	lg.origin()
	
	tx, ty = tx or 0, ty or 0

	for _, layer in ipairs(self.layers) do
		if layer.visible and layer.opacity > 0 then
			local px, py = layer.parallaxx or 1, layer.parallaxy or 1
			px, py = math.floor(tx * px), math.floor(ty * py)
			lg.translate(px, py)
			self:drawLayer(layer)
			lg.translate(-px, -py)
		end
	end

	lg.pop()
bigy123
Prole
Posts: 2
Joined: Mon Feb 22, 2021 3:19 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by bigy123 »

Hi,
I can't figure out how to attach image to box2d object. In the attachment,
is problem simplified to 2x2 map with crate image and box2d collider.
There is also mouse joint allowing to move the collider.

Can I attach the collider to image somehow to move together?
Thanks

Edit: Hmm, it looks like that the right way to do is create collidable object in Tiled and
attach image in love script.
Attachments
tiletest.love
(29.43 KiB) Downloaded 35 times
User avatar
Karai17
Party member
Posts: 909
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by Karai17 »

You want to use the xy coordinates of your box2d object to draw your image on top
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
bigy123
Prole
Posts: 2
Joined: Mon Feb 22, 2021 3:19 pm

Re: Simple Tiled Implementation - STI v1.2.3.0

Post by bigy123 »

Karai17 wrote: Wed Feb 24, 2021 4:19 pm You want to use the xy coordinates of your box2d object to draw your image on top
Thanks for the answer, but I need to have separate proper sized image for every
type of dynamic object. I want to manage images in Tiled.
I have following solution:
Create object (Tiled)
Create tile layer fitting the object (Tiled)
Create custom layer from the tile layer (Love)
Map batch from custom layer to box2d object (Love)
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests