Page 1 of 2

Laggy game

Posted: Sat Aug 10, 2013 7:18 pm
by XxFullMetalxX
I am making a platformer and is very laggy. This issue did not happen until I installed Advanced tile loader, so if you know any fixes, please tell me.

Re: Laggy game

Posted: Sat Aug 10, 2013 7:50 pm
by SeducingOrange
Can I have .love file?

Re: Laggy game

Posted: Sat Aug 10, 2013 7:55 pm
by XxFullMetalxX
Here is the main file

Re: Laggy game

Posted: Sun Aug 11, 2013 6:06 pm
by SeducingOrange
XxFullMetalxX wrote:Here is the main file
I need you to post a full .love file or I can't help you. I need to be able to run the game so I can figure out what's causing the problem. Here is where you can learn how to create one if you don't already know.

http://www.love2d.org/wiki/Game_Distrib ... .love-file

Re: Laggy game

Posted: Sun Aug 11, 2013 8:10 pm
by Eamonn
I've tried replicating your code(made a map, got the camera and AdvTiledLoader version you're using, etc), but it still wont run. From reading your code, though, I can't see a problem. That being said, you haven't provided much information. Leave comments too.

P.S. Don't almost 100% copy Goatures tutorial, Thanks! ;)

Re: Laggy game

Posted: Sun Aug 11, 2013 11:14 pm
by XxFullMetalxX
Can I have .love file?
Here is the .love file

Re: Laggy game

Posted: Mon Aug 12, 2013 12:25 am
by Eamonn
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.

Re: Laggy game

Posted: Mon Aug 12, 2013 3:31 am
by XxFullMetalxX
thank you, eamonn!

Re: Laggy game

Posted: Mon Aug 12, 2013 9:58 am
by Eamonn
No problem! Always happy to help! :)

Re: Laggy game

Posted: Mon Aug 12, 2013 12:21 pm
by T-Bone
I'm not sure exactly what's going on here since I haven't looked at the actual source code, but if your map really is that huge, ATL is probably not the right tool for the job. If you split your map up into several smaller files, and only load the ones that are close to the player this would probably not be an issue.

I've been playing around a bit with a top-down adventure game engine that I wanted to support more or less infinitely large maps. It worked really well when I kept 9 canvases that draw the areas around the player, and once a new part of the world comes into view when I walk to the right, I simply clear the content from the leftmost camvases and draw the rightmost areas on there. Creating and destroying canvases was surprisingly slow, which is what I tried before.