CPU Usage Spiking
Posted: Sat Aug 08, 2020 1:33 am
Hello all. New to lua and love (I use Python in my day job), but I'm a big fan already. I'm hoping for some help in figuring out why my game is eating up so much CPU.
It's a relatively static game where the player clicks letter buttons to try to create words, so very little is actually happening in the update loop (just a counter to determine how long certain messages stay on the screen).
The full code can be found here: https://git.lambda.church/max/Spellspiel Please let me know if there's a better way to share it.
I just added the blockFPS function in main.lua, which is something I'd seen in another forum post about CPU use. It does help, but I'm trying to understand what that's needed in my game though. Why is it using so much CPU in the first place?
One theory is that it has something to do with my many font size changes, which are mostly getting called inside various draw() calls. If that is one of the causes, is there a better way to do this?
Thank you all in advance for any advice you can give!
It's a relatively static game where the player clicks letter buttons to try to create words, so very little is actually happening in the update loop (just a counter to determine how long certain messages stay on the screen).
The full code can be found here: https://git.lambda.church/max/Spellspiel Please let me know if there's a better way to share it.
I just added the blockFPS function in main.lua, which is something I'd seen in another forum post about CPU use. It does help, but I'm trying to understand what that's needed in my game though. Why is it using so much CPU in the first place?
One theory is that it has something to do with my many font size changes, which are mostly getting called inside various draw() calls. If that is one of the causes, is there a better way to do this?
Thank you all in advance for any advice you can give!