Is LOVE limited to how much hardware it can use?
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Is LOVE limited to how much hardware it can use?
I'm using LOVE to create a very hardware intensive application. It should be using I'd assume over 10% of my CPU (Intel Core i7 12700K) and much more than 30% of my GPU (GeForce RTX 3060) but it seems that isn't the case. Due to the lack of intense usage of my hardware LOVE drops my game's performance down to 7 FPS! Could anyone explain if there is a workaround to this or why this is happening?
- BrotSagtMist
- Party member
- Posts: 659
- Joined: Fri Aug 06, 2021 10:30 pm
Re: Is LOVE limited to how much hardware it can use?
Without seeing any code, no. This question is too generic.
obey
- zorg
- Party member
- Posts: 3468
- Joined: Thu Dec 13, 2012 2:55 pm
- Location: Absurdistan, Hungary
- Contact:
Re: Is LOVE limited to how much hardware it can use?
Considering the CPU you're talking about is a 6+4 core one with 20 threads in total, Löve by default being a single-thread application, it can only use one thread out of the 20, so that's around 5% of cpu usage at most (may be more due to the cpu in question having both performance and economy cores that might factor differently into percentages, idk).
If you use love.thread stuff in your code, only then could more cpu be potentially used.
As for GPU, a lot of bottlenecks can crop up depending on what you're doing, so it may very well be your own code's fault, and not anything löve can do about it.
Also, yes, do show code.
If you use love.thread stuff in your code, only then could more cpu be potentially used.
As for GPU, a lot of bottlenecks can crop up depending on what you're doing, so it may very well be your own code's fault, and not anything löve can do about it.
Also, yes, do show code.
Me and my stuff True 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.
Re: Is LOVE limited to how much hardware it can use?
Well... It's not the Love "feature", it's actually quite common for most of the games I've played on Steam. Way more than 50% behaving similarly in my case, which is hundreds of games The reason is that they are all single-threaded applications. Or use just a fixed number of threads: for instance, one thread for drawing, another for background loading, and two more for calculating secondary tasks. Therefore, they cannot use all 10+ cores of modern CPUs. And generally, they shouldn't, because good-written game should be GPU-bound, not CPU-bound.
To fix this, developers could use multi-threading seriously, but most don't because it's challenging, or they don't know how to do it, or it is just not needed for their simple games. Besides, most game engines do not provide convenient functionality for multi-threading. Love2d has some support through the love.thread, but it's rather limited because between-thread communication is difficult to manage. Besides, it still can't use multiple threads for the primary task of drawing.
This second limitation is not specific to Love but to OpenGL. To overcome it, developers could use Vulkan or DirectX12 and tinker with a LOT more complicated stuff than just single-threaded rendering engines.
Regarding your issue with only 7 fps, several factors could cause it, but the most likely one is that you have too many draw calls. You can check this by adding
Code: Select all
print(love.graphics.getStats().drawcalls)
If it's the case, you could use love.graphics.drawInstanced or SpriteBatch to draw your things. With these personally I've managed to draw literally millions of things in one frame without issues in Love. That should reduce CPU usage and fill up GPU usage up to ~100% with all internal and external frame limiters such as vsync disabled for that test of course. That would be an indication that your Love lua code's performance is optimal.
Re: Is LOVE limited to how much hardware it can use?
Start using an OpenGL profiler and debugger like https://renderdoc.org/
Start using Love2D's threading functionality. You can offload pretty much anything but the actual Love2D draw functions.
There are many, many advanced features of OpenGL and your gfx hardware you don't even have access to because there is no Love2D functions for them (bindless textures, compute shaders, various shader buffers).
Start using Love2D's threading functionality. You can offload pretty much anything but the actual Love2D draw functions.
There are many, many advanced features of OpenGL and your gfx hardware you don't even have access to because there is no Love2D functions for them (bindless textures, compute shaders, various shader buffers).
Re: Is LOVE limited to how much hardware it can use?
Actually some great features are being developed in love 12.0, like compute shaders. Take a look at love repo at github, if you are interested in testing it. (However development version may contain bugs and change features / functions / …, so use at your own risk)
Who is online
Users browsing this forum: Google [Bot] and 5 guests