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
Before you make a thread asking for help, read this.
User avatar
zorg
Party member
Posts: 2731
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

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

Post by zorg » Mon Apr 09, 2018 11:11 pm

And your graphics card? love.graphics.getRendererInfo
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.

User avatar
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?

Post by icekiller8002 » Mon Apr 09, 2018 11:30 pm

I am drawing all images at one time, not quads. I will try quads first and let you know how it goes.

Code: Select all

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

User avatar
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?

Post by icekiller8002 » Tue Apr 10, 2018 12:36 am

Zorg, the image below contains my graphics card info

Yintercept, I tried quads for all images, but it still didn't help.
Attachments
graphics.png
graphics.png (2.81 KiB) Viewed 1238 times

Code: Select all

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

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

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

Post by yintercept » Tue Apr 10, 2018 1:14 am

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.
Apparently I'm a fan of most people.

Or maybe LOVE devs are just that good.

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

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

Post by yintercept » Tue Apr 10, 2018 7:29 am

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.
Apparently I'm a fan of most people.

Or maybe LOVE devs are just that good.

User avatar
pgimeno
Party member
Posts: 1903
Joined: Sun Oct 18, 2015 2:58 pm
Location: Valencia, ES

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

Post by pgimeno » Tue Apr 10, 2018 4:54 pm

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.

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

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

Post by yintercept » Tue Apr 10, 2018 7:16 pm

You're the real VIP pgimeno
Apparently I'm a fan of most people.

Or maybe LOVE devs are just that good.

User avatar
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?

Post by icekiller8002 » Tue Apr 10, 2018 7:19 pm

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.

Code: Select all

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

User avatar
NotARaptor
Citizen
Posts: 59
Joined: Thu Feb 22, 2018 3:15 pm

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

Post by NotARaptor » Tue Apr 10, 2018 8:59 pm

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

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

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

Post by yintercept » Tue Apr 10, 2018 11:47 pm

Thats what I was originally gonna ask. Apparently you're a mind reader NotARaptor.
Apparently I'm a fan of most people.

Or maybe LOVE devs are just that good.

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 6 guests