Page 1 of 1

Löve FPS optimisation

Posted: Wed Apr 18, 2012 5:31 pm
by timmeh42
I've been fiddling around with highly repetitive/intensive tasks on Löve, and as an amateur programmer with no formal education in computer science theory (or whatever its called) I have no idea what makes certain functions in Lua and Löve more or less efficient than others.
So, could we make a list of recommended functions to use or not to use for high efficiency?

To start, the best I could come up with so far is that, in Löve itself, when drawing large numbers of images using the same image, it is about 1.5x faster to add them all to a SpriteBatch than to draw them individually.

Re: Löve FPS optimisation

Posted: Wed Apr 18, 2012 5:48 pm
by Robin
Honestly, usually it won't matter, unless you're doing things like calling newFont or newImage in love.update() or love.draw().

In a LÖVE game, there are usually two general bottlenecks: game logic and drawing shit to the screen.

For game logic, you need to watch algorithmic complexity: a for-loop in a for-loop will take more time than a single for-loop, simulating thousands of enemies will be slower than a handful. As long as you don't want too much, this usually will not be a problem.

Drawing shit is more of a mixed bag, this has to do with hardware and that's really not my area of expertise. Using SpriteBatches (as you said) and Canvases can help there, but often you don't need them. Don't try to use "tricks" for a few more FPS if it's not necessary, because you may end up with higher system requirements for graphics drivers and whatnot than you would have had without those tricks.

Re: Löve FPS optimisation

Posted: Thu Apr 19, 2012 8:44 pm
by mickeyjm
Robin wrote: Don't try to use "tricks" for a few more FPS if it's not necessary, because you may end up with higher system requirements for graphics drivers and whatnot than you would have had without those tricks.
And THAT is why I hate Canvases

Re: Löve FPS optimisation

Posted: Thu Apr 19, 2012 9:08 pm
by felix24
i found this quite interesting for general tips on optimization.
it's an article by the guy who programmed Beep.

Re: Löve FPS optimisation

Posted: Fri Apr 20, 2012 1:52 am
by Jasoco
mickeyjm wrote:
Robin wrote: Don't try to use "tricks" for a few more FPS if it's not necessary, because you may end up with higher system requirements for graphics drivers and whatnot than you would have had without those tricks.
And THAT is why I hate Canvases
Hey, don't hate on Canvas. They can do stuff you just simply can't do without them. You either hate Canvases because your computer can't support them, or you don't hate them at all because they're very useful, even if they aren't 100% supported.

Re: Löve FPS optimisation

Posted: Fri Apr 20, 2012 9:42 am
by Roland_Yonaba
Maybe you will find that threadinteresting.

Re: Löve FPS optimisation

Posted: Fri Apr 20, 2012 2:38 pm
by mickeyjm
Jasoco wrote:
mickeyjm wrote:
Robin wrote: Don't try to use "tricks" for a few more FPS if it's not necessary, because you may end up with higher system requirements for graphics drivers and whatnot than you would have had without those tricks.
And THAT is why I hate Canvases
Hey, don't hate on Canvas. They can do stuff you just simply can't do without them. You either hate Canvases because your computer can't support them, or you don't hate them at all because they're very useful, even if they aren't 100% supported.
Hate them for the first reason,
When the were framebuffers I was fine with it, i could actually use them. I no they are useful but IMO works for everyone>faster for those who hav supporting graphic cards