Laggy game

General discussion about LÖVE, Lua, game development, puns, and unicorns.
User avatar
Murii
Party member
Posts: 216
Joined: Fri Jul 05, 2013 9:58 am
Location: Arad, Romania
Contact:

Re: Laggy game

Post by Murii »

If your map its too huge then maybe you need to render only the tiles that can be seen on the screen.Using a nested for loop on x,y axes
User avatar
Jeeper
Party member
Posts: 611
Joined: Tue Mar 12, 2013 7:11 pm
Contact:

Re: Laggy game

Post by Jeeper »

Eamonn wrote:I know what is it: Your map is HUGE! You're rendering too much of the map at once. I had the same problem. You may not realise it, but your map is 800x600. Yes, that's the size of your window, but each of your tiles is 32x32. You don't need all that space. Make your map smaller.

If you want that insanely huge map, just limit the draw range. That being said, I think your map is just too big. Make a new map, and leave it at the default size. You should be alright. If your map was smaller, you'd just have to limit the draw range.

If someone wants to say how to limit the draw range to fix this problem, be my guest. I divided the bounds by about 100,000,000 and it still froze. I think this is because ATL is having trouble loading in a map of that scale. I'm sure there's a way to have maps this big, but it's just not what you'd want.

So yeah: Make your map smaller.

Also, if your having trouble like this, do some deduction. That basically means comment out bits of code that you think might be causing the problem. If you're using a Map, check it's size. Remember: ATL is not an official part of LÖVE, and is a 3rd-party extension.
map:setDrawRange(x, y, width*, height**)

* Or as I do it, Amount of tiles * tile width
** Or as I dot it, amount of tiles * tile height
Post Reply

Who is online

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