Performance questions

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.
Wombat
Prole
Posts: 31
Joined: Mon Oct 03, 2011 8:38 pm

Re: Performance questions

Post by Wombat »

I fixed the Problem. Thanks for your help.

I use love.update(dt) and love.draw() seperately now. And it works.

At first it was too fast. But now i use love.timer.sleep(10) and the framerate is as i want it.

But isn´t the framerate different on every PC? Do i have to edit the love.timer.sleep() number for every PC?
Or should the framerate familiar on every Computer?

Is there any other way to control the framerate?

Thanks for your help ;) You definitely helped me :)
User avatar
kraftman
Party member
Posts: 277
Joined: Sat May 14, 2011 10:18 am

Re: Performance questions

Post by kraftman »

rather than changing the framerate, you should use dt to control the speed that things occur, that way it will be the same speed on any computer
User avatar
Robin
The Omniscient
Posts: 6506
Joined: Fri Feb 20, 2009 4:29 pm
Location: The Netherlands
Contact:

Re: Performance questions

Post by Robin »

See dt for more information.
Help us help you: attach a .love.
User avatar
miko
Party member
Posts: 410
Joined: Fri Nov 26, 2010 2:25 pm
Location: PL

Re: Performance questions

Post by miko »

Wombat wrote:Hi there,

i am new in working with LÖVE. But i work with LUA since 4 years.

I wanted to edit a game i made with another Lua-wrapper to run it on LÖVE.

But unfortunately it runs very very slow :(.
If another wrapper is SDL-based, there is no reason why it could be slower in Love.
Wombat wrote:
Maybe the problem exist, ´cause of i do the love.draw() in the love.update(dt).
Surely it is the problem.
Please try to understand the Love architecture:
http://love2d.org/wiki/Tutorial:Callback_Functions

Then modify your code according to that.
My lovely code lives at GitHub: http://github.com/miko/Love2d-samples
User avatar
T-Bone
Inner party member
Posts: 1492
Joined: Thu Jun 09, 2011 9:03 am

Re: Performance questions

Post by T-Bone »

Another, worse, solution to things moving to fast, is to use vsync. It doesn't work on all setups though, and the speed will still vary depending on the screen's update frequency (which is 60 per second usually but not always).

The best solution is to multiply all speeds with 60*dt or something.
Wombat
Prole
Posts: 31
Joined: Mon Oct 03, 2011 8:38 pm

Re: Performance questions

Post by Wombat »

I tested my Programm on 3 PC´s: 2 Dual Core and 1 Single Core One.

I found out that my game runs always very, very smoothie on the 2 dual core pc´s and always bad on the single core.

And it made NO difference when i used this code structure:

Code: Select all

function love.load()
--code
end

function love.update()
function love.draw()

--all the code

end 
end
or this code structure:

Code: Select all

function love.load()
--code
end

function love.update()
--all the code
end

function love.draw()
--all the code
end
Thanks for your help until now.^^ I only have to set the Timestep correctly, so that the game has an equal speed on every PC. I hope it works when i add (60*dt) on every counter variable^^.
User avatar
tentus
Inner party member
Posts: 1060
Joined: Sun Oct 31, 2010 7:56 pm
Location: Appalachia
Contact:

Re: Performance questions

Post by tentus »

Wombat wrote: And it made NO difference when i used this code structure:
...

Code: Select all

function love.update()
function love.draw()

--all the code

end
end
I hate to say it, but that simply cannot be true. Something is horribly wrong in the method of your testing if putting draw inside of update gives you the same results as having them separate.
Kurosuke needs beta testers
Wombat
Prole
Posts: 31
Joined: Mon Oct 03, 2011 8:38 pm

Re: Performance questions

Post by Wombat »

but it´s still running with an extrem high rate of FPS ;). And that´s what worth. :D

And to my "method" of testing: I only look what looks faster. That´s it. Sure there is a difference between the 2 code structures. But my eye can´t see it ^^.

Furthermore i can´t understand why this engine prefer to seperate these two things when so many programming languages have one main loop... It´s very difficult to seperate the most of my code ´cause maths and drawings are mixed.
User avatar
kraftman
Party member
Posts: 277
Joined: Sat May 14, 2011 10:18 am

Re: Performance questions

Post by kraftman »

Wombat wrote:but it´s still running with an extrem high rate of FPS ;). And that´s what worth. :D

And to my "method" of testing: I only look what looks faster. That´s it. Sure there is a difference between the 2 code structures. But my eye can´t see it ^^.

Furthermore i can´t understand why this engine prefer to seperate these two things when so many programming languages have one main loop... It´s very difficult to seperate the most of my code ´cause maths and drawings are mixed.
I.. I..... I'll leave this to someone else.
Wombat
Prole
Posts: 31
Joined: Mon Oct 03, 2011 8:38 pm

Re: Performance questions

Post by Wombat »

? Now i delete the love.update() loop and the framerate is even higher...

I don´t know what´s going on here? First the IMPOSSIBLE results with this:

Code: Select all

love.update(dt)
love.draw()

--code

end
end

and now this with HIGHER framerate:

Code: Select all

love.draw()

--code

end
I think i missunderstand this engine :D
I.. I..... I'll leave this to someone else.
Sorry, I am new here :(
Last edited by Wombat on Tue Oct 04, 2011 9:54 pm, edited 5 times in total.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot], Google [Bot] and 2 guests