## Is there an effective way to cut down lag?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
icekiller8002
Prole
Posts: 36
Joined: Mon Jun 06, 2016 9:28 pm
Location: United States

### Is there an effective way to cut down lag?

I have a game that I made with LÖVE2D. I want to update the game, but when I made the game compatible with löve 11.0, there's a ton of lag when I make the screen size bigger. I honestly don't know what's causing this, and I was wondering if there's an effective way to figure out the main problem for the lag, then remove it.

Code: Select all

function love.draw()
love.graphics.print("obey")
end


drunken_munki
Party member
Posts: 134
Joined: Tue Mar 29, 2011 11:05 pm

### Re: Is there an effective way to cut down lag?

If it is possible to attach the love file then do so, it would make it easier for people to help out. If not, then posting some of the code would help.

As it is now the problem might be too vague to solve.

On a random note I had a bunch of lag and stuttering on my older pc used for testing, for about two months or so. Turns out the g-card was dying and finally died last week. Anyway, does this happen on other games? Maybe check your drivers.

ivan
Party member
Posts: 1531
Joined: Fri Mar 07, 2008 1:39 pm
Contact:

### Re: Is there an effective way to cut down lag?

an effective way to figure out the main problem for the lag, then remove it.
Yes, there is a way to figure out which functions in your script take the longest time to execute, this is called profiling.
Personally, I use a small utility based on the debug.hook:
https://bitbucket.org/itraykov/profile.lua/src/

icekiller8002
Prole
Posts: 36
Joined: Mon Jun 06, 2016 9:28 pm
Location: United States

### Re: Is there an effective way to cut down lag?

drunken_munki wrote:
Mon Apr 09, 2018 3:56 am
If it is possible to attach the love file then do so, it would make it easier for people to help out. If not, then posting some of the code would help.

As it is now the problem might be too vague to solve.

On a random note I had a bunch of lag and stuttering on my older pc used for testing, for about two months or so. Turns out the g-card was dying and finally died last week. Anyway, does this happen on other games? Maybe check your drivers.
This does not happen in other games. I would provide a .love file, but unless if you're willing to look through nearly 2000 lines of code, I don't wanna waste your time.

Code: Select all

function love.draw()
love.graphics.print("obey")
end


Nixola
Inner party member
Posts: 1940
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

### Re: Is there an effective way to cut down lag?

One doesn't necessarily need to read all of the code to figure out the issue; plus, two thousand lines of code may be a lot to one person but close to nothing for another one. I'd say you should upload the code (if you want to, of course) and let people decide whether they want to try, especially since it's the easiest way to figure out the issue.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
li = love.image
lg = love.graphics

icekiller8002
Prole
Posts: 36
Joined: Mon Jun 06, 2016 9:28 pm
Location: United States

### Re: Is there an effective way to cut down lag?

Nixola wrote:
Mon Apr 09, 2018 8:40 pm
One doesn't necessarily need to read all of the code to figure out the issue; plus, two thousand lines of code may be a lot to one person but close to nothing for another one. I'd say you should upload the code (if you want to, of course) and let people decide whether they want to try, especially since it's the easiest way to figure out the issue.
Yeah, I agree with you. Well, if anyone wants to waste their time by looking through a script with 2K lines, be my guest.

Remember what I said: The lag issue only occurs when you have a big screen resolution.
Attachments
Ball Booster.love

Code: Select all

function love.draw()
love.graphics.print("obey")
end


Nixola
Inner party member
Posts: 1940
Joined: Tue Dec 06, 2011 7:11 pm
Location: Italy

### Re: Is there an effective way to cut down lag?

I can't seem to notice any difference between 650x650 and 2560x1440 (which, as of now, is the highest I can go), so I'm afraid I'm unable to reproduce the issue and thus unable to test it.
lf = love.filesystem
ls = love.sound
la = love.audio
lp = love.physics
li = love.image
lg = love.graphics

yintercept
Citizen
Posts: 61
Joined: Mon Apr 02, 2018 3:31 pm

### Re: Is there an effective way to cut down lag?

Does the lag issue happen when you changing window size/game resolution after start? Does it happen when going from windowed mode to full screen?

What are the specs of the machine you are running it on?
Apparently I'm a fan of most people.

Or maybe LOVE devs are just that good.

icekiller8002
Prole
Posts: 36
Joined: Mon Jun 06, 2016 9:28 pm
Location: United States

### Re: Is there an effective way to cut down lag?

I tried putting an FPS counter on the screen. When I get from 1000 x 700 to 1280 x 720, my framerate drops from 60 to 50. When I get from 1280 x 720 to 1366 x 768 (my computer monitor size), it drops from 50 to 30. Also, here's my specs:
Attachments
specs.png (5.07 KiB) Viewed 2280 times

Code: Select all

function love.draw()
love.graphics.print("obey")
end


yintercept
Citizen
Posts: 61
Joined: Mon Apr 02, 2018 3:31 pm