Page 1 of 2

Only showing 64X63 of my map

Posted: Mon Jul 25, 2011 7:32 am
by Rukiri
Right now I'm just trying to get my tiles to animate but before I can do that my map has to load and well.. it's only showing 64X63, it's the exact same size as the desert_example map.

So does anyone have any ideas?

http://i56.tinypic.com/339t17a.png <-- view the image

Re: Only showing 64X63 of my map

Posted: Mon Jul 25, 2011 1:06 pm
by kraftman
If you want people to help you, you need to help them. Showing a picture with no code is pretty unhelpful.

EDIT: I see it's not about code, sorry.

Re: Only showing 64X63 of my map

Posted: Mon Jul 25, 2011 2:30 pm
by Rukiri
I basically just swapped maps with the desert_example.

Re: Only showing 64X63 of my map

Posted: Tue Jul 26, 2011 3:18 pm
by Kadoba
I looked at this and it's actually a bug.

Goto map.lua and replace lines from 149 to 158 with this:

Code: Select all

      -- Make sure that we stay within the boundry of the map
			x1 = x1 > 1 and x1 or 1
			y1 = y1 > 1 and y1 or 1
			x2 = x2 < self.tilewidth and x2 or self.width
			y2 = y2 < self.tileheight and y2 or self.height
		
		else
			-- If the drawing range isn't defined then we draw all the tiles
			x1, y1, x2, y2 = 1, 1, self.width, self.height
		end
I really need to get Advanced Tiled Loader on github or something.

Re: Only showing 64X63 of my map

Posted: Wed Jul 27, 2011 5:08 am
by Rukiri
Thanks man, but love2D seems to be a bit slow when the map is 2560X1600 in pixels.
192GB ram
12 core intel cpu(s)
12TB hdd
amd radeon 6970 2Gb GDDR5

so either my machines overkill or it's love2d which it certainly is.

Re: Only showing 64X63 of my map

Posted: Wed Jul 27, 2011 3:11 pm
by Kadoba
Did you turn sprite batches on?

Re: Only showing 64X63 of my map

Posted: Wed Jul 27, 2011 6:56 pm
by Rukiri
Nope.

Re: Only showing 64X63 of my map

Posted: Wed Jul 27, 2011 7:01 pm
by slime
You'll need to use spritebatches or framebuffers (preferably spritebatches) for things like that. You could have the absolute best computer and video card that only blowjobs could buy, but that won't mean anything if you're creating a bottleneck sending redundant information from the CPU/RAM to the GPU over and over again because you aren't storing it on the GPU.

tl;dr you need to use spritebatches to take advantage of hardware made in the past ~8 years.

Re: Only showing 64X63 of my map

Posted: Wed Jul 27, 2011 9:17 pm
by Rukiri
Yea, spritebatches fixed the problem.

I'm wondering if anyone knows how to only display the map? Display nothing else, like a black background when you get to the edge of map for example?
The adventure game did this perfectly but he/she used .map which seems to be from a custom editor I think his/her own.

Re: Only showing 64X63 of my map

Posted: Thu Jul 28, 2011 2:22 pm
by Kadoba
You mean have the view stay within the boundary of the map? You'll just have to limit the view yourself.

You should be able to do it with something similar to this:

Code: Select all

local mapWidthLimit = map.width * map.tilewidth - love.graphics.getWidth()
local mapHeightLimit = map.height * map.tileheight - love.graphics.getHeight()

if x > mapWidthLimit then x = mapWidthLimit end
if y > mapHeightLimit then y = mapHeightLimit end
if x < 0 then x = 0 end
if y < 0 then y = 0 end