Page 54 of 92

Re: Simple Tiled Implementation - STI v0.16.0.2

Posted: Fri Aug 19, 2016 11:08 pm
by Positive07
What about a viewport? which can be defined and defaults to screen size

Re: Simple Tiled Implementation - STI v0.16.0.2

Posted: Sat Aug 20, 2016 2:21 am
by Karai17
You mean like setDrawRange?

Re: Simple Tiled Implementation - STI v0.16.0.2

Posted: Sat Aug 20, 2016 3:24 am
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]

Re: Simple Tiled Implementation - STI v0.16.0.2

Posted: Sun Aug 21, 2016 11:18 pm
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.

Re: Simple Tiled Implementation - STI v0.16.0.2

Posted: Mon Aug 22, 2016 12:25 am
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)

Re: Simple Tiled Implementation - STI v0.16.0.2

Posted: Mon Aug 22, 2016 12:28 am
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.

Re: Simple Tiled Implementation - STI v0.16.0.2

Posted: Mon Aug 22, 2016 12:40 am
by Nixola
Yes, but if the map is smaller the canvas is bigger than it should; therefore there's a memory waste.

Re: Simple Tiled Implementation - STI v0.16.0.2

Posted: Mon Aug 22, 2016 12:43 am
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?

Re: Simple Tiled Implementation - STI v0.16.0.2

Posted: Mon Aug 22, 2016 7:08 am
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 107 times

Re: Simple Tiled Implementation - STI v0.16.0.3

Posted: Mon Aug 22, 2016 11:10 pm
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.