Simple Tiled Implementation - STI v1.2.3.0

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Simple Tiled Implementation - STI v0.16.0.2

Post by Positive07 »

What about a viewport? which can be defined and defaults to screen size
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.16.0.2

Post by Karai17 »

You mean like setDrawRange?
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
Positive07
Party member
Posts: 1014
Joined: Sun Aug 12, 2012 4:34 pm
Location: Argentina

Re: Simple Tiled Implementation - STI v0.16.0.2

Post by Positive07 »

I just found there is resize, that would be what I was saying, you resize the canvas so it's the right size you need, this way you don't have unnecessary space

Also why don't you clear to transparent black always? Or just set alpha to 0 with whatever the background color may be?

Note that if you allow to resize the canvas regardless of windows size you should allow the user to draw the canvas in a certain position, and not just do [wiki]love.graphics.origin[/wiki]
for i, person in ipairs(everybody) do
[tab]if not person.obey then person:setObey(true) end
end
love.system.openURL(github.com/pablomayobre)
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.16.0.2

Post by Karai17 »

The use case of making sub-screen-size maps and linking them together is simply too small to bother reworking code for. If the one or two people on earth who want to do that *need* it, they can modify STI (yay MIT license!) to their bidding. For the other 99.9983% of people, clearing to love's default colour and drawing maps that are as big as, or bigger than the viewport is totally fine.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Simple Tiled Implementation - STI v0.16.0.2

Post by Nixola »

Having bigger canvases than needed is still a waste of resources (VRAM, for example) which could lead to issues on low end devices (the Intel HD 530 in my CPU only uses up to 256 MB of VRAM iirc, and it's the last gen)
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.16.0.2

Post by Karai17 »

That's why it is recommended that the canvas uses the default values from love.resize, which is the size of the window.
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
User avatar
Nixola
Inner party member
Posts: 1949
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

Re: Simple Tiled Implementation - STI v0.16.0.2

Post by Nixola »

Yes, but if the map is smaller the canvas is bigger than it should; therefore there's a memory waste.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.16.0.2

Post by Karai17 »

Yes, that is true, but how small is a map going to be? I don't care about theoretical values; how small is an acceptably small map?
STI - An awesome Tiled library
LÖVE3D - A 3D library for LÖVE 0.10+

Dev Blog | GitHub | excessive ❤ moé
mthwl
Prole
Posts: 3
Joined: Mon Aug 15, 2016 1:11 pm

Re: Simple Tiled Implementation - STI v0.16.0.2

Post by mthwl »

Think I'm agreement that having tiny maps that are smaller than the window is indeed an edge case. I think that's a reasonable constraint: maps must be >= window size.

That said, I'm still having this issue with larger maps (which, again, makes me think I'm missing something fundamental about how to load/update/draw multiple maps). Let's say the current camera position overlaps several maps, what's the expected behavior here?

My goal is having reasonably sized maps that can be composed together to build a larger "world" map. I've attached a new example (with a very simple. dumb camera) to show the same problem with larger maps. I load 4 maps, position them using the offset parameters. The last draw call (on whichever map that is) clears the entire "world" canvas and only draws one map.

Give it a moment after opening and you'll see the camera pan down and find map 4.
sti-map-test-2.love
(20.13 KiB) Downloaded 115 times
User avatar
Karai17
Party member
Posts: 930
Joined: Sun Sep 02, 2012 10:46 pm

Re: Simple Tiled Implementation - STI v0.16.0.3

Post by Karai17 »

After looking into it some more, Positive07 was correct and I swapped the canvas clear to simply use transparent black. I'm not sure why it ever worked before, but it seems to work now! Download the latest version from github.
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: Semrush [Bot] and 1 guest