LOVE cpu overload

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
Alexintosh
Prole
Posts: 9
Joined: Mon Apr 04, 2011 11:18 am
Location: Italy
Contact:

LOVE cpu overload

Post by Alexintosh »

Hi everybody,

I'm really new on game development so you'll see a lot of my messages in these days :awesome: anyway i writing this post because I started yesterday to use LOVE and I just LOVE it but using it on ubuntu 9.0 the cpu always run about 100% and the temperature rise up to 90° :ultrashocked:

can anybody help?


Alexintosh
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: LOVE cpu overload

Post by BlackBulletIV »

Welcome!

This may be because LOVE, by default, doesn't have a framerate cap; but then again, it doesn't do this on my computer. It could also be because you're doing some heavy duty processing; make sure you're not creating any resources in love.update or love.draw.

EDIT: By the way, what exactly is your avatar doing? I hope it's not what I think it is. :ehem:
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: LOVE cpu overload

Post by Robin »

You can use love.timer.sleep to slow it down.
Help us help you: attach a .love.
User avatar
nevon
Commander of the Circuloids
Posts: 938
Joined: Thu Feb 14, 2008 8:25 pm
Location: Stockholm, Sweden
Contact:

Re: LOVE cpu overload

Post by nevon »

BlackBulletIV wrote:EDIT: By the way, what exactly is your avatar doing? I hope it's not what I think it is. :ehem:
If you're thinking it's wielding a chainsaw, then yeah, that's exactly what it's doing.
User avatar
Alexintosh
Prole
Posts: 9
Joined: Mon Apr 04, 2011 11:18 am
Location: Italy
Contact:

Re: LOVE cpu overload

Post by Alexintosh »

BlackBulletIV wrote:Welcome!

This may be because LOVE, by default, doesn't have a framerate cap; but then again, it doesn't do this on my computer. It could also be because you're doing some heavy duty processing; make sure you're not creating any resources in love.update or love.draw.
How can I set the framerate??

I'm following this tutorial, so I use love.graphics.draw for any drawable object in a table may be this?
EDIT: By the way, what exactly is your avatar doing? I hope it's not what I think it is. :ehem:
He was laughing :joker: , anyway to avoid problems i changed it.
You can use love.timer.sleep to slow it down.
Do you mean in the love.draw() function?
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: LOVE cpu overload

Post by Robin »

Alexintosh wrote:How can I set the framerate??
You can't. You can aim for a certain framerate with love.time.sleep(), but it's imperfect.
Alexintosh wrote:I'm following this tutorial, so I use love.graphics.draw for any drawable object in a table may be this?
That particular tutorial has been criticised on this forum. Drawing things shouldn't cause problems like that.

Could you try running LÖVE without a game (you'll get the no-game screen) and tell us whether the same thing happens?

Also, could you upload a .love of your game to the forums, so we can look for clues there?
Alexintosh wrote:
You can use love.timer.sleep to slow it down.
Do you mean in the love.draw() function?
You can put it there, but traditionally, it's put at the end of love.update().
Help us help you: attach a .love.
Trevor
Prole
Posts: 30
Joined: Thu Mar 31, 2011 4:14 pm

Re: LOVE cpu overload

Post by Trevor »

I'm glad you pointed this out. I didn't realize my CPU usage increases by 500% (from 10% to 50%) when I run my game. It runs at about 325 FPS. I'll give the sleep idea a try.
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: LOVE cpu overload

Post by BlackBulletIV »

The best way to attempt to set the framerate, is to redefine love.run and increase the amount of time slept at the end of the function (the love.timer.sleep call). You may to do something like:

Code: Select all

love.timer.sleep(1000 / 60) -- 60 FPS
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: LOVE cpu overload

Post by Robin »

But, as I said, it is imperfect.
Help us help you: attach a .love.
User avatar
Alexintosh
Prole
Posts: 9
Joined: Mon Apr 04, 2011 11:18 am
Location: Italy
Contact:

Re: LOVE cpu overload

Post by Alexintosh »

That particular tutorial has been criticised on this forum. Drawing things shouldn't cause problems like that.

Could you try running LÖVE without a game (you'll get the no-game screen) and tell us whether the same thing happens?

Also, could you upload a .love of your game to the forums, so we can look for clues there?
That's the point, drawing two elements every frame shouldnt be a problem.

I tried to run love without games and nothing happened, cpu was fine, but I also tried with a mario version posted by a user, with mario running cpu 100% and the temperature rise up to 90°
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], keharriso and 221 guests