Only showing 64X63 of my map

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
Rukiri
Citizen
Posts: 68
Joined: Mon Jun 27, 2011 5:52 am

Only showing 64X63 of my map

Post 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
User avatar
kraftman
Party member
Posts: 277
Joined: Sat May 14, 2011 10:18 am

Re: Only showing 64X63 of my map

Post 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.
User avatar
Rukiri
Citizen
Posts: 68
Joined: Mon Jun 27, 2011 5:52 am

Re: Only showing 64X63 of my map

Post by Rukiri »

I basically just swapped maps with the desert_example.
User avatar
Kadoba
Party member
Posts: 399
Joined: Mon Jan 10, 2011 8:25 am
Location: Oklahoma

Re: Only showing 64X63 of my map

Post 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.
User avatar
Rukiri
Citizen
Posts: 68
Joined: Mon Jun 27, 2011 5:52 am

Re: Only showing 64X63 of my map

Post 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.
User avatar
Kadoba
Party member
Posts: 399
Joined: Mon Jan 10, 2011 8:25 am
Location: Oklahoma

Re: Only showing 64X63 of my map

Post by Kadoba »

Did you turn sprite batches on?
User avatar
Rukiri
Citizen
Posts: 68
Joined: Mon Jun 27, 2011 5:52 am

Re: Only showing 64X63 of my map

Post by Rukiri »

Nope.
User avatar
slime
Solid Snayke
Posts: 3132
Joined: Mon Aug 23, 2010 6:45 am
Location: Nova Scotia, Canada
Contact:

Re: Only showing 64X63 of my map

Post 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.
User avatar
Rukiri
Citizen
Posts: 68
Joined: Mon Jun 27, 2011 5:52 am

Re: Only showing 64X63 of my map

Post 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.
User avatar
Kadoba
Party member
Posts: 399
Joined: Mon Jan 10, 2011 8:25 am
Location: Oklahoma

Re: Only showing 64X63 of my map

Post 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
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 201 guests