Page 2 of 3

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

Posted: Mon Apr 09, 2018 11:11 pm
by zorg
And your graphics card? love.graphics.getRendererInfo

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

Posted: Mon Apr 09, 2018 11:30 pm
by icekiller8002
I am drawing all images at one time, not quads. I will try quads first and let you know how it goes.

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

Posted: Tue Apr 10, 2018 12:36 am
by icekiller8002
Zorg, the image below contains my graphics card info

Yintercept, I tried quads for all images, but it still didn't help.

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

Posted: Tue Apr 10, 2018 1:14 am
by yintercept
Alright, I'm downloading it now and gonna take a look into it. Can't promise anything but I'll get back to you sometime tonight.

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

Posted: Tue Apr 10, 2018 7:29 am
by yintercept
Experiencing 40-50fps on an i3, with intel hd graphics old enough that it doesn't fully support opengl ES2, with 8gb ram, all running at 1366 by 768 (had to go in and do a little surgery to set resolution).

From what I can see your two biggest resource uses are something called [string 'boot.lua'] line 493, and a draw() call in main.lua on line 1740--but the boot.lua call is using ten times as much resources as the second one I mentioned.

Either too many string operations going on, you're doing something thats particularly taxing, or your system is badly in need of an upgrade
(and I'm one to talk seeing as my systems over 3 years old!)

I hope this helps point you in the right direction. Let us know how it goes.

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

Posted: Tue Apr 10, 2018 4:54 pm
by pgimeno
Drawing a quad has no advantage over drawing an image. However, drawing multiple quads in a single spritebatch has a big performance advantage, as the cost is comparable to that of drawing a single image, even when you have hundreds of quads in the batch.

That doesn't mean that that's the bottleneck, though.

With vsync disabled, I get >600 FPS at the default resolution, and about 210 FPS at 1280x1024. For me, disabling vsync makes the bullets run like crazy. I guess you're not using dt at every place where your game logic requires it. But that's a separate issue.

With this example program, I get ~320 FPS at 800x600 and ~123 FPS when maximized (approx. 1280x1024):

Code: Select all

love.window.setMode(800, 600, {vsync=false, resizable=true})
local MAX = love._version_major > 0 and 1 or 255

function love.draw()
  love.graphics.clear()
  love.graphics.setColor(0,0,MAX)
  local w, h = love.graphics.getDimensions()
  love.graphics.rectangle("fill", 0, 0, w, h)
  love.graphics.rectangle("fill", 0, 0, w, h)
  love.graphics.rectangle("fill", 0, 0, w, h)
  love.graphics.rectangle("fill", 0, 0, w, h)
  love.graphics.rectangle("fill", 0, 0, w, h)
  love.graphics.rectangle("fill", 0, 0, w, h)
  love.graphics.rectangle("fill", 0, 0, w, h)
  love.graphics.rectangle("fill", 0, 0, w, h)
  love.graphics.rectangle("fill", 0, 0, w, h)
  love.graphics.setColor(MAX,MAX,MAX)
  love.graphics.print(love.timer.getFPS())
end

function love.keypressed(k)
  if k == "escape" then love.event.quit() end
  if k == "f" then
    love.window.maximize()
  elseif k == "n" then
    love.window.restore()
  end
end
I get the same FPS in 0.10 and 11.0.

My guess is that your graphics hardware can't cope with drawing what you're drawing at that resolution at full speed.

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

Posted: Tue Apr 10, 2018 7:16 pm
by yintercept
You're the real VIP pgimeno

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

Posted: Tue Apr 10, 2018 7:19 pm
by icekiller8002
The main thing I was worried about was that the lag would affect everyone, not just people with graphics cards like mine. Thank you all for helping. I’ll continue to play around with it.

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

Posted: Tue Apr 10, 2018 8:59 pm
by NotARaptor
yintercept wrote: Tue Apr 10, 2018 7:16 pm You're the real VIP pgimeno
Is there a way to upvote comments here?

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

Posted: Tue Apr 10, 2018 11:47 pm
by yintercept
Thats what I was originally gonna ask. Apparently you're a mind reader NotARaptor.