Laggy game

General discussion about LÖVE, Lua, game development, puns, and unicorns.
XxFullMetalxX
Prole
Posts: 9
Joined: Thu Jul 04, 2013 5:52 pm

Laggy game

Post 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.
SeducingOrange
Prole
Posts: 30
Joined: Tue Feb 12, 2013 7:45 pm

Re: Laggy game

Post by SeducingOrange »

Can I have .love file?
XxFullMetalxX
Prole
Posts: 9
Joined: Thu Jul 04, 2013 5:52 pm

Re: Laggy game

Post by XxFullMetalxX »

Here is the main file
Attachments
main.lua
(4.11 KiB) Downloaded 225 times
SeducingOrange
Prole
Posts: 30
Joined: Tue Feb 12, 2013 7:45 pm

Re: Laggy game

Post 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
User avatar
Eamonn
Party member
Posts: 550
Joined: Sat May 04, 2013 1:29 pm
Location: Ireland

Re: Laggy game

Post 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! ;)
"In those quiet moments, you come into my mind" - Liam Reilly
XxFullMetalxX
Prole
Posts: 9
Joined: Thu Jul 04, 2013 5:52 pm

Re: Laggy game

Post by XxFullMetalxX »

Can I have .love file?
Here is the .love file
Attachments
game.love
sorry but it is unresponsive
(45.78 KiB) Downloaded 222 times
User avatar
Eamonn
Party member
Posts: 550
Joined: Sat May 04, 2013 1:29 pm
Location: Ireland

Re: Laggy game

Post 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.
"In those quiet moments, you come into my mind" - Liam Reilly
XxFullMetalxX
Prole
Posts: 9
Joined: Thu Jul 04, 2013 5:52 pm

Re: Laggy game

Post by XxFullMetalxX »

thank you, eamonn!
User avatar
Eamonn
Party member
Posts: 550
Joined: Sat May 04, 2013 1:29 pm
Location: Ireland

Re: Laggy game

Post by Eamonn »

No problem! Always happy to help! :)
"In those quiet moments, you come into my mind" - Liam Reilly
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Laggy game

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

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 4 guests