Is there an effective way to cut down lag?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
- icekiller8002
- Prole
- Posts: 49
- 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
-
- 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.
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.
Re: Is there an effective way to cut down lag?
Yes, there is a way to figure out which functions in your script take the longest time to execute, this is called profiling.an effective way to figure out the main problem for the lag, then remove it.
Personally, I use a small utility based on the debug.hook:
https://github.com/2dengine/profile.lua
Last edited by ivan on Wed Dec 15, 2021 11:30 am, edited 1 time in total.
- icekiller8002
- Prole
- Posts: 49
- Joined: Mon Jun 06, 2016 9:28 pm
- Location: United States
Re: Is there an effective way to cut down lag?
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.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.
Code: Select all
function love.draw()
love.graphics.print("obey")
end
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
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
- icekiller8002
- Prole
- Posts: 49
- Joined: Mon Jun 06, 2016 9:28 pm
- Location: United States
Re: Is there an effective way to cut down lag?
Yeah, I agree with you. Well, if anyone wants to waste their time by looking through a script with 2K lines, be my guest.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.
Remember what I said: The lag issue only occurs when you have a big screen resolution.
- Attachments
-
- Ball Booster.love
- (61.24 MiB) Downloaded 367 times
Code: Select all
function love.draw()
love.graphics.print("obey")
end
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
lt = love.thread
li = love.image
lg = love.graphics
ls = love.sound
la = love.audio
lp = love.physics
lt = love.thread
li = love.image
lg = love.graphics
- yintercept
- Citizen
- Posts: 64
- 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?
What are the specs of the machine you are running it on?
Back in the saddle again.
- icekiller8002
- Prole
- Posts: 49
- 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:
Code: Select all
function love.draw()
love.graphics.print("obey")
end
- yintercept
- Citizen
- Posts: 64
- Joined: Mon Apr 02, 2018 3:31 pm
Re: Is there an effective way to cut down lag?
Your .love file was taking ages for me to download, networks are fun like that.
Q - are you drawing all the images one at a time, or are you batching them and drawing from quads? If you're not drawing from quads try that--drawing individual images one after another is the first thing I would assume would cause problems especially if scaling up seems to impact fps.
If that fails, download and include the little profiler/utility library ivan suggested and tell us how it goes.
Q - are you drawing all the images one at a time, or are you batching them and drawing from quads? If you're not drawing from quads try that--drawing individual images one after another is the first thing I would assume would cause problems especially if scaling up seems to impact fps.
If that fails, download and include the little profiler/utility library ivan suggested and tell us how it goes.
Last edited by yintercept on Mon Apr 09, 2018 11:11 pm, edited 2 times in total.
Back in the saddle again.
Who is online
Users browsing this forum: Semrush [Bot] and 0 guests